sbsobject module

Module sbsobject provides the definition of a SBSObject, the base class for all objects of a .sbs package.

class common_interfaces.sbsobject.SBSObject

Bases: SBSARObject

Abstract class used to provide a common interface for all derived SBSObjects, and to ensure that each derived object implements the functions ‘parse’ and ‘write’

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

abstractmethod 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

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 common_interfaces.sbsobject.UIDGenerator

Bases: object

Class used to generate unique ID for new SBSObjects, in the context of their parent.

static generateUID(aSBSObject)

Generate a unique 10-digit UID in the context of the given SBSObject

Parameters:

aSBSObject (SBSObject) – the SBSObject in which the new uid must be unique

Returns:

The UID, as a string