ComputeNodeWidgetUtils#

class omni.graph.ui.ComputeNodeWidgetUtils#

Bases: object

Utility methods to allow the widgets used for node attributes in the property window to also be used outside of the property window.

See StandaloneAttributeBuilder for a simplified interface to these methods.

Methods

build_property_item(stage, ui_prop, prim_path)

Build the UI for a single node attribute.

customize_prop_metadata(node, ui_prop)

Update property UI metadata based on OG metadata.

get_additional_kwargs(ui_prop)

Get standard label and value widget arguments used by all data types.

update_prop_for_extended_type(node, ui_prop)

If 'ui_prop' references an extended attribute of 'node' then its metadata will be updated to reflect the current state of resolution of the attribute's type.

__init__()#
static build_property_item(
stage: Stage,
ui_prop: UsdPropertyUiEntry,
prim_path: Path,
label_kwd_args: dict[str, Any] = None,
value_kwd_args: dict[str, Any] = None,
) tuple[Container, list[AbstractValueModel]]#

Build the UI for a single node attribute.

Differences from ComputeNodeWidget’s version:
  • Only supports a single attribute at a time. No shared values across multiple attributes.

  • No support for filtering

Parameters:
  • stage – USD stage containing the node.

  • ui_prop – Description of the attribute. If its ‘prim_paths` member is set then only the first path will be used and it will be used instead of the ‘prim_path’ arg.

  • prim_path – Sdf path to a node’s prim. Can be overridden by the ‘prim_paths’ member of ‘ui_prop’.

  • label_kwd_args

    Dictionary of name/value pairs to be passed to ui.Label when creating the label widget.

    In addition to the usual ui.Label keywords the following is supported:

    no_control_state: bool

    The control state widget is the little box to right of the value that shows whether attribute the has changed from its default, is connected, etc. Set this True to prevent it being drawn. This also controls whether the standard context menu is available so if you set it True you will have to add your own context menu to the built widgets.

  • value_kwd_args – Dictionary of name/value pairs to be passed to the value widgets when they are created.

Returns:

A tuple containing the top-level widget for the attribute’s UI and the model used to get and set the widget’s value. In the case of multi-model widgets (e.g. a vector where each component has its own model) the parent model is returned.

Raises:
  • ValueError if 'prim_path' is invalid or does does not reference an OmniGraph node, or if the node does

  • not have the attribute specified by 'ui_prop', or if the property widget uses an unsupported value model.

static customize_prop_metadata(
node: Node,
ui_prop: UsdPropertyUiEntry,
) Attribute#

Update property UI metadata based on OG metadata. This does not include metadata for the resolution of extended attribute types. For that you must call update_prop_for_extended_type() separately.

Parameters:
  • attribute. (node - OmniGraph node containing the)

  • property (ui_prop - Description of the)

Returns:

The corresponding OmniGraph attribute. If no attribute can be found then None is returned and ‘ui_prop’ is not modified.

static get_additional_kwargs(
ui_prop: UsdPropertyUiEntry,
) tuple[dict[str, Any], dict[str, Any]]#

Get standard label and value widget arguments used by all data types.

Parameters:

property (ui_prop - Description of the)

Returns:

Tuple containing keyword argument dictionaries for the label and value widgets.

static update_prop_for_extended_type(
node: Node,
ui_prop: UsdPropertyUiEntry,
)#

If ‘ui_prop’ references an extended attribute of ‘node’ then its metadata will be updated to reflect the current state of resolution of the attribute’s type.

Not needed if calling build_property_item().

Parameters:
  • attribute. (node - OmniGraph node containing the)

  • property (ui_prop - Description of the)