compnode_common module

Module compnode.common provides the definition of SBSCompOutput, SBSOutputBridging and SBSCompImplWithParams, which are used in the other modules in compnode

class compnode.common.SBSCompImplWithParams(aParameters=None)

Bases: SBSObject

This class allows to gather the parameter management for classes SBSCompFilter, SBSCompInstance, SBSCompInputBridge and SBSParamsGraphData

Members:
  • mParameters (list of SBSParameter): input parameters list.

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.

abstractmethod getDefinition()

Get the definition of the node (Inputs, Outputs, Parameters)

Returns:

a CompNodeDef object

abstractmethod 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.

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

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 SBSDynamicValue object if succeed, None otherwise

Raise:

api_exceptions.SBSLibraryError

setParameterValue(aParameter, aParamValue, aRelativeTo=None)

Set the value of the given parameter to the given value, if compatible with this node.

Parameters:
Returns:

True if succeed, False otherwise

Raise:

api_exceptions.SBSLibraryError

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

abstractmethod 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 compnode.common.SBSCompInputValue(aIdentifier='', aType=None)

Bases: SBSObject

Class that contains information about an input value in a .sbs file

Members:
  • mIdentifier (str): Identifier for the input value.

  • mType (str): Type for the value. Type definition: ParamTypeEnum

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)

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

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 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 compnode.common.SBSCompOutput(aUID='', aCompType=None)

Bases: SBSObject

Class that contains information on a compositing node output as defined in a .sbs file

Members:
  • mUID (str): node output unique identifier in the /compNodes/compOutputs/ context.

  • mCompType (str): return type of the output (color or grayscale). Type definition: ParamTypeEnum

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)

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

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 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 compnode.common.SBSOutputBridging(aUID='', aIdentifier='')

Bases: SBSObject

Class that contains information on an output bridging as defined in a .sbs file

Members:
  • mUID (str): uid of the compositing node output (/compNode/compOutputs/compOutput/uid).

  • mIdentifier (str): graph definition output identifier (/graph/graphOutputs/graphOutput/identifier)

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)

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

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 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