API

  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.property_widget_builder.model.usd.ComboboxField(style_name: str = 'PropertiesWidgetField')

Bases: omni.flux.property_widget_builder.delegates.base.AbstractField

build_ui(item) list[omni.ui._ui.Widget]
class omni.flux.property_widget_builder.model.usd.DisableAllListenersBlock(listener_instance)

Bases: object

Use to disable all listeners

Example

If you add multiple entity at the same time, you can do:

>>> with DisableAllListenersBlock(usd_listener_instance):
>>>     for i in range(100):
>>>         pass  # usd action
LIST_SELF = []
__init__(listener_instance)
class omni.flux.property_widget_builder.model.usd.FileTexturePicker(file_extension_options: Optional[List[Tuple[str, str]]] = None, style_name: str = 'PropertiesWidgetField')

Bases: omni.flux.property_widget_builder.delegates.string_value.file_picker.FilePicker

Delegate of the tree

POPUP_HEIGHT = 320
POPUP_OFFSET = 40
POPUP_WIDTH = 600
__init__(file_extension_options: Optional[List[Tuple[str, str]]] = None, style_name: str = 'PropertiesWidgetField')

A delegate that will show a stringField with a file picker

Parameters

file_extension_options

A list of filename extension options. Each list element is an (extension name, description) pair.

Examples: (“*.usdc”, “Binary format”) or (“.usd*”, “USD format”) or (“*.png, *.jpg, *.exr”, “Image format”) # noqa

build_ui(item) list[omni.ui._ui.Widget]
class omni.flux.property_widget_builder.model.usd.USDAttrListItem(context_name: str, attribute_paths: List[pxr.Sdf.Path], key: Optional[str], default: str, options: List[str], read_only: bool = False, display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, not_implemented: bool = False)

Bases: omni.flux.property_widget_builder.model.usd.items._BaseListModelItem

Item of the model

__init__(context_name: str, attribute_paths: List[pxr.Sdf.Path], key: Optional[str], default: str, options: List[str], read_only: bool = False, display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, not_implemented: bool = False)

Item that represent the key of a metadata of an USD attribute on the tree

Parameters
  • context_name – the context name

  • attribute_paths – the list of USD attribute(s) the item will represent

  • key – the metadata key to show

  • default – the metadata key default value

  • options – the metadata available options

  • read_only – read only or not

  • display_attr_names – override the name(s) of the attribute(s) to show by those one

  • display_attr_names_tooltip – tooltip to show on the attribute name

  • not_implemented – if not implement

class omni.flux.property_widget_builder.model.usd.USDAttributeDef(path: pxr.Sdf.Path, attr_type: pxr.Sdf.ValueTypeNames, op: pxr.UsdGeom.XformOp, value: Optional[Any] = None, exists: bool = False)

Bases: object

Holds arguments for a USD attribute that may be created at a later time.

__init__(path: pxr.Sdf.Path, attr_type: pxr.Sdf.ValueTypeNames, op: pxr.UsdGeom.XformOp, value: Optional[Any] = None, exists: bool = False) None
attr_type: pxr.Sdf.ValueTypeNames
exists: bool = False
op: pxr.UsdGeom.XformOp
path: pxr.Sdf.Path
value: Optional[Any] = None
class omni.flux.property_widget_builder.model.usd.USDAttributeItem(context_name: str, attribute_paths: List[pxr.Sdf.Path], display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, read_only: bool = False, value_type_name: Optional[pxr.Sdf.ValueTypeNames] = None)

Bases: omni.flux.property_widget_builder.widget.tree.model.Item

Item of the model

__init__(context_name: str, attribute_paths: List[pxr.Sdf.Path], display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, read_only: bool = False, value_type_name: Optional[pxr.Sdf.ValueTypeNames] = None)

Item that represent a USD attribute on the tree

