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', identifier: Optional[str] = None)

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', regex_hash: Optional[Pattern[str]] = None)

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', regex_hash: Optional[Pattern[str]] = None)

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], default_value: str, options: List[str], read_only: bool = False, value_type_name: Optional[str] = None, metadata: Optional[dict] = None, display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, metadata_key: Optional[str] = None)

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

Item of the model

abstract property default_attr: dict[str, None]
value_model_class

alias of omni.flux.property_widget_builder.model.usd.item_model.attr_list_model_value.UsdListModelAttrValueModel

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

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: Optional[pxr.UsdGeom.XformOp] = None, value: Optional[Any] = None, exists: bool = False, documentation: Optional[str] = None, display_group: Optional[str] = None) None
attr_type: pxr.Sdf.ValueTypeNames
display_group: str = None
documentation: str = None
exists: bool = False
op: pxr.UsdGeom.XformOp = None
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.model.usd.items._BaseUSDAttributeItem

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

abstract property default_attr: dict[str, None]
property element_count

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

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.

abstract property default_attr: dict[str, None]
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.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

abstract property default_attr: dict[str, None]
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.

abstract property default_attr: dict[str, None]
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, right_aligned_labels: bool = True)

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

Delegate of the tree

__init__(field_builders: Optional[list[omni.flux.property_widget_builder.widget.tree.delegate.FieldBuilder]] = None, right_aligned_labels: bool = True)

A base Delegate class to be overridden and used with the TreeWidget.

build_branch(model: _USDModel, item: _Item, column_id: int = 0, level: int = 0, expanded: bool = False)

Create a branch widget that opens or closes the subtree for item that can have children, or the default & override widgets for items that can’t.

abstract property default_attr: dict[str, None]
reset()

Resets any state stored on the delegate.

This method is called when the parent widget is hidden.

property selection: list['_Item']

Get the currently selected items

value_model_updated(item: _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], default_value: str, options: List[str], read_only: bool = False, value_type_name: Optional[str] = None, metadata: Optional[dict] = None, display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, metadata_key: Optional[str] = None)

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

Item of the model

abstract property default_attr: dict[str, None]
value_model_class

alias of omni.flux.property_widget_builder.model.usd.item_model.metadata_list_model_value.UsdListModelAttrMetadataValueModel

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

abstract property default_attr: dict[str, None]
property default_attrs
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_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, columns_resizable: bool = False, 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

__init__(context_name: str = '', model: Optional[_Model] = None, delegate: Optional[_Delegate] = None, tree_column_widths: List[omni.ui._ui.Length] = None, columns_resizable: bool = False, 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)
class omni.flux.property_widget_builder.model.usd.VirtualUSDAttrListItem(context_name: str, attribute_paths: List[pxr.Sdf.Path], default_value: str, options: List[str], read_only: bool = False, value_type_name: Optional[str] = None, metadata: Optional[dict] = None, display_attr_names: Optional[List[str]] = None, display_attr_names_tooltip: Optional[List[str]] = None, metadata_key: Optional[str] = None)

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

Item of the model

abstract property default_attr: dict[str, None]
value_model_class

alias of omni.flux.property_widget_builder.model.usd.item_model.attr_list_model_value.VirtualUsdListModelAttrValueModel

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

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

Item of the model

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

  • attribute_paths – The attribute paths

  • value_type_name – Value type name for the default values

  • default_value – The default value for the attributes

  • 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

abstract property default_attr: dict[str, None]
omni.flux.property_widget_builder.model.usd.get_usd_listener_instance()