paramgraph module
- class compnode.paramgraph.SBSParamsGraph(aName='', aUID='', aGUILayoutPGraph=None, aRootNode=None, aParamsGraphDatas=None, aParamsGraphNodes=None, aGUIObjects=None)
Bases:
SBSObjectClass 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:
aBottomNode (
SBSParamsGraphNodeor str) – Node to connect toaTopNode (
SBSParamsGraphNodeor str) – Node to connect fromaTopNodeOutput (
OutputEnumor str, optional) – Identifier of the output of the top node
- Returns:
True if success
- Raise:
api_exceptions.SBSImpossibleActionError
- contains(aNode)
Check if the given node belongs to this graph
- Parameters:
aNode (
SBSParamsGraphNodeor 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:
aCommentText (str, optional) – The text of the comment. Default to ‘Comment’
aGUIPos (list of 3 float, optional) – The comment position in the graph. Default to [0,0,0]
aLinkToNode (str, optional) – UID of the node to associate to this comment
- Returns:
The
SBSGUIObjectcreated
- createFrame(aSize, aFrameTitle='Frame', aCommentText='', aGUIPos=None, aColor=None, aDisplayTitle=True)
Create a new framed comment.
- Parameters:
aSize (list of 2 float) – The frame size
aFrameTitle (str, optional) – The title of the frame. Default to ‘Frame’
aCommentText (str, optional) – The text of the frame. Empty by default
aGUIPos (list of 3 float, optional) – The frame position in the graph. Default to [0,0,-100]
aColor (list of 4 float between 0 and 1, optional.) – The frame color. Default to [0.196, 0.196, 0.509, 0.196]
aDisplayTitle (boolean, optional) – True to display the frame title. Default to True
- Returns:
The
SBSGUIObjectcreated
- createFrameAroundNodes(aNodeList, aFrameTitle='Frame', aCommentText='', aColor=None, aDisplayTitle=True)
Create a new framed comment around the given nodes.
- Parameters:
aNodeList (list of class:.SBSParamsGraphNode) – The nodes to include in the frame
aFrameTitle (str, optional) – The title of the frame. Default to ‘Frame’
aCommentText (str, optional) – The text of the frame. Empty by default
aColor (list of 4 float between 0 and 1, optional.) – The frame color. Default to [0.196, 0.196, 0.509, 0.196]
aDisplayTitle (boolean, optional) – True to display the frame title. Default to True
- Returns:
The
SBSGUIObjectcreated- Raise:
api_exceptions.SBSImpossibleActionError
- 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:
aFxMapNode (
FxMapNodeEnumor str) – the kind of FxMap node to create among the list defined inFxMapNodeEnumaGUIPos (list of 3 float, optional) – position of the node in the graph: [x,y,z]. default value is [0,0,0]
aParameters (dictionary {
CompNodeParamEnum: parameterValue(str)}, optional) – parameters of the FxMap node
- Returns:
The new
SBSParamsGraphNodeobject
- 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:
aGraphNode (
SBSParamsGraphNodeor str) – the FxMap node which contains the parameter definition dynamically drivenaParameter (
CompNodeParamEnumor str) – the parameter driven by a dynamic function, on which the iteration will be createdaNbIteration (positive integer) – number of time the pattern must be duplicated
aNodeUIDs (list of str) – list of node’s UID that constitute the pattern to duplicate
aNodeUIDs_NextPattern (list of str, optional) – list of node’s UID that correspond to the next pattern, which must be connected to the given pattern.
aGUIOffset (list of 2 float, optional) – pattern position offset. Default to [150, 0]
- Returns:
The list of params.SBSParamNode created if succeed
- Raise:
api_exceptions.SBSImpossibleActionError
Create a new navigation pin.
- Parameters:
aPinText (str) – The text of the navigation pin
aGUIPos (list of 3 float) – The navigation pin position in the graph
- Returns:
The
SBSGUIObjectcreated
- deleteComment(aComment)
Allows to delete the given comment from the graph.
- Parameters:
aComment (
SBSGUIObjector 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 (
SBSGUIObjector str) – The frame to remove, as a Frame or an UID.- Returns:
True if success
- Raise:
api_exceptions.SBSImpossibleActionError
Allows to delete the given navigation pin from the graph.
- Parameters:
aNavigationPin (
SBSGUIObjector 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 (
SBSParamsGraphNodeor 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:
aTopNode (
SBSCompNode) – Top nodeaBottomNode (
SBSCompNode) – Bottom nodeaTopNodeOutput (
OutputEnumor str, optional) – Identifier of the output of the top node
- Returns:
Nothing
- Raise:
api_exceptions.SBSImpossibleActionError
- 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:
aNode (
SPSParamsGraphNodeor str) – the node to copy (may be identified by its UID)aGUIOffset (list of 2 float, optional) – node position offset. Default to [150, 0]
- Returns:
The new
SPSParamsGraphNodeobject- Raise:
api_exceptions.SBSImpossibleActionError
- 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
Get all the navigation pins defined in the graph
- Returns:
a list of
SBSGUIObject
- getAllNodesOfKind(aFxMapNode)
Search for all
SBSParamsGraphNodeof the given kind (Quadrant, Switch or Iterate).- Parameters:
aFxMapNode (
FxMapNodeEnumstr) – kind of FxMap node to look for- Returns:
a list of
SBSParamsGraphNodecontaining 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 (
SBSParamsGraphNodeor str) – The node to consider, as a SBSParamsGraphNode or given its UID- Returns:
a list of
SBSGUIObject
- getNode(aNodeUID)
Get the
SBSParamsGraphNodeobject with the given UID- Parameters:
aNodeUID (str) – uid of the node to get
- Returns:
The
SBSParamsGraphNodeobject if found, None otherwise
- getNodeAssociatedToComment(aComment)
Get the node associated to the given comment.
- Parameters:
aComment (
SBSGUIObject) – The comment to consider- Returns:
the
SBSParamsGraphNodeif found, None otherwise
- getNodeData(aDataUID)
Get the
SBSParamsGraphDataobject with the given UID- Parameters:
aDataUID (str) – uid of the data to get
- Returns:
The
SBSParamsGraphDataobject 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
SBSParamsGraphNodeincluded 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
SBSParamsGraphDataof 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:
aFrame (
SBSGUIObject) – The frame to editaNodeList (list of class:.SBSParamsGraphNode) – The nodes to include in the frame
- Raise:
SBSImpossibleActionError
- setRootNode(aNode)
Set the root node of the FxMap graph
- Parameters:
aNode (
SBSParamsGraphNodeor str) – the node to set as root, or its UID- Returns:
The
SBSParamsGraphNodecorresponding to the root node, False if not found- Raise:
api_exceptions.SBSImpossibleActionError
- class compnode.paramgraph.SBSParamsGraphData(aIdentifier='', aUID='', aType='', aInherit=None, aParameters=None)
Bases:
SBSCompImplWithParamsClass 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
CompNodeDefobject
- 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 (
CompNodeParamEnumor 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:
aParameter (
CompNodeParamEnumor str) – identifier of the parameteraRelativeTo (
ParamInheritanceEnum) – Inheritance of the parameter
- Returns:
the
SBSDynamicValueobject if succeed, None otherwise- Raise:
api_exceptions.SBSLibraryError
- setParameterValue(aParameter, aParamValue)
Set the value of the given parameter to the given value, if compatible with this type of FxMap graph node
- Parameters:
aParameter (
CompNodeParamEnumor str) – identifier of the parameter to setaParamValue (
SBSDynamicValueor any parameter type) – value of the parameter
- Returns:
True if succeed, False otherwise
- unsetParameter(aParameter)
Unset the given parameter so that it is reset to its default value.
- Parameters:
aParameter (
CompNodeParamEnumor str) – identifier of the parameter to set- Returns:
True if succeed, False otherwise
- Raise:
api_exceptions.SBSLibraryError
- class compnode.paramgraph.SBSParamsGraphNode(aGUIName=None, aUID='', aType='', aDisabled=None, aConnections=None, aData='', aGUILayout=None, aParentGraph=None, aUserId=None)
Bases:
SBSNodeClass 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.mUserId (str): node id given by the user (used for portal connections display).
- 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) 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
- getData()
Get the data associated to this node
- Returns:
a
SBSParamsGraphDataobject if found, None otherwise
- getDefinedParameters()
Get the list of parameters defined on this node.
- Returns:
the list of
SBSParameterspecified on this node.
- getDefinition()
Get the FxMap node definition (Inputs, Outputs, Parameters)
- Returns:
a
CompNodeDefobject
- 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
SBSParameterspecified on this node that have a dynamic function.
- 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
- getParameterValue(aParameter)
Find a parameter among the data (SBSParamsGraphData) with the given name/id, and return its value.
- Parameters:
aParameter (
CompNodeParamEnumor 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
- 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 (
SBSParamsGraphNodeor 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(aBottomNode)
Remove the connection between this node and aBottomNode (in the direction self -> aBottomNode)
- Parameters:
aBottomNode (
SBSParamsGraphNodeor 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 (
CompNodeParamEnumor str) – identifier of the parameter- Returns:
the
SBSDynamicValueobject 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:
aParameter (
CompNodeParamEnumor str) – identifier of the parameter to setaParamValue (
SBSDynamicValueor any parameter type) – value of the parameter
- 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 (
CompNodeParamEnumor str) – identifier of the parameter to set- Returns:
True if succeed, False otherwise