modulenode module
Module modulenode aims to define SBSObjects that are relative to a module node,
mostly ModuleNode.
- class modulegraph.modulenode.ModuleNode(aUID='', aNodeImplementation=None, aDisabled=None, aGUILayout=None, aConnections=None)
Bases:
SBSNodeClass that contains information on a MDL graph as defined in a .sbs file
- Members:
mUID (str): unique identifier in the package/ context.
mNodeImplementation (
ModuleNodeImplementation): Module Node ImplementationmDisabled (str, optional): this node is disabled.
mGUILayout (
SBSGUILayout): GUI position/options
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getConnectedNodeUID(aInputOperand) str
Return the connected’s UID node to the input operand
- Parameters:
aInputOperand (str) – identifier/name of the input operand
- Returns:
the connected node UID
- Return type:
str
- getConnectedNodesUID()
Get the UIDs of the nodes connected to this node.
- Returns:
The UIDs as a list of string
- getConnectedOperands() List[ModuleOperand]
return connected operands :return: list of
ModuleOperand:rtype: list
- getConnectionOnPin(aPinIdentifier)
Get the connection defined on the given input.
- Parameters:
aPinIdentifier (str) – identifier of the input pin (for
SBSCompNode,SBSParamNode) or of the output pin(forSBSParamsGraphNode)- Returns:
a
SBSConnectionobject corresponding to the connection defined on the given pin. None otherwise
- getConnections()
Get the connections defined on this node.
- Returns:
a list of
SBSConnection
- getConnectionsFromNode(aLeftNode)
Get all the connections coming from the given left node.
- Parameters:
aLeftNode (
SBSNodeor str) – The node to look for in the incoming connections of this node, as an object or a UID- Returns:
a list of
SBSConnection
- abstractmethod getDefinition()
Get the node definition (Inputs, Outputs, Parameters) accordingly to the node implementation
- Returns:
a
NodeDefobject if defined, None otherwise
- abstractmethod getDisplayName()
Get the display name of this node
- Returns:
the display name as a string
- getImplementation() ModuleNodeImplementation
- getInputDefinition(self, aInputIdentifier=None)
Get the input definition corresponding to the given identifier.
- Parameters:
aInputIdentifier (
InputEnumor str, optional) – The identifier to get. If let None, the primary input will be returned- Returns:
the input definition as a
CompNodeInputif found, None otherwise
- getOffsetPosition(aOffset=None)
Compute the position of this node offset by the given offset
- Parameters:
aOffset (list of 2 float, optional) – the offset to apply to the node’s current position. Default to [0,0]
- Returns:
the offset position
- getPosition()
Get the position of this node in the graph GUI.
- Returns:
a list of 3 float
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- abstractmethod hasAReferenceOnDependency(aDependency)
Check if this node directly references the given dependency. For instance if it instantiates a graph or a resource included in this dependency.
- Parameters:
aDependency (str or
SBSDependency) – The dependency to look for (UID or object)- Returns:
True if this node references this dependency, False otherwise
- abstractmethod hasAReferenceOnInternalPath(aInternalPath)
Check if this node references the given internal path (pkg:///). For instance if it instantiates the graph or the resource pointed at the given path.
- Parameters:
aInternalPath (str) – The internal path to look for
- Returns:
True if this node references the given internal path, False otherwise
- isConnectedTo(aLeftNode)
Check if the node is connected to the given node, in the direction aLeftNode -> self
- Parameters:
aLeftNode (
SBSNodeor str (UID)) – The node to look for in the connections of this node.- Returns:
True if the nodes are connected, False otherwise
- isDocked()
Check if this node is docked.
- Returns:
True if this node is docked, None otherwise
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- removeConnectionOnPin(aInput)
Remove the connection on the given input pin.
- Parameters:
aPinIdentifier (
InputEnumorFunctionInputEnumor str) – identifier of the input pin (forSBSCompNodeandSBSParamNode) or of the output pin(forSBSParamsGraphNode) to disconnect- Returns:
True if a connection is removed, False otherwise
- removeConnectionsFrom(aLeftNode)
Remove all the connections from aLeftNode to this node (in the direction aLeftNode -> self)
- Parameters:
aLeftNode (
SBSNodeor str (UID)) – The node to look for in the connections of this node.- Returns:
Nothing
- setPosition(aPosition)
Set the position of this node in the graph GUI.
- Parameters:
aPosition (a list of 3 float) – The position to set