omni.flux.custom_tags.window#

  • 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.

  • 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.custom_tags.window.selection_tree.delegate.TagsSelectionDelegate#
build_widget(
model,
item,
column_id,
level,
expanded,
)#

Create one widget per item

subscribe_item_double_clicked(
callback: Callable[[TagsSelectionItem], None],
)#

Return the object that will automatically unsubscribe when destroyed.

subscribe_item_edited(
callback: Callable[[TagsEditItem, str], None],
)#

Return the object that will automatically unsubscribe when destroyed.

  • 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.custom_tags.window.selection_tree.items.TagsEditItem(
original_item: TagsSelectionItem | None = None,
)#
property original_item: TagsSelectionItem | None#

The TagsSelectionItem that is being edited.

If the item is a new item being created, this will be None.

Returns:

The original item if editing or None if creating a new item

property value: str#

The original value that should be set when creating the StringField.

Returns:

The StringField value

class omni.flux.custom_tags.window.selection_tree.items.TagsSelectionItem(tag_path: Path)#
property path: Path#

The Prim Path to the tag (USD Collection)

Returns:

A Prim Path pointing to the tag

property title: str#

The Prim Path to the tag (USD Collection)

Returns:

A Prim Path pointing to the tag

  • 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.custom_tags.window.selection_tree.model.TagsSelectionModel(
display_assigned_tags: bool = False,
context_name: str = '',
)#
drop(
_item_target: TagsSelectionItem | None,
item_source: str | TagsSelectionItem,
_drop_location: int = -1,
)#

The callback executed whenever one or more items are dropped on a widget.

The widget will add the dropped item to the model and emmit the on_items_dropped.

Parameters:
  • _item_target – The item on which the dragged item is dropped

  • item_source – The original item that was dragged (could be the mime data)

  • _drop_location – The location where the item is dropped

drop_accepted(*args, **kwargs)#

Overloaded function.

  1. drop_accepted(self: omni.ui._ui.AbstractItemModel, item_tagget: omni.ui._ui.AbstractItem, item_source: omni.ui._ui.AbstractItem, drop_location: int = -1) -> bool

Called to determine if the model can perform drag and drop to the given item. If this method returns false, the widget shouldn’t highlight the visual element that represents this item.

  1. drop_accepted(self: omni.ui._ui.AbstractItemModel, item_tagget: omni.ui._ui.AbstractItem, source: str, drop_location: int = -1) -> bool

Called to determine if the model can perform drag and drop of the given string to the given item. If this method returns false, the widget shouldn’t highlight the visual element that represents this item.

find_item(
path: Path | str,
) tuple[int | None, TagsSelectionItem | None]#

Find an item based on its Prim Path.

Returns:

A tuple with the format [index, item] if the item is found or [None, None] otherwise

get_drag_mime_data(
item: TagsSelectionItem,
) str#

Get the data for the dragged item(s). If the widget proxy is set, the widget selection will be used instead of the given item.

Parameters:

item – the item that was dragged

Returns:

A newline-separated string of prim paths

get_item_children(
self: omni.ui._ui.AbstractItemModel,
parentItem: omni.ui._ui.AbstractItem = None,
) List[omni.ui._ui.AbstractItem]#

Returns the vector of items that are nested to the given parent item.

### Arguments:

id :

The item to request children from. If it’s null, the children of root will be returned.

get_item_value_model_count(
self: omni.ui._ui.AbstractItemModel,
item: omni.ui._ui.AbstractItem = None,
) int#

Returns the number of columns this model item contains.

insert_item(
item: AbstractItem,
index: int | None = None,
)#

Insert an item in the tree.

Parameters:
  • item – The item to insert

  • index – Optional index where to insert the item. If None, the items will be sorted after the insertion

refresh(prims: Prim)#

Refresh the model items, taking in consideration the display_assigned_tags flag.

Available items will not include assigned items, and vice versa.

Parameters:

prims – The list of prims to get the tags for (affects assigned tags fetching)

remove_item(item: AbstractItem | str)#

Remove an item from the tree.

Parameters:

item – A Tree Item or Prim Path to the item to remove

set_widget(widget: TreeView)#

Update the widget proxy. Will be used in the get_drag_mime_data function to get the current selection.

Parameters:

widget – The TreeView widget to use

subscribe_items_dropped(function)#

Return the object that will automatically unsubscribe when destroyed.