User Guide Cancel

gui | Substance 3D Automation ToolKit

gui

Module gui provides the definition of the classes relative to the GUI: - SBSGUILayout - SBSGUIObject - SBSGUILayoutComp

class sbscommon.gui.GUIObjectList(aParentObject, aGUIObjectsAttr)
class sbscommon.gui.GUIObjectList(aParentObject, aGUIObjectsAttr)
 class sbscommon.gui.GUIObjectList(aParentObject, aGUIObjectsAttr)  

Bases: object

Class used to provide common methods to SBSObjects that contains a list of GUIObjects: - SBSGraph - SBSDynamicValue - SBSParamsGraph

Members:
  • mParentObject (SBSObject): Parent object that contains the GUI object list.
  • mGUIObjectsAttr (str): attribute member name in the parent object that corresponds to the GUI object list.
createComment(aCommentText='Comment', aGUIPos=None)
createComment(aCommentText='Comment', aGUIPos=None)
 createComment(aCommentText='Comment', aGUIPos=None)  

Create a new comment.

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) – The UID of the node to associate to this comment
Returns:

The SBSGUIObject created

createFrame(aSize, aFrameTitle='Frame', aCommentText='', aGUIPos=None, aColor=None, aDisplayTitle=True)
createFrame(aSize, aFrameTitle='Frame', aCommentText='', aGUIPos=None, aColor=None, aDisplayTitle=True)
 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 SBSGUIObject created

createFrameAroundNodes(aNodeList, aFrameTitle='Frame', aCommentText='', aColor=None, aDisplayTitle=True)
createFrameAroundNodes(aNodeList, aFrameTitle='Frame', aCommentText='', aColor=None, aDisplayTitle=True)
 createFrameAroundNodes(aNodeList, aFrameTitle='Frame', aCommentText='', aColor=None, aDisplayTitle=True)  

Create a new framed comment around the given nodes.

Parameters:
  • aNodeList (list of class:.SBSNode) – 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 SBSGUIObject created

Raise:

SBSImpossibleActionError

createNavigationPin(self, aPinText, aGUIPos)
createNavigationPin(self, aPinText, aGUIPos)
 createNavigationPin(self, aPinText, aGUIPos)  

Create a new navigation pin.

Parameters:
  • aPinText (str) – The text of the navigation pin
  • aGUIPos (list of 3 float, optional) – The navigation pin position in the graph. Default to [0,0,0]
Returns:

The SBSGUIObject created

deleteGUIObject(aGUIObject)
deleteGUIObject(aGUIObject)
 deleteGUIObject(aGUIObject)  

deleteGUIObject(aGUIObject): Allows to delete the given GUI object.

Parameters:aGUIObject (SBSGUIObject or str) – The GUI object to remove, as a SBSGUIObject or an UID.
Returns:True if success
Raise:api_exceptions.SBSImpossibleActionError
getAllComments()
getAllComments()
 getAllComments()  

Get all comments defined in the graph

Returns:a list of SBSGUIObject
getAllFrames()
getAllFrames()
 getAllFrames()  

Get all frames defined in the graph

Returns:a list of SBSGUIObject
getAllGUIObjects()
getAllGUIObjects()
 getAllGUIObjects()  

Get all the GUI objects defined in the graph (Comments, Frames, Navigation Pins)

Returns:a list of SBSGUIObject
getAllNavigationPins()
getAllNavigationPins()
 getAllNavigationPins()  

Get all the navigation pins defined in the graph

Returns:a list of SBSGUIObject
getFrameRectAroundNodes(aNodeList)
getFrameRectAroundNodes(aNodeList)
 getFrameRectAroundNodes(aNodeList)  

Return the rectangle a frame would fill to be around the given nodes.

Parameters:aNodeList (list of class:.SBSNode) – The nodes to include in the frame
Returns:A Rect
Raise:SBSImpossibleActionError
getGUIObject(aGUIObject)
getGUIObject(aGUIObject)
 getGUIObject(aGUIObject)  

getGUIObject(aGUIObject): Search for the given GUI object in the list

Parameters:aGUIObject (SBSGUIObject or str) – GUI object to get, identified by its uid or as a SBSGUIObject
Returns:A SBSGUIObject object if found, None otherwise
getNodesInFrame(aFrame)
getNodesInFrame(aFrame)
 getNodesInFrame(aFrame)  

Get all the nodes included or partially included in the given frame. The frame must be included in the parent graph, otherwise SBSImpossibleActionError is raised

Parameters:aFrame (SBSGUIObject) – The frame to consider
Returns:a list of SBSNode
Raise:SBSImpossibleActionError
reframeAroundNodes(aFrame, aNodeList)
reframeAroundNodes(aFrame, aNodeList)
 reframeAroundNodes(aFrame, aNodeList)  

Move and resize a frame to be around the given nodes.

Parameters:
  • aFrame (SBSGUIObject) – The frame to edit
  • aNodeList (list of class:.SBSNode) – The nodes to include in the frame
Raise:

SBSImpossibleActionError

