nodedge.blocks.block

Block module containing Block class.

class nodedge.blocks.block.Block(scene, inputSocketTypes=(2, 2), outputSocketTypes=(1, ))

Bases: nodedge.node.Node

Block class

A block is node which can be evaluated to produce an output.

Parameters
  • scene (Scene) – reference to the Scene

  • title (str) – node title shown in scene

  • inputSocketTypes (Collection[int]) – list of types of the input Sockets

  • outputSocketTypes (Collection[int]) – list of types of the output Sockets

iconPath = ''
operationTitle = 'Undefined'
operationCode = 0
contentLabel = ''
contentLabelObjectName = 'blockBackground'
GraphicsNodeClass

alias of nodedge.blocks.graphics_block.GraphicsBlock

GraphicsNodeContentClass

alias of nodedge.blocks.graphics_block_content.GraphicsBlockContent

initSettings()

Initialize the location of the input and output sockets.

onInputChanged(socket: Optional[nodedge.connector.Socket] = None) → None

Called when the value of an input has changed.

Parameters

socket – the socket on which the input has changed

Returns

None

checkInputsValidity()
evalImplementation()
eval(index=0)

Evaluate this node. This must be overridden. See Evaluation for more details.

serialize() → collections.OrderedDict

Serialization method to serialize this class data into OrderedDict which can be stored in memory or file easily.

Returns

data serialized in OrderedDict

Return type

OrderedDict

deserialize(data: dict, hashmap: Optional[dict] = None, restoreId: bool = True, *args, **kwargs)

Deserialization method which take data in python dict format with helping hashmap containing references to existing entities.

Parameters
  • data (dict) – dictionary containing serialized data

  • hashmap (dict) – helper dictionary containing references (by id == key) to existing objects

  • restoreId (bool) – True if we are creating new sockets. False is useful when loading existing sockets which we want to keep the existing object’s id

Returns

True if deserialization was successful, False otherwise

Return type

bool

exception nodedge.blocks.block.EvaluationError

Bases: Exception

EvaluationError class

If a block cannot be evaluated, raise this error.

exception nodedge.blocks.block.MissInputError

Bases: nodedge.blocks.block.EvaluationError

MissInputError class

If an input is missing to a block, preventing it to be evaluated, raise this error.

exception nodedge.blocks.block.RedundantInputError

Bases: nodedge.blocks.block.EvaluationError

RedundantInputError class

If two different inputs are connected to a single input socket of a block, raise this error.