Parameters
  • context_name – the context name

  • attribute_paths – the list of USD attribute(s) the item will represent

  • display_attr_names – override the name(s) of the attribute(s) to show by those one

  • display_attr_names_tooltip – tooltip to show on the attribute name

  • read_only – show the attribute(s) as read only

  • value_type_name – if None, the type name will be inferred

delete_all_overrides()
delete_layer_override(layer)
property element_count

Number of channel the attribute has (for example, float3 is 3 channels)

refresh()
set_display_attr_names(display_attr_names: List[str])

Set the display name of the attributes

Parameters

display_attr_names – list of display name

set_display_attr_names_tooltip(display_attr_names_tooltip: List[str])

Set the display name of the attributes

Parameters

display_attr_names_tooltip – list of display name tooltip

subscribe_attribute_changed(function)

Return the object that will automatically unsubscribe when destroyed.

subscribe_override_removed(function)

Return the object that will automatically unsubscribe when destroyed.

class omni.flux.property_widget_builder.model.usd.USDAttributeItemStub(name: str, context_name: str, attribute_defs: Sequence[omni.flux.property_widget_builder.model.usd.items.USDAttributeDef])

Bases: omni.flux.property_widget_builder.model.usd.items.USDAttributeItem

Holds USD attribute(s) that may be created at a later time.

__init__(name: str, context_name: str, attribute_defs: Sequence[omni.flux.property_widget_builder.model.usd.items.USDAttributeDef])
Parameters
  • name (str) – A name for the group of attributes this item represents.

  • context_name (str) –

  • attribute_defs (Sequence[USDAttributeDef]) – Attribute definitions to create. These are created in the order they are provided.

create_attributes()

Create the USD attributes.

refresh()

Trigger a task to determine if the attributes should be created.

This can happen if the attributes are created by some mechanism besides interacting with widgets presented in the TreeView.

subscribe_create_attributes_begin(function)

Return the object that will automatically unsubscribe when destroyed.

subscribe_create_attributes_end(function)

Return the object that will automatically unsubscribe when destroyed.

class omni.flux.property_widget_builder.model.usd.USDAttributeItemVirtual(context_name: str, attribute_paths: List[pxr.Sdf.Path], default_values: List[Any], value_type_name: pxr.Sdf.ValueTypeNames, create_callback: Optional[Callable[[Any], None]] = None, display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, read_only: bool = False)

Bases: omni.flux.property_widget_builder.model.usd.items.USDAttributeItem

Item of the model

__init__(context_name: str, attribute_paths: List[pxr.Sdf.Path], default_values: List[Any], value_type_name: pxr.Sdf.ValueTypeNames, create_callback: Optional[Callable[[Any], None]] = None, display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, read_only: bool = False)
Parameters
  • context_name – The context name

  • attribute_paths – The attribute paths

  • default_values – The default values for the attributes

  • value_type_name – Value type name for the default values

  • create_callback – A function called after the attribute is edited (End Edit). By default, this simply adds the attribute to the prim

  • display_attr_names – Display name for the attribute

  • display_attr_names_tooltip – tooltip to show on the attribute name

  • read_only – If the attribute is read-only

class omni.flux.property_widget_builder.model.usd.USDAttributeXformItem(context_name: str, attribute_paths: List[pxr.Sdf.Path], display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, read_only: bool = False, value_type_name: Optional[pxr.Sdf.ValueTypeNames] = None)

Bases: omni.flux.property_widget_builder.model.usd.items.USDAttributeItem

__init__(context_name: str, attribute_paths: List[pxr.Sdf.Path], display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, read_only: bool = False, value_type_name: Optional[pxr.Sdf.ValueTypeNames] = None)

Item that represent a USD attribute on the tree

Parameters
  • context_name – the context name

  • attribute_paths – the list of USD attribute(s) the item will represent

  • display_attr_names – override the name(s) of the attribute(s) to show by those one

  • display_attr_names_tooltip – tooltip to show on the attribute name

  • read_only – show the attribute(s) as read only

  • value_type_name – if None, the type name will be inferred