class sbscommon.gui.Rect(aTop=0, aLeft=0, aWidth=0, aHeight=0)
class sbscommon.gui.Rect(aTop=0, aLeft=0, aWidth=0, aHeight=0)
 class sbscommon.gui.Rect(aTop=0, aLeft=0, aWidth=0, aHeight=0)  

Bases: object

containsPoint(aPoint)
containsPoint(aPoint)
 containsPoint(aPoint)  

Check if the given point is contained in the Rectangle.

Parameters:aPoint – The point to test
Type:list of 2 float [x, y] or tuple
Returns:True if the given point is contained in the Rectangle, False otherwise
getCorners()
getCorners()
 getCorners()  

Get the 4 corner points of this rectangle

Returns:The corners of this rectangle, as a list of tuple
overlapsWith(aOther)
overlapsWith(aOther)
 overlapsWith(aOther)  

Check if the two rectangles overlap

Parameters:aOther (Rect) – The other rectangle
Returns:True if the two rectangles overlap
union(aOther)
union(aOther)
 union(aOther)  

Create the union of two rectangles

Parameters:aOther (Rect) – The other rectangle
Returns:The rectangle which is the union of the two rectangles
class sbscommon.gui.SBSGUILayout(aGPos=None, aDocked=None, aDockDistance=None, aSize=None)
class sbscommon.gui.SBSGUILayout(aGPos=None, aDocked=None, aDockDistance=None, aSize=None)
 class sbscommon.gui.SBSGUILayout(aGPos=None, aDocked=None, aDockDistance=None, aSize=None)  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

Class that contains information on a GUILayout (GUI position and options) as defined in a .sbs file

Members:
  • mGPos (list of 3 float, optional): position in the graph layout.
  • mDocked (str, optional): object is in a docked state.
  • mDockDistance (str, optional): original distance between the docked node and its parent (for undock purpose).
  • mSize (str, optional): size of the object.
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
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 sbscommon.gui.SBSGUILayoutComp(aDisplay=None, aGRoi=None, aGZoom=None)
class sbscommon.gui.SBSGUILayoutComp(aDisplay=None, aGRoi=None, aGZoom=None)
 class sbscommon.gui.SBSGUILayoutComp(aDisplay=None, aGRoi=None, aGZoom=None)  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

Class that contains information on a GUILayoutComp (Gui flags and options) as defined in a .sbs file

Members:
  • mDisplay (str): display type (graph, stack, etc.).
  • mGRoi (str): visualized Region Of Interest of the graph.
  • mGZoom (str): graph zoom.
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
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 sbscommon.gui.SBSGUIObject(aUID='', aType='', aGUIDependency=None, aGUILayout=None, aGUIName='', aOptions=None, aTitle=None, aFrameColor=None, aIsTitleVisible=None, aIsFrameVisible=None)
class sbscommon.gui.SBSGUIObject(aUID='', aType='', aGUIDependency=None, aGUILayout=None, aGUIName='', aOptions=None, aTitle=None, aFrameColor=None, aIsTitleVisible=None, aIsFrameVisible=None)
 class sbscommon.gui.SBSGUIObject(aUID='', aType='', aGUIDependency=None, aGUILayout=None, aGUIName='', aOptions=None, aTitle=None, aFrameColor=None, aIsTitleVisible=None, aIsFrameVisible=None)  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

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

Members:
  • mUID (str): node unique identifier in the /GUIObjects/ context.
  • mType (str): type of GUI object (comment, navigation pin, etc.)
  • mGUIDependency (str): dependency of this GUI Object on an object in the graph ( format : Type?uid(?uid…) )
  • mGUILayout (SBSGUILayout):
  • mGUIName (str): name of the GUI object.
  • mOptions (list of SBSOption): list of specific options of the GUI object type.
  • mTitle (str, optional): The object Title
  • mFrameColor (str, optional): frame color (RGBA Float)
  • mIsTitleVisible (str, optional): bool to set title visibility
  • mIsFrameVisible (str, optional): bool to set frame visibility
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.
getDependencyUID()
getDependencyUID()
 getDependencyUID()  

Get the UID of the node associated to this GUIObject.

Returns:the UID as a string if found, None otherwise
getRect()
getRect()
 getRect()  

Return the rectangle of this GUIObject

Returns:The rectangle as a Rect
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
hasDependencyOn(aUID)
hasDependencyOn(aUID)
 hasDependencyOn(aUID)  

Checks if this GUI Object has a dependency on the given UID

Parameters:aUID (str) – The UID to consider
Returns:True if this GUI Object has a dependency on the object with the given UID, False otherwise
isAComment()
isAComment()
 isAComment()  
Returns:True if this GUIObject is a simple comment
isAFrame()
isAFrame()
 isAFrame()  
Returns:True if this GUIObject is a framed comment
isANavigationPin()
isANavigationPin()
 isANavigationPin()  
Returns:True if this GUIObject is a navigation pin
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
sDefaultColor = [0.196078435, 0.196078435, 0.509803951, 0.196078435]
sDefaultColor = [0.196078435, 0.196078435, 0.509803951, 0.196078435]
 sDefaultColor = [0.196078435, 0.196078435, 0.509803951, 0.196078435]  
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?