sbsargui module

Module sbsargui aims to define SBSARObjects that are relative to the GUI as saved in a .sbsar file, mostly SBSARInputGui, SBSAROutputGui and SBSARGuiGroup.

class sbsarchive.sbsargui.SBSARGuiGroup(aIdentifier='', aLabel='', aDescription=None, aDefaultState=None, aOrder=None)

Bases: SBSARObject

Class that contains information on a GUI group as defined in a .sbsar file

Members:
  • mIdentifier (str): Unique identifier of the group of parameter.

  • mLabel (str): Label of the group of parameter.

  • mDescription (str, optional): Description

  • mDefaultState (str, optional): Default state (‘folded’,’unfolded’).

  • mOrder (str, optional): Group order

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

class sbsarchive.sbsargui.SBSARInputGui(aWidget='', aLabel='', aDescription=None, aGroup=None, aOrder=None, aState=None, aVisibleIf=None, aGuiAngle=None, aGuiComboBox=None, aGuiImage=None, aGuiSlider=None, aGuiButton=None, aShowas=None)

Bases: SBSARObject

Class that contains information on the GUI widget of an input as defined in a .sbsar file

Members:
  • mWidget (str): Kind of widget associated to this input parameter.

  • mLabel (str): Label of the input (unique).

  • mDescription (str, optional): Description.

  • mGroup (str, optional): Group of parameters.

  • mState (str, optional): State of the input (‘visible’,’hidden’,’disabled’).

  • mOrder (str, optional): Input order.

  • mVisibleIf (str, optional): Conditional visibility definition.

  • mGuiAngle (SBSARGuiAngle, optional): Angle widget definition, if the widget is of kind ‘angle’

  • mGuiComboBox (SBSARGuiComboBox, optional): ComboBox widget definition, if the widget is of kind ‘combobox’

  • mGuiImage (SBSARGuiImage, optional): Image widget definition, if the widget is of kind ‘image’

  • mGuiSlider (SBSARGuiSlider, optional): Slider widget definition, if the widget is of kind ‘slider’

  • mGuiButton (SBSARGuiButton, optional): Button widget definition, if the widget is of kind ‘togglebutton’ or ‘enumbuttons’

  • mShowas (str, optional): defines whether the input is should be shown as a pin or tweakable

aTweakIdentifier = 'tweak'
getAttribute(aAttributeIdentifier)

Get the given attribute value

Parameters:

aAttributeIdentifier (AttributesEnum) – the attribute identifier

Returns:

the attribute value if defined, None otherwise

getClamp()
Returns:

the clamp as a boolean if defined for this parameter, None if not defined

getDropDownList()
Returns:

the map{value(int):label(str)} corresponding to the drop down definition if defined for this parameter, None otherwise.

getGroup()

Get the GUI group identifier containing this input

Returns:

The GUI group as a string if defined, None otherwise

getLabelFalse()

Returns the label for the false option if it’s valid for this input

Returns:

str with the label if it’s a button, otherwise None

getLabelTrue()

Returns the label for the true option if it’s valid for this input

Returns:

str with the label if it’s a button, otherwise None

getLabels()
Returns:

the list of all labels defined for this parameter, in the right order, as a list of strings. None if not defined

getMaxValue()
Returns:

the maximum parameter value in the type of the parameter (int or float), None if not defined

getMinValue()
Returns:

the minimum parameter value in the type of the parameter (int or float), None if not defined

getStep()
Returns:

the step value (in the type of the parameter) of the widget for this parameter, None if not defined

getUsages()

Get the usages of this param input

Returns:

the list of SBSARUsage defined on this image input

getWidget()

Get the GuiWidget object defined on this parameters. This will return None for widgets with no child node prefixed by <guiXXXX/> (Transformation widgets, Color widget, Position & Offset widgets)

Returns:

The widget as a SBSARObject if defined, None otherwise

hasUsage(aUsage)

Check if the given usage is defined on this image input

Parameters:

aUsage (str or UsageEnum) – The usage to look for

Returns:

True if the given usage is defined on this param input, False otherwise

isAButton()

Check if this input is a parameter with a toggle button widget.

Returns:

True if this is an input parameter with a toggle button widget, False otherwise

isAColor()

Check if this input is a parameter with a color widget.

Returns:

True if this is an input parameter with a color widget, False otherwise

isAComboBox()

Check if this input is a parameter with a combo box widget.

Returns:

True if this is an input parameter with a combo box widget, False otherwise

isAPosition()

Check if this input is a parameter with a position widget.

Returns:

True if this is an input parameter with a position widget, False otherwise

isASlider()

Check if this input is a parameter with a slider widget.

Returns:

True if this is an input parameter with a slider widget, False otherwise

isATransformationForward()

Check if this input is a parameter with a transformation forward widget.

Returns:

True if this is an input parameter with a transformation forward widget, False otherwise

isATransformationInverse()

Check if this input is a parameter with a transformation inverse widget.

Returns:

True if this is an input parameter with a transformation inverse widget, False otherwise

isAnAngle()

Check if this input is a parameter with an angle widget.

Returns:

True if this is an input parameter with an angle widget, False otherwise

isAnEnumButtons()

Check if this input is a parameter with an enumbuttons widget.

Returns:

True if this is an input parameter with an enumbuttons widget, False otherwise

isAnInputImage()

Check if this input is of kind image.

Returns:

True if this is an input image, False otherwise

isAnInputParameter()

Check if this input is a parameter.

Returns:

True if this is an input parameter, False otherwise

isAnOffset()

Check if this input is a parameter with an offset widget.

Returns:

True if this is an input parameter with an offset widget, 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

sAngleWidget = 'angle'
sButtonWidget = 'togglebutton'
sColorWidget = 'color'
sComboBoxWidget = 'combobox'
sEnumButtonsWidget = 'enumbuttons'
sImageWidget = 'image'
sNormalFormatIdentifier = '$normalformat'
sOffsetWidget = 'reverseposition'
sOutputSizeIdentifier = '$outputsize'
sPinIdentifier = 'pin'
sPositionWidget = 'position'
sRandomSeedIdentifier = '$randomseed'
sSliderWidget = 'slider'
sTimeIdentifier = '$time'
sTransformationForwardWidget = 'straighttransform'
sTransformationInverseWidget = 'transformation'
class sbsarchive.sbsargui.SBSAROutputGui(aLabel='', aDescription=None, aGroup=None, aVisibleIf=None, aUsages=None)

Bases: SBSARObject

Class that contains information on the GUI widget of an input as defined in a .sbsar file

Members:
  • mLabel (str): Label of the input (unique).

  • mDescription (str, optional): Description.

  • mGroup (str, optional): Group of parameters.

  • mVisibleIf (str, optional): Conditional visibility definition.

  • mUsages (list of SBSARUsage, optional): Usages of this output (‘<channels>’ is the .sbsar file)

getAttribute(aAttributeIdentifier)

Get the given attribute value

Parameters:

aAttributeIdentifier (AttributesEnum) – the attribute identifier

Returns:

the attribute value if defined, None otherwise

getUsages()

Get the usages of this param output

Returns:

the list of SBSARUsage defined on this output

hasUsage(aUsage)

Check if the given usage is defined on this output

Parameters:

aUsage (str or UsageEnum) – The usage to look for

Returns:

True if the given usage is defined on this output, 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