User Guide Cancel

modulenode | Substance 3D Automation ToolKit

modulenode

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)
class modulegraph.modulenode.ModuleNode(aUID='', aNodeImplementation=None, aDisabled=None, aGUILayout=None, aConnections=None)
 class modulegraph.modulenode.ModuleNode(aUID='', aNodeImplementation=None, aDisabled=None, aGUILayout=None, aConnections=None)  

Bases: pysbs.sbscommon.nodes.SBSNode

Class 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 Implementation
  • mDisabled (str, optional): this node is disabled.
  • mGUILayout (SBSGUILayout): GUI position/options
equals(other)
equals(other)
 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.

Parameters:other (SBSObject) – The SBSObject to compare to
Returns:True if the two SBSObject are similar according to their definition.
getConnectedNodeUID(aInputOperand) → str
getConnectedNodeUID(aInputOperand) → str
 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()
getConnectedNodesUID()
 getConnectedNodesUID()  

Get the UIDs of the nodes connected to this node.

Returns:The UIDs as a list of string
getConnectedOperands() → List[pysbs.modulegraph.moduleoperand.ModuleOperand]
getConnectedOperands() → List[pysbs.modulegraph.moduleoperand.ModuleOperand]
 getConnectedOperands() → List[pysbs.modulegraph.moduleoperand.ModuleOperand]  

return connected operands :return: list of ModuleOperand :rtype: list

getConnectionOnPin(aPinIdentifier)
getConnectionOnPin(aPinIdentifier)
 getConnectionOnPin(aPinIdentifier)  

Get the connection defined on the given input.

Parameters:aPinIdentifier (str) – identifier of the input pin (for SBSCompNode, SBSParamNode and MDLNode) or of the output pin(for SBSParamsGraphNode)
Returns:a SBSConnection object corresponding to the connection defined on the given pin. None otherwise
getConnections()
getConnections()
 getConnections()  

Get the connections defined on this node.

Returns:a list of SBSConnection
getConnectionsFromNode(aLeftNode)
getConnectionsFromNode(aLeftNode)
 getConnectionsFromNode(aLeftNode)  

Get all the connections coming from the given left node.

Parameters:aLeftNode (SBSNode or str) – The node to look for in the incoming connections of this node, as an object or a UID
Returns:a list of SBSConnection
getDefinition()
getDefinition()
 getDefinition()  

Get the node definition (Inputs, Outputs, Parameters) accordingly to the node implementation

Returns:a NodeDef object if defined, None otherwise
getDisplayName()
getDisplayName()
 getDisplayName()  

Get the display name of this node

Returns:the display name as a string
getImplementation() → pysbs.modulegraph.modulenodeimplementation.ModuleNodeImplementation
getImplementation() → pysbs.modulegraph.modulenodeimplementation.ModuleNodeImplementation
 getImplementation() → pysbs.modulegraph.modulenodeimplementation.ModuleNodeImplementation  
getInputDefinition(self, aInputIdentifier=None)
getInputDefinition(self, aInputIdentifier=None)
 getInputDefinition(self, aInputIdentifier=None)  

Get the input definition corresponding to the given identifier.

Parameters:aInputIdentifier (InputEnum or str, optional) – The identifier to get. If let None, the primary input will be returned
Returns:the input definition as a CompNodeInput if found, None otherwise
getOffsetPosition(aOffset = None)
getOffsetPosition(aOffset = None)
 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()
getPosition()
 getPosition()  

Get the position of this node in the graph GUI.

Returns:a list of 3 float
getRect()
getRect()
 getRect()  

Return the rectangle of this node.

Returns:The rectangle as a Rect
getUidIsUsed(aUID)
getUidIsUsed(aUID)
 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
hasAReferenceOnDependency(aDependency)
hasAReferenceOnDependency(aDependency)
 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
hasAReferenceOnInternalPath(aInternalPath)
hasAReferenceOnInternalPath(aInternalPath)
 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)
isConnectedTo(aLeftNode)
 isConnectedTo(aLeftNode)  

Check if the node is connected to the given node, in the direction aLeftNode -> self

Parameters:aLeftNode (SBSNode or str (UID)) – The node to look for in the connections of this node.
Returns:True if the nodes are connected, False otherwise
isDocked()
isDocked()
 isDocked()  

Check if this node is docked.

Returns:True if this node is docked, None otherwise
parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
 parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)  

Parse recursively the given xml node to retrieve the content of the SBSObject.

Parameters:
  • aContext (Context) – execution context
  • aDirAbsPath (str) – the absolute directory containing the current parsed package (.sbs file)
  • aSBSParser (SBSParser) – the substance parser
  • aXmlNode (xml.etree.ElementTree) – the xml node to parse
removeConnectionOnPin(aInput)
removeConnectionOnPin(aInput)
 removeConnectionOnPin(aInput)  

Remove the connection on the given input pin.

Parameters:aPinIdentifier (InputEnum or FunctionInputEnum or str) – identifier of the input pin (for SBSCompNode and SBSParamNode) or of the output pin(for SBSParamsGraphNode) to disconnect
Returns:True if a connection is removed, False otherwise
removeConnectionsFrom(aLeftNode)
removeConnectionsFrom(aLeftNode)
 removeConnectionsFrom(aLeftNode)  

Remove all the connections from aLeftNode to this node (in the direction aLeftNode -> self)

Parameters:aLeftNode (SBSNode or str (UID)) – The node to look for in the connections of this node.
Returns:Nothing
setPosition(aPosition)
setPosition(aPosition)
 setPosition(aPosition)  

Set the position of this node in the graph GUI.

Parameters:aPosition (a list of 3 float) – The position to set
write(aSBSWriter, aXmlNode)
write(aSBSWriter, aXmlNode)
 write(aSBSWriter, aXmlNode)  

Write recursively the content of the SBSObject into the given xml node.

Parameters:
  • aSBSWriter (SBSWriter) – the substance writer
  • aXmlNode (xml.etree.ElementTree) – the xml node to fill

Get help faster and easier

New user?