Skip to content

usd_chunks.chunk_flags

The flag enums that describe params and groups: their type, layout, state and behaviour.

ChunkFlags ⚓︎

Hold common flags for chunks.

GroupFlags ⚓︎

Bases: _FlagRepr

Flags for chunk container type objects (Chunk, Group).

Attributes:

Name Type Description
LABELED

If the group should have a label in the ui

COLLAPSABLE

If the group should be able to collapse

FRAMED

A simple style flag

LIST

Parameters on this group is treated as a list that can be extended and shrunk

CONTEXT

The group should be displayed as a context rather than a node/chunk. A chunk context only displays the children of said chunk. In the QT plugin, this is a tab

LayoutFlags ⚓︎

Bases: IntEnum

Flags for layout hinting parameters and groups.

Attributes:

Name Type Description
HORIZONTAL

Hint the ui to display this parameter or group horizontally

VERTICAL

Hint the ui to display this parameter or group vertically

ParamFlags ⚓︎

Bases: _FlagRepr

Flags for chunk params.

Attributes:

Name Type Description
LABELED

If the param should have a label in the ui

OUTPUT

The param is a computed output -- hidden from the UI and not user-editable. Its inputs: attr on the chunk prim is still available for @ChunkName.param@ expressions.

FILE_EXISTING

For FILE type params, this rule hints to the file browser that we can not create new files

DIRECTORY

For FILE type params. Allows selection of folders

PRIM_SELECTION

For LINEEDIT type params, this says that the param is meant for UsdPrim selections

PROP_SELECTION

For LINEEDIT type params, this says that the param is meant for UsdProperty selections

PRIM_PATHS

For LINEEDIT type params: it holds prim paths the chunk reads, without PRIM_SELECTION's filling from the host's selection

TRANSIENT

The param holds session state, not a value. It is kept off the chunk prim, so it is not written into a saved scene and comes back empty on reload.

ParamType ⚓︎

Bases: _FlagRepr

Flags for parameters, describing their types.

UI factories should use param.get_type() to get these types, and implement the UI based on them.

The concrete types are combinations of any of NONE, EMPTY, FLOAT, STRING, INT, BOOL. As these are flags, they can be combined using bitwise operators to create more complex parameters. It's up to the ui implementation to handle these.

Attributes:

Name Type Description
NONE

A default param type. Nothing will be drawn in the ui

EMPTY

The param does not manage a value. used for separators and similar

FLOAT

The parameter can hold a float value

STRING

The parameter can hold a string value

INT

The parameter can hold a int value

BOOL

The parameter can hold a bool value

MATRIX

The parameter can hold a Gf.Matrix4d, stored in USD as matrix4d

CUSTOM

The parameter is custom, will use param.custom_widget when creating the widget

SEPARATOR

The parameter is a separator

BUTTON

The parameter is a button

FLOAT_SLIDER

The parameter is a float valued slider

FLOAT_SPINBOX

The parameter is a float valued spinbox

INT_SLIDER

The parameter is an int valued slider

INT_SPINBOX

The parameter is an int valued spinbox

LABEL

The parameter is a string valued label

LINEEDIT

The parameter is an editable string

FILE

The parameter is a string value referring to a file

STRING_MENU

The parameter is a string valued menu with multiple choices

State ⚓︎

Bases: _FlagRepr

Store current state of parameters and containers.

Attributes:

Name Type Description
NONE

No specified state

HIDDEN

Hint the ui to not draw this param or group

DISABLED

Hint the ui to disable this param or group

COLLAPSED

For COLLAPSABLE groups, this should collapse the group if set

SELECTED

The chunk is selected

STALE

The chunk's last computed result no longer reflects its current inputs (e.g. an expensive, manually-triggered chunk whose params or upstream changed since it last ran). Purely a UI hint -- nothing clears or checks it automatically.

FAILED

The chunk's last cook raised or was cancelled, so the chunks below it did not cook. Set and cleared by every cook (chunk_cook.cook); the node shows red.

ParamTypeToTypes staticmethod ⚓︎

ParamTypeToTypes(t)

Provides default values for ParamType enums.

Parameters:

Name Type Description Default
t ParamType

Input ParamType which to request value for

required

Returns:

Type Description
list[type]

list[type]: The value types t supports; all of them when t combines several

list[type]

ParamTypes.

Source code in usd_chunks/chunk_flags.py
@staticmethod
def ParamTypeToTypes(t: ParamType) -> list[type]:
    """Provides default values for ParamType enums.

    Args:
        t (ParamType): Input ParamType which to request value for

    Returns:
        list[type]: The value types `t` supports; all of them when `t` combines several
        ParamTypes.
    """
    result = []

    if t in (ChunkFlags.ParamType.EMPTY | ChunkFlags.ParamType.NONE):
        result.append(None)
    if ChunkFlags.ParamType.INT in t:
        result.append(int)
    if ChunkFlags.ParamType.FLOAT in t:
        result.append(float)
    if ChunkFlags.ParamType.BOOL in t:
        result.append(bool)
    if ChunkFlags.ParamType.STRING in t:
        result.append(str)
        result.append(Sdf.AssetPath)
    if ChunkFlags.ParamType.VECTOR in t:
        result.append(tuple)
        result.append(list)
    if ChunkFlags.ParamType.MATRIX in t:
        result.append(Gf.Matrix4d)
    return result