delete_all_overrides() None
delete_layer_override(layer) None
class omni.flux.property_widget_builder.model.usd.USDAttributeXformItemStub(name: str, context_name: str, attribute_defs: Sequence[omni.flux.property_widget_builder.model.usd.items.USDAttributeDef])

Bases: omni.flux.property_widget_builder.model.usd.items.USDAttributeItemStub

Holds USD XForm attribute(s) that may be created at a later time.

class omni.flux.property_widget_builder.model.usd.USDAttributeXformItemVirtual(context_name: str, attribute_paths: List[pxr.Sdf.Path], default_values: List[Any], value_type_name: pxr.Sdf.ValueTypeNames, op_type: Optional[pxr.UsdGeom.XformOp] = None, ops_to_create: Optional[Tuple[pxr.UsdGeom.XformOp, Any]] = None, display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, read_only: bool = False)

Bases: omni.flux.property_widget_builder.model.usd.items.USDAttributeItemVirtual

Item of the model

__init__(context_name: str, attribute_paths: List[pxr.Sdf.Path], default_values: List[Any], value_type_name: pxr.Sdf.ValueTypeNames, op_type: Optional[pxr.UsdGeom.XformOp] = None, ops_to_create: Optional[Tuple[pxr.UsdGeom.XformOp, Any]] = None, display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, read_only: bool = False)
Parameters
  • context_name – The context name

  • attribute_paths – The attribute paths

  • default_values – The default values for the attributes

  • value_type_name – Value type name for the default values

  • op_type – The current item’s xform op type

  • ops_to_create – Tuple of xform op types to create when the value model is edited and their default values

  • display_attr_names – Display name for the attribute

  • display_attr_names_tooltip – tooltip to show on the attribute name

  • read_only – If the attribute is read-only

class omni.flux.property_widget_builder.model.usd.USDBuilderList(iterable=(), /)

Bases: omni.flux.property_widget_builder.widget.tree.delegate.FieldBuilderList

An extension of the FieldBuilderList that has some additional USD specific registration helpers for constructing FieldBuilder instances.

append_builder_by_attr_name(names: Union[str, Iterable[str]], build_func: Callable[[_Item], omni.ui._ui.Widget | list[omni.ui._ui.Widget] | None])

A simple helper which allows users to register a FieldBuilder with just attribute names and a build_func.

static claim_by_name(*names: str) Callable[[_Item], bool]

Get a FieldBuilder claim_func that will claim items that use any USD attributes that match names.

register_by_name(*names)

Decorator to simplify registering a build function for USDAttributeItem for specific attribute name(s).

register_by_type(*types)

Decorator to simplify registering a build function for USDAttributeItem of specific type(s).

class omni.flux.property_widget_builder.model.usd.USDDelegate(field_builders: Optional[list[omni.flux.property_widget_builder.widget.tree.delegate.FieldBuilder]] = None)

Bases: omni.flux.property_widget_builder.widget.tree.delegate.Delegate

Delegate of the tree

__init__(self: omni.ui._ui.AbstractItemDelegate) None

Constructs AbstractItemDelegate.

kwargs : dict

See below

### Keyword Arguments:

build_branch(model: _USDModel, item: _Item, column_id: int, level: int, expanded: bool) None

Create a branch widget that opens or closes subtree

property default_attrs: dict[str, Any]
destroy()
reset()

Reset any stored state.

selected_items_changed(items: Iterable[_Item])

Callback intended to be connected to the view’s selection changed event.

This needs to be connected manually when configuring the delegate and the view.

value_model_updated(item)

Callback ran whenever an item’s value model updates.

class omni.flux.property_widget_builder.model.usd.USDFloatSliderField(min_value, max_value, step: Optional[int] = None, style_name: str = 'FloatSliderField')

