omni.flux.property_widget_builder.delegates#

  • 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.delegates.AbstractDragFieldGroup(
min_value: int | float | ScalarSequence | None = None,
max_value: int | float | ScalarSequence | None = None,
hard_min_value: int | float | ScalarSequence | None = None,
hard_max_value: int | float | ScalarSequence | None = None,
step: int | float | ScalarSequence | None = None,
**kwargs,
)#

Abstract base for drag-style delegates with optional min/max bounds and step.

Subclasses must implement build_drag_widget() to create the actual drag widget instance. Edit events are grouped for undo via begin_edit() and end_edit().

Hard bounds (hard_min_value / hard_max_value) are forwarded to the widget, which is responsible for value clamping behavior. Soft bounds are drag-range hints only and are not promoted to typed-value clamps. Bounded drag widgets also use a matching hard bound as the drag bound when that soft side is omitted.

API note:

This class was renamed from AbstractDragField to AbstractDragFieldGroup to make it explicit that it orchestrates one or more drag widgets (for scalar/vector channels) rather than being a single concrete drag widget itself.

begin_edit(model: ItemModelBase) None#

Start an undo group for non-batched edits.

Typed edits use this begin/end pair directly. Drag edits on batch-capable models open and close their undo group from the widget mouse callbacks.

abstract build_drag_widget(
model: AbstractValueModel,
style_type_name_override: str,
read_only: bool,
min_val: int | float | None,
max_val: int | float | None,
hard_min_val: int | float | None,
hard_max_val: int | float | None,
step: int | float | None,
) Widget#

Build the drag widget for one value model.

Parameters:
  • model – Value model to bind to the widget.

  • style_type_name_override – Style name for the widget (e.g. read-only variant).

  • read_only – Whether the widget should be read-only.

  • min_val – Minimum value for the widget, or None for unbounded.

  • max_val – Maximum value for the widget, or None for unbounded.

  • hard_min_val – Hard minimum value for typed-value clamping, or None for no lower hard bound.

  • hard_max_val – Hard maximum value for typed-value clamping, or None for no upper hard bound.

  • step – Step size for the widget, or None to omit.

Returns:

The built drag widget (typically FloatBoundedDrag/IntBoundedDrag wrappers or other ui.Widget-compatible drag controls).

build_ui(
item,
**kwargs,
) list[Widget]#

Build drag widgets for each element of the item, with undo grouping and tooltips.

end_edit(model: ItemModelBase) None#

End the current edit.

For batch-edit models, this closes any active drag batch if needed. For non-batch models, this closes the regular undo group.

class omni.flux.property_widget_builder.delegates.AbstractField(
style_name: str = 'PropertiesWidgetField',
identifier: str | None = None,
)#

AbstractField that stores a style_name attribute to be used within build_ui for styling widgets.

static set_dynamic_tooltip_fn(
widget: ui.Widget,
item_value_model: ItemModelBase,
) None#

Helper method to set dynamic tooltip function on a built widget.

class omni.flux.property_widget_builder.delegates.BytesToHuman(
style_name: str = 'PropertiesWidgetField',
identifier: str | None = None,
)#

Delegate of the tree

static convert_size(size_bytes, _item_model)#

Convert bytes to something more readable

class omni.flux.property_widget_builder.delegates.ColorField(
display_precision: int = 2,
style_name: str = 'ColorsWidgetFieldRead',
)#

Delegate of the tree

class omni.flux.property_widget_builder.delegates.ColorGradientField(
keyframes: list | None = None,
on_gradient_changed_fn: Callable | None = None,
get_keyframes_fn: Callable | None = None,
default_color: tuple | None = None,
read_only: bool = False,
time_range: tuple = (0.0, 1.0),
style_name: str = 'ColorGradientField',
title: str = '',
)#

Property-panel delegate that displays a color gradient editor.

Receives keyframes and callbacks at construction time; all attribute reads/writes are handled by the caller via the provided callbacks.

destroy()#

Release subscriptions and child widget resources.

class omni.flux.property_widget_builder.delegates.CreatorField(
text: str = 'Create',
clicked_callback: Callable[[], None] | None = None,
style_name: str = 'PropertiesWidgetField',
)#

A simple delegate that presents a button that when clicked will trigger the provided callback.

class omni.flux.property_widget_builder.delegates.DefaultField(
widget_type: type[Widget],
style_name: str = 'PropertiesWidgetField',
identifier: str | None = None,
)#

A default field can be used to create a simple widget(s) for an item’s value_models.

class omni.flux.property_widget_builder.delegates.DefaultLabelField(
widget_type_name: str,
style_name: str = 'PropertiesWidgetField',
identifier: str | None = None,
)#

Delegate of the tree

class omni.flux.property_widget_builder.delegates.FileAccess(
style_name: str = 'PropertiesWidgetField',
identifier: str | None = None,
)#

Delegate of the tree

class omni.flux.property_widget_builder.delegates.FileFlags(
style_name: str = 'PropertiesWidgetField',
identifier: str | None = None,
)#

Delegate of the tree

class omni.flux.property_widget_builder.delegates.FilePicker(
file_extension_options: list[tuple[str, str]] | None = None,
style_name: str = 'PropertiesWidgetField',
use_relative_paths: bool = False,
)#
class omni.flux.property_widget_builder.delegates.FloatDragFieldGroup(
min_value: int | float | ScalarSequence | None = None,
max_value: int | float | ScalarSequence | None = None,
hard_min_value: int | float | ScalarSequence | None = None,
hard_max_value: int | float | ScalarSequence | None = None,
step: int | float | ScalarSequence | None = None,
**kwargs,
)#

A float drag field delegate with optional min/max bounds and step.

build_drag_widget(
model: AbstractValueModel,
style_type_name_override: str,
read_only: bool,
min_val: float | int | None,
max_val: float | int | None,
hard_min_val: float | int | None,
hard_max_val: float | int | None,
step: float | int | None,
) Widget#

Build a ui.FloatDrag widget, only passing bounds/step that are set.

property step: int | float | ScalarSequence#

Step size; uses explicit step if set, else derives from effective range or falls back to 1.0.

class omni.flux.property_widget_builder.delegates.IntDragFieldGroup(
min_value: int | float | ScalarSequence | None = None,
max_value: int | float | ScalarSequence | None = None,
hard_min_value: int | float | ScalarSequence | None = None,
hard_max_value: int | float | ScalarSequence | None = None,
step: int | float | ScalarSequence | None = None,
**kwargs,
)#

An integer drag field delegate with optional min/max bounds and step.

build_drag_widget(
model: AbstractValueModel,
style_type_name_override: str,
read_only: bool,
min_val: float | int | None,
max_val: float | int | None,
hard_min_val: float | int | None,
hard_max_val: float | int | None,
step: float | int | None,
) Widget#

Build a ui.IntDrag widget, only passing bounds/step that are set.

property step: int | float | ScalarSequence#

Step size; uses explicit step if set, else derives from effective range or falls back to 1.

class omni.flux.property_widget_builder.delegates.MultilineField(line_count, style_name: str = 'PropertiesWidgetField')#
class omni.flux.property_widget_builder.delegates.NameField(
style_name: str = 'PropertiesWidgetField',
identifier: str | None = None,
)#