- Substance 3D home
- Home
- Command Line Tools
- Command Line overview
- sbsbaker
- sbscooker
- sbsmtools
- sbsmutator
- sbsrender
- sbsupdater
- Command Line overview
- Pysbs - Python API
- Pysbs - Python API overview
- Getting started
- General topics
- Examples
- API Content
- API Content overview
- Substance definitions
- Common interfaces
- compnode
- context projectmgr
- graph
- mdl
- modelgraphindex
- modelannotationnames
- modelgraph
- modelgraphgenerator
- modelgraphimplementation
- modelnodenames
- modeloperand
- modulegraphindex
- moduleannotation
- moduleconnection
- modulegraph
- modulegraphgenerator
- modulegraphimplementation
- modulegraphlibrary
- modulegraphregister
- modulenode
- modulenodeimplementation
- modulenodeinstance
- moduleoperand
- moduleoutputbridging
- moduleparaminput
- params
- projectmgrdoc
- sbsarchive
- sbscommon
- sbspreset
- sbsproject
- substance
- Libraries
- sbsenum
- sbslibrary
- sbsbakerslibrary
- Helpers
- Execution context
- API Change log
- Samples
- Setup and Getting Started
- Integrations
- Substance Maya toolset
- Changelog overview
paramgraph
Module paramgraph provides the definition of all the objects relative to a FxMap graph:
class compnode.paramgraph.SBSParamsGraph(aName='', aUID='', aGUILayoutPGraph=None, aRootNode=None, aParamsGraphDatas=None, aParamsGraphNodes=None, aGUIObjects=None)
Bases: pysbs.common_interfaces.sbsobject.SBSObject
Class that contains information on a FxMap graph (e.g. parameters set graph) as defined in a .sbs file. Data (parameters) are separated from node instances to allow data reuse and Inheritance.
- Members:
- mName (str): name (type) of the graph.
- mUID (str): unique identifier of the graph in the /paramsGraphs/ context.
- mGUILayoutPGraph (
SBSGUILayoutComp
, optional): GUI flags and options. - mRootNode (str, optional): uid of the root node.
- mParamsGraphDatas (list of
SBSParamsGraphData
): data set of nodes, with Inheritance system. - mParamsGraphNodes (list of
SBSParamsGraphNode
): nodes list of the parameters graph. - mGUIObjects (
SBSGUIObject
): GUI specific objects.
computeUniqueIdentifier(aIdentifier, aSuffixId = 0)
Check if the given identifier is already used and generate a unique identifier if necessary
Returns: | A unique identifier, which is either the given one or a new one with a suffix: identifier_id |
---|
connectNodes(aBottomNode, aTopNode, aTopNodeOutput = None)
Connect the given nodes together: aTopNode(on the output aTopNodeOutput) -> aBottomNode. If the top node output is None, the connection will be done for ALL the outputs of the top node.
Parameters: |
|
---|---|
Returns: | True if success |
Raise: |
|
contains(aNode)
Check if the given node belongs to this graph
Parameters: | aNode (SBSParamsGraphNode or str) – The node to check, as a, object or an UID |
---|---|
Returns: | True if the given node belongs to the graph, False otherwise |
createComment(aCommentText='Comment', aGUIPos=None, aLinkToNode=None)
Create a new comment. If aLinkToNode is not None, this comment will be linked to the given node, and the given GUI position must be relative to this node.
Parameters: |
|
---|---|
Returns: | The |
createFrame(aSize, aFrameTitle='Frame', aCommentText='', aGUIPos=None, aColor=None, aDisplayTitle=True)
Create a new framed comment.
Parameters: |
|
---|---|
Returns: | The |
createFrameAroundNodes(aNodeList, aFrameTitle='Frame', aCommentText='', aColor=None, aDisplayTitle=True)
Create a new framed comment around the given nodes.
Parameters: |
|
---|---|
Returns: | The |
Raise: |
|
createFxMapNode(aFxMapNode, aGUIPos = None, aParameters = None)
Create a new FxMap node (SBSParamsGraphNode
) and its associated data (SBSParamsGraphData
) and add them to the FxMap graph.
Parameters: |
|
---|---|
Returns: | The new |
createIterationOnPattern(aGraphNode, aParameter, aNbIteration, aNodeUIDs, aNodeUIDs_NextPatternInput = None, aGUIOffset = None)
Allows to create an iteration in the function defining the value of the given parameter.
Duplicate nbIteration times the given pattern of nodes, to create this kind of connection:
Pattern -> Pattern_1 -> Pattern_2 -> … -> Pattern_N
Parameters: |
|
---|---|
Returns: | The list of params.SBSParamNode created if succeed |
Raise: |
|
createNavigationPin(self, aPinText, aGUIPos)
Create a new navigation pin.
Parameters: |
|
---|---|
Returns: | The |
deleteComment(aComment)
Allows to delete the given comment from the graph.
Parameters: | aComment (SBSGUIObject or str) – The comment to remove, as a Comment or an UID. |
---|---|
Returns: | True if success |
Raise: | api_exceptions.SBSImpossibleActionError |
deleteFrame(aFrame)
Allows to delete the given frame from the graph.
Parameters: | aFrame (SBSGUIObject or str) – The frame to remove, as a Frame or an UID. |
---|---|
Returns: | True if success |
Raise: | api_exceptions.SBSImpossibleActionError |
deleteNavigationPin(aNavigationPin)
Allows to delete the given navigation pin from the graph.
Parameters: | aNavigationPin (SBSGUIObject or str) – The navigation pin to remove, as a NavigationPin or an UID. |
---|---|
Returns: | True if success |
Raise: | api_exceptions.SBSImpossibleActionError |
deleteNode(aNode)
Allows to delete the given node from the graph. It removes it from the mParamsGraphNodes and mParamsGraphDatas list, and delete all the connection from and to that node in the graph.
Parameters: | aNode (SBSParamsGraphNode or str) – The node to remove, as a SBSParamsGraphNode or an UID. |
---|---|
Returns: | True if success |
Raise: | api_exceptions.SBSImpossibleActionError |
disconnectNodes(aTopNode, aBottomNode, aTopNodeOutput = None)
Disconnect the given nodes: aTopNode(on the output aTopNodeOutput) -> aBottomNode. If the top node output is None, all connections will be removed.
Parameters: |
|
---|---|
Returns: | Nothing |
Raise: |
|
duplicateNode(aNode, aGUIOffset = None)
Duplicate the given node, generate a new UID and add the node to the graph. Duplicate also the SPSParamsGraphData associated to this node
Parameters: |
|
---|---|
Returns: | The new |
Raise: |
|
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.
getAllComments()
Get all comments defined in the graph
Returns: | a list of SBSGUIObject |
---|
getAllDependencyUID()
Get the UIDs of the dependencies used by this graph
Returns: | a list of UIDs as strings |
---|
getAllFrames()
Get all frames defined in the graph
Returns: | a list of SBSGUIObject |
---|
getAllGUIObjects()
Get all the GUI objects defined in the graph (Comments, Frames, Navigation Pins)
Returns: | a list of SBSGUIObject |
---|
getAllNavigationPins()
Get all the navigation pins defined in the graph
Returns: | a list of SBSGUIObject |
---|
getAllNodesOfKind(aFxMapNode)
Search for all SBSParamsGraphNode
of the given kind (Quadrant, Switch or Iterate).
Parameters: | aFxMapNode (FxMapNodeEnum str) – kind of FxMap node to look for |
---|---|
Returns: | a list of SBSParamsGraphNode containing all filters of the given kind. |
getAllReferencesOnDependency(aDependency)
Get all the SBSCompNode that are referencing the given dependency
Parameters: | aDependency (str or SBSDependency ) – The dependency to look for (UID or object) |
---|---|
Returns: | A list of SBSCompNode |
getCommentsAssociatedToNode(aNode)
Get the list of comments associated to the given node
Parameters: | aNode (SBSParamsGraphNode or str) – The node to consider, as a SBSParamsGraphNode or given its UID |
---|---|
Returns: | a list of SBSGUIObject |
getNode(aNodeUID)
Get the SBSParamsGraphNode
object with the given UID
Parameters: | aNodeUID (str) – uid of the node to get |
---|---|
Returns: | The SBSParamsGraphNode object if found, None otherwise |
getNodeAssociatedToComment(aComment)
Get the node associated to the given comment.
Parameters: | aComment (SBSGUIObject ) – The comment to consider |
---|---|
Returns: | the SBSParamsGraphNode if found, None otherwise |
getNodeData(aDataUID)
Get the SBSParamsGraphData
object with the given UID
Parameters: | aDataUID (str) – uid of the data to get |
---|---|
Returns: | The SBSParamsGraphData object if found, None otherwise |
getNodeList(aNodesList = None)
Get all the nodes of this FxMap graph, or look for the given nodes if aNodesList is not None
Parameters: | aNodesList (list of str or list of SBSParamsGraphNode , optional) – list of node to look for |
---|---|
Returns: | A list of SBSParamsGraphNode included in the FxMap graph |
getNodesInFrame(aFrame)
Get all the nodes included or partially included in the given frame. The frame must be included in this graph, otherwise SBSImpossibleActionError is raised
Parameters: | aFrame (SBSGUIObject ) – The frame to consider |
---|---|
Returns: | a list of SBSParamsGraphNode |
getParamsGraphDataList()
Get the list of SBSParamsGraphData
of this graph
Returns: | A list of SBSParamsGraphData |
---|
getUidIsUsed(aUID)
Check if the given uid is already used in the context of this paramsGraphData
return: True if the uid is already used, False otherwise
isAPathBetween(self, aTopNode, aBottomNode)
Check if there is a path from the top node to the bottom node with the current connections.
parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
reframeAroundNodes(aFrame, aNodeList)
Move and resize a frame to be around the given nodes.
Parameters: |
|
---|---|
Raise: | SBSImpossibleActionError |
setRootNode(aNode)
Set the root node of the FxMap graph
Parameters: | aNode (SBSParamsGraphNode or str) – the node to set as root, or its UID |
---|---|
Returns: | The SBSParamsGraphNode corresponding to the root node, False if not found |
Raise: | api_exceptions.SBSImpossibleActionError |
write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
Parameters: |
|
---|
class compnode.paramgraph.SBSParamsGraphData(aIdentifier='', aUID='', aType='', aInherit=None, aParameters=None)
Bases: compnode.common.SBSCompImplWithParams
Class that contains information on a paramsGraphData as defined in a .sbs file. Refers to parameter set of FxMaps.
- Members:
- mIdentifier (str): data identifier.
- mUID (str): data unique identifier in the /paramsGraphDatas/ context.
- mType (str, optional): node type, among the list of available FxMap node identifiers (
sbsfxmapnodes
) - mInherit (str, optional): uid of the inherited data if exists (/paramsGraphData/uid).
- mParameters (list of
SBSParameter
): parameters definition.
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.
getDefinition()
Get the FxMap node definition (Inputs, Outputs, Parameters)
Returns: | a CompNodeDef object |
---|
getDisplayName()
Get the display name of this node
Returns: | the display name as a string |
---|
getParameterValue(aParameter)
Find a parameter with the given name/id among the overloaded parameters and the default node parameters, and return its value.
Parameters: | aParameter (CompNodeParamEnum or str) – Parameter identifier |
---|---|
Returns: | The parameter value if found (string or SBSDynamicValue , None otherwise |
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 |
hasIdenticalParameters(self, other)
Allows to check if two nodes has the same parameters defined with the same values.
Parameters: | other (SBSCompImplWithParams ) – the node to compare with |
---|---|
Returns: | True if the two nodes has the same parameters, False otherwise |
parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
setDynamicParameter(aParameter, aRelativeTo = None)
Set the given parameter as dynamic, to init its params.SBSDynamicValue. If Inheritance is None, the default Inheritance for this node is set.
Parameters: |
|
---|---|
Returns: | the |
Raise: |
|
setParameterValue(aParameter, aParamValue)
Set the value of the given parameter to the given value, if compatible with this type of FxMap graph node
Parameters: |
|
---|---|
Returns: | True if succeed, False otherwise |
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 recursively the content of the SBSObject into the given xml node.
Parameters: |
|
---|
class compnode.paramgraph.SBSParamsGraphNode(aGUIName=None, aUID='', aType='', aDisabled=None, aConnections=None, aData='', aGUILayout=None, aParentGraph=None)
Bases: pysbs.sbscommon.nodes.SBSNode
Class that contains information on a paramsGraphNode as defined in a .sbs file Refers to a FxMap graph node.
- Members:
- mGUIName (str): name of the node.
- mUID (str): node unique identifier in the /paramsGraphNodes/ context.
- mType (str): node type, among the identifiers available for the FxMap node definition (
sbsfxmapnodes
) - mDisabled (str, optional): this node is disabled (“1” / None).
- mConnections (list of
SBSConnection
): input (parameter of type ENTRY_PARAMETER) connections list. connRef are nodes unique identifier references (/paramsGraphNode/uid). - mData (str): uid of the data associated to this node (/paramsGraph/paramsGraphDatas/), where the parameters are defined.
- 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.
getConnectedNodesUID()
Get the UIDs of the nodes connected to this node.
Returns: | The UIDs as a list of string |
---|
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()
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 (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 |
getData()
Get the data associated to this node
Returns: | a SBSParamsGraphData object if found, None otherwise |
---|
getDefinedParameters()
Get the list of parameters defined on this node.
Returns: | the list of SBSParameter specified on this node. |
---|
getDefinition()
Get the FxMap node definition (Inputs, Outputs, Parameters)
Returns: | a CompNodeDef object |
---|
getDisplayName()
Get the display name of this node
Returns: | the display name as a string |
---|
getDynamicParameters()
Get the list of dynamic parameters defined on this node.
Returns: | the list of SBSParameter specified on this node that have a dynamic function. |
---|
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)
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 |
getParameterValue(aParameter)
Find a parameter among the data (SBSParamsGraphData) with the given name/id, and return its value.
Parameters: | aParameter (CompNodeParamEnum or str) – Parameter identifier |
---|---|
Returns: | The parameter value if found, None otherwise |
getPosition()
Get the position of this node in the graph GUI.
Returns: | a list of 3 float |
---|
getRect()
Return the rectangle of this node.
Returns: | The rectangle as a Rect |
---|
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)
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)
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(aBottomNode)
Check if the node is connected to the given node, in the direction aLeftNode -> self
Parameters: | aBottomNode (SBSParamsGraphNode or 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 (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(aBottomNode)
Remove the connection between this node and aBottomNode (in the direction self -> aBottomNode)
Parameters: | aBottomNode (SBSParamsGraphNode or str (UID)) – The node to look for in the connections of this node. |
---|---|
Returns: | Nothing |
setDynamicParameter(aParameter)
Set the given parameter as dynamic, to init its params.SBSDynamicValue.
Parameters: | aParameter (CompNodeParamEnum or str) – identifier of the parameter |
---|---|
Returns: | the SBSDynamicValue object if succeed, None otherwise |
setParameterValue(aParameter, aParamValue)
Find a parameter among the data (SBSParamsGraphData) with the given name/id, and set it to the given value.
Parameters: |
|
---|---|
Returns: | True if succeed, False otherwise |
setParentGraph(aParentGraph)
Allows to set the reference to the parent graph.
Parameters: | aParentGraph (SBSGraph ) – The parent Graph of this node |
---|
setPosition(aPosition)
Set the position of this node in the graph GUI.
Parameters: | aPosition (a list of 3 float) – The position to set |
---|
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 |
write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
Parameters: |
|
---|