Bases: omni.flux.property_widget_builder.delegates.float_value.slider.FloatSliderField

A FloatSliderField that will attempt to adjust it’s min/max range using USD attribute metadata.

adjust_min_max_range(item: omni.flux.property_widget_builder.model.usd.items.USDAttributeItem)

Attempts to adjust the sliders min/max range by inspecting the USD metadata.

build_ui(item) list[omni.ui._ui.Widget]
class omni.flux.property_widget_builder.model.usd.USDMetadataListItem(context_name: str, attribute_paths: List[pxr.Sdf.Path], key: str, default: str, options: List[str], read_only: bool = False, display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, not_implemented: bool = False)

Bases: omni.flux.property_widget_builder.model.usd.items._BaseListModelItem

Item of the model

__init__(context_name: str, attribute_paths: List[pxr.Sdf.Path], key: str, default: str, options: List[str], read_only: bool = False, display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, not_implemented: bool = False)

Item that represent the key of a metadata of an USD attribute on the tree

Parameters
  • context_name – the context name

  • attribute_paths – the list of USD attribute(s) the item will represent

  • key – the metadata key to show

  • default – the metadata key default value

  • options – the metadata available options

  • read_only – read only or not

  • display_attr_names – override the name(s) of the attribute(s) to show by those one

  • display_attr_names_tooltip – tooltip to show on the attribute name

  • not_implemented – if not implement

class omni.flux.property_widget_builder.model.usd.USDModel(context_name: str = '')

Bases: omni.flux.property_widget_builder.widget.tree.model.Model

Basic list model

__init__(context_name: str = '')

Override of the init of the base class

Parameters

context_name – the context name to use

property context_name: str

The current used context

property default_attrs

Default created class attribute

destroy()
property prim_paths: List[pxr.Sdf.Path]

The current used attribute paths

set_items(items: List[Union[_ItemGroup, omni.flux.property_widget_builder.model.usd.items.USDAttributeItem]])

Set the items to show

Parameters

items – the items to show

set_prim_paths(value: List[pxr.Sdf.Path])

The current used attribute paths

property stage: pxr.Usd.Stage

The current used stage

subscribe_attribute_changed(function)

Return the object that will automatically unsubscribe when destroyed.

subscribe_attribute_created(function)

Return the object that will automatically unsubscribe when destroyed.

subscribe_item_model_end_edit(function)

Return the object that will automatically unsubscribe when destroyed.

subscribe_override_removed(function)

Return the object that will automatically unsubscribe when destroyed.

class omni.flux.property_widget_builder.model.usd.USDPropertyWidget(context_name: str = '', model: Optional[_Model] = None, delegate: Optional[_Delegate] = None, tree_column_widths: List[omni.ui._ui.Length] = None, refresh_callback: Optional[Union[Callable[[], None], Callable[[], Awaitable[None]]]] = None)

Bases: omni.flux.property_widget_builder.widget.property_widget_builder.PropertyWidget

Widget that let you build property widget(s) from any data

REFRESH_DELAY_SECONDS = 0.25
__init__(context_name: str = '', model: Optional[_Model] = None, delegate: Optional[_Delegate] = None, tree_column_widths: List[omni.ui._ui.Length] = None, refresh_callback: Optional[Union[Callable[[], None], Callable[[], Awaitable[None]]]] = None)
Parameters
  • context_name – the context name

  • model – the tree widget’s model

  • delegate – the tree widget’s delegate

  • tree_column_widths – the tree widget’s column widths

  • refresh_callback – callback to refresh the parent widget. IE: used to refresh the widgets on sublayer change.

destroy()
enable_listeners(value: bool) None
class omni.flux.property_widget_builder.model.usd.USDPropertyWidgetExtension

Bases: omni.ext._extensions.IExt

Create Final Configuration

on_shutdown()
on_startup(ext_id)
omni.flux.property_widget_builder.model.usd.get_usd_listener_instance()