User Guide Cancel

paramnode | Substance 3D Automation ToolKit

paramnode

Module paramnode provides the definition of the class SBSFuncData and SBSParamNode which compose a function graph.

class params.paramnode.SBSFuncData(aName='', aConstantValue=None)
class params.paramnode.SBSFuncData(aName='', aConstantValue=None)
 class params.paramnode.SBSFuncData(aName='', aConstantValue=None)  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

Class that contains information on a function data as defined in a .sbs file

Members:
  • mName (str): identifier of the data.
  • mConstantValue (SBSConstantValue): value.
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.
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
getValue()
getValue()
 getValue()  

Get the value of this function data

Returns:The value as a string
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
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
class params.paramnode.SBSParamNode(aGUIName=None, aUID='', aFunction='', aDisabled=None, aType=None, aConnections=None, aFuncDatas=None, aGUILayout=None, aRefFunction=None, aRefDependency=None)
class params.paramnode.SBSParamNode(aGUIName=None, aUID='', aFunction='', aDisabled=None, aType=None, aConnections=None, aFuncDatas=None, aGUILayout=None, aRefFunction=None, aRefDependency=None)
 class params.paramnode.SBSParamNode(aGUIName=None, aUID='', aFunction='', aDisabled=None, aType=None, aConnections=None, aFuncDatas=None, aGUILayout=None, aRefFunction=None, aRefDependency=None)  

Bases: pysbs.sbscommon.nodes.SBSNode

Class that contains information on a parameter node as defined in a .sbs file. A SBSParamNode represents a function node. It is included in the definition of a SBSDynamicValue, and it can be connected to other SBSParamNode.

Members:
  • mGUIName (str, optional): name of the node.
  • mUID (str): unique identifier in the dynamicValue/paramNodes/ context.
  • mFunction (str): identifier of the function, among the available identifiers as defined in sbsfunctions.
  • mDisabled (str, optional): this node is disabled (“1” / None).
  • mType (str, optional): return type of the node, if the node can handle multiple types.
  • mConnections (list of SBSConnection, optional): input connections list.
  • mFuncDatas (list of SBSFuncData): additional data list.
  • mGUILayout (SBSGUILayout): GUI position of the node in the function graph.
  • mRefFunction (SBSFunction, optional): in the case of an instance function node, reference to the function it represents.
changeDependencyUID(aSBSDocument, newDepUID)
changeDependencyUID(aSBSDocument, newDepUID)
 changeDependencyUID(aSBSDocument, newDepUID)  

Change the UID of the dependency referenced by this instance.

Parameters:
  • aSBSDocument (SBSDocument) – The root document, required to reset all the internal links to the referenced graph
  • newDepUID (str) – The new dependency UID
changeInstancePath(aParentDocument, aInstanceDocument, aFunctionRelPath)
changeInstancePath(aParentDocument, aInstanceDocument, aFunctionRelPath)
 changeInstancePath(aParentDocument, aInstanceDocument, aFunctionRelPath)  

Change the function referenced by this instance. If aInstanceDocument is not already declared as a dependency, the dependency will be added to aParentDocument.

Parameters:
  • aParentDocument (SBSDocument) – The parent document of this node
  • aInstanceDocument (SBSDocument) – The document containing the function to reference by this instance (can be equal to parent document)
  • aFunctionRelPath (str) – The function path, relatively to its parent package aInstanceDocument (pkg:///myFunction?dependency=1234567890)
classify(aOther)
classify(aOther)
 classify(aOther)  

Use the definition of the two nodes to classify them, and their GUI position if they have the same definition. The function identifier is used to classify them. At a final option, the GUI position is used, and in this case, mostLeft < mostRight and then mostUp < mostDown.

Parameters:
  • aOther (SBSParamNode) – The node to compare to.
  • aParentContainer (SBSDynamicValue, optional) – The dynamic value containing the nodes to classify
Returns:

1 if itself is considered greater than the other node, -1 for the opposite. 0 in case of equality.

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.
getConnectedNodesUID()
getConnectedNodesUID()
 getConnectedNodesUID()  

Get the UIDs of the nodes connected to this node.

Returns:The UIDs as a list of string
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 function node definition (Inputs, Outputs, Parameters)

Returns:a FunctionDef object
getDependencyUID()
getDependencyUID()
 getDependencyUID()  

If this node is an instance of a Function, get the UID of the dependency referenced by this instance.

Returns:The dependency UID as a string if found, None otherwise
getDisplayName()
getDisplayName()
 getDisplayName()  

Get the display name of this node

Returns:the display name as a string
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
getOutputType()
getOutputType()
 getOutputType()  
Returns:The output type of the function node. In case of a template, return the value of the template
getParameterValue(aParameter = None)
getParameterValue(aParameter = None)
 getParameterValue(aParameter = None)  

Find a parameter with the given name/id among the function datas of this ParamNode. If aParameter is None, return the parameter with the name of the function.

Parameters:aParameter (sbsenum.Function or str, optional) – Parameter identifier
Returns:The parameter value if found, None otherwise
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
getReferenceAbsPath()
getReferenceAbsPath()
 getReferenceAbsPath()  

If this function node is an instance, get the absolute path of the function referenced by this instance.

Returns:The absolute path of the function referenced by this instance, in the format absolutePath/filename.sbs/functionIdentifier, as a string
getReferenceInternalPath()
getReferenceInternalPath()
 getReferenceInternalPath()  

If this function node is an instance, get the path of the function relatively to the package (pkg:///).

Returns:The path as a string
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
isAnInstance()
isAnInstance()
 isAnInstance()  

Check if this SBSParamNode is of kind ‘instance’

Returns:True if this node is a function node ‘instance’, 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
resolveDependency(aSBSDocument)
resolveDependency(aSBSDocument)
 resolveDependency(aSBSDocument)  

Allow to resolve the dependency of the function instance node with the function it references.

Parameters:aSBSDocument (SBSDocument) – The root document
setParameterValue(aParameter, aParamValue)
setParameterValue(aParameter, aParamValue)
 setParameterValue(aParameter, aParamValue)  

Set the value of the given parameter to the given value, if compatible with this type of Function

Parameters:
  • aParameter (sbsenum.FilterParameterEnum or str) – identifier of the parameter to set
  • aParamValue (any parameter type) – value of the parameter
Returns:

True if succeed

Raise:

api_exceptions.SBSLibraryError

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
setType()
setType()
 setType()  

Set a new param type

Returns:aParamTypeEnum
unsetParameter(aParameter)
unsetParameter(aParameter)
 unsetParameter(aParameter)  

Unset the given parameter so that it is reset to its default value.

Parameters:aParameter (CompNodeParamEnum or str) – identifier of the parameter to set
Returns:True if succeed, False otherwise
Raise:api_exceptions.SBSLibraryError
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?