file_path
stringlengths
20
202
content
stringlengths
9
3.85M
size
int64
9
3.85M
lang
stringclasses
9 values
avg_line_length
float64
3.33
100
max_line_length
int64
8
993
alphanum_fraction
float64
0.26
0.93
omniverse-code/kit/exts/omni.kit.widget.stage/omni/kit/widget/stage/delegates/type_column_delegate.py
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # __all__ = ["TypeColumnDelegate"] from ..abstract_stage_column_delegate import AbstractStageColumnDelegate from ..stage_model import StageModel, StageItemSortPolicy from ..stage_item import StageItem from typing import List from enum import Enum import omni.ui as ui class TypeColumnSortPolicy(Enum): DEFAULT = 0 A_TO_Z = 1 Z_TO_A = 2 class TypeColumnDelegate(AbstractStageColumnDelegate): """The column delegate that represents the type column""" def __init__(self): super().__init__() self.__name_label_layout = None self.__name_label = None self.__items_sort_policy = TypeColumnSortPolicy.DEFAULT self.__stage_model: StageModel = None def destroy(self): if self.__name_label_layout: self.__name_label_layout.set_mouse_pressed_fn(None) @property def initial_width(self): """The width of the column""" return ui.Pixel(100) def __initialize_policy_from_model(self): stage_model = self.__stage_model if not stage_model: return if stage_model.get_items_sort_policy() == StageItemSortPolicy.TYPE_COLUMN_A_TO_Z: self.__items_sort_policy = TypeColumnSortPolicy.A_TO_Z elif stage_model.get_items_sort_policy() == StageItemSortPolicy.TYPE_COLUMN_Z_TO_A: self.__items_sort_policy = TypeColumnSortPolicy.Z_TO_A else: self.__items_sort_policy = TypeColumnSortPolicy.DEFAULT self.__update_label_from_policy() def __update_label_from_policy(self): if not self.__name_label: return if self.__name_label: if self.__items_sort_policy == TypeColumnSortPolicy.A_TO_Z: name = "Type (A to Z)" elif self.__items_sort_policy == TypeColumnSortPolicy.Z_TO_A: name = "Type (Z to A)" else: name = "Type" self.__name_label.text = name def __on_policy_changed(self): stage_model = self.__stage_model if not stage_model: return if self.__items_sort_policy == TypeColumnSortPolicy.A_TO_Z: stage_model.set_items_sort_policy(StageItemSortPolicy.TYPE_COLUMN_A_TO_Z) elif self.__items_sort_policy == TypeColumnSortPolicy.Z_TO_A: stage_model.set_items_sort_policy(StageItemSortPolicy.TYPE_COLUMN_Z_TO_A) else: stage_model.set_items_sort_policy(StageItemSortPolicy.DEFAULT) self.__update_label_from_policy() def __on_name_label_clicked(self, x, y, b, m): stage_model = self.__stage_model if b != 0 or not stage_model: return if self.__items_sort_policy == TypeColumnSortPolicy.A_TO_Z: self.__items_sort_policy = TypeColumnSortPolicy.Z_TO_A elif self.__items_sort_policy == TypeColumnSortPolicy.Z_TO_A: self.__items_sort_policy = TypeColumnSortPolicy.DEFAULT else: self.__items_sort_policy = TypeColumnSortPolicy.A_TO_Z self.__on_policy_changed() def build_header(self, **kwargs): """Build the header""" stage_model = kwargs.get("stage_model", None) self.__stage_model = stage_model if stage_model: self.__name_label_layout = ui.HStack() with self.__name_label_layout: ui.Spacer(width=10) self.__name_label = ui.Label( "Type", name="columnname", style_type_name_override="TreeView.Header" ) self.__initialize_policy_from_model() self.__name_label_layout.set_mouse_pressed_fn(self.__on_name_label_clicked) else: self.__name_label_layout.set_mouse_pressed_fn(None) with ui.HStack(): ui.Spacer(width=10) ui.Label("Type", name="columnname", style_type_name_override="TreeView.Header") async def build_widget(self, _, **kwargs): """Build the type widget""" item = kwargs.get("stage_item", None) if not item or not item.stage: return prim = item.stage.GetPrimAtPath(item.path) if not prim or not prim.IsValid(): return with ui.HStack(enabled=not item.instance_proxy, spacing=4, height=20): ui.Spacer(width=4) ui.Label(item.type_name, width=0, name="object_name", style_type_name_override="TreeView.Item") def on_stage_items_destroyed(self, items: List[StageItem]): pass @property def sortable(self): return True @property def order(self): return -100 @property def minimum_width(self): return ui.Pixel(20)
5,139
Python
33.039735
107
0.616852
omniverse-code/kit/exts/omni.kit.widget.stage/omni/kit/widget/stage/delegates/visibility_column_delegate.py
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # __all__ = ["VisibilityColumnDelegate"] from ..abstract_stage_column_delegate import AbstractStageColumnDelegate from ..stage_model import StageModel, StageItemSortPolicy from ..stage_item import StageItem from pxr import UsdGeom from typing import List from functools import partial from enum import Enum import weakref import omni.ui as ui class VisibilityColumnSortPolicy(Enum): DEFAULT = 0 INVISIBLE_TO_VISIBLE = 1 VISIBLE_TO_INVISIBLE = 2 class VisibilityColumnDelegate(AbstractStageColumnDelegate): """The column delegate that represents the visibility column""" def __init__(self): super().__init__() self.__visibility_layout = None self.__items_sort_policy = VisibilityColumnSortPolicy.DEFAULT self.__stage_model: StageModel = None def destroy(self): if self.__visibility_layout: self.__visibility_layout.set_mouse_pressed_fn(None) self.__visibility_layout = None self.__stage_model = None @property def initial_width(self): """The width of the column""" return ui.Pixel(24) def __initialize_policy_from_model(self): stage_model = self.__stage_model if not stage_model: return if stage_model.get_items_sort_policy() == StageItemSortPolicy.VISIBILITY_COLUMN_INVISIBLE_TO_VISIBLE: self.__items_sort_policy = VisibilityColumnSortPolicy.INVISIBLE_TO_VISIBLE elif stage_model.get_items_sort_policy() == StageItemSortPolicy.VISIBILITY_COLUMN_VISIBLE_TO_INVISIBLE: self.__items_sort_policy = VisibilityColumnSortPolicy.VISIBLE_TO_INVISIBLE else: self.__items_sort_policy = VisibilityColumnSortPolicy.DEFAULT def __on_policy_changed(self): stage_model = self.__stage_model if not stage_model: return if self.__items_sort_policy == VisibilityColumnSortPolicy.INVISIBLE_TO_VISIBLE: stage_model.set_items_sort_policy(StageItemSortPolicy.VISIBILITY_COLUMN_INVISIBLE_TO_VISIBLE) elif self.__items_sort_policy == VisibilityColumnSortPolicy.VISIBLE_TO_INVISIBLE: stage_model.set_items_sort_policy(StageItemSortPolicy.VISIBILITY_COLUMN_VISIBLE_TO_INVISIBLE) else: stage_model.set_items_sort_policy(StageItemSortPolicy.DEFAULT) def __on_visiblity_clicked(self, x, y, b, m): if b != 0 or not self.__stage_model: return if self.__items_sort_policy == VisibilityColumnSortPolicy.VISIBLE_TO_INVISIBLE: self.__items_sort_policy = VisibilityColumnSortPolicy.INVISIBLE_TO_VISIBLE elif self.__items_sort_policy == VisibilityColumnSortPolicy.INVISIBLE_TO_VISIBLE: self.__items_sort_policy = VisibilityColumnSortPolicy.DEFAULT else: self.__items_sort_policy = VisibilityColumnSortPolicy.VISIBLE_TO_INVISIBLE self.__on_policy_changed() def build_header(self, **kwargs): """Build the header""" stage_model = kwargs.get("stage_model", None) self.__stage_model = stage_model self.__initialize_policy_from_model() if stage_model: with ui.ZStack(): ui.Rectangle(name="hovering", style_type_name_override="TreeView.Header") self.__visibility_layout = ui.HStack() with self.__visibility_layout: ui.Spacer() with ui.VStack(width=0): ui.Spacer() ui.Image(width=22, height=14, name="visibility_header", style_type_name_override="TreeView.Header") ui.Spacer() ui.Spacer() self.__visibility_layout.set_mouse_pressed_fn(self.__on_visiblity_clicked) else: with ui.HStack(): ui.Spacer() with ui.VStack(width=0): ui.Spacer() ui.Image(width=22, height=14, name="visibility_header", style_type_name_override="TreeView.Header") ui.Spacer() ui.Spacer() async def build_widget(self, _, **kwargs): """Build the eye widget""" item = kwargs.get("stage_item", None) if not item or not item.prim or not item.prim.IsA(UsdGeom.Imageable): return with ui.ZStack(height=20): # Min size ui.Spacer(width=22) # TODO the way to make this widget grayed out ui.ToolButton(item.visibility_model, enabled=not item.instance_proxy, name="visibility") @property def order(self): # Ensure it's always to the leftmost column except the name column. return -101 @property def sortable(self): return True def on_stage_items_destroyed(self, items: List[StageItem]): pass @property def minimum_width(self): return ui.Pixel(20)
5,352
Python
36.964539
123
0.640882
omniverse-code/kit/exts/omni.kit.widget.stage/omni/kit/widget/stage/delegates/name_column_delegate.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # __all__ = ["NameColumnDelegate"] import asyncio import math import omni.ui as ui from ..abstract_stage_column_delegate import AbstractStageColumnDelegate from ..stage_model import StageModel, StageItemSortPolicy from ..stage_item import StageItem from ..stage_icons import StageIcons from functools import partial from typing import List from enum import Enum class NameColumnSortPolicy(Enum): NEW_TO_OLD = 0 OLD_TO_NEW = 1 A_TO_Z = 2 Z_TO_A = 3 def split_selection(text, selection): """ Split given text to substrings to draw selected text. Result starts with unselected text. Example: "helloworld" "o" -> ["hell", "o", "w", "o", "rld"] Example: "helloworld" "helloworld" -> ["", "helloworld"] """ if not selection or text == selection: return ["", text] selection = selection.lower() selection_len = len(selection) result = [] while True: found = text.lower().find(selection) result.append(text if found < 0 else text[:found]) if found < 0: break else: result.append(text[found : found + selection_len]) text = text[found + selection_len :] return result class NameColumnDelegate(AbstractStageColumnDelegate): """The column delegate that represents the type column""" def __init__(self): super().__init__() self.__name_label_layout = None self.__name_label = None self.__drop_down_layout = None self.__name_sort_options_menu = None self.__items_sort_policy = NameColumnSortPolicy.OLD_TO_NEW self.__highlighting_enabled = None # Text that is highlighted in flat mode self.__highlighting_text = None self.__stage_model: StageModel = None def set_highlighting(self, enable: bool = None, text: str = None): """ Specify if the widgets should consider highlighting. Also set the text that should be highlighted in flat mode. """ if enable is not None: self.__highlighting_enabled = enable if text is not None: self.__highlighting_text = text.lower() @property def sort_policy(self): return self.__items_sort_policy @sort_policy.setter def sort_policy(self, value): if self.__items_sort_policy != value: self.__items_sort_policy = value self.__on_policy_changed() def destroy(self): if self.__name_label_layout: self.__name_label_layout.set_mouse_pressed_fn(None) if self.__drop_down_layout: self.__drop_down_layout.set_mouse_pressed_fn(None) self.__drop_down_layout = None self.__name_sort_options_menu = None if self.__name_label_layout: self.__name_label_layout.set_mouse_pressed_fn(None) self.__name_label_layout = None self.__stage_model = None @property def initial_width(self): """The width of the column""" return ui.Fraction(1) def __initialize_policy_from_model(self): stage_model = self.__stage_model if not stage_model: return if stage_model.get_items_sort_policy() == StageItemSortPolicy.NAME_COLUMN_NEW_TO_OLD: self.__items_sort_policy = NameColumnSortPolicy.NEW_TO_OLD elif stage_model.get_items_sort_policy() == StageItemSortPolicy.NAME_COLUMN_A_TO_Z: self.__items_sort_policy = NameColumnSortPolicy.A_TO_Z elif stage_model.get_items_sort_policy() == StageItemSortPolicy.NAME_COLUMN_Z_TO_A: self.__items_sort_policy = NameColumnSortPolicy.Z_TO_A else: self.__items_sort_policy = NameColumnSortPolicy.OLD_TO_NEW self.__update_label_from_policy() def __update_label_from_policy(self): if not self.__name_label: return if self.__items_sort_policy == NameColumnSortPolicy.NEW_TO_OLD: name = "Name (New to Old)" elif self.__items_sort_policy == NameColumnSortPolicy.A_TO_Z: name = "Name (A to Z)" elif self.__items_sort_policy == NameColumnSortPolicy.Z_TO_A: name = "Name (Z to A)" else: name = "Name (Old to New)" self.__name_label.text = name def __on_policy_changed(self): stage_model = self.__stage_model if not stage_model: return if self.__items_sort_policy == NameColumnSortPolicy.NEW_TO_OLD: stage_model.set_items_sort_policy(StageItemSortPolicy.NAME_COLUMN_NEW_TO_OLD) elif self.__items_sort_policy == NameColumnSortPolicy.A_TO_Z: stage_model.set_items_sort_policy(StageItemSortPolicy.NAME_COLUMN_A_TO_Z) elif self.__items_sort_policy == NameColumnSortPolicy.Z_TO_A: stage_model.set_items_sort_policy(StageItemSortPolicy.NAME_COLUMN_Z_TO_A) else: stage_model.set_items_sort_policy(StageItemSortPolicy.NAME_COLUMN_OLD_TO_NEW) self.__update_label_from_policy() def __on_name_label_clicked(self, x, y, b, m): if b != 0 or not self.__stage_model: return if self.__items_sort_policy == NameColumnSortPolicy.A_TO_Z: self.__items_sort_policy = NameColumnSortPolicy.Z_TO_A elif self.__items_sort_policy == NameColumnSortPolicy.Z_TO_A: self.__items_sort_policy = NameColumnSortPolicy.NEW_TO_OLD elif self.__items_sort_policy == NameColumnSortPolicy.NEW_TO_OLD: self.__items_sort_policy = NameColumnSortPolicy.OLD_TO_NEW else: self.__items_sort_policy = NameColumnSortPolicy.A_TO_Z self.__on_policy_changed() def build_header(self, **kwargs): """Build the header""" style_type_name = "TreeView.Header" stage_model = kwargs.get("stage_model", None) self.__stage_model = stage_model if stage_model: with ui.HStack(): self.__name_label_layout = ui.HStack() self.__name_label_layout.set_mouse_pressed_fn(self.__on_name_label_clicked) with self.__name_label_layout: ui.Spacer(width=10) self.__name_label = ui.Label( "Name", name="columnname", style_type_name_override=style_type_name ) self.__initialize_policy_from_model() ui.Spacer() with ui.ZStack(width=16): ui.Rectangle(name="drop_down_hovered_area", style_type_name_override=style_type_name) self.__drop_down_layout = ui.ZStack(width=0) with self.__drop_down_layout: ui.Rectangle(width=16, name="drop_down_background", style_type_name_override=style_type_name) with ui.HStack(): ui.Spacer() with ui.VStack(width=0): ui.Spacer(height=4) ui.Triangle( name="drop_down_button", width=8, height=8, style_type_name_override=style_type_name, alignment=ui.Alignment.CENTER_BOTTOM ) ui.Spacer(height=2) ui.Spacer() ui.Spacer(width=4) def on_sort_policy_changed(policy, value): if self.sort_policy != policy: self.sort_policy = policy self.__on_policy_changed() def on_mouse_pressed_fn(x, y, b, m): if b != 0: return items_sort_policy = self.__items_sort_policy self.__name_sort_options_menu = ui.Menu("Sort Options") with self.__name_sort_options_menu: ui.MenuItem("Sort By", enabled=False) ui.Separator() ui.MenuItem( "New to Old", checkable=True, checked=items_sort_policy == NameColumnSortPolicy.NEW_TO_OLD, checked_changed_fn=partial( on_sort_policy_changed, NameColumnSortPolicy.NEW_TO_OLD ), hide_on_click=False, ) ui.MenuItem( "Old to New", checkable=True, checked=items_sort_policy == NameColumnSortPolicy.OLD_TO_NEW, checked_changed_fn=partial( on_sort_policy_changed, NameColumnSortPolicy.OLD_TO_NEW ), hide_on_click=False, ) ui.MenuItem( "A to Z", checkable=True, checked=items_sort_policy == NameColumnSortPolicy.A_TO_Z, checked_changed_fn=partial( on_sort_policy_changed, NameColumnSortPolicy.A_TO_Z ), hide_on_click=False ) ui.MenuItem( "Z to A", checkable=True, checked=items_sort_policy == NameColumnSortPolicy.Z_TO_A, checked_changed_fn=partial( on_sort_policy_changed, NameColumnSortPolicy.Z_TO_A ), hide_on_click=False ) self.__name_sort_options_menu.show() self.__drop_down_layout.set_mouse_pressed_fn(on_mouse_pressed_fn) self.__drop_down_layout.visible = False else: self.__name_label_layout.set_mouse_pressed_fn(None) with ui.HStack(): ui.Spacer(width=10) ui.Label("Name", name="columnname", style_type_name_override="TreeView.Header") def get_type_icon(self, node_type): """Convert USD Type to icon file name""" icons = StageIcons() if node_type in ["DistantLight", "SphereLight", "RectLight", "DiskLight", "CylinderLight", "DomeLight"]: return icons.get(node_type, "Light") if node_type == "": node_type = "Xform" return icons.get(node_type, "Prim") async def build_widget(self, _, **kwargs): self.build_widget_async(_, **kwargs) def __get_all_icons_to_draw(self, item: StageItem, item_is_native): # Get the node type node_type = item.type_name if item != item.stage_model.root else None icon_filenames = [self.get_type_icon(node_type)] # Get additional icons based on the properties of StageItem if item_is_native: if item.references: icon_filenames.append(StageIcons().get("Reference")) if item.payloads: icon_filenames.append(StageIcons().get("Payload")) if item.instanceable: icon_filenames.append(StageIcons().get("Instance")) return icon_filenames def __draw_all_icons(self, item: StageItem, item_is_native, is_highlighted): icon_filenames = self.__get_all_icons_to_draw(item, item_is_native) # Gray out the icon if the filter string is not in the text iconname = "object_icon" if is_highlighted else "object_icon_grey" parent_layout = ui.ZStack(width=20, height=20) with parent_layout: for icon_filename in icon_filenames: ui.Image(icon_filename, name=iconname, style_type_name_override="TreeView.Image") if item.instance_proxy: parent_layout.set_tooltip("Instance Proxy") def __build_rename_field(self, item: StageItem, name_labels, parent_stack): def on_end_edit(name_labels, field): for label in name_labels: label.visible = True field.visible = False self.end_edit_subscription = None def on_mouse_double_clicked(button, name_labels, field): if button != 0 or item.instance_proxy: return for label in name_labels: label.visible = False field.visible = True self.end_edit_subscription = field.model.subscribe_end_edit_fn(lambda _: on_end_edit(name_labels, field)) import omni.kit.app async def focus(field): await omni.kit.app.get_app().next_update_async() field.focus_keyboard() asyncio.ensure_future(focus(field)) field = ui.StringField(item.name_model, identifier="rename_field", visible=False) parent_stack.set_mouse_double_clicked_fn( lambda x, y, b, _: on_mouse_double_clicked(b, name_labels, field) ) item._ui_widget = parent_stack def build_widget_sync(self, _, **kwargs): """Build the type widget""" # True if it's StageItem. We need it to determine if it's a Root item (which is None). model = kwargs.get("stage_model", None) item = kwargs.get("stage_item", None) if not item: item = model.root item_is_native = False else: item_is_native = True if not item: return # If highlighting disabled completley, all the items should be light is_highlighted = not self.__highlighting_enabled and not self.__highlighting_text if not is_highlighted: # If it's not disabled completley is_highlighted = item_is_native and item.filtered with ui.HStack(enabled=not item.instance_proxy, spacing=4, height=20): # Draw all icons on top of each other self.__draw_all_icons(item, item_is_native, is_highlighted) value_model = item.name_model text = value_model.get_value_as_string() stack = ui.HStack() name_labels = [] # We have three different text draw model depending on the column and on the highlighting state if item_is_native and model.flat: # Flat search mode. We need to highlight only the part that is is the search field selection_chain = split_selection(text, self.__highlighting_text) labelnames_chain = ["object_name_grey", "object_name"] # Extend the label names depending on the size of the selection chain. Example, if it was [a, b] # and selection_chain is [z,y,x,w], it will become [a, b, a, b]. labelnames_chain *= int(math.ceil(len(selection_chain) / len(labelnames_chain))) with stack: for current_text, current_name in zip(selection_chain, labelnames_chain): if not current_text: continue label = ui.Label( current_text, name=current_name, width=0, style_type_name_override="TreeView.Item", hide_text_after_hash=False ) name_labels.append(label) if hasattr(item, "_callback_id"): item._callback_id = None else: with stack: if item.has_missing_references: name = "object_name_missing" else: name = "object_name" if is_highlighted else "object_name_grey" if item.is_outdated: name = "object_name_outdated" if item.in_session: name = "object_name_live" if item.is_outdated: style_override = "TreeView.Item.Outdated" elif item.in_session: style_override = "TreeView.Item.Live" else: style_override = "TreeView.Item" text = value_model.get_value_as_string() if item.is_default: text += " (defaultPrim)" label = ui.Label( text, hide_text_after_hash=False, name=name, style_type_name_override=style_override ) if item.has_missing_references: label.set_tooltip("Missing references found.") name_labels.append(label) # The hidden field for renaming the prim if item != model.root and not item.instance_proxy: self.__build_rename_field(item, name_labels, stack) elif hasattr(item, "_ui_widget"): item._ui_widget = None def rename_item(self, item: StageItem): if not item or not hasattr(item, "_ui_widget") or not item._ui_widget or item.instance_proxy: return item._ui_widget.call_mouse_double_clicked_fn(0, 0, 0, 0) def on_stage_items_destroyed(self, items: List[StageItem]): for item in items: if hasattr(item, "_ui_widget"): item._ui_widget = None def on_header_hovered(self, hovered): self.__drop_down_layout.visible = hovered @property def sortable(self): return True @property def order(self): return -100000 @property def minimum_width(self): return ui.Pixel(40)
18,548
Python
38.050526
119
0.537578
omniverse-code/kit/exts/omni.kit.widget.stage/docs/CHANGELOG.md
# Changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [2.7.24] - 2023-02-21 ### Fixed - OM-82577: Drag&drop of flowusd presets will call flowusd command to add a reference. ## [2.7.23] - 2023-02-16 ### Fixed - OM-81767: Drag&drop behaviour of sbsar files now consistent with viewport's behaviour. ## [2.7.22] - 2023-01-11 ### Updated - Allow to select children under instance. - Fix selection issue after clearing search text. - Move SelectionWatch from omni.kit.window.stage to provide default implementation. ## [2.7.21] - 2022-12-9 ### Updated - Fixed issue where drag & drop material urls with encoded subidentifiers were not being handled. ## [2.7.20] - 2022-12-14 ### Updated - Improve drag and drop style. ## [2.7.19] - 2022-12-09 ### Updated - Improve filter and search. - Fix issue that creates new prims will not be filtered when it's in filtering mode. - Add support to search with prim path. ## [2.7.18] - 2022-12-08 ### Updated - Fix style of search results in stage window. ## [2.7.17] - 2022-11-29 ### Updated - Don't show context menu for converting references or payloads if they are not in the local layer stack. ## [2.7.16] - 2022-11-29 ### Updated - Don't show context menu for header of stage widget. ## [2.7.15] - 2022-11-15 ### Updated - Fixed issue with context menu & not hovering over label ## [2.7.14] - 2022-11-14 ### Updated - Supports sorting by name/visibility/type. ## [2.7.13] - 2022-11-14 ### Updated - Fix issue to search or filter stage window. ## [2.7.12] - 2022-11-07 ### Updated - Optimize more loading time to avoid populating tree item when it's to get children count. ## [2.7.11] - 2022-11-04 ### Updated - Refresh prim handle when it's resyced to avoid access staled prim. ## [2.7.10] - 2022-11-03 ### Updated - Support to show 'displayName' of prim from metadata. ## [2.7.9] - 2022-11-02 ### Updated - Drag and drop assets to default prim from content browser if default prim is existed. ## [2.7.8] - 2022-11-01 ### Updated - Fix rename issue. ## [2.7.7] - 2022-10-25 ### Updated - More optimization to stage window refresh without traversing. ## [2.7.6] - 2022-09-13 ### Updated - Don't use "use_hovered" for context menu objects when user click nowhere ## [2.7.5] - 2022-09-10 - Add TreeView drop style to show hilighting. ## [2.7.4] - 2022-09-08 ### Updated - Added "use_hovered" to context menu objects so menu can create child prims ## [2.7.3] - 2022-08-31 ### Fixed - Moved eye icon to front of ZStack to receive mouse clicks. ## [2.7.2] - 2022-08-12 ### Fixed - Updated context menu behaviour ## [2.7.1] - 2022-08-13 - Fix prims filter. - Clear prims filter after stage switching. ## [2.7.0] - 2022-08-06 - Refactoring stage model to improve perf and fix issue of refresh. ## [2.6.26] - 2022-08-04 - Support multi-selection for toggling visibility ## [2.6.25] - 2022-08-02 ### Fixed - Show non-defined prims as well. ## [2.6.24] - 2022-07-28 ### Fixed - Fix regression to drag and drop prim to absolute root. ## [2.6.23] - 2022-07-28 ### Fixed - Ensure rename operation non-destructive. ## [2.6.23] - 2022-07-25 ### Changes - Refactored unittests to make use of content_browser test helpers ## [2.6.22] - 2022-07-18 ### Fixed - Restored the arguments of ExportPrimUSD ## [2.6.21] - 2022-07-05 - Replaced filepicker dialog with file exporter ## [2.6.20] - 2022-06-23 - Make material paths relative if "/persistent/app/material/dragDropMaterialPath" is set to "relative" ## [2.6.19] - 2022-06-22 - Multiple drag and drop support. ## [2.6.18] - 2022-05-31 - Changed "Export Selected" to "Save Selected" ## [2.6.17] - 2022-05-20 - Support multi-selection for toggling visibility ## [2.6.16] - 2022-05-17 - Support multi-file drag & drop ## [2.6.15] - 2022-04-28 - Drag & Drop can create payload or reference based on /persistent/app/stage/dragDropImport setting ## [2.6.14] - 2022-03-09 - Updated unittests to retrieve the treeview widget from content browser. ## [2.6.13] - 2022-03-07 - Expand default prim ## [2.6.12] - 2022-02-09 - Fix stage window refresh after sublayer is inserted/removed. ## [2.6.11] - 2022-01-26 - Fix the columns item not able to reorder ## [2.6.10] - 2022-01-05 - Support drag/drop from material browser ## [2.6.9] - 2021-11-03 - Updated to use new omni.kit.material.library `get_subidentifier_from_mdl` ## [2.6.8] - 2021-09-24 - Fix export selected prims if it has external dependences outside of the copy prim tree. ## [2.6.7] - 2021-09-17 - Copy axis after export selected prims. ## [2.6.6] - 2021-08-11 - Updated drag/drop material to no-prim to not bind to /World - Added drag/drop test ## [2.6.5] - 2021-08-11 - Updated to lastest omni.kit.material.library ## [2.6.4] - 2021-07-26 - Added "Refesh Payload" to context menu - Added Payload icon - Added "Convert Payloads to References" to context menu - Added "Convert References to Payloads" to context menu ## [2.6.3] - 2021-07-21 - Added "Refesh Reference" to context menu ## [2.6.2] - 2021-06-30 - Changed "Assign Material" to use async show function as it could be slow on large scenes ## [2.6.1] - 2021-06-02 - Changed export prim as usd, postfix name now lowercase ## [2.6.0] - 2021-06-16 ### Added - "Show Missing Reference" that is off by default. When it's on, missing references are displayed with red color in the tree. ### Changed - Indentation level. There is no offset on the left anymore. ## [2.5.0] - 2021-06-02 - Added export prim as usd ## [2.4.2] - 2021-04-29 - Use sub-material selector on material import ## [2.4.1] - 2021-04-09 ### Fixed - Context menu in extensions that are not omni.kit.window.stage ## [2.4.0] - 2021-03-19 ### Added - Supported accepting drag and drop to create versioned reference. ## [2.3.7] - 2021-03-17 ### Changed - Updated to new context_menu and how custom functions are added ## [2.3.6] - 2021-03-01 ### Changed - Additional check if the stage and prim are still valid ## [2.3.5] - 2021-02-23 ### Added - Exclusion list allows to hide prims of specific types silently. To hide the prims of specific type, set the string array setting `ext/omni.kit.widget.stage/exclusion/types` ``` [settings] ext."omni.kit.widget.stage".exclusion.types = ["Mesh"] ``` ## [2.3.4] - 2021-02-10 ### Changes - Updated StyleUI handling ## [2.3.3] - 2020-11-16 ### Changed - Updated Find In Browser ## [2.3.2] - 2020-11-13 ### Changed - Fixed disappearing the "eye" icon when searched objects are toggled off ## [2.3.1] - 2020-10-22 ### Added - An interface to add and remove the icons in the TreeView dependin on the prim type ### Removed - The standard prim icons are moved to omni.kit.widget.stage_icons ## [2.3.0] - 2020-09-16 ### Changed - Split to two parts: omni.kit.widget.stage and omni.kit.window.stage ## [2.2.0] - 2020-09-15 ### Changed - Detached from Editor and using UsdNotice for notifications
6,926
Markdown
25.438931
105
0.6838
omniverse-code/kit/exts/omni.kit.test_suite.layout/omni/kit/test_suite/layout/tests/__init__.py
from .compare_layout import * from .verify_dockspace import *
62
Python
19.999993
31
0.774194
omniverse-code/kit/exts/omni.kit.test_suite.layout/omni/kit/test_suite/layout/tests/verify_dockspace.py
## Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. ## ## NVIDIA CORPORATION and its licensors retain all intellectual property ## and proprietary rights in and to this software, related documentation ## and any modifications thereto. Any use, reproduction, disclosure or ## distribution of this software and related documentation without an express ## license agreement from NVIDIA CORPORATION is strictly prohibited. ## import carb import omni.kit.test import omni.kit.app import omni.ui as ui import omni.kit.commands from omni.kit.test.async_unittest import AsyncTestCase from omni.kit import ui_test from omni.kit.test_suite.helpers import get_test_data_path, arrange_windows class VerifyDockspace(AsyncTestCase): # Before running each test async def setUp(self): await arrange_windows("Stage", 256) await omni.usd.get_context().new_stage_async() omni.kit.commands.execute("CreatePrimWithDefaultXform", prim_type="Sphere", select_new_prim=True) # After running each test async def tearDown(self): pass async def test_verify_dockspace(self): # verify "Dockspace" window doesn't disapear when a prim is selected as this breaks layout load/save omni.usd.get_context().get_selection().set_selected_prim_paths([], True) await ui_test.human_delay(100) self.assertNotEqual(ui.Workspace.get_window("DockSpace"), None) omni.usd.get_context().get_selection().set_selected_prim_paths(["/Sphere"], True) await ui_test.human_delay(100) self.assertNotEqual(ui.Workspace.get_window("DockSpace"), None) async def test_verify_dockspace_shutdown(self): self._hooks = [] self._hooks.append(omni.kit.app.get_app().get_shutdown_event_stream().create_subscription_to_pop_by_type( omni.kit.app.POST_QUIT_EVENT_TYPE, self._on_shutdown_handler, name="omni.create.app.setup shutdown for layout", order=0)) omni.usd.get_context().get_selection().set_selected_prim_paths(["/Sphere"], True) await ui_test.human_delay(100) def _on_shutdown_handler(self, e: carb.events.IEvent): # verify "Dockspace" window hasn't disapeared as prims are selected as this breaks layout load/save print("running _on_shutdown_handler test") self.assertNotEqual(ui.Workspace.get_window("DockSpace"), None)
2,418
Python
42.981817
113
0.702233
omniverse-code/kit/exts/omni.kit.test_suite.layout/omni/kit/test_suite/layout/tests/compare_layout.py
## Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. ## ## NVIDIA CORPORATION and its licensors retain all intellectual property ## and proprietary rights in and to this software, related documentation ## and any modifications thereto. Any use, reproduction, disclosure or ## distribution of this software and related documentation without an express ## license agreement from NVIDIA CORPORATION is strictly prohibited. ## import omni.kit.test import omni.kit.app import omni.ui as ui from omni.kit.test.async_unittest import AsyncTestCase from omni.kit import ui_test from omni.kit.test_suite.helpers import get_test_data_path, arrange_windows from omni.kit.quicklayout import QuickLayout from omni.ui.workspace_utils import CompareDelegate class CompareLayout(AsyncTestCase): # Before running each test async def setUp(self): await arrange_windows("Stage", 256) # After running each test async def tearDown(self): pass async def test_compare_layout(self): layout_path = get_test_data_path(__name__, "layout.json") # compare layout, this should fail result = QuickLayout.compare_file(layout_path) self.assertNotEqual(result, []) # load layout QuickLayout.load_file(layout_path) # need to pause as load_file does some async stuff await ui_test.human_delay(10) # compare layout, this should pass result = QuickLayout.compare_file(layout_path) self.assertEqual(result, []) async def test_compare_layout_delegate(self): called_delegate = False layout_path = get_test_data_path(__name__, "layout.json") class TestCompareDelegate(CompareDelegate): def failed_get_window(self, error_list: list, target: dict): nonlocal called_delegate called_delegate = True return super().failed_get_window(error_list, target) def failed_window_key(self, error_list: list, key: str, target: dict, target_window: ui.Window): nonlocal called_delegate called_delegate = True return super().failed_window_key(error_list, key, target, target_window) def failed_window_value(self, error_list: list, key: str, value, target: dict, target_window: ui.Window): nonlocal called_delegate called_delegate = True return super().failed_window_value(error_list, key, value, target, target_window) def compare_value(self, key:str, value, target): nonlocal called_delegate called_delegate = True return super().compare_value(key, value, target) self.assertFalse(called_delegate) # compare layout, this should fail result = QuickLayout.compare_file(layout_path, compare_delegate=TestCompareDelegate()) self.assertNotEqual(result, []) # load layout QuickLayout.load_file(layout_path) # need to pause as load_file does some async stuff await ui_test.human_delay(10) # compare layout, this should pass result = QuickLayout.compare_file(layout_path, compare_delegate=TestCompareDelegate()) self.assertEqual(result, []) self.assertTrue(called_delegate)
3,328
Python
36.829545
117
0.666166
omniverse-code/kit/exts/omni.kit.test_suite.layout/docs/index.rst
omni.kit.test_suite.layout ############################ layout tests .. toctree:: :maxdepth: 1 CHANGELOG
114
reStructuredText
10.499999
28
0.508772
omniverse-code/kit/exts/omni.resourcemonitor/config/extension.toml
[package] title = "Resource Monitor" description = "Monitor utility for device and host memory" authors = ["NVIDIA"] changelog = "docs/CHANGELOG.md" readme = "docs/README.md" category = "Internal" preview_image = "data/preview.png" icon = "data/icon.png" version = "1.0.0" [dependencies] "omni.kit.renderer.core" = {} "omni.kit.window.preferences" = {} [[python.module]] name = "omni.resourcemonitor" [[native.plugin]] path = "bin/*.plugin" # Additional python module with tests, to make them discoverable by test system [[python.module]] name = "omni.resourcemonitor.tests" [[test]] timeout = 300
603
TOML
20.571428
79
0.713101
omniverse-code/kit/exts/omni.resourcemonitor/omni/resourcemonitor/_resourceMonitor.pyi
"""pybind11 omni.resourcemonitor bindings""" from __future__ import annotations import omni.resourcemonitor._resourceMonitor import typing import carb.events._events __all__ = [ "IResourceMonitor", "ResourceMonitorEventType", "acquire_resource_monitor_interface", "deviceMemoryWarnFractionSettingName", "deviceMemoryWarnMBSettingName", "hostMemoryWarnFractionSettingName", "hostMemoryWarnMBSettingName", "release_resource_monitor_interface", "sendDeviceMemoryWarningSettingName", "sendHostMemoryWarningSettingName", "timeBetweenQueriesSettingName" ] class IResourceMonitor(): def get_available_device_memory(self, arg0: int) -> int: ... def get_available_host_memory(self) -> int: ... def get_event_stream(self) -> carb.events._events.IEventStream: ... def get_total_device_memory(self, arg0: int) -> int: ... def get_total_host_memory(self) -> int: ... pass class ResourceMonitorEventType(): """ ResourceMonitor notification. Members: DEVICE_MEMORY HOST_MEMORY LOW_DEVICE_MEMORY LOW_HOST_MEMORY """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ DEVICE_MEMORY: omni.resourcemonitor._resourceMonitor.ResourceMonitorEventType # value = <ResourceMonitorEventType.DEVICE_MEMORY: 0> HOST_MEMORY: omni.resourcemonitor._resourceMonitor.ResourceMonitorEventType # value = <ResourceMonitorEventType.HOST_MEMORY: 1> LOW_DEVICE_MEMORY: omni.resourcemonitor._resourceMonitor.ResourceMonitorEventType # value = <ResourceMonitorEventType.LOW_DEVICE_MEMORY: 2> LOW_HOST_MEMORY: omni.resourcemonitor._resourceMonitor.ResourceMonitorEventType # value = <ResourceMonitorEventType.LOW_HOST_MEMORY: 3> __members__: dict # value = {'DEVICE_MEMORY': <ResourceMonitorEventType.DEVICE_MEMORY: 0>, 'HOST_MEMORY': <ResourceMonitorEventType.HOST_MEMORY: 1>, 'LOW_DEVICE_MEMORY': <ResourceMonitorEventType.LOW_DEVICE_MEMORY: 2>, 'LOW_HOST_MEMORY': <ResourceMonitorEventType.LOW_HOST_MEMORY: 3>} pass def acquire_resource_monitor_interface(plugin_name: str = None, library_path: str = None) -> IResourceMonitor: pass def release_resource_monitor_interface(arg0: IResourceMonitor) -> None: pass deviceMemoryWarnFractionSettingName = '/persistent/resourcemonitor/deviceMemoryWarnFraction' deviceMemoryWarnMBSettingName = '/persistent/resourcemonitor/deviceMemoryWarnMB' hostMemoryWarnFractionSettingName = '/persistent/resourcemonitor/hostMemoryWarnFraction' hostMemoryWarnMBSettingName = '/persistent/resourcemonitor/hostMemoryWarnMB' sendDeviceMemoryWarningSettingName = '/persistent/resourcemonitor/sendDeviceMemoryWarning' sendHostMemoryWarningSettingName = '/persistent/resourcemonitor/sendHostMemoryWarning' timeBetweenQueriesSettingName = '/persistent/resourcemonitor/timeBetweenQueries'
3,333
unknown
40.674999
288
0.712571
omniverse-code/kit/exts/omni.resourcemonitor/omni/resourcemonitor/scripts/extension.py
import omni.ext from .._resourceMonitor import * class PublicExtension(omni.ext.IExt): def on_startup(self): self._resourceMonitor = acquire_resource_monitor_interface() def on_shutdown(self): release_resource_monitor_interface(self._resourceMonitor)
277
Python
26.799997
68
0.729242
omniverse-code/kit/exts/omni.resourcemonitor/omni/resourcemonitor/scripts/resource_monitor_page.py
import omni.ui as ui from omni.kit.window.preferences import PreferenceBuilder, SettingType from .. import _resourceMonitor class ResourceMonitorPreferences(PreferenceBuilder): def __init__(self): super().__init__("Resource Monitor") def build(self): """ Resource Monitor """ with ui.VStack(height=0): with self.add_frame("Resource Monitor"): with ui.VStack(): self.create_setting_widget( "Time Between Queries", _resourceMonitor.timeBetweenQueriesSettingName, SettingType.FLOAT, ) self.create_setting_widget( "Send Device Memory Warnings", _resourceMonitor.sendDeviceMemoryWarningSettingName, SettingType.BOOL, ) self.create_setting_widget( "Device Memory Warning Threshold (MB)", _resourceMonitor.deviceMemoryWarnMBSettingName, SettingType.INT, ) self.create_setting_widget( "Device Memory Warning Threshold (Fraction)", _resourceMonitor.deviceMemoryWarnFractionSettingName, SettingType.FLOAT, range_from=0., range_to=1., ) self.create_setting_widget( "Send Host Memory Warnings", _resourceMonitor.sendHostMemoryWarningSettingName, SettingType.BOOL ) self.create_setting_widget( "Host Memory Warning Threshold (MB)", _resourceMonitor.hostMemoryWarnMBSettingName, SettingType.INT, ) self.create_setting_widget( "Host Memory Warning Threshold (Fraction)", _resourceMonitor.hostMemoryWarnFractionSettingName, SettingType.FLOAT, range_from=0., range_to=1., )
2,300
Python
41.61111
77
0.475652
omniverse-code/kit/exts/omni.resourcemonitor/omni/resourcemonitor/tests/__init__.py
""" Presence of this file allows the tests directory to be imported as a module so that all of its contents can be scanned to automatically add tests that are placed into this directory. """ scan_for_test_modules = True
220
Python
35.833327
103
0.777273
omniverse-code/kit/exts/omni.resourcemonitor/omni/resourcemonitor/tests/test_resource_monitor.py
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # import numpy as np import carb.settings import omni.kit.test import omni.resourcemonitor as rm class TestResourceSettings(omni.kit.test.AsyncTestCase): # Before running each test async def setUp(self): self._savedSettings = {} self._rm_interface = rm.acquire_resource_monitor_interface() self._settings = carb.settings.get_settings() # Save current settings self._savedSettings[rm.timeBetweenQueriesSettingName] = \ self._settings.get_as_float(rm.timeBetweenQueriesSettingName) self._savedSettings[rm.sendDeviceMemoryWarningSettingName] = \ self._settings.get_as_bool(rm.sendDeviceMemoryWarningSettingName) self._savedSettings[rm.deviceMemoryWarnMBSettingName] = \ self._settings.get_as_int(rm.deviceMemoryWarnMBSettingName) self._savedSettings[rm.deviceMemoryWarnFractionSettingName] = \ self._settings.get_as_float(rm.deviceMemoryWarnFractionSettingName) self._savedSettings[rm.sendHostMemoryWarningSettingName] = \ self._settings.get_as_bool(rm.sendHostMemoryWarningSettingName) self._savedSettings[rm.hostMemoryWarnMBSettingName] = \ self._settings.get_as_int(rm.hostMemoryWarnMBSettingName) self._savedSettings[rm.hostMemoryWarnFractionSettingName] = \ self._settings.get_as_float(rm.hostMemoryWarnFractionSettingName) # After running each test async def tearDown(self): # Restore settings self._settings.set_float( rm.timeBetweenQueriesSettingName, self._savedSettings[rm.timeBetweenQueriesSettingName]) self._settings.set_bool( rm.sendDeviceMemoryWarningSettingName, self._savedSettings[rm.sendDeviceMemoryWarningSettingName]) self._settings.set_int( rm.deviceMemoryWarnMBSettingName, self._savedSettings[rm.deviceMemoryWarnMBSettingName]) self._settings.set_float( rm.deviceMemoryWarnFractionSettingName, self._savedSettings[rm.deviceMemoryWarnFractionSettingName]) self._settings.set_bool( rm.sendHostMemoryWarningSettingName, self._savedSettings[rm.sendHostMemoryWarningSettingName]) self._settings.set_int( rm.hostMemoryWarnMBSettingName, self._savedSettings[rm.hostMemoryWarnMBSettingName]) self._settings.set_float( rm.hostMemoryWarnFractionSettingName, self._savedSettings[rm.hostMemoryWarnFractionSettingName]) async def test_resource_monitor(self): """ Test host memory warnings by setting the warning threshold to slightly less than 10 GB below current memory usage then allocating a 10 GB buffer """ hostBytesAvail = self._rm_interface.get_available_host_memory() memoryToAlloc = 10 * 1024 * 1024 * 1024 queryTime = 0.1 fudge = 512 * 1024 * 1024 # make sure we go below the warning threshold warnHostThresholdBytes = hostBytesAvail - memoryToAlloc + fudge self._settings.set_float( rm.timeBetweenQueriesSettingName, queryTime) self._settings.set_bool( rm.sendHostMemoryWarningSettingName, True) self._settings.set_int( rm.hostMemoryWarnMBSettingName, warnHostThresholdBytes // (1024 * 1024)) # bytes to MB hostMemoryWarningOccurred = False def on_rm_update(event): nonlocal hostMemoryWarningOccurred hostBytesAvail = self._rm_interface.get_available_host_memory() if event.type == int(rm.ResourceMonitorEventType.LOW_HOST_MEMORY): hostMemoryWarningOccurred = True sub = self._rm_interface.get_event_stream().create_subscription_to_pop(on_rm_update, name='resource monitor update') self.assertIsNotNone(sub) # allocate something numElements = memoryToAlloc // np.dtype(np.int64).itemsize array = np.zeros(numElements, dtype=np.int64) array[:] = 1 time = 0. while time < 2. * queryTime: # give time for a resourcemonitor event to come through dt = await omni.kit.app.get_app().next_update_async() time = time + dt self.assertTrue(hostMemoryWarningOccurred)
4,789
Python
37.015873
124
0.683441
omniverse-code/kit/exts/omni.resourcemonitor/docs/CHANGELOG.md
# CHANGELOG ## [1.0.0] - 2021-09-14 ### Added - Initial implementation. - Provide event stream for low memory warnings. - Provide convenience functions for host and device memory queries.
189
Markdown
22.749997
67
0.740741
omniverse-code/kit/exts/omni.resourcemonitor/docs/README.md
# [omni.resourcemonitor] Utility extension for host and device memory updates. Clients can subscribe to this extension's event stream to receive updates on available memory and/or receive warnings when available memory falls below specified thresholds.
254
Markdown
49.99999
173
0.830709
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnVersionedDeformerPy.rst
.. _omni_graph_examples_python_VersionedDeformerPy_2: .. _omni_graph_examples_python_VersionedDeformerPy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: VersionedDeformerPy :keywords: lang-en omnigraph node examples python versioned-deformer-py VersionedDeformerPy =================== .. <description> Test node to confirm version upgrading works. Performs a basic deformation on some points. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:points", "``pointf[3][]``", "Set of points to be deformed", "[]" "inputs:wavelength", "``float``", "Wavelength of sinusodal deformer function", "50.0" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:points", "``pointf[3][]``", "Set of deformed points", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.VersionedDeformerPy" "Version", "2" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "VersionedDeformerPy" "Categories", "examples" "Generated Class Name", "OgnVersionedDeformerPyDatabase" "Python Module", "omni.graph.examples.python"
1,775
reStructuredText
24.73913
115
0.590986
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnPyUniversalAdd.rst
.. _omni_graph_examples_python_UniversalAdd_1: .. _omni_graph_examples_python_UniversalAdd: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Universal Add For All Types (Python) :keywords: lang-en omnigraph node examples python universal-add Universal Add For All Types (Python) ==================================== .. <description> Python-based universal add node for all types. This file is generated using UniversalAddGenerator.py .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:bool_0", "``bool``", "Input of type bool", "False" "inputs:bool_1", "``bool``", "Input of type bool", "False" "inputs:bool_arr_0", "``bool[]``", "Input of type bool[]", "[]" "inputs:bool_arr_1", "``bool[]``", "Input of type bool[]", "[]" "inputs:colord3_0", "``colord[3]``", "Input of type colord[3]", "[0.0, 0.0, 0.0]" "inputs:colord3_1", "``colord[3]``", "Input of type colord[3]", "[0.0, 0.0, 0.0]" "inputs:colord3_arr_0", "``colord[3][]``", "Input of type colord[3][]", "[]" "inputs:colord3_arr_1", "``colord[3][]``", "Input of type colord[3][]", "[]" "inputs:colord4_0", "``colord[4]``", "Input of type colord[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:colord4_1", "``colord[4]``", "Input of type colord[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:colord4_arr_0", "``colord[4][]``", "Input of type colord[4][]", "[]" "inputs:colord4_arr_1", "``colord[4][]``", "Input of type colord[4][]", "[]" "inputs:colorf3_0", "``colorf[3]``", "Input of type colorf[3]", "[0.0, 0.0, 0.0]" "inputs:colorf3_1", "``colorf[3]``", "Input of type colorf[3]", "[0.0, 0.0, 0.0]" "inputs:colorf3_arr_0", "``colorf[3][]``", "Input of type colorf[3][]", "[]" "inputs:colorf3_arr_1", "``colorf[3][]``", "Input of type colorf[3][]", "[]" "inputs:colorf4_0", "``colorf[4]``", "Input of type colorf[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:colorf4_1", "``colorf[4]``", "Input of type colorf[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:colorf4_arr_0", "``colorf[4][]``", "Input of type colorf[4][]", "[]" "inputs:colorf4_arr_1", "``colorf[4][]``", "Input of type colorf[4][]", "[]" "inputs:colorh3_0", "``colorh[3]``", "Input of type colorh[3]", "[0.0, 0.0, 0.0]" "inputs:colorh3_1", "``colorh[3]``", "Input of type colorh[3]", "[0.0, 0.0, 0.0]" "inputs:colorh3_arr_0", "``colorh[3][]``", "Input of type colorh[3][]", "[]" "inputs:colorh3_arr_1", "``colorh[3][]``", "Input of type colorh[3][]", "[]" "inputs:colorh4_0", "``colorh[4]``", "Input of type colorh[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:colorh4_1", "``colorh[4]``", "Input of type colorh[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:colorh4_arr_0", "``colorh[4][]``", "Input of type colorh[4][]", "[]" "inputs:colorh4_arr_1", "``colorh[4][]``", "Input of type colorh[4][]", "[]" "inputs:double2_0", "``double[2]``", "Input of type double[2]", "[0.0, 0.0]" "inputs:double2_1", "``double[2]``", "Input of type double[2]", "[0.0, 0.0]" "inputs:double2_arr_0", "``double[2][]``", "Input of type double[2][]", "[]" "inputs:double2_arr_1", "``double[2][]``", "Input of type double[2][]", "[]" "inputs:double3_0", "``double[3]``", "Input of type double[3]", "[0.0, 0.0, 0.0]" "inputs:double3_1", "``double[3]``", "Input of type double[3]", "[0.0, 0.0, 0.0]" "inputs:double3_arr_0", "``double[3][]``", "Input of type double[3][]", "[]" "inputs:double3_arr_1", "``double[3][]``", "Input of type double[3][]", "[]" "inputs:double4_0", "``double[4]``", "Input of type double[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:double4_1", "``double[4]``", "Input of type double[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:double4_arr_0", "``double[4][]``", "Input of type double[4][]", "[]" "inputs:double4_arr_1", "``double[4][]``", "Input of type double[4][]", "[]" "inputs:double_0", "``double``", "Input of type double", "0.0" "inputs:double_1", "``double``", "Input of type double", "0.0" "inputs:double_arr_0", "``double[]``", "Input of type double[]", "[]" "inputs:double_arr_1", "``double[]``", "Input of type double[]", "[]" "inputs:float2_0", "``float[2]``", "Input of type float[2]", "[0.0, 0.0]" "inputs:float2_1", "``float[2]``", "Input of type float[2]", "[0.0, 0.0]" "inputs:float2_arr_0", "``float[2][]``", "Input of type float[2][]", "[]" "inputs:float2_arr_1", "``float[2][]``", "Input of type float[2][]", "[]" "inputs:float3_0", "``float[3]``", "Input of type float[3]", "[0.0, 0.0, 0.0]" "inputs:float3_1", "``float[3]``", "Input of type float[3]", "[0.0, 0.0, 0.0]" "inputs:float3_arr_0", "``float[3][]``", "Input of type float[3][]", "[]" "inputs:float3_arr_1", "``float[3][]``", "Input of type float[3][]", "[]" "inputs:float4_0", "``float[4]``", "Input of type float[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:float4_1", "``float[4]``", "Input of type float[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:float4_arr_0", "``float[4][]``", "Input of type float[4][]", "[]" "inputs:float4_arr_1", "``float[4][]``", "Input of type float[4][]", "[]" "inputs:float_0", "``float``", "Input of type float", "0.0" "inputs:float_1", "``float``", "Input of type float", "0.0" "inputs:float_arr_0", "``float[]``", "Input of type float[]", "[]" "inputs:float_arr_1", "``float[]``", "Input of type float[]", "[]" "inputs:frame4_0", "``frame[4]``", "Input of type frame[4]", "[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]" "inputs:frame4_1", "``frame[4]``", "Input of type frame[4]", "[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]" "inputs:frame4_arr_0", "``frame[4][]``", "Input of type frame[4][]", "[]" "inputs:frame4_arr_1", "``frame[4][]``", "Input of type frame[4][]", "[]" "inputs:half2_0", "``half[2]``", "Input of type half[2]", "[0.0, 0.0]" "inputs:half2_1", "``half[2]``", "Input of type half[2]", "[0.0, 0.0]" "inputs:half2_arr_0", "``half[2][]``", "Input of type half[2][]", "[]" "inputs:half2_arr_1", "``half[2][]``", "Input of type half[2][]", "[]" "inputs:half3_0", "``half[3]``", "Input of type half[3]", "[0.0, 0.0, 0.0]" "inputs:half3_1", "``half[3]``", "Input of type half[3]", "[0.0, 0.0, 0.0]" "inputs:half3_arr_0", "``half[3][]``", "Input of type half[3][]", "[]" "inputs:half3_arr_1", "``half[3][]``", "Input of type half[3][]", "[]" "inputs:half4_0", "``half[4]``", "Input of type half[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:half4_1", "``half[4]``", "Input of type half[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:half4_arr_0", "``half[4][]``", "Input of type half[4][]", "[]" "inputs:half4_arr_1", "``half[4][]``", "Input of type half[4][]", "[]" "inputs:half_0", "``half``", "Input of type half", "0.0" "inputs:half_1", "``half``", "Input of type half", "0.0" "inputs:half_arr_0", "``half[]``", "Input of type half[]", "[]" "inputs:half_arr_1", "``half[]``", "Input of type half[]", "[]" "inputs:int2_0", "``int[2]``", "Input of type int[2]", "[0, 0]" "inputs:int2_1", "``int[2]``", "Input of type int[2]", "[0, 0]" "inputs:int2_arr_0", "``int[2][]``", "Input of type int[2][]", "[]" "inputs:int2_arr_1", "``int[2][]``", "Input of type int[2][]", "[]" "inputs:int3_0", "``int[3]``", "Input of type int[3]", "[0, 0, 0]" "inputs:int3_1", "``int[3]``", "Input of type int[3]", "[0, 0, 0]" "inputs:int3_arr_0", "``int[3][]``", "Input of type int[3][]", "[]" "inputs:int3_arr_1", "``int[3][]``", "Input of type int[3][]", "[]" "inputs:int4_0", "``int[4]``", "Input of type int[4]", "[0, 0, 0, 0]" "inputs:int4_1", "``int[4]``", "Input of type int[4]", "[0, 0, 0, 0]" "inputs:int4_arr_0", "``int[4][]``", "Input of type int[4][]", "[]" "inputs:int4_arr_1", "``int[4][]``", "Input of type int[4][]", "[]" "inputs:int64_0", "``int64``", "Input of type int64", "0" "inputs:int64_1", "``int64``", "Input of type int64", "0" "inputs:int64_arr_0", "``int64[]``", "Input of type int64[]", "[]" "inputs:int64_arr_1", "``int64[]``", "Input of type int64[]", "[]" "inputs:int_0", "``int``", "Input of type int", "0" "inputs:int_1", "``int``", "Input of type int", "0" "inputs:int_arr_0", "``int[]``", "Input of type int[]", "[]" "inputs:int_arr_1", "``int[]``", "Input of type int[]", "[]" "inputs:matrixd2_0", "``matrixd[2]``", "Input of type matrixd[2]", "[[0.0, 0.0], [0.0, 0.0]]" "inputs:matrixd2_1", "``matrixd[2]``", "Input of type matrixd[2]", "[[0.0, 0.0], [0.0, 0.0]]" "inputs:matrixd2_arr_0", "``matrixd[2][]``", "Input of type matrixd[2][]", "[]" "inputs:matrixd2_arr_1", "``matrixd[2][]``", "Input of type matrixd[2][]", "[]" "inputs:matrixd3_0", "``matrixd[3]``", "Input of type matrixd[3]", "[[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]" "inputs:matrixd3_1", "``matrixd[3]``", "Input of type matrixd[3]", "[[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]" "inputs:matrixd3_arr_0", "``matrixd[3][]``", "Input of type matrixd[3][]", "[]" "inputs:matrixd3_arr_1", "``matrixd[3][]``", "Input of type matrixd[3][]", "[]" "inputs:matrixd4_0", "``matrixd[4]``", "Input of type matrixd[4]", "[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]" "inputs:matrixd4_1", "``matrixd[4]``", "Input of type matrixd[4]", "[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]" "inputs:matrixd4_arr_0", "``matrixd[4][]``", "Input of type matrixd[4][]", "[]" "inputs:matrixd4_arr_1", "``matrixd[4][]``", "Input of type matrixd[4][]", "[]" "inputs:normald3_0", "``normald[3]``", "Input of type normald[3]", "[0.0, 0.0, 0.0]" "inputs:normald3_1", "``normald[3]``", "Input of type normald[3]", "[0.0, 0.0, 0.0]" "inputs:normald3_arr_0", "``normald[3][]``", "Input of type normald[3][]", "[]" "inputs:normald3_arr_1", "``normald[3][]``", "Input of type normald[3][]", "[]" "inputs:normalf3_0", "``normalf[3]``", "Input of type normalf[3]", "[0.0, 0.0, 0.0]" "inputs:normalf3_1", "``normalf[3]``", "Input of type normalf[3]", "[0.0, 0.0, 0.0]" "inputs:normalf3_arr_0", "``normalf[3][]``", "Input of type normalf[3][]", "[]" "inputs:normalf3_arr_1", "``normalf[3][]``", "Input of type normalf[3][]", "[]" "inputs:normalh3_0", "``normalh[3]``", "Input of type normalh[3]", "[0.0, 0.0, 0.0]" "inputs:normalh3_1", "``normalh[3]``", "Input of type normalh[3]", "[0.0, 0.0, 0.0]" "inputs:normalh3_arr_0", "``normalh[3][]``", "Input of type normalh[3][]", "[]" "inputs:normalh3_arr_1", "``normalh[3][]``", "Input of type normalh[3][]", "[]" "inputs:pointd3_0", "``pointd[3]``", "Input of type pointd[3]", "[0.0, 0.0, 0.0]" "inputs:pointd3_1", "``pointd[3]``", "Input of type pointd[3]", "[0.0, 0.0, 0.0]" "inputs:pointd3_arr_0", "``pointd[3][]``", "Input of type pointd[3][]", "[]" "inputs:pointd3_arr_1", "``pointd[3][]``", "Input of type pointd[3][]", "[]" "inputs:pointf3_0", "``pointf[3]``", "Input of type pointf[3]", "[0.0, 0.0, 0.0]" "inputs:pointf3_1", "``pointf[3]``", "Input of type pointf[3]", "[0.0, 0.0, 0.0]" "inputs:pointf3_arr_0", "``pointf[3][]``", "Input of type pointf[3][]", "[]" "inputs:pointf3_arr_1", "``pointf[3][]``", "Input of type pointf[3][]", "[]" "inputs:pointh3_0", "``pointh[3]``", "Input of type pointh[3]", "[0.0, 0.0, 0.0]" "inputs:pointh3_1", "``pointh[3]``", "Input of type pointh[3]", "[0.0, 0.0, 0.0]" "inputs:pointh3_arr_0", "``pointh[3][]``", "Input of type pointh[3][]", "[]" "inputs:pointh3_arr_1", "``pointh[3][]``", "Input of type pointh[3][]", "[]" "inputs:quatd4_0", "``quatd[4]``", "Input of type quatd[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:quatd4_1", "``quatd[4]``", "Input of type quatd[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:quatd4_arr_0", "``quatd[4][]``", "Input of type quatd[4][]", "[]" "inputs:quatd4_arr_1", "``quatd[4][]``", "Input of type quatd[4][]", "[]" "inputs:quatf4_0", "``quatf[4]``", "Input of type quatf[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:quatf4_1", "``quatf[4]``", "Input of type quatf[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:quatf4_arr_0", "``quatf[4][]``", "Input of type quatf[4][]", "[]" "inputs:quatf4_arr_1", "``quatf[4][]``", "Input of type quatf[4][]", "[]" "inputs:quath4_0", "``quath[4]``", "Input of type quath[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:quath4_1", "``quath[4]``", "Input of type quath[4]", "[0.0, 0.0, 0.0, 0.0]" "inputs:quath4_arr_0", "``quath[4][]``", "Input of type quath[4][]", "[]" "inputs:quath4_arr_1", "``quath[4][]``", "Input of type quath[4][]", "[]" "inputs:texcoordd2_0", "``texcoordd[2]``", "Input of type texcoordd[2]", "[0.0, 0.0]" "inputs:texcoordd2_1", "``texcoordd[2]``", "Input of type texcoordd[2]", "[0.0, 0.0]" "inputs:texcoordd2_arr_0", "``texcoordd[2][]``", "Input of type texcoordd[2][]", "[]" "inputs:texcoordd2_arr_1", "``texcoordd[2][]``", "Input of type texcoordd[2][]", "[]" "inputs:texcoordd3_0", "``texcoordd[3]``", "Input of type texcoordd[3]", "[0.0, 0.0, 0.0]" "inputs:texcoordd3_1", "``texcoordd[3]``", "Input of type texcoordd[3]", "[0.0, 0.0, 0.0]" "inputs:texcoordd3_arr_0", "``texcoordd[3][]``", "Input of type texcoordd[3][]", "[]" "inputs:texcoordd3_arr_1", "``texcoordd[3][]``", "Input of type texcoordd[3][]", "[]" "inputs:texcoordf2_0", "``texcoordf[2]``", "Input of type texcoordf[2]", "[0.0, 0.0]" "inputs:texcoordf2_1", "``texcoordf[2]``", "Input of type texcoordf[2]", "[0.0, 0.0]" "inputs:texcoordf2_arr_0", "``texcoordf[2][]``", "Input of type texcoordf[2][]", "[]" "inputs:texcoordf2_arr_1", "``texcoordf[2][]``", "Input of type texcoordf[2][]", "[]" "inputs:texcoordf3_0", "``texcoordf[3]``", "Input of type texcoordf[3]", "[0.0, 0.0, 0.0]" "inputs:texcoordf3_1", "``texcoordf[3]``", "Input of type texcoordf[3]", "[0.0, 0.0, 0.0]" "inputs:texcoordf3_arr_0", "``texcoordf[3][]``", "Input of type texcoordf[3][]", "[]" "inputs:texcoordf3_arr_1", "``texcoordf[3][]``", "Input of type texcoordf[3][]", "[]" "inputs:texcoordh2_0", "``texcoordh[2]``", "Input of type texcoordh[2]", "[0.0, 0.0]" "inputs:texcoordh2_1", "``texcoordh[2]``", "Input of type texcoordh[2]", "[0.0, 0.0]" "inputs:texcoordh2_arr_0", "``texcoordh[2][]``", "Input of type texcoordh[2][]", "[]" "inputs:texcoordh2_arr_1", "``texcoordh[2][]``", "Input of type texcoordh[2][]", "[]" "inputs:texcoordh3_0", "``texcoordh[3]``", "Input of type texcoordh[3]", "[0.0, 0.0, 0.0]" "inputs:texcoordh3_1", "``texcoordh[3]``", "Input of type texcoordh[3]", "[0.0, 0.0, 0.0]" "inputs:texcoordh3_arr_0", "``texcoordh[3][]``", "Input of type texcoordh[3][]", "[]" "inputs:texcoordh3_arr_1", "``texcoordh[3][]``", "Input of type texcoordh[3][]", "[]" "inputs:timecode_0", "``timecode``", "Input of type timecode", "0.0" "inputs:timecode_1", "``timecode``", "Input of type timecode", "0.0" "inputs:timecode_arr_0", "``timecode[]``", "Input of type timecode[]", "[]" "inputs:timecode_arr_1", "``timecode[]``", "Input of type timecode[]", "[]" "inputs:token_0", "``token``", "Input of type token", "default_token" "inputs:token_1", "``token``", "Input of type token", "default_token" "inputs:token_arr_0", "``token[]``", "Input of type token[]", "[]" "inputs:token_arr_1", "``token[]``", "Input of type token[]", "[]" "inputs:transform4_0", "``transform[4]``", "Input of type transform[4]", "[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]" "inputs:transform4_1", "``transform[4]``", "Input of type transform[4]", "[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]" "inputs:transform4_arr_0", "``transform[4][]``", "Input of type transform[4][]", "[]" "inputs:transform4_arr_1", "``transform[4][]``", "Input of type transform[4][]", "[]" "inputs:uchar_0", "``uchar``", "Input of type uchar", "0" "inputs:uchar_1", "``uchar``", "Input of type uchar", "0" "inputs:uchar_arr_0", "``uchar[]``", "Input of type uchar[]", "[]" "inputs:uchar_arr_1", "``uchar[]``", "Input of type uchar[]", "[]" "inputs:uint64_0", "``uint64``", "Input of type uint64", "0" "inputs:uint64_1", "``uint64``", "Input of type uint64", "0" "inputs:uint64_arr_0", "``uint64[]``", "Input of type uint64[]", "[]" "inputs:uint64_arr_1", "``uint64[]``", "Input of type uint64[]", "[]" "inputs:uint_0", "``uint``", "Input of type uint", "0" "inputs:uint_1", "``uint``", "Input of type uint", "0" "inputs:uint_arr_0", "``uint[]``", "Input of type uint[]", "[]" "inputs:uint_arr_1", "``uint[]``", "Input of type uint[]", "[]" "inputs:vectord3_0", "``vectord[3]``", "Input of type vectord[3]", "[0.0, 0.0, 0.0]" "inputs:vectord3_1", "``vectord[3]``", "Input of type vectord[3]", "[0.0, 0.0, 0.0]" "inputs:vectord3_arr_0", "``vectord[3][]``", "Input of type vectord[3][]", "[]" "inputs:vectord3_arr_1", "``vectord[3][]``", "Input of type vectord[3][]", "[]" "inputs:vectorf3_0", "``vectorf[3]``", "Input of type vectorf[3]", "[0.0, 0.0, 0.0]" "inputs:vectorf3_1", "``vectorf[3]``", "Input of type vectorf[3]", "[0.0, 0.0, 0.0]" "inputs:vectorf3_arr_0", "``vectorf[3][]``", "Input of type vectorf[3][]", "[]" "inputs:vectorf3_arr_1", "``vectorf[3][]``", "Input of type vectorf[3][]", "[]" "inputs:vectorh3_0", "``vectorh[3]``", "Input of type vectorh[3]", "[0.0, 0.0, 0.0]" "inputs:vectorh3_1", "``vectorh[3]``", "Input of type vectorh[3]", "[0.0, 0.0, 0.0]" "inputs:vectorh3_arr_0", "``vectorh[3][]``", "Input of type vectorh[3][]", "[]" "inputs:vectorh3_arr_1", "``vectorh[3][]``", "Input of type vectorh[3][]", "[]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:bool_0", "``bool``", "Output of type bool", "False" "outputs:bool_arr_0", "``bool[]``", "Output of type bool[]", "[]" "outputs:colord3_0", "``colord[3]``", "Output of type colord[3]", "[0.0, 0.0, 0.0]" "outputs:colord3_arr_0", "``colord[3][]``", "Output of type colord[3][]", "[]" "outputs:colord4_0", "``colord[4]``", "Output of type colord[4]", "[0.0, 0.0, 0.0, 0.0]" "outputs:colord4_arr_0", "``colord[4][]``", "Output of type colord[4][]", "[]" "outputs:colorf3_0", "``colorf[3]``", "Output of type colorf[3]", "[0.0, 0.0, 0.0]" "outputs:colorf3_arr_0", "``colorf[3][]``", "Output of type colorf[3][]", "[]" "outputs:colorf4_0", "``colorf[4]``", "Output of type colorf[4]", "[0.0, 0.0, 0.0, 0.0]" "outputs:colorf4_arr_0", "``colorf[4][]``", "Output of type colorf[4][]", "[]" "outputs:colorh3_0", "``colorh[3]``", "Output of type colorh[3]", "[0.0, 0.0, 0.0]" "outputs:colorh3_arr_0", "``colorh[3][]``", "Output of type colorh[3][]", "[]" "outputs:colorh4_0", "``colorh[4]``", "Output of type colorh[4]", "[0.0, 0.0, 0.0, 0.0]" "outputs:colorh4_arr_0", "``colorh[4][]``", "Output of type colorh[4][]", "[]" "outputs:double2_0", "``double[2]``", "Output of type double[2]", "[0.0, 0.0]" "outputs:double2_arr_0", "``double[2][]``", "Output of type double[2][]", "[]" "outputs:double3_0", "``double[3]``", "Output of type double[3]", "[0.0, 0.0, 0.0]" "outputs:double3_arr_0", "``double[3][]``", "Output of type double[3][]", "[]" "outputs:double4_0", "``double[4]``", "Output of type double[4]", "[0.0, 0.0, 0.0, 0.0]" "outputs:double4_arr_0", "``double[4][]``", "Output of type double[4][]", "[]" "outputs:double_0", "``double``", "Output of type double", "0.0" "outputs:double_arr_0", "``double[]``", "Output of type double[]", "[]" "outputs:float2_0", "``float[2]``", "Output of type float[2]", "[0.0, 0.0]" "outputs:float2_arr_0", "``float[2][]``", "Output of type float[2][]", "[]" "outputs:float3_0", "``float[3]``", "Output of type float[3]", "[0.0, 0.0, 0.0]" "outputs:float3_arr_0", "``float[3][]``", "Output of type float[3][]", "[]" "outputs:float4_0", "``float[4]``", "Output of type float[4]", "[0.0, 0.0, 0.0, 0.0]" "outputs:float4_arr_0", "``float[4][]``", "Output of type float[4][]", "[]" "outputs:float_0", "``float``", "Output of type float", "0.0" "outputs:float_arr_0", "``float[]``", "Output of type float[]", "[]" "outputs:frame4_0", "``frame[4]``", "Output of type frame[4]", "[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]" "outputs:frame4_arr_0", "``frame[4][]``", "Output of type frame[4][]", "[]" "outputs:half2_0", "``half[2]``", "Output of type half[2]", "[0.0, 0.0]" "outputs:half2_arr_0", "``half[2][]``", "Output of type half[2][]", "[]" "outputs:half3_0", "``half[3]``", "Output of type half[3]", "[0.0, 0.0, 0.0]" "outputs:half3_arr_0", "``half[3][]``", "Output of type half[3][]", "[]" "outputs:half4_0", "``half[4]``", "Output of type half[4]", "[0.0, 0.0, 0.0, 0.0]" "outputs:half4_arr_0", "``half[4][]``", "Output of type half[4][]", "[]" "outputs:half_0", "``half``", "Output of type half", "0.0" "outputs:half_arr_0", "``half[]``", "Output of type half[]", "[]" "outputs:int2_0", "``int[2]``", "Output of type int[2]", "[0, 0]" "outputs:int2_arr_0", "``int[2][]``", "Output of type int[2][]", "[]" "outputs:int3_0", "``int[3]``", "Output of type int[3]", "[0, 0, 0]" "outputs:int3_arr_0", "``int[3][]``", "Output of type int[3][]", "[]" "outputs:int4_0", "``int[4]``", "Output of type int[4]", "[0, 0, 0, 0]" "outputs:int4_arr_0", "``int[4][]``", "Output of type int[4][]", "[]" "outputs:int64_0", "``int64``", "Output of type int64", "0" "outputs:int64_arr_0", "``int64[]``", "Output of type int64[]", "[]" "outputs:int_0", "``int``", "Output of type int", "0" "outputs:int_arr_0", "``int[]``", "Output of type int[]", "[]" "outputs:matrixd2_0", "``matrixd[2]``", "Output of type matrixd[2]", "[[0.0, 0.0], [0.0, 0.0]]" "outputs:matrixd2_arr_0", "``matrixd[2][]``", "Output of type matrixd[2][]", "[]" "outputs:matrixd3_0", "``matrixd[3]``", "Output of type matrixd[3]", "[[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]" "outputs:matrixd3_arr_0", "``matrixd[3][]``", "Output of type matrixd[3][]", "[]" "outputs:matrixd4_0", "``matrixd[4]``", "Output of type matrixd[4]", "[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]" "outputs:matrixd4_arr_0", "``matrixd[4][]``", "Output of type matrixd[4][]", "[]" "outputs:normald3_0", "``normald[3]``", "Output of type normald[3]", "[0.0, 0.0, 0.0]" "outputs:normald3_arr_0", "``normald[3][]``", "Output of type normald[3][]", "[]" "outputs:normalf3_0", "``normalf[3]``", "Output of type normalf[3]", "[0.0, 0.0, 0.0]" "outputs:normalf3_arr_0", "``normalf[3][]``", "Output of type normalf[3][]", "[]" "outputs:normalh3_0", "``normalh[3]``", "Output of type normalh[3]", "[0.0, 0.0, 0.0]" "outputs:normalh3_arr_0", "``normalh[3][]``", "Output of type normalh[3][]", "[]" "outputs:pointd3_0", "``pointd[3]``", "Output of type pointd[3]", "[0.0, 0.0, 0.0]" "outputs:pointd3_arr_0", "``pointd[3][]``", "Output of type pointd[3][]", "[]" "outputs:pointf3_0", "``pointf[3]``", "Output of type pointf[3]", "[0.0, 0.0, 0.0]" "outputs:pointf3_arr_0", "``pointf[3][]``", "Output of type pointf[3][]", "[]" "outputs:pointh3_0", "``pointh[3]``", "Output of type pointh[3]", "[0.0, 0.0, 0.0]" "outputs:pointh3_arr_0", "``pointh[3][]``", "Output of type pointh[3][]", "[]" "outputs:quatd4_0", "``quatd[4]``", "Output of type quatd[4]", "[0.0, 0.0, 0.0, 0.0]" "outputs:quatd4_arr_0", "``quatd[4][]``", "Output of type quatd[4][]", "[]" "outputs:quatf4_0", "``quatf[4]``", "Output of type quatf[4]", "[0.0, 0.0, 0.0, 0.0]" "outputs:quatf4_arr_0", "``quatf[4][]``", "Output of type quatf[4][]", "[]" "outputs:quath4_0", "``quath[4]``", "Output of type quath[4]", "[0.0, 0.0, 0.0, 0.0]" "outputs:quath4_arr_0", "``quath[4][]``", "Output of type quath[4][]", "[]" "outputs:texcoordd2_0", "``texcoordd[2]``", "Output of type texcoordd[2]", "[0.0, 0.0]" "outputs:texcoordd2_arr_0", "``texcoordd[2][]``", "Output of type texcoordd[2][]", "[]" "outputs:texcoordd3_0", "``texcoordd[3]``", "Output of type texcoordd[3]", "[0.0, 0.0, 0.0]" "outputs:texcoordd3_arr_0", "``texcoordd[3][]``", "Output of type texcoordd[3][]", "[]" "outputs:texcoordf2_0", "``texcoordf[2]``", "Output of type texcoordf[2]", "[0.0, 0.0]" "outputs:texcoordf2_arr_0", "``texcoordf[2][]``", "Output of type texcoordf[2][]", "[]" "outputs:texcoordf3_0", "``texcoordf[3]``", "Output of type texcoordf[3]", "[0.0, 0.0, 0.0]" "outputs:texcoordf3_arr_0", "``texcoordf[3][]``", "Output of type texcoordf[3][]", "[]" "outputs:texcoordh2_0", "``texcoordh[2]``", "Output of type texcoordh[2]", "[0.0, 0.0]" "outputs:texcoordh2_arr_0", "``texcoordh[2][]``", "Output of type texcoordh[2][]", "[]" "outputs:texcoordh3_0", "``texcoordh[3]``", "Output of type texcoordh[3]", "[0.0, 0.0, 0.0]" "outputs:texcoordh3_arr_0", "``texcoordh[3][]``", "Output of type texcoordh[3][]", "[]" "outputs:timecode_0", "``timecode``", "Output of type timecode", "0.0" "outputs:timecode_arr_0", "``timecode[]``", "Output of type timecode[]", "[]" "outputs:token_0", "``token``", "Output of type token", "default_token" "outputs:token_arr_0", "``token[]``", "Output of type token[]", "[]" "outputs:transform4_0", "``transform[4]``", "Output of type transform[4]", "[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]" "outputs:transform4_arr_0", "``transform[4][]``", "Output of type transform[4][]", "[]" "outputs:uchar_0", "``uchar``", "Output of type uchar", "0" "outputs:uchar_arr_0", "``uchar[]``", "Output of type uchar[]", "[]" "outputs:uint64_0", "``uint64``", "Output of type uint64", "0" "outputs:uint64_arr_0", "``uint64[]``", "Output of type uint64[]", "[]" "outputs:uint_0", "``uint``", "Output of type uint", "0" "outputs:uint_arr_0", "``uint[]``", "Output of type uint[]", "[]" "outputs:vectord3_0", "``vectord[3]``", "Output of type vectord[3]", "[0.0, 0.0, 0.0]" "outputs:vectord3_arr_0", "``vectord[3][]``", "Output of type vectord[3][]", "[]" "outputs:vectorf3_0", "``vectorf[3]``", "Output of type vectorf[3]", "[0.0, 0.0, 0.0]" "outputs:vectorf3_arr_0", "``vectorf[3][]``", "Output of type vectorf[3][]", "[]" "outputs:vectorh3_0", "``vectorh[3]``", "Output of type vectorh[3]", "[0.0, 0.0, 0.0]" "outputs:vectorh3_arr_0", "``vectorh[3][]``", "Output of type vectorh[3][]", "[]" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.UniversalAdd" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "usd" "uiName", "Universal Add For All Types (Python)" "Categories", "examples" "Generated Class Name", "OgnPyUniversalAddDatabase" "Python Module", "omni.graph.examples.python"
27,714
reStructuredText
72.320106
169
0.526665
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnBouncingCubesGpu.rst
.. _omni_graph_examples_python_BouncingCubesGpu_1: .. _omni_graph_examples_python_BouncingCubesGpu: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Deprecated Node - Bouncing Cubes (GPU) :keywords: lang-en omnigraph node examples python bouncing-cubes-gpu Deprecated Node - Bouncing Cubes (GPU) ====================================== .. <description> Deprecated node - no longer supported .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.BouncingCubesGpu" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "True" "Implementation Language", "Python" "Default Memory Type", "cuda" "Generated Code Exclusions", "usd, test" "uiName", "Deprecated Node - Bouncing Cubes (GPU)" "__memoryType", "cuda" "Categories", "examples" "Generated Class Name", "OgnBouncingCubesGpuDatabase" "Python Module", "omni.graph.examples.python"
1,346
reStructuredText
25.411764
115
0.57578
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnCountTo.rst
.. _omni_graph_examples_python_CountTo_1: .. _omni_graph_examples_python_CountTo: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Count To :keywords: lang-en omnigraph node examples python count-to Count To ======== .. <description> Example stateful node that counts to countTo by a certain increment .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:countTo", "``double``", "The ceiling to count to", "3" "inputs:increment", "``double``", "Increment to count by", "0.1" "inputs:reset", "``bool``", "Whether to reset the count", "False" "inputs:trigger", "``double[3]``", "Position to be used as a trigger for the counting", "[0.0, 0.0, 0.0]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:count", "``double``", "The current count", "0.0" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.CountTo" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Count To" "Categories", "examples" "Generated Class Name", "OgnCountToDatabase" "Python Module", "omni.graph.examples.python"
1,784
reStructuredText
24.140845
115
0.567265
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnPositionToColor.rst
.. _omni_graph_examples_python_PositionToColor_1: .. _omni_graph_examples_python_PositionToColor: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: PositionToColor :keywords: lang-en omnigraph node examples python position-to-color PositionToColor =============== .. <description> This node takes positional data (double3) and converts to a color, and outputs as color3f[] (which seems to be the default color connection in USD) .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:color_offset", "``colorf[3]``", "Offset added to the scaled color to get the final result", "[0.0, 0.0, 0.0]" "inputs:position", "``double[3]``", "Position to be converted to a color", "[0.0, 0.0, 0.0]" "inputs:scale", "``float``", "Constant by which to multiply the position to get the color", "1.0" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:color", "``colorf[3][]``", "Color value extracted from the position", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.PositionToColor" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "PositionToColor" "Categories", "examples" "Generated Class Name", "OgnPositionToColorDatabase" "Python Module", "omni.graph.examples.python"
1,967
reStructuredText
27.114285
148
0.593798
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnDeformerYAxis.rst
.. _omni_graph_examples_python_DeformerYAxis_1: .. _omni_graph_examples_python_DeformerYAxis: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Sine Wave Deformer Y-axis (Python) :keywords: lang-en omnigraph node examples python deformer-y-axis Sine Wave Deformer Y-axis (Python) ================================== .. <description> Example node applying a sine wave deformation to a set of points, written in Python. Deforms along Y-axis instead of Z .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:multiplier", "``double``", "The multiplier for the amplitude of the sine wave", "1" "inputs:offset", "``double``", "The offset of the sine wave", "0" "inputs:points", "``pointf[3][]``", "The input points to be deformed", "[]" "inputs:wavelength", "``double``", "The wavelength of the sine wave", "1" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:points", "``pointf[3][]``", "The deformed output points", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.DeformerYAxis" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Sine Wave Deformer Y-axis (Python)" "Categories", "examples" "Generated Class Name", "OgnDeformerYAxisDatabase" "Python Module", "omni.graph.examples.python"
1,995
reStructuredText
27.112676
119
0.582957
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnComposeDouble3.rst
.. _omni_graph_examples_python_ComposeDouble3_1: .. _omni_graph_examples_python_ComposeDouble3: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Compose Double3 (Python) :keywords: lang-en omnigraph node examples python compose-double3 Compose Double3 (Python) ======================== .. <description> Example node that takes in the components of three doubles and outputs a double3 .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:x", "``double``", "The x component of the input double3", "0" "inputs:y", "``double``", "The y component of the input double3", "0" "inputs:z", "``double``", "The z component of the input double3", "0" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:double3", "``double[3]``", "Output double3", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.ComposeDouble3" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Compose Double3 (Python)" "Categories", "examples" "Generated Class Name", "OgnComposeDouble3Database" "Python Module", "omni.graph.examples.python"
1,805
reStructuredText
24.8
115
0.577839
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnMultDouble.rst
.. _omni_graph_examples_python_MultDouble_1: .. _omni_graph_examples_python_MultDouble: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Multiply Double (Python) :keywords: lang-en omnigraph node examples python mult-double Multiply Double (Python) ======================== .. <description> Example node that multiplies 2 doubles together .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:a", "``double``", "Input a", "0" "inputs:b", "``double``", "Input b", "0" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:out", "``double``", "The result of a * b", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.MultDouble" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Multiply Double (Python)" "Categories", "examples" "Generated Class Name", "OgnMultDoubleDatabase" "Python Module", "omni.graph.examples.python"
1,618
reStructuredText
22.463768
115
0.556242
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnDynamicSwitch.rst
.. _omni_graph_examples_python_DynamicSwitch_1: .. _omni_graph_examples_python_DynamicSwitch: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Dynamic Switch :keywords: lang-en omnigraph node examples python dynamic-switch Dynamic Switch ============== .. <description> A switch node that will enable the left side or right side depending on the input. Requires dynamic scheduling to work .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:left_value", "``int``", "Left value to output", "-1" "inputs:right_value", "``int``", "Right value to output", "1" "inputs:switch", "``int``", "Enables right value if greater than 0, else left value", "0" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:left_out", "``int``", "Left side output", "0" "outputs:right_out", "``int``", "Right side output", "0" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.DynamicSwitch" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "usd" "uiName", "Dynamic Switch" "Categories", "examples" "Generated Class Name", "OgnDynamicSwitchDatabase" "Python Module", "omni.graph.examples.python"
1,856
reStructuredText
25.154929
119
0.579741
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnBouncingCubesCpu.rst
.. _omni_graph_examples_python_BouncingCubes_1: .. _omni_graph_examples_python_BouncingCubes: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Deprecated Node - Bouncing Cubes (GPU) :keywords: lang-en omnigraph node examples python bouncing-cubes Deprecated Node - Bouncing Cubes (GPU) ====================================== .. <description> Deprecated node - no longer supported .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. State ----- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Translations (*state:translations*)", "``float[3][]``", "Set of translation attributes gathered from the inputs. Translations have velocities applied to them each evaluation.", "None" "Velocities (*state:velocities*)", "``float[]``", "Set of velocity attributes gathered from the inputs", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.BouncingCubes" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "True" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Deprecated Node - Bouncing Cubes (GPU)" "Categories", "examples" "Generated Class Name", "OgnBouncingCubesCpuDatabase" "Python Module", "omni.graph.examples.python"
1,716
reStructuredText
27.616666
188
0.594406
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnExecSwitch.rst
.. _omni_graph_examples_python_ExecSwitch_1: .. _omni_graph_examples_python_ExecSwitch: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Exec Switch :keywords: lang-en omnigraph node examples python exec-switch Exec Switch =========== .. <description> A switch node that will enable the left side or right side depending on the input .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Exec In (*inputs:execIn*)", "``execution``", "Trigger the output", "None" "inputs:switch", "``bool``", "Enables right value if greater than 0, else left value", "False" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:execLeftOut", "``execution``", "Left execution", "None" "outputs:execRightOut", "``execution``", "Right execution", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.ExecSwitch" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "usd" "uiName", "Exec Switch" "Categories", "examples" "Generated Class Name", "OgnExecSwitchDatabase" "Python Module", "omni.graph.examples.python"
1,764
reStructuredText
24.214285
115
0.579932
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnTestInitNode.rst
.. _omni_graph_examples_python_TestInitNode_1: .. _omni_graph_examples_python_TestInitNode: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: TestInitNode :keywords: lang-en omnigraph node examples python test-init-node TestInitNode ============ .. <description> Test Init Node .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:value", "``float``", "Value", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.TestInitNode" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "TestInitNode" "Categories", "examples" "Generated Class Name", "OgnTestInitNodeDatabase" "Python Module", "omni.graph.examples.python"
1,332
reStructuredText
21.59322
115
0.563814
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnIntCounter.rst
.. _omni_graph_examples_python_IntCounter_1: .. _omni_graph_examples_python_IntCounter: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Int Counter :keywords: lang-en omnigraph node examples python int-counter Int Counter =========== .. <description> Example stateful node that increments every time it's evaluated .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:increment", "``int``", "Increment to count by", "1" "inputs:reset", "``bool``", "Whether to reset the count", "False" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:count", "``int``", "The current count", "0" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.IntCounter" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Int Counter" "Categories", "examples" "Generated Class Name", "OgnIntCounterDatabase" "Python Module", "omni.graph.examples.python"
1,620
reStructuredText
22.492753
115
0.567901
omniverse-code/kit/exts/omni.graph.examples.python/ogn/docs/OgnTestSingleton.rst
.. _omni_graph_examples_python_TestSingleton_1: .. _omni_graph_examples_python_TestSingleton: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Test Singleton :keywords: lang-en omnigraph node examples python test-singleton Test Singleton ============== .. <description> Example node that showcases the use of singleton nodes (nodes that can have only 1 instance) .. </description> Installation ------------ To use this node enable :ref:`omni.graph.examples.python<ext_omni_graph_examples_python>` in the Extension Manager. Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:out", "``double``", "The unique output of the only instance of this node", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.examples.python.TestSingleton" "Version", "1" "Extension", "omni.graph.examples.python" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "singleton", "1" "uiName", "Test Singleton" "Categories", "examples" "Generated Class Name", "OgnTestSingletonDatabase" "Python Module", "omni.graph.examples.python"
1,488
reStructuredText
23.816666
115
0.583333
omniverse-code/kit/exts/omni.graph.examples.python/config/extension.toml
[package] title = "OmniGraph Python Examples" version = "1.3.2" category = "Graph" readme = "docs/README.md" changelog = "docs/CHANGELOG.md" description = "Contains a set of sample OmniGraph nodes implemented in Python." repository = "" keywords = ["kit", "omnigraph", "nodes", "python"] # Main module for the Python interface [[python.module]] name = "omni.graph.examples.python" # Watch the .ogn files for hot reloading (only works for Python files) [fswatcher.patterns] include = ["*.ogn", "*.py"] exclude = ["Ogn*Database.py"] # Python array data uses numpy as its format [python.pipapi] requirements = ["numpy"] # SWIPAT filed under: http://nvbugs/3193231 # Other extensions that need to load in order for this one to work [dependencies] "omni.graph" = {} "omni.graph.tools" = {} "omni.kit.test" = {} "omni.kit.pipapi" = {} [[test]] stdoutFailPatterns.exclude = [ "*[omni.graph.core.plugin] getTypes called on non-existent path*", "*Trying to create multiple instances of singleton*" ] [documentation] deps = [ ["kit-sdk", "_build/docs/kit-sdk/latest"], # WAR to include omni.graph refs until that workflow is moved ] pages = [ "docs/Overview.md", "docs/CHANGELOG.md", ]
1,199
TOML
25.666666
108
0.69558
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/__init__.py
"""Module containing example nodes written in pure Python. There is no public API to this module. """ __all__ = [] from ._impl.extension import _PublicExtension # noqa: F401
177
Python
21.249997
59
0.711864
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/OgnBouncingCubesGpuDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.examples.python.BouncingCubesGpu Deprecated node - no longer supported """ import sys import traceback import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnBouncingCubesGpuDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.examples.python.BouncingCubesGpu Class Members: node: Node being evaluated """ # Imprint the generator and target ABI versions in the file for JIT generation GENERATOR_VERSION = (1, 41, 3) TARGET_VERSION = (2, 139, 12) # This is an internal object that provides per-class storage of a per-node data dictionary PER_NODE_DATA = {} # This is an internal object that describes unchanging attributes in a generic way # The values in this list are in no particular order, as a per-attribute tuple # Name, Type, ExtendedTypeIndex, UiName, Description, Metadata, # Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg # You should not need to access any of this data directly, use the defined database interfaces INTERFACE = og.Database._get_interface([ ]) class ValuesForInputs(og.DynamicAttributeAccess): LOCAL_PROPERTY_NAMES = { } """Helper class that creates natural hierarchical access to input attributes""" def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface): """Initialize simplified access for the attribute data""" context = node.get_graph().get_default_graph_context() super().__init__(context, node, attributes, dynamic_attributes) self._batchedReadAttributes = [] self._batchedReadValues = [] def _prefetch(self): readAttributes = self._batchedReadAttributes newValues = _og._prefetch_input_attributes_data(readAttributes) if len(readAttributes) == len(newValues): self._batchedReadValues = newValues class ValuesForOutputs(og.DynamicAttributeAccess): LOCAL_PROPERTY_NAMES = { } """Helper class that creates natural hierarchical access to output attributes""" def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface): """Initialize simplified access for the attribute data""" context = node.get_graph().get_default_graph_context() super().__init__(context, node, attributes, dynamic_attributes) self._batchedWriteValues = { } def _commit(self): _og._commit_output_attributes_data(self._batchedWriteValues) self._batchedWriteValues = { } class ValuesForState(og.DynamicAttributeAccess): """Helper class that creates natural hierarchical access to state attributes""" def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface): """Initialize simplified access for the attribute data""" context = node.get_graph().get_default_graph_context() super().__init__(context, node, attributes, dynamic_attributes) def __init__(self, node): super().__init__(node) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT) self.inputs = OgnBouncingCubesGpuDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnBouncingCubesGpuDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnBouncingCubesGpuDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes) class abi: """Class defining the ABI interface for the node type""" @staticmethod def get_node_type(): get_node_type_function = getattr(OgnBouncingCubesGpuDatabase.NODE_TYPE_CLASS, 'get_node_type', None) if callable(get_node_type_function): return get_node_type_function() return 'omni.graph.examples.python.BouncingCubesGpu' @staticmethod def compute(context, node): def database_valid(): return True try: per_node_data = OgnBouncingCubesGpuDatabase.PER_NODE_DATA[node.node_id()] db = per_node_data.get('_db') if db is None: db = OgnBouncingCubesGpuDatabase(node) per_node_data['_db'] = db if not database_valid(): per_node_data['_db'] = None return False except: db = OgnBouncingCubesGpuDatabase(node) try: compute_function = getattr(OgnBouncingCubesGpuDatabase.NODE_TYPE_CLASS, 'compute', None) if callable(compute_function) and compute_function.__code__.co_argcount > 1: return compute_function(context, node) db.inputs._prefetch() db.inputs._setting_locked = True with og.in_compute(): return OgnBouncingCubesGpuDatabase.NODE_TYPE_CLASS.compute(db) except Exception as error: stack_trace = "".join(traceback.format_tb(sys.exc_info()[2].tb_next)) db.log_error(f'Assertion raised in compute - {error}\n{stack_trace}', add_context=False) finally: db.inputs._setting_locked = False db.outputs._commit() return False @staticmethod def initialize(context, node): OgnBouncingCubesGpuDatabase._initialize_per_node_data(node) initialize_function = getattr(OgnBouncingCubesGpuDatabase.NODE_TYPE_CLASS, 'initialize', None) if callable(initialize_function): initialize_function(context, node) per_node_data = OgnBouncingCubesGpuDatabase.PER_NODE_DATA[node.node_id()] def on_connection_or_disconnection(*args): per_node_data['_db'] = None node.register_on_connected_callback(on_connection_or_disconnection) node.register_on_disconnected_callback(on_connection_or_disconnection) @staticmethod def release(node): release_function = getattr(OgnBouncingCubesGpuDatabase.NODE_TYPE_CLASS, 'release', None) if callable(release_function): release_function(node) OgnBouncingCubesGpuDatabase._release_per_node_data(node) @staticmethod def release_instance(node, target): OgnBouncingCubesGpuDatabase._release_per_node_instance_data(node, target) @staticmethod def update_node_version(context, node, old_version, new_version): update_node_version_function = getattr(OgnBouncingCubesGpuDatabase.NODE_TYPE_CLASS, 'update_node_version', None) if callable(update_node_version_function): return update_node_version_function(context, node, old_version, new_version) return False @staticmethod def initialize_type(node_type): initialize_type_function = getattr(OgnBouncingCubesGpuDatabase.NODE_TYPE_CLASS, 'initialize_type', None) needs_initializing = True if callable(initialize_type_function): needs_initializing = initialize_type_function(node_type) if needs_initializing: node_type.set_metadata(ogn.MetadataKeys.EXTENSION, "omni.graph.examples.python") node_type.set_metadata(ogn.MetadataKeys.UI_NAME, "Deprecated Node - Bouncing Cubes (GPU)") node_type.set_metadata(ogn.MetadataKeys.MEMORY_TYPE, "cuda") node_type.set_metadata(ogn.MetadataKeys.CATEGORIES, "examples") node_type.set_metadata(ogn.MetadataKeys.DESCRIPTION, "Deprecated node - no longer supported") node_type.set_metadata(ogn.MetadataKeys.EXCLUSIONS, "usd,test") node_type.set_metadata(ogn.MetadataKeys.LANGUAGE, "Python") node_type.set_metadata(ogn.MetadataKeys.MEMORY_TYPE, "cuda") node_type.set_has_state(True) @staticmethod def on_connection_type_resolve(node): on_connection_type_resolve_function = getattr(OgnBouncingCubesGpuDatabase.NODE_TYPE_CLASS, 'on_connection_type_resolve', None) if callable(on_connection_type_resolve_function): on_connection_type_resolve_function(node) NODE_TYPE_CLASS = None @staticmethod def register(node_type_class): OgnBouncingCubesGpuDatabase.NODE_TYPE_CLASS = node_type_class og.register_node_type(OgnBouncingCubesGpuDatabase.abi, 1) @staticmethod def deregister(): og.deregister_node_type("omni.graph.examples.python.BouncingCubesGpu")
9,183
Python
47.336842
138
0.653055
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/OgnBouncingCubesCpuDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.examples.python.BouncingCubes Deprecated node - no longer supported """ import numpy import sys import traceback import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnBouncingCubesCpuDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.examples.python.BouncingCubes Class Members: node: Node being evaluated Attribute Value Properties: State: state.translations state.velocities """ # Imprint the generator and target ABI versions in the file for JIT generation GENERATOR_VERSION = (1, 41, 3) TARGET_VERSION = (2, 139, 12) # This is an internal object that provides per-class storage of a per-node data dictionary PER_NODE_DATA = {} # This is an internal object that describes unchanging attributes in a generic way # The values in this list are in no particular order, as a per-attribute tuple # Name, Type, ExtendedTypeIndex, UiName, Description, Metadata, # Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg # You should not need to access any of this data directly, use the defined database interfaces INTERFACE = og.Database._get_interface([ ('state:translations', 'float3[]', 0, 'Translations', 'Set of translation attributes gathered from the inputs.\nTranslations have velocities applied to them each evaluation.', {}, True, None, False, ''), ('state:velocities', 'float[]', 0, 'Velocities', 'Set of velocity attributes gathered from the inputs', {}, True, None, False, ''), ]) class ValuesForInputs(og.DynamicAttributeAccess): LOCAL_PROPERTY_NAMES = { } """Helper class that creates natural hierarchical access to input attributes""" def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface): """Initialize simplified access for the attribute data""" context = node.get_graph().get_default_graph_context() super().__init__(context, node, attributes, dynamic_attributes) self._batchedReadAttributes = [] self._batchedReadValues = [] def _prefetch(self): readAttributes = self._batchedReadAttributes newValues = _og._prefetch_input_attributes_data(readAttributes) if len(readAttributes) == len(newValues): self._batchedReadValues = newValues class ValuesForOutputs(og.DynamicAttributeAccess): LOCAL_PROPERTY_NAMES = { } """Helper class that creates natural hierarchical access to output attributes""" def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface): """Initialize simplified access for the attribute data""" context = node.get_graph().get_default_graph_context() super().__init__(context, node, attributes, dynamic_attributes) self._batchedWriteValues = { } def _commit(self): _og._commit_output_attributes_data(self._batchedWriteValues) self._batchedWriteValues = { } class ValuesForState(og.DynamicAttributeAccess): """Helper class that creates natural hierarchical access to state attributes""" def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface): """Initialize simplified access for the attribute data""" context = node.get_graph().get_default_graph_context() super().__init__(context, node, attributes, dynamic_attributes) self.translations_size = None self.velocities_size = None @property def translations(self): data_view = og.AttributeValueHelper(self._attributes.translations) self.translations_size = data_view.get_array_size() return data_view.get() @translations.setter def translations(self, value): data_view = og.AttributeValueHelper(self._attributes.translations) data_view.set(value) self.translations_size = data_view.get_array_size() @property def velocities(self): data_view = og.AttributeValueHelper(self._attributes.velocities) self.velocities_size = data_view.get_array_size() return data_view.get() @velocities.setter def velocities(self, value): data_view = og.AttributeValueHelper(self._attributes.velocities) data_view.set(value) self.velocities_size = data_view.get_array_size() def __init__(self, node): super().__init__(node) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT) self.inputs = OgnBouncingCubesCpuDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnBouncingCubesCpuDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnBouncingCubesCpuDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes) class abi: """Class defining the ABI interface for the node type""" @staticmethod def get_node_type(): get_node_type_function = getattr(OgnBouncingCubesCpuDatabase.NODE_TYPE_CLASS, 'get_node_type', None) if callable(get_node_type_function): return get_node_type_function() return 'omni.graph.examples.python.BouncingCubes' @staticmethod def compute(context, node): def database_valid(): return True try: per_node_data = OgnBouncingCubesCpuDatabase.PER_NODE_DATA[node.node_id()] db = per_node_data.get('_db') if db is None: db = OgnBouncingCubesCpuDatabase(node) per_node_data['_db'] = db if not database_valid(): per_node_data['_db'] = None return False except: db = OgnBouncingCubesCpuDatabase(node) try: compute_function = getattr(OgnBouncingCubesCpuDatabase.NODE_TYPE_CLASS, 'compute', None) if callable(compute_function) and compute_function.__code__.co_argcount > 1: return compute_function(context, node) db.inputs._prefetch() db.inputs._setting_locked = True with og.in_compute(): return OgnBouncingCubesCpuDatabase.NODE_TYPE_CLASS.compute(db) except Exception as error: stack_trace = "".join(traceback.format_tb(sys.exc_info()[2].tb_next)) db.log_error(f'Assertion raised in compute - {error}\n{stack_trace}', add_context=False) finally: db.inputs._setting_locked = False db.outputs._commit() return False @staticmethod def initialize(context, node): OgnBouncingCubesCpuDatabase._initialize_per_node_data(node) initialize_function = getattr(OgnBouncingCubesCpuDatabase.NODE_TYPE_CLASS, 'initialize', None) if callable(initialize_function): initialize_function(context, node) per_node_data = OgnBouncingCubesCpuDatabase.PER_NODE_DATA[node.node_id()] def on_connection_or_disconnection(*args): per_node_data['_db'] = None node.register_on_connected_callback(on_connection_or_disconnection) node.register_on_disconnected_callback(on_connection_or_disconnection) @staticmethod def release(node): release_function = getattr(OgnBouncingCubesCpuDatabase.NODE_TYPE_CLASS, 'release', None) if callable(release_function): release_function(node) OgnBouncingCubesCpuDatabase._release_per_node_data(node) @staticmethod def release_instance(node, target): OgnBouncingCubesCpuDatabase._release_per_node_instance_data(node, target) @staticmethod def update_node_version(context, node, old_version, new_version): update_node_version_function = getattr(OgnBouncingCubesCpuDatabase.NODE_TYPE_CLASS, 'update_node_version', None) if callable(update_node_version_function): return update_node_version_function(context, node, old_version, new_version) return False @staticmethod def initialize_type(node_type): initialize_type_function = getattr(OgnBouncingCubesCpuDatabase.NODE_TYPE_CLASS, 'initialize_type', None) needs_initializing = True if callable(initialize_type_function): needs_initializing = initialize_type_function(node_type) if needs_initializing: node_type.set_metadata(ogn.MetadataKeys.EXTENSION, "omni.graph.examples.python") node_type.set_metadata(ogn.MetadataKeys.UI_NAME, "Deprecated Node - Bouncing Cubes (GPU)") node_type.set_metadata(ogn.MetadataKeys.CATEGORIES, "examples") node_type.set_metadata(ogn.MetadataKeys.DESCRIPTION, "Deprecated node - no longer supported") node_type.set_metadata(ogn.MetadataKeys.LANGUAGE, "Python") OgnBouncingCubesCpuDatabase.INTERFACE.add_to_node_type(node_type) node_type.set_has_state(True) @staticmethod def on_connection_type_resolve(node): on_connection_type_resolve_function = getattr(OgnBouncingCubesCpuDatabase.NODE_TYPE_CLASS, 'on_connection_type_resolve', None) if callable(on_connection_type_resolve_function): on_connection_type_resolve_function(node) NODE_TYPE_CLASS = None @staticmethod def register(node_type_class): OgnBouncingCubesCpuDatabase.NODE_TYPE_CLASS = node_type_class og.register_node_type(OgnBouncingCubesCpuDatabase.abi, 1) @staticmethod def deregister(): og.deregister_node_type("omni.graph.examples.python.BouncingCubes")
10,508
Python
46.337838
211
0.649505
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/OgnPositionToColorDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.examples.python.PositionToColor This node takes positional data (double3) and converts to a color, and outputs as color3f[] (which seems to be the default color connection in USD) """ import numpy import sys import traceback import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnPositionToColorDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.examples.python.PositionToColor Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.color_offset inputs.position inputs.scale Outputs: outputs.color """ # Imprint the generator and target ABI versions in the file for JIT generation GENERATOR_VERSION = (1, 41, 3) TARGET_VERSION = (2, 139, 12) # This is an internal object that provides per-class storage of a per-node data dictionary PER_NODE_DATA = {} # This is an internal object that describes unchanging attributes in a generic way # The values in this list are in no particular order, as a per-attribute tuple # Name, Type, ExtendedTypeIndex, UiName, Description, Metadata, # Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg # You should not need to access any of this data directly, use the defined database interfaces INTERFACE = og.Database._get_interface([ ('inputs:color_offset', 'color3f', 0, None, 'Offset added to the scaled color to get the final result', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:position', 'double3', 0, None, 'Position to be converted to a color', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:scale', 'float', 0, None, 'Constant by which to multiply the position to get the color', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''), ('outputs:color', 'color3f[]', 0, None, 'Color value extracted from the position', {}, True, None, False, ''), ]) @classmethod def _populate_role_data(cls): """Populate a role structure with the non-default roles on this node type""" role_data = super()._populate_role_data() role_data.inputs.color_offset = og.AttributeRole.COLOR role_data.outputs.color = og.AttributeRole.COLOR return role_data class ValuesForInputs(og.DynamicAttributeAccess): LOCAL_PROPERTY_NAMES = {"color_offset", "position", "scale", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"} """Helper class that creates natural hierarchical access to input attributes""" def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface): """Initialize simplified access for the attribute data""" context = node.get_graph().get_default_graph_context() super().__init__(context, node, attributes, dynamic_attributes) self._batchedReadAttributes = [self._attributes.color_offset, self._attributes.position, self._attributes.scale] self._batchedReadValues = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], 1.0] @property def color_offset(self): return self._batchedReadValues[0] @color_offset.setter def color_offset(self, value): self._batchedReadValues[0] = value @property def position(self): return self._batchedReadValues[1] @position.setter def position(self, value): self._batchedReadValues[1] = value @property def scale(self): return self._batchedReadValues[2] @scale.setter def scale(self, value): self._batchedReadValues[2] = value def __getattr__(self, item: str): if item in self.LOCAL_PROPERTY_NAMES: return object.__getattribute__(self, item) else: return super().__getattr__(item) def __setattr__(self, item: str, new_value): if item in self.LOCAL_PROPERTY_NAMES: object.__setattr__(self, item, new_value) else: super().__setattr__(item, new_value) def _prefetch(self): readAttributes = self._batchedReadAttributes newValues = _og._prefetch_input_attributes_data(readAttributes) if len(readAttributes) == len(newValues): self._batchedReadValues = newValues class ValuesForOutputs(og.DynamicAttributeAccess): LOCAL_PROPERTY_NAMES = { } """Helper class that creates natural hierarchical access to output attributes""" def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface): """Initialize simplified access for the attribute data""" context = node.get_graph().get_default_graph_context() super().__init__(context, node, attributes, dynamic_attributes) self.color_size = None self._batchedWriteValues = { } @property def color(self): data_view = og.AttributeValueHelper(self._attributes.color) return data_view.get(reserved_element_count=self.color_size) @color.setter def color(self, value): data_view = og.AttributeValueHelper(self._attributes.color) data_view.set(value) self.color_size = data_view.get_array_size() def _commit(self): _og._commit_output_attributes_data(self._batchedWriteValues) self._batchedWriteValues = { } class ValuesForState(og.DynamicAttributeAccess): """Helper class that creates natural hierarchical access to state attributes""" def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface): """Initialize simplified access for the attribute data""" context = node.get_graph().get_default_graph_context() super().__init__(context, node, attributes, dynamic_attributes) def __init__(self, node): super().__init__(node) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT) self.inputs = OgnPositionToColorDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnPositionToColorDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnPositionToColorDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes) class abi: """Class defining the ABI interface for the node type""" @staticmethod def get_node_type(): get_node_type_function = getattr(OgnPositionToColorDatabase.NODE_TYPE_CLASS, 'get_node_type', None) if callable(get_node_type_function): return get_node_type_function() return 'omni.graph.examples.python.PositionToColor' @staticmethod def compute(context, node): def database_valid(): return True try: per_node_data = OgnPositionToColorDatabase.PER_NODE_DATA[node.node_id()] db = per_node_data.get('_db') if db is None: db = OgnPositionToColorDatabase(node) per_node_data['_db'] = db if not database_valid(): per_node_data['_db'] = None return False except: db = OgnPositionToColorDatabase(node) try: compute_function = getattr(OgnPositionToColorDatabase.NODE_TYPE_CLASS, 'compute', None) if callable(compute_function) and compute_function.__code__.co_argcount > 1: return compute_function(context, node) db.inputs._prefetch() db.inputs._setting_locked = True with og.in_compute(): return OgnPositionToColorDatabase.NODE_TYPE_CLASS.compute(db) except Exception as error: stack_trace = "".join(traceback.format_tb(sys.exc_info()[2].tb_next)) db.log_error(f'Assertion raised in compute - {error}\n{stack_trace}', add_context=False) finally: db.inputs._setting_locked = False db.outputs._commit() return False @staticmethod def initialize(context, node): OgnPositionToColorDatabase._initialize_per_node_data(node) initialize_function = getattr(OgnPositionToColorDatabase.NODE_TYPE_CLASS, 'initialize', None) if callable(initialize_function): initialize_function(context, node) per_node_data = OgnPositionToColorDatabase.PER_NODE_DATA[node.node_id()] def on_connection_or_disconnection(*args): per_node_data['_db'] = None node.register_on_connected_callback(on_connection_or_disconnection) node.register_on_disconnected_callback(on_connection_or_disconnection) @staticmethod def release(node): release_function = getattr(OgnPositionToColorDatabase.NODE_TYPE_CLASS, 'release', None) if callable(release_function): release_function(node) OgnPositionToColorDatabase._release_per_node_data(node) @staticmethod def release_instance(node, target): OgnPositionToColorDatabase._release_per_node_instance_data(node, target) @staticmethod def update_node_version(context, node, old_version, new_version): update_node_version_function = getattr(OgnPositionToColorDatabase.NODE_TYPE_CLASS, 'update_node_version', None) if callable(update_node_version_function): return update_node_version_function(context, node, old_version, new_version) return False @staticmethod def initialize_type(node_type): initialize_type_function = getattr(OgnPositionToColorDatabase.NODE_TYPE_CLASS, 'initialize_type', None) needs_initializing = True if callable(initialize_type_function): needs_initializing = initialize_type_function(node_type) if needs_initializing: node_type.set_metadata(ogn.MetadataKeys.EXTENSION, "omni.graph.examples.python") node_type.set_metadata(ogn.MetadataKeys.UI_NAME, "PositionToColor") node_type.set_metadata(ogn.MetadataKeys.CATEGORIES, "examples") node_type.set_metadata(ogn.MetadataKeys.DESCRIPTION, "This node takes positional data (double3) and converts to a color, and outputs as color3f[] (which seems to be the default color connection in USD)") node_type.set_metadata(ogn.MetadataKeys.LANGUAGE, "Python") OgnPositionToColorDatabase.INTERFACE.add_to_node_type(node_type) @staticmethod def on_connection_type_resolve(node): on_connection_type_resolve_function = getattr(OgnPositionToColorDatabase.NODE_TYPE_CLASS, 'on_connection_type_resolve', None) if callable(on_connection_type_resolve_function): on_connection_type_resolve_function(node) NODE_TYPE_CLASS = None @staticmethod def register(node_type_class): OgnPositionToColorDatabase.NODE_TYPE_CLASS = node_type_class og.register_node_type(OgnPositionToColorDatabase.abi, 1) @staticmethod def deregister(): og.deregister_node_type("omni.graph.examples.python.PositionToColor")
12,043
Python
45.863813
220
0.639708
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/tutorial1/OgnAbsDouble.py
""" Implementation of an OmniGraph node takes the absolute value of a number """ class OgnAbsDouble: @staticmethod def compute(db): db.outputs.out = abs(db.inputs.num) return True
206
Python
17.81818
72
0.669903
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/tutorial1/OgnComposeDouble3.py
""" Implementation of an OmniGraph node that composes a double3 from its components """ class OgnComposeDouble3: @staticmethod def compute(db): db.outputs.double3 = (db.inputs.x, db.inputs.y, db.inputs.z) return True
243
Python
21.181816
79
0.687243
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/tutorial1/OgnDeformerYAxis.py
""" Implementation of an OmniGraph node that deforms a surface using a sine wave """ import numpy as np class OgnDeformerYAxis: @staticmethod def compute(db): """Deform the input points by a multiple of the sine wave""" points = db.inputs.points multiplier = db.inputs.multiplier wavelength = db.inputs.wavelength offset = db.inputs.offset db.outputs.points_size = points.shape[0] # Nothing to evaluate if there are no input points if db.outputs.points_size == 0: return True output_points = db.outputs.points if wavelength <= 0: wavelength = 1.0 pt = points.copy() # we still need to do a copy here because we do not want to modify points tx = pt[:, 0] offset_tx = tx + offset disp = np.sin(offset_tx / wavelength) pt[:, 1] += disp * multiplier output_points[:] = pt[:] # we modify output_points in memory so we do not need to set the value again return True
1,037
Python
29.529411
110
0.612343
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/tutorial1/OgnClampDouble.py
""" Implementation of an OmniGraph node that clamps a double value """ class OgnClampDouble: @staticmethod def compute(db): if db.inputs.num < db.inputs.min: db.outputs.out = db.inputs.min elif db.inputs.num > db.inputs.max: db.outputs.out = db.inputs.max else: db.outputs.out = db.inputs.num return True
384
Python
21.647058
62
0.596354
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/tutorial1/OgnDecomposeDouble3.py
""" Implementation of an OmniGraph node that decomposes a double3 into its comonents """ class OgnDecomposeDouble3: @staticmethod def compute(db): in_double3 = db.inputs.double3 db.outputs.x = in_double3[0] db.outputs.y = in_double3[1] db.outputs.z = in_double3[2] return True
327
Python
22.42857
80
0.64526
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/tutorial1/OgnMultDouble.py
""" Implementation of an OmniGraph node that calculates a * b """ class OgnMultDouble: @staticmethod def compute(db): db.outputs.out = db.inputs.a * db.inputs.b return True
199
Python
17.181817
57
0.648241
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/tutorial1/OgnSubtractDouble.py
""" Implementation of an OmniGraph node that subtracts b from a """ class OgnSubtractDouble: @staticmethod def compute(db): db.outputs.out = db.inputs.a - db.inputs.b return True
205
Python
17.727271
59
0.663415
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/tutorial1/OgnPositionToColor.py
""" Implementation of the node algorith to convert a position to a color """ class OgnPositionToColor: """ This node takes positional data (double3) and converts to a color, and outputs as color3f[] (which seems to be the default color connection in USD) """ @staticmethod def compute(db): """Run the algorithm to convert a position to a color""" position = db.inputs.position scale_value = db.inputs.scale color_offset = db.inputs.color_offset color = (abs(position[:])) / scale_value color += color_offset ramp = (scale_value - abs(position[0])) / scale_value ramp = max(ramp, 0) color[0] -= ramp if color[0] < 0: color[0] = 0 color[1] += ramp if color[1] > 1: color[1] = 1 color[2] -= ramp if color[2] < 0: color[2] = 0 db.outputs.color_size = 1 db.outputs.color[0] = color return True
993
Python
24.487179
82
0.558912
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/realtime/OgnBouncingCubesCpu.py
""" Example node showing realtime update from gathered data. """ class OgnBouncingCubesCpu: @staticmethod def compute(db): velocities = db.state.velocities translations = db.state.translations # Empty input means nothing to do if translations.size == 0 or velocities.size == 0: return True h = 1.0 / 60.0 g = -1000.0 for ii, velocity in enumerate(velocities): velocity += h * g translations[ii][2] += h * velocity if translations[ii][2] < 1.0: translations[ii][2] = 1.0 velocity = -5 * h * g translations[0][0] += 0.03 translations[1][0] += 0.03 # We no longer need to set values because we do not copy memory of the numpy arrays # Mutating the numpy array will also mutate the attribute data # Alternative, setting values using the below lines will also work # context.set_attr_value(translations, attr_translations) # context.set_attr_value(velocities, attr_translations) return True
1,102
Python
29.638888
91
0.598004
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/realtime/OgnBouncingCubesGpu.py
""" Example node showing realtime update from gathered data computed on the GPU. """ class OgnBouncingCubesGpu: @staticmethod def compute(db): # This is how it should work when gather is fully supported # velocities = db.state.velocities # translations = db.state.translations attr_velocities = db.node.get_attribute("state:velocities") attr_translations = db.node.get_attribute("state:translations") velocities = db.context_helper.get_attr_value(attr_velocities, isGPU=True, isTensor=True) translations = db.context_helper.get_attr_value(attr_translations, isGPU=True, isTensor=True) # When there is no data there is nothing to do if velocities.size == 0 or translations.size == 0: return True h = 1.0 / 60.0 g = -1000.0 velocities += h * g translations[:, 2] += h * velocities translations_z = translations.split(1, dim=1)[2].squeeze(-1) update_idx = (translations_z < 1.0).nonzero().squeeze(-1) if update_idx.shape[0] > 0: translations[update_idx, 2] = 1 velocities[update_idx] = -5 * h * g translations[:, 0] += 0.03 # We no longer need to set values because we do not copy memory of the numpy arrays # Mutating the numpy array will also mutate the attribute data # Computegraph APIs using torch tensors currently do not have support for setting values. # context.set_attr_value(translations, attr_translations) # context.set_attr_value(velocities, attr_translations) return True
1,624
Python
35.11111
101
0.644089
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/utility/OgnPyUniversalAdd.py
class OgnPyUniversalAdd: @staticmethod def compute(db): db.outputs.bool_0 = db.inputs.bool_0 ^ db.inputs.bool_1 db.outputs.bool_arr_0 = [ db.inputs.bool_arr_0[i] ^ db.inputs.bool_arr_1[i] for i in range(len(db.inputs.bool_arr_0)) ] db.outputs.colord3_0 = db.inputs.colord3_0 + db.inputs.colord3_1 db.outputs.colord4_0 = db.inputs.colord4_0 + db.inputs.colord4_1 db.outputs.colord3_arr_0 = db.inputs.colord3_arr_0 + db.inputs.colord3_arr_1 db.outputs.colord4_arr_0 = db.inputs.colord4_arr_0 + db.inputs.colord4_arr_1 db.outputs.colorf3_0 = db.inputs.colorf3_0 + db.inputs.colorf3_1 db.outputs.colorf4_0 = db.inputs.colorf4_0 + db.inputs.colorf4_1 db.outputs.colorf3_arr_0 = db.inputs.colorf3_arr_0 + db.inputs.colorf3_arr_1 db.outputs.colorf4_arr_0 = db.inputs.colorf4_arr_0 + db.inputs.colorf4_arr_1 db.outputs.colorh3_0 = db.inputs.colorh3_0 + db.inputs.colorh3_1 db.outputs.colorh4_0 = db.inputs.colorh4_0 + db.inputs.colorh4_1 db.outputs.colorh3_arr_0 = db.inputs.colorh3_arr_0 + db.inputs.colorh3_arr_1 db.outputs.colorh4_arr_0 = db.inputs.colorh4_arr_0 + db.inputs.colorh4_arr_1 db.outputs.double_0 = db.inputs.double_0 + db.inputs.double_1 db.outputs.double2_0 = db.inputs.double2_0 + db.inputs.double2_1 db.outputs.double3_0 = db.inputs.double3_0 + db.inputs.double3_1 db.outputs.double4_0 = db.inputs.double4_0 + db.inputs.double4_1 db.outputs.double_arr_0 = db.inputs.double_arr_0 + db.inputs.double_arr_1 db.outputs.double2_arr_0 = db.inputs.double2_arr_0 + db.inputs.double2_arr_1 db.outputs.double3_arr_0 = db.inputs.double3_arr_0 + db.inputs.double3_arr_1 db.outputs.double4_arr_0 = db.inputs.double4_arr_0 + db.inputs.double4_arr_1 db.outputs.float_0 = db.inputs.float_0 + db.inputs.float_1 db.outputs.float2_0 = db.inputs.float2_0 + db.inputs.float2_1 db.outputs.float3_0 = db.inputs.float3_0 + db.inputs.float3_1 db.outputs.float4_0 = db.inputs.float4_0 + db.inputs.float4_1 db.outputs.float_arr_0 = db.inputs.float_arr_0 + db.inputs.float_arr_1 db.outputs.float2_arr_0 = db.inputs.float2_arr_0 + db.inputs.float2_arr_1 db.outputs.float3_arr_0 = db.inputs.float3_arr_0 + db.inputs.float3_arr_1 db.outputs.float4_arr_0 = db.inputs.float4_arr_0 + db.inputs.float4_arr_1 db.outputs.frame4_0 = db.inputs.frame4_0 + db.inputs.frame4_1 db.outputs.frame4_arr_0 = db.inputs.frame4_arr_0 + db.inputs.frame4_arr_1 db.outputs.half_0 = db.inputs.half_0 + db.inputs.half_1 db.outputs.half2_0 = db.inputs.half2_0 + db.inputs.half2_1 db.outputs.half3_0 = db.inputs.half3_0 + db.inputs.half3_1 db.outputs.half4_0 = db.inputs.half4_0 + db.inputs.half4_1 db.outputs.half_arr_0 = db.inputs.half_arr_0 + db.inputs.half_arr_1 db.outputs.half2_arr_0 = db.inputs.half2_arr_0 + db.inputs.half2_arr_1 db.outputs.half3_arr_0 = db.inputs.half3_arr_0 + db.inputs.half3_arr_1 db.outputs.half4_arr_0 = db.inputs.half4_arr_0 + db.inputs.half4_arr_1 db.outputs.int_0 = db.inputs.int_0 + db.inputs.int_1 db.outputs.int2_0 = db.inputs.int2_0 + db.inputs.int2_1 db.outputs.int3_0 = db.inputs.int3_0 + db.inputs.int3_1 db.outputs.int4_0 = db.inputs.int4_0 + db.inputs.int4_1 db.outputs.int_arr_0 = db.inputs.int_arr_0 + db.inputs.int_arr_1 db.outputs.int2_arr_0 = db.inputs.int2_arr_0 + db.inputs.int2_arr_1 db.outputs.int3_arr_0 = db.inputs.int3_arr_0 + db.inputs.int3_arr_1 db.outputs.int4_arr_0 = db.inputs.int4_arr_0 + db.inputs.int4_arr_1 db.outputs.int64_0 = db.inputs.int64_0 + db.inputs.int64_1 db.outputs.int64_arr_0 = db.inputs.int64_arr_0 + db.inputs.int64_arr_1 db.outputs.matrixd2_0 = db.inputs.matrixd2_0 + db.inputs.matrixd2_1 db.outputs.matrixd3_0 = db.inputs.matrixd3_0 + db.inputs.matrixd3_1 db.outputs.matrixd4_0 = db.inputs.matrixd4_0 + db.inputs.matrixd4_1 db.outputs.matrixd2_arr_0 = db.inputs.matrixd2_arr_0 + db.inputs.matrixd2_arr_1 db.outputs.matrixd3_arr_0 = db.inputs.matrixd3_arr_0 + db.inputs.matrixd3_arr_1 db.outputs.matrixd4_arr_0 = db.inputs.matrixd4_arr_0 + db.inputs.matrixd4_arr_1 db.outputs.normald3_0 = db.inputs.normald3_0 + db.inputs.normald3_1 db.outputs.normald3_arr_0 = db.inputs.normald3_arr_0 + db.inputs.normald3_arr_1 db.outputs.normalf3_0 = db.inputs.normalf3_0 + db.inputs.normalf3_1 db.outputs.normalf3_arr_0 = db.inputs.normalf3_arr_0 + db.inputs.normalf3_arr_1 db.outputs.normalh3_0 = db.inputs.normalh3_0 + db.inputs.normalh3_1 db.outputs.normalh3_arr_0 = db.inputs.normalh3_arr_0 + db.inputs.normalh3_arr_1 db.outputs.pointd3_0 = db.inputs.pointd3_0 + db.inputs.pointd3_1 db.outputs.pointd3_arr_0 = db.inputs.pointd3_arr_0 + db.inputs.pointd3_arr_1 db.outputs.pointf3_0 = db.inputs.pointf3_0 + db.inputs.pointf3_1 db.outputs.pointf3_arr_0 = db.inputs.pointf3_arr_0 + db.inputs.pointf3_arr_1 db.outputs.pointh3_0 = db.inputs.pointh3_0 + db.inputs.pointh3_1 db.outputs.pointh3_arr_0 = db.inputs.pointh3_arr_0 + db.inputs.pointh3_arr_1 db.outputs.quatd4_0 = db.inputs.quatd4_0 + db.inputs.quatd4_1 db.outputs.quatd4_arr_0 = db.inputs.quatd4_arr_0 + db.inputs.quatd4_arr_1 db.outputs.quatf4_0 = db.inputs.quatf4_0 + db.inputs.quatf4_1 db.outputs.quatf4_arr_0 = db.inputs.quatf4_arr_0 + db.inputs.quatf4_arr_1 db.outputs.quath4_0 = db.inputs.quath4_0 + db.inputs.quath4_1 db.outputs.quath4_arr_0 = db.inputs.quath4_arr_0 + db.inputs.quath4_arr_1 db.outputs.texcoordd2_0 = db.inputs.texcoordd2_0 + db.inputs.texcoordd2_1 db.outputs.texcoordd3_0 = db.inputs.texcoordd3_0 + db.inputs.texcoordd3_1 db.outputs.texcoordd2_arr_0 = db.inputs.texcoordd2_arr_0 + db.inputs.texcoordd2_arr_1 db.outputs.texcoordd3_arr_0 = db.inputs.texcoordd3_arr_0 + db.inputs.texcoordd3_arr_1 db.outputs.texcoordf2_0 = db.inputs.texcoordf2_0 + db.inputs.texcoordf2_1 db.outputs.texcoordf3_0 = db.inputs.texcoordf3_0 + db.inputs.texcoordf3_1 db.outputs.texcoordf2_arr_0 = db.inputs.texcoordf2_arr_0 + db.inputs.texcoordf2_arr_1 db.outputs.texcoordf3_arr_0 = db.inputs.texcoordf3_arr_0 + db.inputs.texcoordf3_arr_1 db.outputs.texcoordh2_0 = db.inputs.texcoordh2_0 + db.inputs.texcoordh2_1 db.outputs.texcoordh3_0 = db.inputs.texcoordh3_0 + db.inputs.texcoordh3_1 db.outputs.texcoordh2_arr_0 = db.inputs.texcoordh2_arr_0 + db.inputs.texcoordh2_arr_1 db.outputs.texcoordh3_arr_0 = db.inputs.texcoordh3_arr_0 + db.inputs.texcoordh3_arr_1 db.outputs.timecode_0 = db.inputs.timecode_0 + db.inputs.timecode_1 db.outputs.timecode_arr_0 = db.inputs.timecode_arr_0 + db.inputs.timecode_arr_1 db.outputs.token_0 = db.inputs.token_0 + db.inputs.token_1 db.outputs.token_arr_0 = [ db.inputs.token_arr_0[i] + db.inputs.token_arr_1[i] for i in range(len(db.inputs.token_arr_0)) ] db.outputs.transform4_0 = db.inputs.transform4_0 + db.inputs.transform4_1 db.outputs.transform4_arr_0 = db.inputs.transform4_arr_0 + db.inputs.transform4_arr_1 db.outputs.uchar_0 = db.inputs.uchar_0 + db.inputs.uchar_1 db.outputs.uchar_arr_0 = db.inputs.uchar_arr_0 + db.inputs.uchar_arr_1 db.outputs.uint_0 = db.inputs.uint_0 + db.inputs.uint_1 db.outputs.uint_arr_0 = db.inputs.uint_arr_0 + db.inputs.uint_arr_1 db.outputs.uint64_0 = db.inputs.uint64_0 + db.inputs.uint64_1 db.outputs.uint64_arr_0 = db.inputs.uint64_arr_0 + db.inputs.uint64_arr_1 db.outputs.vectord3_0 = db.inputs.vectord3_0 + db.inputs.vectord3_1 db.outputs.vectord3_arr_0 = db.inputs.vectord3_arr_0 + db.inputs.vectord3_arr_1 db.outputs.vectorf3_0 = db.inputs.vectorf3_0 + db.inputs.vectorf3_1 db.outputs.vectorf3_arr_0 = db.inputs.vectorf3_arr_0 + db.inputs.vectorf3_arr_1 db.outputs.vectorh3_0 = db.inputs.vectorh3_0 + db.inputs.vectorh3_1 db.outputs.vectorh3_arr_0 = db.inputs.vectorh3_arr_0 + db.inputs.vectorh3_arr_1 return True
8,362
Python
72.359648
106
0.669816
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/utility/OgnDynamicSwitch.py
""" Implementation of an stateful OmniGraph node that enables 1 branch or another using dynamic scheduling """ class OgnDynamicSwitch: @staticmethod def compute(db): db.node.set_dynamic_downstream_control(True) left_out_attr = db.node.get_attribute("outputs:left_out") right_out_attr = db.node.get_attribute("outputs:right_out") if db.inputs.switch > 0: left_out_attr.set_disable_dynamic_downstream_work(True) right_out_attr.set_disable_dynamic_downstream_work(False) else: left_out_attr.set_disable_dynamic_downstream_work(False) right_out_attr.set_disable_dynamic_downstream_work(True) db.outputs.left_out = db.inputs.left_value db.outputs.right_out = db.inputs.right_value return True
812
Python
34.347825
102
0.671182
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/stateful/OgnCountTo.py
""" Implementation of an stateful OmniGraph node that counts to a number defined by countTo """ class OgnCountTo: @staticmethod def compute(db): if db.inputs.reset: db.outputs.count = 0 else: db.outputs.count = db.outputs.count + db.inputs.increment if db.outputs.count > db.inputs.countTo: db.outputs.count = db.inputs.countTo else: db.node.set_compute_incomplete() return True
495
Python
23.799999
87
0.589899
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/stateful/OgnIntCounter.py
""" Implementation of an stateful OmniGraph node that counts up by an increment """ class OgnIntCounter: @staticmethod def compute(db): if db.inputs.reset: db.outputs.count = 0 else: db.outputs.count = db.outputs.count + db.inputs.increment return True
312
Python
19.866665
75
0.625
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/tests/OgnTestInitNode.py
import omni.graph.core as og class OgnTestInitNode: @staticmethod def initialize(context, node): _ = og.Controller() @staticmethod def release(node): pass @staticmethod def compute(db): db.outputs.value = 1.0 return True
281
Python
15.588234
34
0.608541
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/tests/OgnTestSingleton.py
class OgnTestSingleton: @staticmethod def compute(db): db.outputs.out = 88.8 return True
113
Python
17.999997
29
0.619469
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/deformers/OgnVersionedDeformerPy.py
""" Implementation of a Python node that handles a simple version upgrade where the different versions contain different attributes: Version 0: multiplier Version 1: multiplier, wavelength Version 2: wavelength Depending on the version that was received the upgrade will remove the obsolete "multiplier" attribute and/or insert the new "wavelength" attribute. """ import numpy as np import omni.graph.core as og class OgnVersionedDeformerPy: @staticmethod def compute(db): input_points = db.inputs.points if len(input_points) <= 0: return False wavelength = db.inputs.wavelength if wavelength <= 0.0: wavelength = 310.0 db.outputs.points_size = input_points.shape[0] # Nothing to evaluate if there are no input points if db.outputs.points_size == 0: return True output_points = db.outputs.points pt = input_points.copy() # we still need to do a copy here because we do not want to modify points tx = (pt[:, 0] - wavelength) / wavelength ty = (pt[:, 1] - wavelength) / wavelength disp = 10.0 * (np.sin(tx * 10.0) + np.cos(ty * 15.0)) pt[:, 2] += disp * 5 output_points[:] = pt[:] # we modify output_points in memory so we do not need to set the value again return True @staticmethod def update_node_version(context, node, old_version, new_version): if old_version < new_version: if old_version < 1: node.create_attribute( "inputs:wavelength", og.Type(og.BaseDataType.FLOAT), og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT, 50.0, ) if old_version < 2: node.remove_attribute("inputs:multiplier") return True return False @staticmethod def initialize_type(node_type): node_type.add_input("test_input", "int", True) node_type.add_output("test_output", "float", True) node_type.add_extended_input( "test_union_input", "float,double", True, og.ExtendedAttributeType.EXTENDED_ATTR_TYPE_UNION ) return True
2,233
Python
33.906249
110
0.605911
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/python/nodes/deformers/OgnDeformerGpu.py
""" Implementation of an OmniGraph node that runs a simple deformer on the GPU """ from contextlib import suppress with suppress(ImportError): import torch class OgnDeformerGpu: @staticmethod def compute(db) -> bool: try: # TODO: This method of GPU compute isn't recommended. Use CPU compute or Warp. if torch: input_points = db.inputs.points multiplier = db.inputs.multiplier db.outputs.points_size = input_points.shape[0] # Nothing to evaluate if there are no input points if db.outputs.points_size == 0: return True output_points = db.outputs.points pt = input_points.copy() tx = (pt[:, 0] - 310.0) / 310.0 ty = (pt[:, 1] - 310.0) / 310.0 disp = 10.0 * (torch.sin(tx * 10.0) + torch.cos(ty * 15.0)) pt[:, 2] += disp * multiplier output_points[:] = pt[:] return True except NameError: db.log_warning("Torch not found, no compute") return False
1,153
Python
30.189188
90
0.525585
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/tests/TestOgnDynamicSwitch.py
import omni.kit.test import omni.graph.core as og import omni.graph.core.tests as ogts from omni.graph.core.tests.omnigraph_test_utils import _TestGraphAndNode from omni.graph.core.tests.omnigraph_test_utils import _test_clear_scene from omni.graph.core.tests.omnigraph_test_utils import _test_setup_scene from omni.graph.core.tests.omnigraph_test_utils import _test_verify_scene class TestOgn(ogts.OmniGraphTestCase): async def test_data_access(self): from omni.graph.examples.python.ogn.OgnDynamicSwitchDatabase import OgnDynamicSwitchDatabase (_, (test_node,), _, _) = og.Controller.edit("/TestGraph", { og.Controller.Keys.CREATE_NODES: ("Template_omni_graph_examples_python_DynamicSwitch", "omni.graph.examples.python.DynamicSwitch") }) database = OgnDynamicSwitchDatabase(test_node) self.assertTrue(test_node.is_valid()) node_type_name = test_node.get_type_name() self.assertEqual(og.GraphRegistry().get_node_type_version(node_type_name), 1) def _attr_error(attribute: og.Attribute, usd_test: bool) -> str: test_type = "USD Load" if usd_test else "Database Access" return f"{node_type_name} {test_type} Test - {attribute.get_name()} value error" self.assertTrue(test_node.get_attribute_exists("inputs:left_value")) attribute = test_node.get_attribute("inputs:left_value") db_value = database.inputs.left_value expected_value = -1 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:right_value")) attribute = test_node.get_attribute("inputs:right_value") db_value = database.inputs.right_value expected_value = 1 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:switch")) attribute = test_node.get_attribute("inputs:switch") db_value = database.inputs.switch expected_value = 0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("outputs:left_out")) attribute = test_node.get_attribute("outputs:left_out") db_value = database.outputs.left_out self.assertTrue(test_node.get_attribute_exists("outputs:right_out")) attribute = test_node.get_attribute("outputs:right_out") db_value = database.outputs.right_out
2,527
Python
47.615384
142
0.695291
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/ogn/tests/TestOgnPyUniversalAdd.py
import omni.kit.test import omni.graph.core as og import omni.graph.core.tests as ogts from omni.graph.core.tests.omnigraph_test_utils import _TestGraphAndNode from omni.graph.core.tests.omnigraph_test_utils import _test_clear_scene from omni.graph.core.tests.omnigraph_test_utils import _test_setup_scene from omni.graph.core.tests.omnigraph_test_utils import _test_verify_scene class TestOgn(ogts.OmniGraphTestCase): async def test_data_access(self): from omni.graph.examples.python.ogn.OgnPyUniversalAddDatabase import OgnPyUniversalAddDatabase (_, (test_node,), _, _) = og.Controller.edit("/TestGraph", { og.Controller.Keys.CREATE_NODES: ("Template_omni_graph_examples_python_UniversalAdd", "omni.graph.examples.python.UniversalAdd") }) database = OgnPyUniversalAddDatabase(test_node) self.assertTrue(test_node.is_valid()) node_type_name = test_node.get_type_name() self.assertEqual(og.GraphRegistry().get_node_type_version(node_type_name), 1) def _attr_error(attribute: og.Attribute, usd_test: bool) -> str: test_type = "USD Load" if usd_test else "Database Access" return f"{node_type_name} {test_type} Test - {attribute.get_name()} value error" self.assertTrue(test_node.get_attribute_exists("inputs:bool_0")) attribute = test_node.get_attribute("inputs:bool_0") db_value = database.inputs.bool_0 expected_value = False ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:bool_1")) attribute = test_node.get_attribute("inputs:bool_1") db_value = database.inputs.bool_1 expected_value = False ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:bool_arr_0")) attribute = test_node.get_attribute("inputs:bool_arr_0") db_value = database.inputs.bool_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:bool_arr_1")) attribute = test_node.get_attribute("inputs:bool_arr_1") db_value = database.inputs.bool_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colord3_0")) attribute = test_node.get_attribute("inputs:colord3_0") db_value = database.inputs.colord3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colord3_1")) attribute = test_node.get_attribute("inputs:colord3_1") db_value = database.inputs.colord3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colord3_arr_0")) attribute = test_node.get_attribute("inputs:colord3_arr_0") db_value = database.inputs.colord3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colord3_arr_1")) attribute = test_node.get_attribute("inputs:colord3_arr_1") db_value = database.inputs.colord3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colord4_0")) attribute = test_node.get_attribute("inputs:colord4_0") db_value = database.inputs.colord4_0 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colord4_1")) attribute = test_node.get_attribute("inputs:colord4_1") db_value = database.inputs.colord4_1 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colord4_arr_0")) attribute = test_node.get_attribute("inputs:colord4_arr_0") db_value = database.inputs.colord4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colord4_arr_1")) attribute = test_node.get_attribute("inputs:colord4_arr_1") db_value = database.inputs.colord4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorf3_0")) attribute = test_node.get_attribute("inputs:colorf3_0") db_value = database.inputs.colorf3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorf3_1")) attribute = test_node.get_attribute("inputs:colorf3_1") db_value = database.inputs.colorf3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorf3_arr_0")) attribute = test_node.get_attribute("inputs:colorf3_arr_0") db_value = database.inputs.colorf3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorf3_arr_1")) attribute = test_node.get_attribute("inputs:colorf3_arr_1") db_value = database.inputs.colorf3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorf4_0")) attribute = test_node.get_attribute("inputs:colorf4_0") db_value = database.inputs.colorf4_0 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorf4_1")) attribute = test_node.get_attribute("inputs:colorf4_1") db_value = database.inputs.colorf4_1 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorf4_arr_0")) attribute = test_node.get_attribute("inputs:colorf4_arr_0") db_value = database.inputs.colorf4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorf4_arr_1")) attribute = test_node.get_attribute("inputs:colorf4_arr_1") db_value = database.inputs.colorf4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorh3_0")) attribute = test_node.get_attribute("inputs:colorh3_0") db_value = database.inputs.colorh3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorh3_1")) attribute = test_node.get_attribute("inputs:colorh3_1") db_value = database.inputs.colorh3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorh3_arr_0")) attribute = test_node.get_attribute("inputs:colorh3_arr_0") db_value = database.inputs.colorh3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorh3_arr_1")) attribute = test_node.get_attribute("inputs:colorh3_arr_1") db_value = database.inputs.colorh3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorh4_0")) attribute = test_node.get_attribute("inputs:colorh4_0") db_value = database.inputs.colorh4_0 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorh4_1")) attribute = test_node.get_attribute("inputs:colorh4_1") db_value = database.inputs.colorh4_1 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorh4_arr_0")) attribute = test_node.get_attribute("inputs:colorh4_arr_0") db_value = database.inputs.colorh4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:colorh4_arr_1")) attribute = test_node.get_attribute("inputs:colorh4_arr_1") db_value = database.inputs.colorh4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double2_0")) attribute = test_node.get_attribute("inputs:double2_0") db_value = database.inputs.double2_0 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double2_1")) attribute = test_node.get_attribute("inputs:double2_1") db_value = database.inputs.double2_1 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double2_arr_0")) attribute = test_node.get_attribute("inputs:double2_arr_0") db_value = database.inputs.double2_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double2_arr_1")) attribute = test_node.get_attribute("inputs:double2_arr_1") db_value = database.inputs.double2_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double3_0")) attribute = test_node.get_attribute("inputs:double3_0") db_value = database.inputs.double3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double3_1")) attribute = test_node.get_attribute("inputs:double3_1") db_value = database.inputs.double3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double3_arr_0")) attribute = test_node.get_attribute("inputs:double3_arr_0") db_value = database.inputs.double3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double3_arr_1")) attribute = test_node.get_attribute("inputs:double3_arr_1") db_value = database.inputs.double3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double4_0")) attribute = test_node.get_attribute("inputs:double4_0") db_value = database.inputs.double4_0 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double4_1")) attribute = test_node.get_attribute("inputs:double4_1") db_value = database.inputs.double4_1 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double4_arr_0")) attribute = test_node.get_attribute("inputs:double4_arr_0") db_value = database.inputs.double4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double4_arr_1")) attribute = test_node.get_attribute("inputs:double4_arr_1") db_value = database.inputs.double4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double_0")) attribute = test_node.get_attribute("inputs:double_0") db_value = database.inputs.double_0 expected_value = 0.0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double_1")) attribute = test_node.get_attribute("inputs:double_1") db_value = database.inputs.double_1 expected_value = 0.0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double_arr_0")) attribute = test_node.get_attribute("inputs:double_arr_0") db_value = database.inputs.double_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:double_arr_1")) attribute = test_node.get_attribute("inputs:double_arr_1") db_value = database.inputs.double_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float2_0")) attribute = test_node.get_attribute("inputs:float2_0") db_value = database.inputs.float2_0 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float2_1")) attribute = test_node.get_attribute("inputs:float2_1") db_value = database.inputs.float2_1 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float2_arr_0")) attribute = test_node.get_attribute("inputs:float2_arr_0") db_value = database.inputs.float2_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float2_arr_1")) attribute = test_node.get_attribute("inputs:float2_arr_1") db_value = database.inputs.float2_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float3_0")) attribute = test_node.get_attribute("inputs:float3_0") db_value = database.inputs.float3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float3_1")) attribute = test_node.get_attribute("inputs:float3_1") db_value = database.inputs.float3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float3_arr_0")) attribute = test_node.get_attribute("inputs:float3_arr_0") db_value = database.inputs.float3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float3_arr_1")) attribute = test_node.get_attribute("inputs:float3_arr_1") db_value = database.inputs.float3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float4_0")) attribute = test_node.get_attribute("inputs:float4_0") db_value = database.inputs.float4_0 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float4_1")) attribute = test_node.get_attribute("inputs:float4_1") db_value = database.inputs.float4_1 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float4_arr_0")) attribute = test_node.get_attribute("inputs:float4_arr_0") db_value = database.inputs.float4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float4_arr_1")) attribute = test_node.get_attribute("inputs:float4_arr_1") db_value = database.inputs.float4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float_0")) attribute = test_node.get_attribute("inputs:float_0") db_value = database.inputs.float_0 expected_value = 0.0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float_1")) attribute = test_node.get_attribute("inputs:float_1") db_value = database.inputs.float_1 expected_value = 0.0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float_arr_0")) attribute = test_node.get_attribute("inputs:float_arr_0") db_value = database.inputs.float_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:float_arr_1")) attribute = test_node.get_attribute("inputs:float_arr_1") db_value = database.inputs.float_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:frame4_0")) attribute = test_node.get_attribute("inputs:frame4_0") db_value = database.inputs.frame4_0 expected_value = [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:frame4_1")) attribute = test_node.get_attribute("inputs:frame4_1") db_value = database.inputs.frame4_1 expected_value = [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:frame4_arr_0")) attribute = test_node.get_attribute("inputs:frame4_arr_0") db_value = database.inputs.frame4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:frame4_arr_1")) attribute = test_node.get_attribute("inputs:frame4_arr_1") db_value = database.inputs.frame4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half2_0")) attribute = test_node.get_attribute("inputs:half2_0") db_value = database.inputs.half2_0 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half2_1")) attribute = test_node.get_attribute("inputs:half2_1") db_value = database.inputs.half2_1 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half2_arr_0")) attribute = test_node.get_attribute("inputs:half2_arr_0") db_value = database.inputs.half2_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half2_arr_1")) attribute = test_node.get_attribute("inputs:half2_arr_1") db_value = database.inputs.half2_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half3_0")) attribute = test_node.get_attribute("inputs:half3_0") db_value = database.inputs.half3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half3_1")) attribute = test_node.get_attribute("inputs:half3_1") db_value = database.inputs.half3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half3_arr_0")) attribute = test_node.get_attribute("inputs:half3_arr_0") db_value = database.inputs.half3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half3_arr_1")) attribute = test_node.get_attribute("inputs:half3_arr_1") db_value = database.inputs.half3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half4_0")) attribute = test_node.get_attribute("inputs:half4_0") db_value = database.inputs.half4_0 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half4_1")) attribute = test_node.get_attribute("inputs:half4_1") db_value = database.inputs.half4_1 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half4_arr_0")) attribute = test_node.get_attribute("inputs:half4_arr_0") db_value = database.inputs.half4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half4_arr_1")) attribute = test_node.get_attribute("inputs:half4_arr_1") db_value = database.inputs.half4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half_0")) attribute = test_node.get_attribute("inputs:half_0") db_value = database.inputs.half_0 expected_value = 0.0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half_1")) attribute = test_node.get_attribute("inputs:half_1") db_value = database.inputs.half_1 expected_value = 0.0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half_arr_0")) attribute = test_node.get_attribute("inputs:half_arr_0") db_value = database.inputs.half_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:half_arr_1")) attribute = test_node.get_attribute("inputs:half_arr_1") db_value = database.inputs.half_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int2_0")) attribute = test_node.get_attribute("inputs:int2_0") db_value = database.inputs.int2_0 expected_value = [0, 0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int2_1")) attribute = test_node.get_attribute("inputs:int2_1") db_value = database.inputs.int2_1 expected_value = [0, 0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int2_arr_0")) attribute = test_node.get_attribute("inputs:int2_arr_0") db_value = database.inputs.int2_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int2_arr_1")) attribute = test_node.get_attribute("inputs:int2_arr_1") db_value = database.inputs.int2_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int3_0")) attribute = test_node.get_attribute("inputs:int3_0") db_value = database.inputs.int3_0 expected_value = [0, 0, 0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int3_1")) attribute = test_node.get_attribute("inputs:int3_1") db_value = database.inputs.int3_1 expected_value = [0, 0, 0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int3_arr_0")) attribute = test_node.get_attribute("inputs:int3_arr_0") db_value = database.inputs.int3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int3_arr_1")) attribute = test_node.get_attribute("inputs:int3_arr_1") db_value = database.inputs.int3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int4_0")) attribute = test_node.get_attribute("inputs:int4_0") db_value = database.inputs.int4_0 expected_value = [0, 0, 0, 0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int4_1")) attribute = test_node.get_attribute("inputs:int4_1") db_value = database.inputs.int4_1 expected_value = [0, 0, 0, 0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int4_arr_0")) attribute = test_node.get_attribute("inputs:int4_arr_0") db_value = database.inputs.int4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int4_arr_1")) attribute = test_node.get_attribute("inputs:int4_arr_1") db_value = database.inputs.int4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int64_0")) attribute = test_node.get_attribute("inputs:int64_0") db_value = database.inputs.int64_0 expected_value = 0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int64_1")) attribute = test_node.get_attribute("inputs:int64_1") db_value = database.inputs.int64_1 expected_value = 0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int64_arr_0")) attribute = test_node.get_attribute("inputs:int64_arr_0") db_value = database.inputs.int64_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int64_arr_1")) attribute = test_node.get_attribute("inputs:int64_arr_1") db_value = database.inputs.int64_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int_0")) attribute = test_node.get_attribute("inputs:int_0") db_value = database.inputs.int_0 expected_value = 0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int_1")) attribute = test_node.get_attribute("inputs:int_1") db_value = database.inputs.int_1 expected_value = 0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int_arr_0")) attribute = test_node.get_attribute("inputs:int_arr_0") db_value = database.inputs.int_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:int_arr_1")) attribute = test_node.get_attribute("inputs:int_arr_1") db_value = database.inputs.int_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd2_0")) attribute = test_node.get_attribute("inputs:matrixd2_0") db_value = database.inputs.matrixd2_0 expected_value = [[0.0, 0.0], [0.0, 0.0]] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd2_1")) attribute = test_node.get_attribute("inputs:matrixd2_1") db_value = database.inputs.matrixd2_1 expected_value = [[0.0, 0.0], [0.0, 0.0]] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd2_arr_0")) attribute = test_node.get_attribute("inputs:matrixd2_arr_0") db_value = database.inputs.matrixd2_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd2_arr_1")) attribute = test_node.get_attribute("inputs:matrixd2_arr_1") db_value = database.inputs.matrixd2_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd3_0")) attribute = test_node.get_attribute("inputs:matrixd3_0") db_value = database.inputs.matrixd3_0 expected_value = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd3_1")) attribute = test_node.get_attribute("inputs:matrixd3_1") db_value = database.inputs.matrixd3_1 expected_value = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd3_arr_0")) attribute = test_node.get_attribute("inputs:matrixd3_arr_0") db_value = database.inputs.matrixd3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd3_arr_1")) attribute = test_node.get_attribute("inputs:matrixd3_arr_1") db_value = database.inputs.matrixd3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd4_0")) attribute = test_node.get_attribute("inputs:matrixd4_0") db_value = database.inputs.matrixd4_0 expected_value = [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd4_1")) attribute = test_node.get_attribute("inputs:matrixd4_1") db_value = database.inputs.matrixd4_1 expected_value = [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd4_arr_0")) attribute = test_node.get_attribute("inputs:matrixd4_arr_0") db_value = database.inputs.matrixd4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:matrixd4_arr_1")) attribute = test_node.get_attribute("inputs:matrixd4_arr_1") db_value = database.inputs.matrixd4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normald3_0")) attribute = test_node.get_attribute("inputs:normald3_0") db_value = database.inputs.normald3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normald3_1")) attribute = test_node.get_attribute("inputs:normald3_1") db_value = database.inputs.normald3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normald3_arr_0")) attribute = test_node.get_attribute("inputs:normald3_arr_0") db_value = database.inputs.normald3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normald3_arr_1")) attribute = test_node.get_attribute("inputs:normald3_arr_1") db_value = database.inputs.normald3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normalf3_0")) attribute = test_node.get_attribute("inputs:normalf3_0") db_value = database.inputs.normalf3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normalf3_1")) attribute = test_node.get_attribute("inputs:normalf3_1") db_value = database.inputs.normalf3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normalf3_arr_0")) attribute = test_node.get_attribute("inputs:normalf3_arr_0") db_value = database.inputs.normalf3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normalf3_arr_1")) attribute = test_node.get_attribute("inputs:normalf3_arr_1") db_value = database.inputs.normalf3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normalh3_0")) attribute = test_node.get_attribute("inputs:normalh3_0") db_value = database.inputs.normalh3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normalh3_1")) attribute = test_node.get_attribute("inputs:normalh3_1") db_value = database.inputs.normalh3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normalh3_arr_0")) attribute = test_node.get_attribute("inputs:normalh3_arr_0") db_value = database.inputs.normalh3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:normalh3_arr_1")) attribute = test_node.get_attribute("inputs:normalh3_arr_1") db_value = database.inputs.normalh3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointd3_0")) attribute = test_node.get_attribute("inputs:pointd3_0") db_value = database.inputs.pointd3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointd3_1")) attribute = test_node.get_attribute("inputs:pointd3_1") db_value = database.inputs.pointd3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointd3_arr_0")) attribute = test_node.get_attribute("inputs:pointd3_arr_0") db_value = database.inputs.pointd3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointd3_arr_1")) attribute = test_node.get_attribute("inputs:pointd3_arr_1") db_value = database.inputs.pointd3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointf3_0")) attribute = test_node.get_attribute("inputs:pointf3_0") db_value = database.inputs.pointf3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointf3_1")) attribute = test_node.get_attribute("inputs:pointf3_1") db_value = database.inputs.pointf3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointf3_arr_0")) attribute = test_node.get_attribute("inputs:pointf3_arr_0") db_value = database.inputs.pointf3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointf3_arr_1")) attribute = test_node.get_attribute("inputs:pointf3_arr_1") db_value = database.inputs.pointf3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointh3_0")) attribute = test_node.get_attribute("inputs:pointh3_0") db_value = database.inputs.pointh3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointh3_1")) attribute = test_node.get_attribute("inputs:pointh3_1") db_value = database.inputs.pointh3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointh3_arr_0")) attribute = test_node.get_attribute("inputs:pointh3_arr_0") db_value = database.inputs.pointh3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:pointh3_arr_1")) attribute = test_node.get_attribute("inputs:pointh3_arr_1") db_value = database.inputs.pointh3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quatd4_0")) attribute = test_node.get_attribute("inputs:quatd4_0") db_value = database.inputs.quatd4_0 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quatd4_1")) attribute = test_node.get_attribute("inputs:quatd4_1") db_value = database.inputs.quatd4_1 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quatd4_arr_0")) attribute = test_node.get_attribute("inputs:quatd4_arr_0") db_value = database.inputs.quatd4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quatd4_arr_1")) attribute = test_node.get_attribute("inputs:quatd4_arr_1") db_value = database.inputs.quatd4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quatf4_0")) attribute = test_node.get_attribute("inputs:quatf4_0") db_value = database.inputs.quatf4_0 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quatf4_1")) attribute = test_node.get_attribute("inputs:quatf4_1") db_value = database.inputs.quatf4_1 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quatf4_arr_0")) attribute = test_node.get_attribute("inputs:quatf4_arr_0") db_value = database.inputs.quatf4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quatf4_arr_1")) attribute = test_node.get_attribute("inputs:quatf4_arr_1") db_value = database.inputs.quatf4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quath4_0")) attribute = test_node.get_attribute("inputs:quath4_0") db_value = database.inputs.quath4_0 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quath4_1")) attribute = test_node.get_attribute("inputs:quath4_1") db_value = database.inputs.quath4_1 expected_value = [0.0, 0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quath4_arr_0")) attribute = test_node.get_attribute("inputs:quath4_arr_0") db_value = database.inputs.quath4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:quath4_arr_1")) attribute = test_node.get_attribute("inputs:quath4_arr_1") db_value = database.inputs.quath4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordd2_0")) attribute = test_node.get_attribute("inputs:texcoordd2_0") db_value = database.inputs.texcoordd2_0 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordd2_1")) attribute = test_node.get_attribute("inputs:texcoordd2_1") db_value = database.inputs.texcoordd2_1 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordd2_arr_0")) attribute = test_node.get_attribute("inputs:texcoordd2_arr_0") db_value = database.inputs.texcoordd2_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordd2_arr_1")) attribute = test_node.get_attribute("inputs:texcoordd2_arr_1") db_value = database.inputs.texcoordd2_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordd3_0")) attribute = test_node.get_attribute("inputs:texcoordd3_0") db_value = database.inputs.texcoordd3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordd3_1")) attribute = test_node.get_attribute("inputs:texcoordd3_1") db_value = database.inputs.texcoordd3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordd3_arr_0")) attribute = test_node.get_attribute("inputs:texcoordd3_arr_0") db_value = database.inputs.texcoordd3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordd3_arr_1")) attribute = test_node.get_attribute("inputs:texcoordd3_arr_1") db_value = database.inputs.texcoordd3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordf2_0")) attribute = test_node.get_attribute("inputs:texcoordf2_0") db_value = database.inputs.texcoordf2_0 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordf2_1")) attribute = test_node.get_attribute("inputs:texcoordf2_1") db_value = database.inputs.texcoordf2_1 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordf2_arr_0")) attribute = test_node.get_attribute("inputs:texcoordf2_arr_0") db_value = database.inputs.texcoordf2_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordf2_arr_1")) attribute = test_node.get_attribute("inputs:texcoordf2_arr_1") db_value = database.inputs.texcoordf2_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordf3_0")) attribute = test_node.get_attribute("inputs:texcoordf3_0") db_value = database.inputs.texcoordf3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordf3_1")) attribute = test_node.get_attribute("inputs:texcoordf3_1") db_value = database.inputs.texcoordf3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordf3_arr_0")) attribute = test_node.get_attribute("inputs:texcoordf3_arr_0") db_value = database.inputs.texcoordf3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordf3_arr_1")) attribute = test_node.get_attribute("inputs:texcoordf3_arr_1") db_value = database.inputs.texcoordf3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordh2_0")) attribute = test_node.get_attribute("inputs:texcoordh2_0") db_value = database.inputs.texcoordh2_0 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordh2_1")) attribute = test_node.get_attribute("inputs:texcoordh2_1") db_value = database.inputs.texcoordh2_1 expected_value = [0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordh2_arr_0")) attribute = test_node.get_attribute("inputs:texcoordh2_arr_0") db_value = database.inputs.texcoordh2_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordh2_arr_1")) attribute = test_node.get_attribute("inputs:texcoordh2_arr_1") db_value = database.inputs.texcoordh2_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordh3_0")) attribute = test_node.get_attribute("inputs:texcoordh3_0") db_value = database.inputs.texcoordh3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordh3_1")) attribute = test_node.get_attribute("inputs:texcoordh3_1") db_value = database.inputs.texcoordh3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordh3_arr_0")) attribute = test_node.get_attribute("inputs:texcoordh3_arr_0") db_value = database.inputs.texcoordh3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:texcoordh3_arr_1")) attribute = test_node.get_attribute("inputs:texcoordh3_arr_1") db_value = database.inputs.texcoordh3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:timecode_0")) attribute = test_node.get_attribute("inputs:timecode_0") db_value = database.inputs.timecode_0 expected_value = 0.0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:timecode_1")) attribute = test_node.get_attribute("inputs:timecode_1") db_value = database.inputs.timecode_1 expected_value = 0.0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:timecode_arr_0")) attribute = test_node.get_attribute("inputs:timecode_arr_0") db_value = database.inputs.timecode_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:timecode_arr_1")) attribute = test_node.get_attribute("inputs:timecode_arr_1") db_value = database.inputs.timecode_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:token_0")) attribute = test_node.get_attribute("inputs:token_0") db_value = database.inputs.token_0 expected_value = "default_token" ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:token_1")) attribute = test_node.get_attribute("inputs:token_1") db_value = database.inputs.token_1 expected_value = "default_token" ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:token_arr_0")) attribute = test_node.get_attribute("inputs:token_arr_0") db_value = database.inputs.token_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:token_arr_1")) attribute = test_node.get_attribute("inputs:token_arr_1") db_value = database.inputs.token_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:transform4_0")) attribute = test_node.get_attribute("inputs:transform4_0") db_value = database.inputs.transform4_0 expected_value = [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:transform4_1")) attribute = test_node.get_attribute("inputs:transform4_1") db_value = database.inputs.transform4_1 expected_value = [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:transform4_arr_0")) attribute = test_node.get_attribute("inputs:transform4_arr_0") db_value = database.inputs.transform4_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:transform4_arr_1")) attribute = test_node.get_attribute("inputs:transform4_arr_1") db_value = database.inputs.transform4_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uchar_0")) attribute = test_node.get_attribute("inputs:uchar_0") db_value = database.inputs.uchar_0 expected_value = 0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uchar_1")) attribute = test_node.get_attribute("inputs:uchar_1") db_value = database.inputs.uchar_1 expected_value = 0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uchar_arr_0")) attribute = test_node.get_attribute("inputs:uchar_arr_0") db_value = database.inputs.uchar_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uchar_arr_1")) attribute = test_node.get_attribute("inputs:uchar_arr_1") db_value = database.inputs.uchar_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uint64_0")) attribute = test_node.get_attribute("inputs:uint64_0") db_value = database.inputs.uint64_0 expected_value = 0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uint64_1")) attribute = test_node.get_attribute("inputs:uint64_1") db_value = database.inputs.uint64_1 expected_value = 0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uint64_arr_0")) attribute = test_node.get_attribute("inputs:uint64_arr_0") db_value = database.inputs.uint64_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uint64_arr_1")) attribute = test_node.get_attribute("inputs:uint64_arr_1") db_value = database.inputs.uint64_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uint_0")) attribute = test_node.get_attribute("inputs:uint_0") db_value = database.inputs.uint_0 expected_value = 0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uint_1")) attribute = test_node.get_attribute("inputs:uint_1") db_value = database.inputs.uint_1 expected_value = 0 ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uint_arr_0")) attribute = test_node.get_attribute("inputs:uint_arr_0") db_value = database.inputs.uint_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:uint_arr_1")) attribute = test_node.get_attribute("inputs:uint_arr_1") db_value = database.inputs.uint_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectord3_0")) attribute = test_node.get_attribute("inputs:vectord3_0") db_value = database.inputs.vectord3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectord3_1")) attribute = test_node.get_attribute("inputs:vectord3_1") db_value = database.inputs.vectord3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectord3_arr_0")) attribute = test_node.get_attribute("inputs:vectord3_arr_0") db_value = database.inputs.vectord3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectord3_arr_1")) attribute = test_node.get_attribute("inputs:vectord3_arr_1") db_value = database.inputs.vectord3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectorf3_0")) attribute = test_node.get_attribute("inputs:vectorf3_0") db_value = database.inputs.vectorf3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectorf3_1")) attribute = test_node.get_attribute("inputs:vectorf3_1") db_value = database.inputs.vectorf3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectorf3_arr_0")) attribute = test_node.get_attribute("inputs:vectorf3_arr_0") db_value = database.inputs.vectorf3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectorf3_arr_1")) attribute = test_node.get_attribute("inputs:vectorf3_arr_1") db_value = database.inputs.vectorf3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectorh3_0")) attribute = test_node.get_attribute("inputs:vectorh3_0") db_value = database.inputs.vectorh3_0 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectorh3_1")) attribute = test_node.get_attribute("inputs:vectorh3_1") db_value = database.inputs.vectorh3_1 expected_value = [0.0, 0.0, 0.0] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectorh3_arr_0")) attribute = test_node.get_attribute("inputs:vectorh3_arr_0") db_value = database.inputs.vectorh3_arr_0 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("inputs:vectorh3_arr_1")) attribute = test_node.get_attribute("inputs:vectorh3_arr_1") db_value = database.inputs.vectorh3_arr_1 expected_value = [] ogts.verify_values(expected_value, db_value, _attr_error(attribute, False)) self.assertTrue(test_node.get_attribute_exists("outputs:bool_0")) attribute = test_node.get_attribute("outputs:bool_0") db_value = database.outputs.bool_0 self.assertTrue(test_node.get_attribute_exists("outputs:bool_arr_0")) attribute = test_node.get_attribute("outputs:bool_arr_0") db_value = database.outputs.bool_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:colord3_0")) attribute = test_node.get_attribute("outputs:colord3_0") db_value = database.outputs.colord3_0 self.assertTrue(test_node.get_attribute_exists("outputs:colord3_arr_0")) attribute = test_node.get_attribute("outputs:colord3_arr_0") db_value = database.outputs.colord3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:colord4_0")) attribute = test_node.get_attribute("outputs:colord4_0") db_value = database.outputs.colord4_0 self.assertTrue(test_node.get_attribute_exists("outputs:colord4_arr_0")) attribute = test_node.get_attribute("outputs:colord4_arr_0") db_value = database.outputs.colord4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:colorf3_0")) attribute = test_node.get_attribute("outputs:colorf3_0") db_value = database.outputs.colorf3_0 self.assertTrue(test_node.get_attribute_exists("outputs:colorf3_arr_0")) attribute = test_node.get_attribute("outputs:colorf3_arr_0") db_value = database.outputs.colorf3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:colorf4_0")) attribute = test_node.get_attribute("outputs:colorf4_0") db_value = database.outputs.colorf4_0 self.assertTrue(test_node.get_attribute_exists("outputs:colorf4_arr_0")) attribute = test_node.get_attribute("outputs:colorf4_arr_0") db_value = database.outputs.colorf4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:colorh3_0")) attribute = test_node.get_attribute("outputs:colorh3_0") db_value = database.outputs.colorh3_0 self.assertTrue(test_node.get_attribute_exists("outputs:colorh3_arr_0")) attribute = test_node.get_attribute("outputs:colorh3_arr_0") db_value = database.outputs.colorh3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:colorh4_0")) attribute = test_node.get_attribute("outputs:colorh4_0") db_value = database.outputs.colorh4_0 self.assertTrue(test_node.get_attribute_exists("outputs:colorh4_arr_0")) attribute = test_node.get_attribute("outputs:colorh4_arr_0") db_value = database.outputs.colorh4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:double2_0")) attribute = test_node.get_attribute("outputs:double2_0") db_value = database.outputs.double2_0 self.assertTrue(test_node.get_attribute_exists("outputs:double2_arr_0")) attribute = test_node.get_attribute("outputs:double2_arr_0") db_value = database.outputs.double2_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:double3_0")) attribute = test_node.get_attribute("outputs:double3_0") db_value = database.outputs.double3_0 self.assertTrue(test_node.get_attribute_exists("outputs:double3_arr_0")) attribute = test_node.get_attribute("outputs:double3_arr_0") db_value = database.outputs.double3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:double4_0")) attribute = test_node.get_attribute("outputs:double4_0") db_value = database.outputs.double4_0 self.assertTrue(test_node.get_attribute_exists("outputs:double4_arr_0")) attribute = test_node.get_attribute("outputs:double4_arr_0") db_value = database.outputs.double4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:double_0")) attribute = test_node.get_attribute("outputs:double_0") db_value = database.outputs.double_0 self.assertTrue(test_node.get_attribute_exists("outputs:double_arr_0")) attribute = test_node.get_attribute("outputs:double_arr_0") db_value = database.outputs.double_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:float2_0")) attribute = test_node.get_attribute("outputs:float2_0") db_value = database.outputs.float2_0 self.assertTrue(test_node.get_attribute_exists("outputs:float2_arr_0")) attribute = test_node.get_attribute("outputs:float2_arr_0") db_value = database.outputs.float2_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:float3_0")) attribute = test_node.get_attribute("outputs:float3_0") db_value = database.outputs.float3_0 self.assertTrue(test_node.get_attribute_exists("outputs:float3_arr_0")) attribute = test_node.get_attribute("outputs:float3_arr_0") db_value = database.outputs.float3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:float4_0")) attribute = test_node.get_attribute("outputs:float4_0") db_value = database.outputs.float4_0 self.assertTrue(test_node.get_attribute_exists("outputs:float4_arr_0")) attribute = test_node.get_attribute("outputs:float4_arr_0") db_value = database.outputs.float4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:float_0")) attribute = test_node.get_attribute("outputs:float_0") db_value = database.outputs.float_0 self.assertTrue(test_node.get_attribute_exists("outputs:float_arr_0")) attribute = test_node.get_attribute("outputs:float_arr_0") db_value = database.outputs.float_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:frame4_0")) attribute = test_node.get_attribute("outputs:frame4_0") db_value = database.outputs.frame4_0 self.assertTrue(test_node.get_attribute_exists("outputs:frame4_arr_0")) attribute = test_node.get_attribute("outputs:frame4_arr_0") db_value = database.outputs.frame4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:half2_0")) attribute = test_node.get_attribute("outputs:half2_0") db_value = database.outputs.half2_0 self.assertTrue(test_node.get_attribute_exists("outputs:half2_arr_0")) attribute = test_node.get_attribute("outputs:half2_arr_0") db_value = database.outputs.half2_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:half3_0")) attribute = test_node.get_attribute("outputs:half3_0") db_value = database.outputs.half3_0 self.assertTrue(test_node.get_attribute_exists("outputs:half3_arr_0")) attribute = test_node.get_attribute("outputs:half3_arr_0") db_value = database.outputs.half3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:half4_0")) attribute = test_node.get_attribute("outputs:half4_0") db_value = database.outputs.half4_0 self.assertTrue(test_node.get_attribute_exists("outputs:half4_arr_0")) attribute = test_node.get_attribute("outputs:half4_arr_0") db_value = database.outputs.half4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:half_0")) attribute = test_node.get_attribute("outputs:half_0") db_value = database.outputs.half_0 self.assertTrue(test_node.get_attribute_exists("outputs:half_arr_0")) attribute = test_node.get_attribute("outputs:half_arr_0") db_value = database.outputs.half_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:int2_0")) attribute = test_node.get_attribute("outputs:int2_0") db_value = database.outputs.int2_0 self.assertTrue(test_node.get_attribute_exists("outputs:int2_arr_0")) attribute = test_node.get_attribute("outputs:int2_arr_0") db_value = database.outputs.int2_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:int3_0")) attribute = test_node.get_attribute("outputs:int3_0") db_value = database.outputs.int3_0 self.assertTrue(test_node.get_attribute_exists("outputs:int3_arr_0")) attribute = test_node.get_attribute("outputs:int3_arr_0") db_value = database.outputs.int3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:int4_0")) attribute = test_node.get_attribute("outputs:int4_0") db_value = database.outputs.int4_0 self.assertTrue(test_node.get_attribute_exists("outputs:int4_arr_0")) attribute = test_node.get_attribute("outputs:int4_arr_0") db_value = database.outputs.int4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:int64_0")) attribute = test_node.get_attribute("outputs:int64_0") db_value = database.outputs.int64_0 self.assertTrue(test_node.get_attribute_exists("outputs:int64_arr_0")) attribute = test_node.get_attribute("outputs:int64_arr_0") db_value = database.outputs.int64_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:int_0")) attribute = test_node.get_attribute("outputs:int_0") db_value = database.outputs.int_0 self.assertTrue(test_node.get_attribute_exists("outputs:int_arr_0")) attribute = test_node.get_attribute("outputs:int_arr_0") db_value = database.outputs.int_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:matrixd2_0")) attribute = test_node.get_attribute("outputs:matrixd2_0") db_value = database.outputs.matrixd2_0 self.assertTrue(test_node.get_attribute_exists("outputs:matrixd2_arr_0")) attribute = test_node.get_attribute("outputs:matrixd2_arr_0") db_value = database.outputs.matrixd2_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:matrixd3_0")) attribute = test_node.get_attribute("outputs:matrixd3_0") db_value = database.outputs.matrixd3_0 self.assertTrue(test_node.get_attribute_exists("outputs:matrixd3_arr_0")) attribute = test_node.get_attribute("outputs:matrixd3_arr_0") db_value = database.outputs.matrixd3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:matrixd4_0")) attribute = test_node.get_attribute("outputs:matrixd4_0") db_value = database.outputs.matrixd4_0 self.assertTrue(test_node.get_attribute_exists("outputs:matrixd4_arr_0")) attribute = test_node.get_attribute("outputs:matrixd4_arr_0") db_value = database.outputs.matrixd4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:normald3_0")) attribute = test_node.get_attribute("outputs:normald3_0") db_value = database.outputs.normald3_0 self.assertTrue(test_node.get_attribute_exists("outputs:normald3_arr_0")) attribute = test_node.get_attribute("outputs:normald3_arr_0") db_value = database.outputs.normald3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:normalf3_0")) attribute = test_node.get_attribute("outputs:normalf3_0") db_value = database.outputs.normalf3_0 self.assertTrue(test_node.get_attribute_exists("outputs:normalf3_arr_0")) attribute = test_node.get_attribute("outputs:normalf3_arr_0") db_value = database.outputs.normalf3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:normalh3_0")) attribute = test_node.get_attribute("outputs:normalh3_0") db_value = database.outputs.normalh3_0 self.assertTrue(test_node.get_attribute_exists("outputs:normalh3_arr_0")) attribute = test_node.get_attribute("outputs:normalh3_arr_0") db_value = database.outputs.normalh3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:pointd3_0")) attribute = test_node.get_attribute("outputs:pointd3_0") db_value = database.outputs.pointd3_0 self.assertTrue(test_node.get_attribute_exists("outputs:pointd3_arr_0")) attribute = test_node.get_attribute("outputs:pointd3_arr_0") db_value = database.outputs.pointd3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:pointf3_0")) attribute = test_node.get_attribute("outputs:pointf3_0") db_value = database.outputs.pointf3_0 self.assertTrue(test_node.get_attribute_exists("outputs:pointf3_arr_0")) attribute = test_node.get_attribute("outputs:pointf3_arr_0") db_value = database.outputs.pointf3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:pointh3_0")) attribute = test_node.get_attribute("outputs:pointh3_0") db_value = database.outputs.pointh3_0 self.assertTrue(test_node.get_attribute_exists("outputs:pointh3_arr_0")) attribute = test_node.get_attribute("outputs:pointh3_arr_0") db_value = database.outputs.pointh3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:quatd4_0")) attribute = test_node.get_attribute("outputs:quatd4_0") db_value = database.outputs.quatd4_0 self.assertTrue(test_node.get_attribute_exists("outputs:quatd4_arr_0")) attribute = test_node.get_attribute("outputs:quatd4_arr_0") db_value = database.outputs.quatd4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:quatf4_0")) attribute = test_node.get_attribute("outputs:quatf4_0") db_value = database.outputs.quatf4_0 self.assertTrue(test_node.get_attribute_exists("outputs:quatf4_arr_0")) attribute = test_node.get_attribute("outputs:quatf4_arr_0") db_value = database.outputs.quatf4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:quath4_0")) attribute = test_node.get_attribute("outputs:quath4_0") db_value = database.outputs.quath4_0 self.assertTrue(test_node.get_attribute_exists("outputs:quath4_arr_0")) attribute = test_node.get_attribute("outputs:quath4_arr_0") db_value = database.outputs.quath4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordd2_0")) attribute = test_node.get_attribute("outputs:texcoordd2_0") db_value = database.outputs.texcoordd2_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordd2_arr_0")) attribute = test_node.get_attribute("outputs:texcoordd2_arr_0") db_value = database.outputs.texcoordd2_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordd3_0")) attribute = test_node.get_attribute("outputs:texcoordd3_0") db_value = database.outputs.texcoordd3_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordd3_arr_0")) attribute = test_node.get_attribute("outputs:texcoordd3_arr_0") db_value = database.outputs.texcoordd3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordf2_0")) attribute = test_node.get_attribute("outputs:texcoordf2_0") db_value = database.outputs.texcoordf2_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordf2_arr_0")) attribute = test_node.get_attribute("outputs:texcoordf2_arr_0") db_value = database.outputs.texcoordf2_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordf3_0")) attribute = test_node.get_attribute("outputs:texcoordf3_0") db_value = database.outputs.texcoordf3_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordf3_arr_0")) attribute = test_node.get_attribute("outputs:texcoordf3_arr_0") db_value = database.outputs.texcoordf3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordh2_0")) attribute = test_node.get_attribute("outputs:texcoordh2_0") db_value = database.outputs.texcoordh2_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordh2_arr_0")) attribute = test_node.get_attribute("outputs:texcoordh2_arr_0") db_value = database.outputs.texcoordh2_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordh3_0")) attribute = test_node.get_attribute("outputs:texcoordh3_0") db_value = database.outputs.texcoordh3_0 self.assertTrue(test_node.get_attribute_exists("outputs:texcoordh3_arr_0")) attribute = test_node.get_attribute("outputs:texcoordh3_arr_0") db_value = database.outputs.texcoordh3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:timecode_0")) attribute = test_node.get_attribute("outputs:timecode_0") db_value = database.outputs.timecode_0 self.assertTrue(test_node.get_attribute_exists("outputs:timecode_arr_0")) attribute = test_node.get_attribute("outputs:timecode_arr_0") db_value = database.outputs.timecode_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:token_0")) attribute = test_node.get_attribute("outputs:token_0") db_value = database.outputs.token_0 self.assertTrue(test_node.get_attribute_exists("outputs:token_arr_0")) attribute = test_node.get_attribute("outputs:token_arr_0") db_value = database.outputs.token_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:transform4_0")) attribute = test_node.get_attribute("outputs:transform4_0") db_value = database.outputs.transform4_0 self.assertTrue(test_node.get_attribute_exists("outputs:transform4_arr_0")) attribute = test_node.get_attribute("outputs:transform4_arr_0") db_value = database.outputs.transform4_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:uchar_0")) attribute = test_node.get_attribute("outputs:uchar_0") db_value = database.outputs.uchar_0 self.assertTrue(test_node.get_attribute_exists("outputs:uchar_arr_0")) attribute = test_node.get_attribute("outputs:uchar_arr_0") db_value = database.outputs.uchar_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:uint64_0")) attribute = test_node.get_attribute("outputs:uint64_0") db_value = database.outputs.uint64_0 self.assertTrue(test_node.get_attribute_exists("outputs:uint64_arr_0")) attribute = test_node.get_attribute("outputs:uint64_arr_0") db_value = database.outputs.uint64_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:uint_0")) attribute = test_node.get_attribute("outputs:uint_0") db_value = database.outputs.uint_0 self.assertTrue(test_node.get_attribute_exists("outputs:uint_arr_0")) attribute = test_node.get_attribute("outputs:uint_arr_0") db_value = database.outputs.uint_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:vectord3_0")) attribute = test_node.get_attribute("outputs:vectord3_0") db_value = database.outputs.vectord3_0 self.assertTrue(test_node.get_attribute_exists("outputs:vectord3_arr_0")) attribute = test_node.get_attribute("outputs:vectord3_arr_0") db_value = database.outputs.vectord3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:vectorf3_0")) attribute = test_node.get_attribute("outputs:vectorf3_0") db_value = database.outputs.vectorf3_0 self.assertTrue(test_node.get_attribute_exists("outputs:vectorf3_arr_0")) attribute = test_node.get_attribute("outputs:vectorf3_arr_0") db_value = database.outputs.vectorf3_arr_0 self.assertTrue(test_node.get_attribute_exists("outputs:vectorh3_0")) attribute = test_node.get_attribute("outputs:vectorh3_0") db_value = database.outputs.vectorh3_0 self.assertTrue(test_node.get_attribute_exists("outputs:vectorh3_arr_0")) attribute = test_node.get_attribute("outputs:vectorh3_arr_0") db_value = database.outputs.vectorh3_arr_0
86,139
Python
49.970414
140
0.666191
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/_impl/extension.py
""" Support required by the Carbonite extension loader """ import omni.ext class _PublicExtension(omni.ext.IExt): """Object that tracks the lifetime of the Python part of the extension loading""" def on_startup(self): """Set up initial conditions for the Python part of the extension""" def on_shutdown(self): """Shutting down this part of the extension prepares it for hot reload"""
416
Python
26.799998
85
0.701923
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/tests/test_api.py
"""Testing the stability of the API in this module""" import omni.graph.core.tests as ogts import omni.graph.examples.python as ogep from omni.graph.tools.tests.internal_utils import _check_module_api_consistency, _check_public_api_contents # ====================================================================== class _TestOmniGraphExamplesPythonApi(ogts.OmniGraphTestCase): _UNPUBLISHED = ["bindings", "ogn", "tests"] async def test_api(self): _check_module_api_consistency(ogep, self._UNPUBLISHED) # noqa: PLW0212 _check_module_api_consistency(ogep.tests, is_test_module=True) # noqa: PLW0212 async def test_api_features(self): """Test that the known public API features continue to exist""" _check_public_api_contents(ogep, [], self._UNPUBLISHED, only_expected_allowed=True) # noqa: PLW0212 _check_public_api_contents(ogep.tests, [], [], only_expected_allowed=True) # noqa: PLW0212
947
Python
48.894734
108
0.661035
omniverse-code/kit/exts/omni.graph.examples.python/omni/graph/examples/python/tests/test_omnigraph_python_examples.py
import math import os import omni.graph.core as og import omni.graph.core.tests as ogts import omni.kit.test import omni.timeline import omni.usd from pxr import Gf, Sdf, UsdGeom def example_deformer1(input_point, width, height, freq): """Implement simple deformation on the input point with the given wavelength, wave height, and frequency""" tx = freq * (input_point[0] - width) / width ty = 1.5 * freq * (input_point[1] - width) / width tz = height * (math.sin(tx) + math.cos(ty)) return Gf.Vec3f(input_point[0], input_point[1], input_point[2] + tz) class TestOmniGraphPythonExamples(ogts.OmniGraphTestCase): # ---------------------------------------------------------------------- async def verify_example_deformer(self): """Compare the actual deformation against the expected values using example_deformer1""" stage = omni.usd.get_context().get_stage() input_grid = stage.GetPrimAtPath("/defaultPrim/inputGrid") self.assertEqual(input_grid.GetTypeName(), "Mesh") input_points_attr = input_grid.GetAttribute("points") self.assertIsNotNone(input_points_attr) output_grid = stage.GetPrimAtPath("/defaultPrim/outputGrid") self.assertEqual(output_grid.GetTypeName(), "Mesh") output_points_attr = output_grid.GetAttribute("points") self.assertIsNotNone(output_points_attr) await omni.kit.app.get_app().next_update_async() await og.Controller.evaluate() multiplier_attr = og.Controller.attribute("inputs:multiplier", "/defaultPrim/DeformerGraph/testDeformer") multiplier = og.Controller.get(multiplier_attr) # TODO: Should really be using hardcoded values from the file to ensure correct operation # multiplier = 3.0 width = 310.0 height = multiplier * 10.0 freq = 10.0 # check that the deformer applies the correct deformation input_points = input_points_attr.Get() output_points = output_points_attr.Get() actual_points = [] for input_point, output_point in zip(input_points, output_points): point = example_deformer1(input_point, width, height, freq) self.assertEqual(point[0], output_point[0]) self.assertEqual(point[1], output_point[1]) # verify that the z-coordinates computed by the test and the deformer match to three decimal places actual_points.append(point) self.assertAlmostEqual(point[2], output_point[2], 3) # need to wait for next update to propagate the attribute change from USD og.Controller.set(multiplier_attr, 0.0) await omni.kit.app.get_app().next_update_async() # check that the deformer with a zero multiplier leaves the grid undeformed input_points = input_points_attr.Get() output_points = output_points_attr.Get() for input_point, output_point in zip(input_points, output_points): self.assertEqual(input_point, output_point) # ---------------------------------------------------------------------- async def test_example_deformer_python(self): """Tests the omnigraph.examples.deformerPy node""" (result, error) = await og.load_example_file("ExampleGridDeformerPython.usda") self.assertTrue(result, error) await omni.kit.app.get_app().next_update_async() await self.verify_example_deformer() # ---------------------------------------------------------------------- async def run_python_node_creation_by_command(self, node_backed_by_usd=True): """ This tests the creation of python nodes through the node definition mechanism We have a python node type that defines the inputs and outputs of a python node type. Here, without pre-declaring these attributes in USD, we will create the node using its node type definition only. The required attributes should automatically be created for the node. We then wire it up to make sure it works. """ graph = og.Controller.create_graph("/defaultPrim/TestGraph") new_node_path = "/defaultPrim/TestGraph/new_node" omni.kit.commands.execute( "CreateNode", graph=graph, node_path=new_node_path, node_type="omni.graph.examples.python.VersionedDeformerPy", create_usd=node_backed_by_usd, ) node = graph.get_node(new_node_path) self.assertEqual(node.get_prim_path(), new_node_path) # ---------------------------------------------------------------------- async def test_python_node_creation_by_command_usd(self): """Test that USD commands creating Python nodes also create OmniGraph nodes""" await self.run_python_node_creation_by_command(node_backed_by_usd=True) # ---------------------------------------------------------------------- async def test_python_node_creation_by_command_no_usd(self): """Test that USD commands creating Python nodes also create OmniGraph nodes""" await self.run_python_node_creation_by_command(node_backed_by_usd=False) # ---------------------------------------------------------------------- async def test_update_node_version(self): usd_context = omni.usd.get_context() stage = usd_context.get_stage() controller = og.Controller() (input_grid, output_grid) = ogts.create_input_and_output_grid_meshes(stage) input_points_attr = input_grid.GetPointsAttr() output_points_attr = output_grid.GetPointsAttr() keys = og.Controller.Keys controller = og.Controller() (push_graph, _, _, _) = controller.edit( "/defaultPrim/pushGraph", { keys.CREATE_NODES: [ ("ReadPoints", "omni.graph.nodes.ReadPrimAttribute"), ("WritePoints", "omni.graph.nodes.WritePrimAttribute"), ], keys.SET_VALUES: [ ("ReadPoints.inputs:name", input_points_attr.GetName()), ("ReadPoints.inputs:primPath", "/defaultPrim/inputGrid"), ("ReadPoints.inputs:usePath", True), ("WritePoints.inputs:name", output_points_attr.GetName()), ("WritePoints.inputs:primPath", "/defaultPrim/outputGrid"), ("WritePoints.inputs:usePath", True), ], }, ) test_deformer = stage.DefinePrim("/defaultPrim/pushGraph/testVersionedDeformer", "OmniGraphNode") test_deformer.GetAttribute("node:type").Set("omni.graph.examples.python.VersionedDeformerPy") test_deformer.GetAttribute("node:typeVersion").Set(0) deformer_input_points = test_deformer.CreateAttribute("inputs:points", Sdf.ValueTypeNames.Point3fArray) deformer_input_points.Set([(0, 0, 0)] * 1024) deformer_output_points = test_deformer.CreateAttribute("outputs:points", Sdf.ValueTypeNames.Point3fArray) deformer_output_points.Set([(0, 0, 0)] * 1024) multiplier_attr = test_deformer.CreateAttribute("inputs:multiplier", Sdf.ValueTypeNames.Float) multiplier_attr.Set(3) await controller.evaluate() controller.edit( push_graph, { keys.CONNECT: [ ("ReadPoints.outputs:value", deformer_input_points.GetPath().pathString), (deformer_output_points.GetPath().pathString, "WritePoints.inputs:value"), ] }, ) # Wait for USD notice handler to construct the underlying compute graph await controller.evaluate() # This node has 2 attributes declared as part of its node definition. We didn't create these attributes # above, but the code should have automatically filled them in version_deformer_node = push_graph.get_node("/defaultPrim/pushGraph/testVersionedDeformer") input_attr = version_deformer_node.get_attribute("test_input") output_attr = version_deformer_node.get_attribute("test_output") self.assertTrue(input_attr is not None and input_attr.is_valid()) self.assertTrue(output_attr is not None and output_attr.is_valid()) self.assertEqual(input_attr.get_name(), "test_input") self.assertEqual(input_attr.get_type_name(), "int") self.assertEqual(output_attr.get_name(), "test_output") self.assertEqual(output_attr.get_type_name(), "float") # We added an union type input to this node as well, so test that is here: union_attr = version_deformer_node.get_attribute("test_union_input") self.assertTrue(union_attr is not None and union_attr.is_valid()) self.assertEqual(union_attr.get_name(), "test_union_input") self.assertEqual(union_attr.get_type_name(), "token") self.assertEqual(union_attr.get_extended_type(), og.ExtendedAttributeType.EXTENDED_ATTR_TYPE_UNION) self.assertEqual(union_attr.get_resolved_type().base_type, og.BaseDataType.UNKNOWN) union_attr.set_resolved_type(og.Type(og.BaseDataType.FLOAT)) self.assertEqual(union_attr.get_resolved_type(), og.Type(og.BaseDataType.FLOAT)) union_attr.set(32) self.assertEqual(union_attr.get(), 32) # Node version update happens as the nodes are constructed and checked against the node type multiplier_attr = test_deformer.GetAttribute("inputs:multiplier") self.assertFalse(multiplier_attr.IsValid()) wavelength_attr = test_deformer.GetAttribute("inputs:wavelength") self.assertIsNotNone(wavelength_attr) self.assertEqual(wavelength_attr.GetTypeName(), Sdf.ValueTypeNames.Float) # attrib value should be initialized to 50 og_attr = controller.node("/defaultPrim/pushGraph/testVersionedDeformer").get_attribute("inputs:wavelength") self.assertEqual(og_attr.get(), 50.0) # ---------------------------------------------------------------------- async def test_example_tutorial1_finished(self): """Tests the deforming_text_tutorial_finished.usda file""" ext_dir = os.path.dirname(__file__) + ("/.." * 5) file_path = os.path.join(ext_dir, "data", "deforming_text_tutorial_finished.usda") (result, error) = await ogts.load_test_file(file_path) self.assertTrue(result, error) await omni.kit.app.get_app().next_update_async() await og.Controller.evaluate() # Verify the test graph is functional. We take a look at the location of the sphere and the 'G' mesh. When we # move the sphere it should also move the 'G'. If the 'G' is not moved from it's orginal location we know # something is wrong. stage = omni.usd.get_context().get_stage() sphere = UsdGeom.Xformable(stage.GetPrimAtPath("/World/Sphere")) text_g_mesh = UsdGeom.Xformable(stage.GetPrimAtPath("/World/Text_G")) text_g_x0 = text_g_mesh.GetLocalTransformation()[3] # Move the sphere sphere.ClearXformOpOrder() sphere_translate_op = sphere.AddTranslateOp() sphere_translate_op.Set(Gf.Vec3d(0, 0, 0)) # Check the 'G' position has changed await omni.kit.app.get_app().next_update_async() text_g_x1 = text_g_mesh.GetLocalTransformation()[3] self.assertNotEqual(text_g_x0, text_g_x1) # ---------------------------------------------------------------------- async def test_singleton(self): """ Basic idea of test: we define a node that's been tagged as singleton. We then try to add another node of the same type. It should fail and not let us. """ (graph, (singleton_node,), _, _) = og.Controller.edit( "/TestGraph", {og.Controller.Keys.CREATE_NODES: ("testSingleton", "omni.graph.examples.python.TestSingleton")}, ) singleton_node = graph.get_node("/TestGraph/testSingleton") self.assertTrue(singleton_node.is_valid()) with ogts.ExpectedError(): (_, (other_node,), _, _) = og.Controller.edit( graph, {og.Controller.Keys.CREATE_NODES: ("testSingleton2", "omni.graph.examples.python.TestSingleton")} ) self.assertFalse(other_node.is_valid()) node = graph.get_node("/TestGraph/testSingleton") self.assertTrue(node.is_valid()) node = graph.get_node("/TestGraph/testSingleton2") self.assertFalse(node.is_valid()) # ---------------------------------------------------------------------- async def test_set_compute_incomplete(self): """ Test usage of OgnCountTo which leverages set_compute_incomplete API. """ controller = og.Controller() keys = og.Controller.Keys (_, nodes, _, _,) = controller.edit( {"graph_path": "/World/TestGraph", "evaluator_name": "dirty_push"}, { keys.CREATE_NODES: [ ("CountTo", "omni.graph.examples.python.CountTo"), ], keys.SET_VALUES: [ ("CountTo.inputs:increment", 1), ], }, ) count_out = controller.attribute("outputs:count", nodes[0]) self.assertEqual(og.Controller.get(count_out), 0.0) await controller.evaluate() self.assertEqual(og.Controller.get(count_out), 1.0) await controller.evaluate() self.assertEqual(og.Controller.get(count_out), 2.0) await controller.evaluate() self.assertEqual(og.Controller.get(count_out), 3.0) await controller.evaluate() self.assertEqual(og.Controller.get(count_out), 3.0)
13,779
Python
48.568345
120
0.609768
omniverse-code/kit/exts/omni.graph.examples.python/docs/CHANGELOG.md
# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ## [1.3.2] - 2022-08-31 ### Fixed - Refactored out use of a deprecated class ## [1.3.1] - 2022-08-09 ### Fixed - Applied formatting to all of the Python files ## [1.3.0] - 2022-07-07 ### Added - Test for public API consistency ## [1.2.0] - 2022-06-21 ### Changed - Made the imports and docstring more explicit in the top level __init__.py - Deliberately emptied out the _impl/__init__.py since it should not be imported - Changed the name of the extension class to emphasize that it is not part of an API ## [1.1.0] - 2022-04-29 ### Removed - Obsolete GPU Tests ### Changed - Made tests derive from OmniGraphTestCase ## [1.0.2] - 2022-03-14 ### Changed - Added categories to node OGN ## [1.0.1] - 2022-01-13 ### Changed - Fixed the outdated OmniGraph tutorial - Updated the USDA files, UI screenshots, and tutorial contents ## [1.0.0] - 2021-03-01 ### Initial Version - Started changelog with initial released version of the OmniGraph core
1,217
Markdown
25.47826
87
0.703369
omniverse-code/kit/exts/omni.graph.examples.python/docs/README.md
# OmniGraph Python Examples [omni.graph.examples.python] This extension contains example implementations for OmniGraph nodes written in Python.
145
Markdown
35.499991
86
0.834483
omniverse-code/kit/exts/omni.graph.examples.python/docs/index.rst
.. _ogn_omni_graph_examples_python: OmniGraph Python Example Nodes ############################## .. tabularcolumns:: |L|R| .. csv-table:: :width: 100% **Extension**: omni.graph.examples.python,**Documentation Generated**: |today| .. toctree:: :maxdepth: 1 CHANGELOG This extension includes a miscellaneous collection of examples that exercise some of the functionality of the OmniGraph nodes written in Python. Ulike the set of nodes implementing common features found in :ref:`ogn_omni_graph_nodes` the nodes here do not serve a common purpose, they are just used to illustrate the use of certain features of the OmniGraph. For examples of nodes implemented in C++ see the extension :ref:`ogn_omni_graph_examples_cpp`. For more comprehensive examples targeted at explaining the use of OmniGraph node features in detail see :ref:`ogn_user_guide`.
875
reStructuredText
29.206896
105
0.730286
omniverse-code/kit/exts/omni.graph.examples.python/docs/Overview.md
# OmniGraph Python Example Nodes ```{csv-table} **Extension**: omni.graph.examples.python,**Documentation Generated**: {sub-ref}`today` ``` This extension includes a miscellaneous collection of examples that exercise some of the functionality of the OmniGraph nodes written in Python. Ulike the set of nodes implementing common features found in {ref}`ogn_omni_graph_nodes` the nodes here do not serve a common purpose, they are just used to illustrate the use of certain features of the OmniGraph. For examples of nodes implemented in C++ see the extension {ref}`ogn_omni_graph_examples_cpp`. For more comprehensive examples targeted at explaining the use of OmniGraph node features in detail see {ref}`ogn_user_guide`.
729
Markdown
44.624997
105
0.781893
omniverse-code/kit/exts/omni.kit.widget.options_menu/omni/kit/widget/options_menu/options_model.py
from typing import List import omni.ui as ui from .option_item import OptionItem class OptionsModel(ui.AbstractItemModel): """ Model for options items. Args: name (str): Model name to display in menu header. items (List[OptionItem]): Items to show in menu. """ def __init__(self, name: str, items: List[OptionItem]): self.name = name self._items = items self.__subs = {} for item in self._items: if item.name: self.__subs[item] = item.model.subscribe_value_changed_fn(lambda m, i=item: self.__on_value_changed(i, m)) super().__init__() def destroy(self): self.__subs.clear() @property def dirty(self) -> bool: """ Flag if any item not in default value. """ for item in self._items: if item.dirty: return True return False def rebuild_items(self, items: List[OptionItem]) -> None: """ Rebuild option items. Args: items (List[OptionItem]): Items to show in menu. """ self.__subs.clear() self._items = items for item in self._items: if item.name: self.__subs[item] = item.model.subscribe_value_changed_fn(lambda m, i=item: self.__on_value_changed(i, m)) self._item_changed(None) def reset(self) -> None: """ Reset all items to default value. """ for item in self._items: item.reset() def get_item_children(self) -> List[OptionItem]: """ Get items in this model. """ return self._items def __on_value_changed(self, item: OptionItem, model: ui.SimpleBoolModel): self._item_changed(item)
1,802
Python
25.910447
122
0.54384
omniverse-code/kit/exts/omni.kit.widget.options_menu/omni/kit/widget/options_menu/option_menu_item.py
import omni.ui as ui from .option_item import OptionItem class OptionMenuItemDelegate(ui.MenuDelegate): """ Delegate for general option menu item. A general option item includes a selected icon and item text. Args: option_item (OptionItem): Option item to show as menu item. Keyword Args: width (ui.Length): Menu item width. Default ui.Fraction(1). """ def __init__(self, option_item: OptionItem, width: ui.Length = ui.Fraction(1)): self._option_item = option_item self._width = width super().__init__(propagate=True) def destroy(self): self.__sub = None def build_item(self, item: ui.MenuItem): model = self._option_item.model self.__sub = model.subscribe_value_changed_fn(self._on_value_changed) self._container = ui.HStack(height=24, width=self._width, content_clipping=False, checked=model.as_bool) with self._container: ui.ImageWithProvider(width = 24, style_type_name_override="MenuItem.Icon") ui.Label( item.text, style_type_name_override="MenuItem.Label", ) ui.Spacer(width=16) self._container.set_mouse_pressed_fn(lambda x, y, b, a, m=model: m.set_value(not m.as_bool)) self._container.set_mouse_hovered_fn(self._on_mouse_hovered) def _on_value_changed(self, model: ui.SimpleBoolModel) -> None: self._container.checked = model.as_bool def _on_mouse_hovered(self, hovered: bool) -> None: # Here to set selected instead of hovered status for icon. # Because there is margin in icon, there will be some blank at top/bottom as a result icon does not become hovered if mouse on these area. self._container.selected = hovered class OptionMenuItem(ui.MenuItem): """ Represent a menu item for a single option. Args: option_item (OptionItem): Option item to show as menu item. Keyword Args: hide_on_click (bool): Hide menu if item clicked. Default False. width (ui.Length): Menu item width. Default ui.Fraction(1). """ def __init__(self, option_item: OptionItem, hide_on_click: bool = False, width: ui.Length = ui.Fraction(1)): self._delegate = OptionMenuItemDelegate(option_item, width=width) super().__init__(option_item.text, delegate=self._delegate, hide_on_click=hide_on_click, checkable=True) def destroy(self): self._delegate.destroy()
2,502
Python
36.924242
146
0.642286
omniverse-code/kit/exts/omni.kit.widget.options_menu/omni/kit/widget/options_menu/style.py
from pathlib import Path import omni.ui as ui from omni.ui import color as cl CURRENT_PATH = Path(__file__).parent.absolute() ICON_PATH = CURRENT_PATH.parent.parent.parent.parent.joinpath(f"data/icons") OPTIONS_MENU_STYLE = { "Title.Background": {"background_color": 0xFF23211F, "corner_flag": ui.CornerFlag.TOP, "margin": 0}, "Title.Header": {"margin_width": 3, "margin_height": 0}, "Title.Label": {"background_color": 0x0, "color": cl.shade(cl('#A1A1A1')), "margin_width": 5}, "ResetButton": {"background_color": 0}, "ResetButton:hovered": {"background_color": cl.shade(cl('323434'))}, "ResetButton.Label": {"color": cl.shade(cl('#34C7FF'))}, "ResetButton.Label:disabled": {"color": cl.shade(cl('#6E6E6E'))}, "ResetButton.Label:hovered": {"color": cl.shade(cl('#1A91C5'))}, "MenuItem.Icon": {"image_url": f"{ICON_PATH}/check_solid.svg", "color": 0, "margin": 7}, "MenuItem.Icon:checked": {"color": cl.shade(cl('#34C7FF'))}, "MenuItem.Icon:selected": {"color": cl.shade(cl('#1F2123'))}, "MenuItem.Label::title": {"color": cl.shade(cl('#A1A1A1')), "margin_width": 5}, "MenuItem.Separator": {"color": cl.shade(cl('#626363')), "border_width": 1.5}, }
1,205
Python
47.239998
104
0.640664
omniverse-code/kit/exts/omni.kit.widget.options_menu/omni/kit/widget/options_menu/option_separator.py
import omni.ui as ui class SeparatorDelegate(ui.MenuDelegate): """Menu delegate for separator""" def build_item(self, _): with ui.HStack(): ui.Spacer(width=24) ui.Line(height=10, style_type_name_override="MenuItem.Separator") ui.Spacer(width=8) class OptionSeparator(ui.MenuItem): """A simple separator""" def __init__(self): super().__init__("##OPTION_SEPARATOR", delegate=SeparatorDelegate(), enabled=False)
482
Python
27.411763
91
0.628631
omniverse-code/kit/exts/omni.kit.widget.options_menu/omni/kit/widget/options_menu/__init__.py
from .options_menu import OptionsMenu from .options_model import OptionsModel from .option_item import OptionItem, OptionSeparator
132
Python
25.599995
52
0.840909
omniverse-code/kit/exts/omni.kit.widget.options_menu/omni/kit/widget/options_menu/option_item.py
from typing import Optional, Callable import omni.ui as ui class OptionItem(ui.AbstractItem): """ Represent an item for OptionsMenu. Args: name (str): Item name. Keyword args: text (str): Item text to show in menu item. Default None means using name. default (bool): Default item value. Default False. on_value_changed_fn (Callable[[bool], None]): Callback when item value changed. """ def __init__(self, name: Optional[str], text: Optional[str] = None, default: bool = False, on_value_changed_fn: Callable[[bool], None] = None): self.name = name self.text = text or name self.default = default self.model = ui.SimpleBoolModel(default) if on_value_changed_fn: self.__on_value_changed_fn = on_value_changed_fn def __on_value_changed(model: ui.SimpleBoolModel): self.__on_value_changed_fn(model.as_bool) self.__sub = self.model.subscribe_value_changed_fn(__on_value_changed) super().__init__() def destroy(self): self.__sub = None @property def value(self) -> bool: """ Item current value. """ return self.model.as_bool @value.setter def value(self, new_value: bool) -> None: self.model.set_value(new_value) @property def dirty(self) -> bool: """ Flag of item value changed. """ return self.model.as_bool != self.default def reset(self) -> None: """ Reset item value to default. """ self.model.set_value(self.default) class OptionSeparator(OptionItem): """ A simple option item represents a separator in menu item. """ def __init__(self): super().__init__(None)
1,814
Python
26.5
147
0.579383
omniverse-code/kit/exts/omni.kit.widget.options_menu/omni/kit/widget/options_menu/options_menu.py
from typing import Optional import omni.ui as ui from .option_item import OptionItem from .option_menu_item import OptionMenuItem from .options_model import OptionsModel from .option_separator import OptionSeparator from .style import OPTIONS_MENU_STYLE class OptionsMenuDelegate(ui.MenuDelegate): """ Delegate for options menu. It has a header to show label and reset button Args: model (OptionsModel): Model for options to show in this menu. """ def __init__(self, model: OptionsModel, **kwargs): self._model = model self._reset_all: Optional[ui.Button] = None self.__sub = self._model.subscribe_item_changed_fn(self.__on_item_changed) super().__init__(**kwargs) def destroy(self) -> None: self.__sub = None def build_title(self, item: ui.Menu) -> None: with ui.ZStack(content_clipping=True, height=24): ui.Rectangle(style_type_name_override="Title.Background") with ui.HStack(style_type_name_override="Title.Header"): if item.text: ui.Label(self._model.name, width=0, style_type_name_override="Title.Label") # Extra spacer here to make sure menu window has min width ui.Spacer(width=45) ui.Spacer() self._reset_all = ui.Button( "Reset All", width=0, height=24, enabled=self._model.dirty, style_type_name_override="ResetButton", clicked_fn=self._model.reset, identifier="reset_all", ) def __on_item_changed(self, model: OptionsModel, item: OptionItem) -> None: if self._reset_all: self._reset_all.enabled = self._model.dirty class OptionsMenu(ui.Menu): """ Represent a menu to show options. A options menu includes a header and a list of menu items for options. Args: model (OptionsModel): Model of option items to show in this menu. hide_on_click (bool): Hide menu when item clicked. Default False. width (ui.Length): Width of menu item. Default ui.Fraction(1). style (dict): Additional style. Default empty. """ def __init__(self, model: OptionsModel, hide_on_click: bool = False, width: ui.Length = ui.Fraction(1), style: dict = {}): self._model = model self._hide_on_click = hide_on_click self._width = width menu_style = OPTIONS_MENU_STYLE.copy() menu_style.update(style) self._delegate = OptionsMenuDelegate(self._model) super().__init__(self._model.name, delegate=self._delegate, menu_compatibility=False, on_build_fn=self._build_menu_items, style=menu_style) self.__sub = self._model.subscribe_item_changed_fn(self.__on_model_changed) def destroy(self): self.__sub = None self._delegate.destroy() def show_by_widget(self, widget: ui.Widget) -> None: """ Show menu around widget (bottom left). Args: widget (ui.Widget): Widget to align for this menu. """ if widget: x = widget.screen_position_x y = widget.screen_position_y + widget.computed_height self.show_at(x, y) else: self.show() def _build_menu_items(self): for item in self._model.get_item_children(): if item.text is None: # Separator OptionSeparator() else: OptionMenuItem(item, hide_on_click=self._hide_on_click, width=self._width) def __on_model_changed(self, model: OptionsModel, item: Optional[OptionItem]) -> None: if item is None: self.invalidate()
3,803
Python
34.886792
147
0.591112
omniverse-code/kit/exts/omni.kit.widget.options_menu/omni/kit/widget/options_menu/tests/__init__.py
from .test_ui import *
23
Python
10.999995
22
0.695652
omniverse-code/kit/exts/omni.kit.widget.options_menu/omni/kit/widget/options_menu/tests/test_ui.py
from pathlib import Path import omni.kit.ui_test as ui_test from omni.ui.tests.test_base import OmniUiTest from ..options_menu import OptionsMenu from ..options_model import OptionsModel from ..option_item import OptionItem, OptionSeparator CURRENT_PATH = Path(__file__).parent.absolute() TEST_DATA_PATH = CURRENT_PATH.parent.parent.parent.parent.parent.joinpath("data/tests") class TestOptions(OmniUiTest): # Before running each test async def setUp(self): self._model = OptionsModel( "Filter", [ OptionItem("audio", text="Audio"), OptionItem("materials", text="Materials"), OptionItem("scripts", text="Scripts"), OptionItem("textures", text="Textures"), OptionItem("usd", text="USD"), ] ) self._golden_img_dir = TEST_DATA_PATH.absolute().joinpath("golden") await super().setUp() # After running each test async def tearDown(self): await super().tearDown() async def finalize_test(self, golden_img_name: str): await self.wait_n_updates() await super().finalize_test(golden_img_dir=self._golden_img_dir, golden_img_name=golden_img_name) await self.wait_n_updates() async def test_ui_layout(self): """Test ui, reset and API to get/set value""" items = self._model.get_item_children() self._changed_names = [] def _on_item_changed(_, item: OptionItem): self._changed_names.append(item.name) self._sub = self._model.subscribe_item_changed_fn(_on_item_changed) menu = OptionsMenu(self._model) menu.show_at(0, 0) try: # Initial UI await ui_test.emulate_mouse_move(ui_test.Vec2(0, 0)) await ui_test.human_delay() await self.finalize_test("options_menu.png") # Change first and last item via mouse click await ui_test.human_delay() await ui_test.emulate_mouse_move_and_click(ui_test.Vec2(50, 45)) await ui_test.human_delay() await ui_test.emulate_mouse_move_and_click(ui_test.Vec2(50, 145)) await ui_test.human_delay() self.assertEqual(len(self._changed_names), 2) self.assertEqual(self._changed_names[0], items[0].name) self.assertEqual(self._changed_names[1], items[-1].name) await self.finalize_test("options_menu_click.png") # Change value via item property items[2].value = not items[2].value items[3].value = not items[3].value await self.finalize_test("options_menu_value_changed.png") # Reset all await ui_test.emulate_mouse_move_and_click(ui_test.Vec2(120, 20)) await self.finalize_test("options_menu.png") finally: menu.destroy() async def test_ui_rebuild_items(self): """Test ui, reset and API to get/set value""" items = self._model.get_item_children() menu = OptionsMenu(self._model) menu.show_at(0, 0) try: # Initial UI await ui_test.emulate_mouse_move(ui_test.Vec2(0, 0)) await ui_test.human_delay() await self.finalize_test("options_menu.png") self._model.rebuild_items( [ OptionItem("Test"), OptionSeparator(), OptionItem("More"), ] ) await ui_test.human_delay() await self.finalize_test("options_menu_rebuild.png") self._model.rebuild_items(items) await ui_test.human_delay() await self.finalize_test("options_menu.png") finally: menu.destroy()
3,827
Python
33.486486
105
0.577215
omniverse-code/kit/exts/omni.kit.welcome.about/omni/kit/welcome/about/style.py
from pathlib import Path import omni.ui as ui from omni.ui import color as cl from omni.ui import constant as fl CURRENT_PATH = Path(__file__).parent ICON_PATH = CURRENT_PATH.parent.parent.parent.parent.joinpath("icons") ABOUT_PAGE_STYLE = { "Info": { "background_color": cl("#1F2123") }, "Title.Label": { "font_size": fl.welcome_title_font_size }, "Version.Label": { "font_size": 18, "margin_width": 5 }, "Plugin.Title": { "font_size": 16, "margin_width": 5 }, "Plugin.Label": { "font_size": 16, "margin_width": 5 }, "Plugin.Frame": { "background_color": 0xFF454545, "margin_width": 2, "margin_height": 3, "margin": 5 } }
650
Python
35.166665
106
0.646154
omniverse-code/kit/exts/omni.kit.welcome.about/omni/kit/welcome/about/extension.py
from typing import List import carb.settings import carb.tokens import omni.client import omni.ext import omni.ui as ui from omni.kit.welcome.window import register_page from omni.ui import constant as fl from .style import ABOUT_PAGE_STYLE _extension_instance = None class AboutPageExtension(omni.ext.IExt): def on_startup(self, ext_id): self.__ext_name = omni.ext.get_extension_name(ext_id) register_page(self.__ext_name, self.build_ui) def on_shutdown(self): global _extension_instance _extension_instance = None self._about_widget = None def build_ui(self) -> None: with ui.ZStack(style=ABOUT_PAGE_STYLE): # Background ui.Rectangle(style_type_name_override="Content") with ui.VStack(): with ui.VStack(height=fl._find("welcome_page_title_height")): ui.Spacer() ui.Label("ABOUT", height=0, alignment=ui.Alignment.CENTER, style_type_name_override="Title.Label") ui.Spacer() with ui.HStack(): ui.Spacer(width=fl._find("welcome_content_padding_x")) with ui.VStack(): with ui.ZStack(): ui.Rectangle(style_type_name_override="Info") self.__build_content() ui.Spacer(width=fl._find("welcome_content_padding_x")) ui.Spacer(height=fl._find("welcome_content_padding_y")) def __build_content(self): import omni.kit.app manager = omni.kit.app.get_app().get_extension_manager() manager.set_extension_enabled_immediate("omni.kit.window.about", True) from omni.kit.window.about import AboutWidget with ui.Frame(): self._about_widget = AboutWidget()
1,849
Python
32.636363
118
0.593294
omniverse-code/kit/exts/omni.kit.welcome.about/omni/kit/welcome/about/tests/test_page.py
import asyncio from pathlib import Path import omni.kit.app from omni.ui.tests.test_base import OmniUiTest from ..extension import AboutPageExtension CURRENT_PATH = Path(__file__).parent TEST_DATA_PATH = CURRENT_PATH.parent.parent.parent.parent.parent.joinpath("data").joinpath("tests") class TestPage(OmniUiTest): # Before running each test async def setUp(self): await super().setUp() self._golden_img_dir = TEST_DATA_PATH.absolute().joinpath("golden_img").absolute() # After running each test async def tearDown(self): await super().tearDown() async def test_page(self): window = await self.create_test_window(width=800, height=500) with window.frame: ext = AboutPageExtension() ext.on_startup("omni.kit.welcome.extensions-1.1.0") ext.build_ui() ext._about_widget.app_info = "#App Name# #App Version#" ext._about_widget.versions = ["About test version #1", "About test version #2", "About test version #3"] class FakePluginImpl(): def __init__(self, name): self.name = name class FakePlugin(): def __init__(self, name): self.libPath = "Lib Path " + name self.impl = FakePluginImpl("Impl " + name) self.interfaces = "Interface " + name ext._about_widget.plugins = [FakePlugin("Test 1"), FakePlugin("Test 2"), FakePlugin("Test 3"), FakePlugin("Test 4")] await omni.kit.app.get_app().next_update_async() # Wait for image loaded await asyncio.sleep(5) await self.finalize_test(golden_img_dir=self._golden_img_dir, golden_img_name="page.png")
1,765
Python
35.040816
128
0.603399
omniverse-code/kit/exts/omni.kit.viewport.manipulator.transform/omni/kit/viewport/manipulator/transform/fakeGf.py
import math from usdrt import Gf def GfRotation(axis0, angle): axis = Gf.Vec3d(axis0[0], axis0[1], axis0[2]).GetNormalized() quat = Gf.Quatd() s = math.sin(math.radians (angle*0.5 ) ) qx = axis[0] * s qy = axis[1] * s qz = axis[2] * s qw = math.cos( math.radians (angle/2) ) i = Gf.Vec3d(qx, qy, qz) quat.SetReal(qw) quat.SetImaginary(i) return quat
397
Python
21.11111
65
0.586902
omniverse-code/kit/exts/omni.kit.viewport.manipulator.transform/omni/kit/viewport/manipulator/transform/__init__.py
from .extension import * from .model import *
46
Python
14.666662
24
0.73913
omniverse-code/kit/exts/omni.kit.viewport.manipulator.transform/omni/kit/viewport/manipulator/transform/utils.py
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # import carb import carb.profiler import carb.settings @carb.profiler.profile def flatten(transform): """Convert array[4][4] to array[16]""" # flatten the matrix by hand # USING LIST COMPREHENSION IS VERY SLOW (e.g. return [item for sublist in transform for item in sublist]), which takes around 10ms. m0, m1, m2, m3 = transform[0], transform[1], transform[2], transform[3] return [ m0[0], m0[1], m0[2], m0[3], m1[0], m1[1], m1[2], m1[3], m2[0], m2[1], m2[2], m2[3], m3[0], m3[1], m3[2], m3[3], ]
1,078
Python
27.394736
135
0.628942
omniverse-code/kit/exts/omni.kit.viewport.manipulator.transform/omni/kit/viewport/manipulator/transform/model.py
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # from __future__ import annotations # import asyncio # import math # import traceback from enum import Enum, Flag, IntEnum, auto # from typing import Dict, List, Sequence, Set, Tuple, Union # import concurrent.futures import carb import carb.dictionary import carb.events import carb.profiler import carb.settings # import omni.kit.app from omni.kit.async_engine import run_coroutine import omni.kit.undo import omni.timeline # from omni.kit.manipulator.tool.snap import settings_constants as snap_c from omni.kit.manipulator.transform import AbstractTransformManipulatorModel, Operation # from omni.kit.manipulator.transform.settings_constants import c # from omni.kit.manipulator.transform.settings_listener import OpSettingsListener, SnapSettingsListener # from omni.ui import scene as sc # from pxr import Gf, Sdf, Tf, Usd, UsdGeom, UsdUtils # from .utils import * # from .settings_constants import Constants as prim_c class ManipulationMode(IntEnum): PIVOT = 0 # transform around manipulator pivot UNIFORM = 1 # set same world transform from manipulator to all prims equally INDIVIDUAL = 2 # 2: (TODO) transform around each prim's own pivot respectively class Viewport1WindowState: def __init__(self): self._focused_windows = None focused_windows = [] try: # For some reason is_focused may return False, when a Window is definitely in fact is the focused window! # And there's no good solution to this when multiple Viewport-1 instances are open; so we just have to # operate on all Viewports for a given usd_context. import omni.kit.viewport_legacy as vp vpi = vp.acquire_viewport_interface() for instance in vpi.get_instance_list(): window = vpi.get_viewport_window(instance) if not window: continue focused_windows.append(window) if focused_windows: self._focused_windows = focused_windows for window in self._focused_windows: # Disable the selection_rect, but enable_picking for snapping window.disable_selection_rect(True) # Schedule a picking request so if snap needs it later, it may arrive by the on_change event window.request_picking() except Exception: pass def get_picked_world_pos(self): if self._focused_windows: # Try to reduce to the focused window now after, we've had some mouse-move input focused_windows = [window for window in self._focused_windows if window.is_focused()] if focused_windows: self._focused_windows = focused_windows for window in self._focused_windows: window.disable_selection_rect(True) # request picking FOR NEXT FRAME window.request_picking() # get PREVIOUSLY picked pos, it may be None the first frame but that's fine return window.get_picked_world_pos() return None def __del__(self): self.destroy() def destroy(self): self._focused_windows = None def get_usd_context_name(self): if self._focused_windows: return self._focused_windows[0].get_usd_context_name() else: return "" class DataAccessorRegistry(): def __init__(self): ... def getDataAccessor(self): self.dataAccessor = DataAccessor() return self.dataAccessor class DataAccessor(): def __init__(self): ... def get_local_to_world_transform(self, obj): ... def get_parent_to_world_transform(self, obj): ... def clear_xform_cache(self): ... class ViewportTransformModel(AbstractTransformManipulatorModel): def __init__(self, usd_context_name: str = "", viewport_api=None): super().__init__()
4,385
Python
38.160714
117
0.662942
omniverse-code/kit/exts/omni.kit.viewport.manipulator.transform/omni/kit/viewport/manipulator/transform/gestures.py
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # from __future__ import annotations import asyncio import math import traceback from enum import Enum, Flag, IntEnum, auto from typing import Dict, List, Sequence, Set, Tuple, Union import concurrent.futures import carb import carb.dictionary import carb.events import carb.profiler import carb.settings import omni.kit.app from omni.kit.async_engine import run_coroutine import omni.kit.commands import omni.kit.undo import omni.timeline from omni.kit.manipulator.tool.snap import SnapProviderManager # from omni.kit.manipulator.tool.snap import settings_constants as snap_c from omni.kit.manipulator.transform.gestures import ( RotateChangedGesture, RotateDragGesturePayload, ScaleChangedGesture, ScaleDragGesturePayload, TransformDragGesturePayload, TranslateChangedGesture, TranslateDragGesturePayload, ) from omni.kit.manipulator.transform import Operation from omni.kit.manipulator.transform.settings_constants import c from omni.ui import scene as sc from .model import ViewportTransformModel, ManipulationMode, Viewport1WindowState from .utils import flatten from .fakeGf import GfRotation # from usdrt import Sdf, Usd, UsdGeom from usdrt import Gf class ViewportTransformChangedGestureBase: def __init__(self, usd_context_name: str = "", viewport_api=None): self._settings = carb.settings.get_settings() self._usd_context_name = usd_context_name self._usd_context = omni.usd.get_context(self._usd_context_name) self._viewport_api = viewport_api # VP2 self._vp1_window_state = None self._stage_id = None def on_began(self, payload_type=TransformDragGesturePayload): self._viewport_on_began() if not self.gesture_payload or not self.sender or not isinstance(self.gesture_payload, payload_type): return model = self.sender.model if not model: return item = self.gesture_payload.changing_item self._current_editing_op = item.operation # NOTE! self._begin_xform has no scale. To get the full matrix, do self._begin_scale_mtx * self._begin_xform self._begin_xform = Gf.Matrix4d(*model.get_as_floats(model.get_item("no_scale_transform_manipulator"))) manip_scale = Gf.Vec3d(*model.get_as_floats(model.get_item("scale_manipulator"))) self._begin_scale_mtx = Gf.Matrix4d(1.0) self._begin_scale_mtx.SetScale(manip_scale) model.set_floats(model.get_item("viewport_fps"), [0.0]) model.on_began(self.gesture_payload) def on_changed(self, payload_type=TransformDragGesturePayload): if not self.gesture_payload or not self.sender or not isinstance(self.gesture_payload, payload_type): return model = self.sender.model if not model: return if self._viewport_api: fps = self._viewport_api.frame_info.get("fps") model.set_floats(model.get_item("viewport_fps"), [fps]) model.on_changed(self.gesture_payload) def on_ended(self, payload_type=TransformDragGesturePayload): self._viewport_on_ended() if not self.gesture_payload or not self.sender or not isinstance(self.gesture_payload, payload_type): return model = self.sender.model if not model: return item = self.gesture_payload.changing_item if item.operation != self._current_editing_op: return model.set_floats(model.get_item("viewport_fps"), [0.0]) model.on_ended(self.gesture_payload) self._current_editing_op = None def on_canceled(self, payload_type=TransformDragGesturePayload): self._viewport_on_ended() if not self.gesture_payload or not self.sender or not isinstance(self.gesture_payload, payload_type): return model = self.sender.model if not model: return item = self.gesture_payload.changing_item if item.operation != self._current_editing_op: return model.on_canceled(self.gesture_payload) self._current_editing_op = None def _publish_delta(self, operation: Operation, delta: List[float]): if operation == Operation.TRANSLATE: self._settings.set_float_array(TRANSFORM_GIZMO_TRANSLATE_DELTA_XYZ, delta) elif operation == Operation.ROTATE: self._settings.set_float_array(TRANSFORM_GIZMO_ROTATE_DELTA_XYZW, delta) elif operation == Operation.SCALE: self._settings.set_float_array(TRANSFORM_GIZMO_SCALE_DELTA_XYZ, delta) def __set_viewport_manipulating(self, value: int): # Signal that user-manipulation has started for this stage if self._stage_id is None: # self._stage_id = UsdUtils.StageCache.Get().GetId(self._usd_context.get_stage()).ToLongInt() self._stage_id = self._usd_context.get_stage_id() key = f"/app/viewport/{self._stage_id}/manipulating" cur_value = self._settings.get(key) or 0 self._settings.set(key, cur_value + value) def _viewport_on_began(self): self._viewport_on_ended() if self._viewport_api is None: self._vp1_window_state = Viewport1WindowState() self.__set_viewport_manipulating(1) def _viewport_on_ended(self): if self._vp1_window_state: self._vp1_window_state.destroy() self._vp1_window_state = None if self._stage_id: self.__set_viewport_manipulating(-1) self._stage_id = None class ViewportTranslateChangedGesture(TranslateChangedGesture, ViewportTransformChangedGestureBase): def __init__(self, snap_manager: SnapProviderManager, **kwargs): ViewportTransformChangedGestureBase.__init__(self, **kwargs) TranslateChangedGesture.__init__(self) self._accumulated_translate = Gf.Vec3d(0) self._snap_manager = snap_manager def on_began(self): ViewportTransformChangedGestureBase.on_began(self, TranslateDragGesturePayload) self._accumulated_translate = Gf.Vec3d(0) model = self._get_model(TranslateDragGesturePayload) if model and self._can_snap(model): # TODO No need for gesture=self when VP1 has viewport_api self._snap_manager.on_began(model.consolidated_xformable_prim_data_curr.keys(), gesture=self) if model: model.set_floats(model.get_item("translate_delta"), [0, 0, 0]) def on_ended(self): ViewportTransformChangedGestureBase.on_ended(self, TranslateDragGesturePayload) model = self._get_model(TranslateDragGesturePayload) if model and self._can_snap(model): self._snap_manager.on_ended() def on_canceled(self): ViewportTransformChangedGestureBase.on_canceled(self, TranslateDragGesturePayload) model = self._get_model(TranslateDragGesturePayload) if model and self._can_snap(model): self._snap_manager.on_ended() @carb.profiler.profile def on_changed(self): ViewportTransformChangedGestureBase.on_changed(self, TranslateDragGesturePayload) model = self._get_model(TranslateDragGesturePayload) if not model: return manip_xform = Gf.Matrix4d(*model.get_as_floats(model.get_item("no_scale_transform_manipulator"))) new_manip_xform = Gf.Matrix4d(manip_xform) rotation_mtx = manip_xform.ExtractRotationMatrix() rotation_mtx.Orthonormalize() translate_delta = self.gesture_payload.moved_delta translate = self.gesture_payload.moved axis = self.gesture_payload.axis # slow Gf.Vec3d(*translate_delta) translate_delta = Gf.Vec3d(translate_delta[0], translate_delta[1], translate_delta[2]) if model.op_settings_listener.translation_mode == c.TRANSFORM_MODE_LOCAL: translate_delta = translate_delta * rotation_mtx self._accumulated_translate += translate_delta def apply_position(snap_world_pos=None, snap_world_orient=None, keep_spacing: bool = True): nonlocal new_manip_xform if self.state != sc.GestureState.CHANGED: return # only set translate if no snap or only snap to position item_name = "translate" if snap_world_pos and ( math.isfinite(snap_world_pos[0]) and math.isfinite(snap_world_pos[1]) and math.isfinite(snap_world_pos[2]) ): if snap_world_orient is None: new_manip_xform.SetTranslateOnly(Gf.Vec3d(snap_world_pos[0], snap_world_pos[1], snap_world_pos[2])) new_manip_xform = self._begin_scale_mtx * new_manip_xform else: new_manip_xform.SetTranslateOnly(Gf.Vec3d(snap_world_pos[0], snap_world_pos[1], snap_world_pos[2])) new_manip_xform.SetRotateOnly(snap_world_orient) # set transform if snap both position and orientation item_name = "no_scale_transform_manipulator" else: new_manip_xform.SetTranslateOnly(self._begin_xform.ExtractTranslation() + self._accumulated_translate) new_manip_xform = self._begin_scale_mtx * new_manip_xform model.set_floats(model.get_item("translate_delta"), translate_delta) if model.custom_manipulator_enabled: self._publish_delta(Operation.TRANSLATE, translate_delta) if keep_spacing is False: mode_item = model.get_item("manipulator_mode") prev_mode = model.get_as_ints(mode_item) model.set_ints(mode_item, [int(ManipulationMode.UNIFORM)]) model.set_floats(model.get_item(item_name), flatten(new_manip_xform)) if keep_spacing is False: model.set_ints(mode_item, prev_mode) # only do snap to surface if drag the center point if ( model.snap_settings_listener.snap_enabled and model.snap_settings_listener.snap_provider and axis == [1, 1, 1] ): ndc_location = None if self._viewport_api: # No mouse location is available, have to convert back to NDC space ndc_location = self.sender.transform_space( sc.Space.WORLD, sc.Space.NDC, self.gesture_payload.ray_closest_point ) if self._snap_manager.get_snap_pos( new_manip_xform, ndc_location, self.sender.scene_view, lambda **kwargs: apply_position( kwargs.get("position", None), kwargs.get("orient", None), kwargs.get("keep_spacing", True) ), ): return apply_position() def _get_model(self, payload_type) -> ViewportTransformModel: if not self.gesture_payload or not self.sender or not isinstance(self.gesture_payload, payload_type): return None return self.sender.model def _can_snap(self, model: ViewportTransformModel): axis = self.gesture_payload.axis if ( model.snap_settings_listener.snap_enabled and model.snap_settings_listener.snap_provider and axis == [1, 1, 1] ): return True return False class ViewportRotateChangedGesture(RotateChangedGesture, ViewportTransformChangedGestureBase): def __init__(self, **kwargs): ViewportTransformChangedGestureBase.__init__(self, **kwargs) RotateChangedGesture.__init__(self) def on_began(self): ViewportTransformChangedGestureBase.on_began(self, RotateDragGesturePayload) model = self.sender.model if model: model.set_floats(model.get_item("rotate_delta"), [0, 0, 0, 0]) def on_ended(self): ViewportTransformChangedGestureBase.on_ended(self, RotateDragGesturePayload) def on_canceled(self): ViewportTransformChangedGestureBase.on_canceled(self, RotateDragGesturePayload) @carb.profiler.profile def on_changed(self): ViewportTransformChangedGestureBase.on_changed(self, RotateDragGesturePayload) if ( not self.gesture_payload or not self.sender or not isinstance(self.gesture_payload, RotateDragGesturePayload) ): return model = self.sender.model if not model: return axis = self.gesture_payload.axis angle = self.gesture_payload.angle angle_delta = self.gesture_payload.angle_delta screen_space = self.gesture_payload.screen_space free_rotation = self.gesture_payload.free_rotation axis = Gf.Vec3d(*axis[:3]) rotate = GfRotation(axis, angle) delta_axis = Gf.Vec4d(*axis, 0.0) rot_matrix = Gf.Matrix4d(1) rot_matrix.SetRotate(rotate) if free_rotation: rotate = GfRotation(axis, angle_delta) rot_matrix = Gf.Matrix4d(1) rot_matrix.SetRotate(rotate) xform = Gf.Matrix4d(*model.get_as_floats(model.get_item("no_scale_transform_manipulator"))) full_xform = self._begin_scale_mtx * xform translate = full_xform.ExtractTranslation() no_translate_mtx = Gf.Matrix4d(full_xform) no_translate_mtx.SetTranslateOnly(Gf.Vec3d(0)) no_translate_mtx = no_translate_mtx * rot_matrix new_transform_matrix = no_translate_mtx.SetTranslateOnly(translate) delta_axis = no_translate_mtx * delta_axis elif model.op_settings_listener.rotation_mode == c.TRANSFORM_MODE_GLOBAL or screen_space: begin_full_xform = self._begin_scale_mtx * self._begin_xform translate = begin_full_xform.ExtractTranslation() no_translate_mtx = Gf.Matrix4d(begin_full_xform) no_translate_mtx.SetTranslateOnly(Gf.Vec3d(0)) no_translate_mtx = no_translate_mtx * rot_matrix new_transform_matrix = no_translate_mtx.SetTranslateOnly(translate) delta_axis = no_translate_mtx * delta_axis else: self._begin_xform = Gf.Matrix4d(*model.get_as_floats(model.get_item("no_scale_transform_manipulator"))) new_transform_matrix = self._begin_scale_mtx * rot_matrix * self._begin_xform delta_axis.Normalize() delta_rotate = GfRotation(delta_axis[:3], angle_delta) quat = delta_rotate #.GetQuaternion() real = quat.GetReal() imaginary = quat.GetImaginary() rd = [imaginary[0], imaginary[1], imaginary[2], real] model.set_floats(model.get_item("rotate_delta"), rd) if model.custom_manipulator_enabled: self._publish_delta(Operation.ROTATE, rd) model.set_floats(model.get_item("rotate"), flatten(new_transform_matrix)) class ViewportScaleChangedGesture(ScaleChangedGesture, ViewportTransformChangedGestureBase): def __init__(self, **kwargs): ViewportTransformChangedGestureBase.__init__(self, **kwargs) ScaleChangedGesture.__init__(self) def on_began(self): ViewportTransformChangedGestureBase.on_began(self, ScaleDragGesturePayload) model = self.sender.model if model: model.set_floats(model.get_item("scale_delta"), [0, 0, 0]) def on_ended(self): ViewportTransformChangedGestureBase.on_ended(self, ScaleDragGesturePayload) def on_canceled(self): ViewportTransformChangedGestureBase.on_canceled(self, ScaleDragGesturePayload) @carb.profiler.profile def on_changed(self): ViewportTransformChangedGestureBase.on_changed(self, ScaleDragGesturePayload) if not self.gesture_payload or not self.sender or not isinstance(self.gesture_payload, ScaleDragGesturePayload): return model = self.sender.model if not model: return axis = self.gesture_payload.axis scale = self.gesture_payload.scale axis = Gf.Vec3d(*axis[:3]) scale_delta = scale * axis scale_vec = Gf.Vec3d() for i in range(3): scale_vec[i] = scale_delta[i] if scale_delta[i] else 1 scale_matrix = Gf.Matrix4d(1.0) scale_matrix.SetScale(scale_vec) scale_matrix *= self._begin_scale_mtx new_transform_matrix = scale_matrix * self._begin_xform s = Gf.Vec3d(*model.get_as_floats(model.get_item("scale_manipulator"))) sd = [s_n / s_o for s_n, s_o in zip([scale_matrix[0][0], scale_matrix[1][1], scale_matrix[2][2]], s)] model.set_floats(model.get_item("scale_delta"), sd) if model.custom_manipulator_enabled: self._publish_delta(Operation.SCALE, sd) model.set_floats(model.get_item("scale"), flatten(new_transform_matrix))
17,358
Python
37.747768
120
0.649038
omniverse-code/kit/exts/omni.kit.viewport.manipulator.transform/omni/kit/viewport/manipulator/transform/tests/test_manipulator_transform.py
## Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. ## ## NVIDIA CORPORATION and its licensors retain all intellectual property ## and proprietary rights in and to this software, related documentation ## and any modifications thereto. Any use, reproduction, disclosure or ## distribution of this software and related documentation without an express ## license agreement from NVIDIA CORPORATION is strictly prohibited. ## from omni.ui.tests.test_base import OmniUiTest class TestViewportTransform(OmniUiTest): # Before running each test async def setUp(self): pass # After running each test async def tearDown(self): pass
670
Python
34.315788
77
0.756716
omniverse-code/kit/exts/omni.kit.window.content_browser_registry/config/extension.toml
[package] # Semantic Versioning is used: https://semver.org/ version = "0.0.1" # Lists people or organizations that are considered the "authors" of the package. authors = ["NVIDIA"] # The title and description fields are primarly for displaying extension info in UI title = "content Browser Registry" description="Registry for all customizations that are added to the Content Browser" # URL of the extension source repository. repository = "" # Keywords for the extension keywords = ["kit", "ui"] # Location of change log file in target (final) folder of extension, relative to the root. # More info on writing changelog: https://keepachangelog.com/en/1.0.0/ changelog="docs/CHANGELOG.md" # Path (relative to the root) or content of readme markdown file for UI. readme = "docs/README.md" # Icon is shown in Extensions window, it is recommended to be square, of size 256x256. icon = "data/icon.png" category = "core" [dependencies] "omni.kit.window.filepicker" = {} # Main python module this extension provides, it will be publicly available as "import omni.kit.viewport.registry". [[python.module]] name = "omni.kit.window.content_browser_registry" [settings] # exts."omni.kit.window.content_browser_registry".xxx = "" [documentation] pages = [ "docs/CHANGELOG.md", ] [[test]] args = [ "--/app/window/dpiScaleOverride=1.0", "--/app/window/scaleToMonitor=false", "--no-window" ]
1,408
TOML
26.62745
115
0.727983
omniverse-code/kit/exts/omni.kit.window.content_browser_registry/omni/kit/window/content_browser_registry/extension.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # import omni.ext import omni.kit.app from typing import Callable from collections import OrderedDict from omni.kit.window.filepicker import SearchDelegate g_singleton = None # Any class derived from `omni.ext.IExt` in top level module (defined in `python.modules` of `extension.toml`) will be # instantiated when extension gets enabled and `on_startup(ext_id)` will be called. Later when extension gets disabled # on_shutdown() is called. class ContentBrowserRegistryExtension(omni.ext.IExt): """ This registry extension keeps track of the functioanl customizations that are applied to the Content Browser - so that they can be re-applied should the browser be re-started. """ def __init__(self): super().__init__() self._custom_menus = OrderedDict() self._selection_handlers = set() self._search_delegate = None def on_startup(self, ext_id): # Save away this instance as singleton global g_singleton g_singleton = self def on_shutdown(self): self._custom_menus.clear() self._selection_handlers.clear() self._search_delegate = None global g_singleton g_singleton = None def register_custom_menu(self, context: str, name: str, glyph: str, click_fn: Callable, show_fn: Callable, index: int = -1): id = f"{context}::{name}" self._custom_menus[id] = { 'name': name, 'glyph': glyph, 'click_fn': click_fn, 'show_fn': show_fn, 'index': index, } def deregister_custom_menu(self, context: str, name: str): id = f"{context}::{name}" if id in self._custom_menus: del self._custom_menus[id] def register_selection_handler(self, handler: Callable): self._selection_handlers.add(handler) def deregister_selection_handler(self, handler: Callable): if handler in self._selection_handlers: self._selection_handlers.remove(handler) def register_search_delegate(self, search_delegate: SearchDelegate): self._search_delegate = search_delegate def deregister_search_delegate(self, search_delegate: SearchDelegate): if self._search_delegate == search_delegate: self._search_delegate = None def get_instance(): return g_singleton
2,775
Python
34.13924
128
0.675676
omniverse-code/kit/exts/omni.kit.window.content_browser_registry/omni/kit/window/content_browser_registry/__init__.py
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # from typing import Callable, Union, Set from collections import OrderedDict from omni.kit.window.filepicker import SearchDelegate from .extension import ContentBrowserRegistryExtension, get_instance def custom_menus() -> OrderedDict: registry = get_instance() if registry: return registry._custom_menus return OrderedDict() def selection_handlers() -> Set: registry = get_instance() if registry: return registry._selection_handlers return set() def search_delegate() -> SearchDelegate: registry = get_instance() if registry: return registry._search_delegate return None def register_context_menu(name: str, glyph: str, click_fn: Callable, show_fn: Callable, index: int = -1): registry = get_instance() if registry: registry.register_custom_menu("context", name, glyph, click_fn, show_fn, index=index) def deregister_context_menu(name: str): registry = get_instance() if registry: registry.deregister_custom_menu("context", name) def register_listview_menu(name: str, glyph: str, click_fn: Callable, show_fn: Callable, index: int = -1): registry = get_instance() if registry: registry.register_custom_menu("listview", name, glyph, click_fn, show_fn, index=index) def deregister_listview_menu(name: str): registry = get_instance() if registry: registry.deregister_custom_menu("listview", name) def register_import_menu(name: str, glyph: str, click_fn: Callable, show_fn: Callable): registry = get_instance() if registry: registry.register_custom_menu("import", name, glyph, click_fn, show_fn) def deregister_import_menu(name: str): registry = get_instance() if registry: registry.deregister_custom_menu("import", name) def register_file_open_handler(name: str, open_fn: Callable, file_type: Union[int, Callable]): registry = get_instance() if registry: registry.register_custom_menu("file_open", name, None, open_fn, file_type) def deregister_file_open_handler(name: str): registry = get_instance() if registry: registry.deregister_custom_menu("file_open", name) def register_selection_handler(handler: Callable): registry = get_instance() if registry: registry.register_selection_handler(handler) def deregister_selection_handler(handler: Callable): registry = get_instance() if registry: registry.deregister_selection_handler(handler) def register_search_delegate(search_delegate: SearchDelegate): registry = get_instance() if registry: registry.register_search_delegate(search_delegate) def deregister_search_delegate(search_delegate: SearchDelegate): registry = get_instance() if registry: registry.deregister_search_delegate(search_delegate)
3,246
Python
34.293478
106
0.718731
omniverse-code/kit/exts/omni.kit.window.content_browser_registry/omni/kit/window/content_browser_registry/tests/test_registry.py
## Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. ## ## NVIDIA CORPORATION and its licensors retain all intellectual property ## and proprietary rights in and to this software, related documentation ## and any modifications thereto. Any use, reproduction, disclosure or ## distribution of this software and related documentation without an express ## license agreement from NVIDIA CORPORATION is strictly prohibited. ## import omni.kit.test import inspect import omni.kit.window.content_browser_registry as registry from unittest.mock import Mock from omni.kit.test.async_unittest import AsyncTestCase class TestRegistry(AsyncTestCase): """Testing Content Browser Registry""" async def setUp(self): pass async def tearDown(self): pass async def test_custom_menus(self): """Test registering and de-registering custom menus""" test_menus = [ { "register_fn": registry.register_context_menu, "deregister_fn": registry.deregister_context_menu, "context": "context", "name": "my context menu", "glyph": "my glyph", "click_fn": Mock(), "show_fn": Mock(), }, { "register_fn": registry.register_listview_menu, "deregister_fn": registry.deregister_listview_menu, "context": "listview", "name": "my listview menu", "glyph": "my glyph", "click_fn": Mock(), "show_fn": Mock(), }, { "register_fn": registry.register_import_menu, "deregister_fn": registry.deregister_import_menu, "context": "import", "name": "my import menu", "glyph": None, "click_fn": Mock(), "show_fn": Mock(), }, { "register_fn": registry.register_file_open_handler, "deregister_fn": registry.deregister_file_open_handler, "context": "file_open", "name": "my file_open handler", "glyph": None, "click_fn": Mock(), "show_fn": Mock(), } ] # Register menus for test_menu in test_menus: register_fn = test_menu["register_fn"] if 'glyph' in inspect.getfullargspec(register_fn).args: register_fn(test_menu["name"], test_menu["glyph"], test_menu["click_fn"], test_menu["show_fn"]) else: register_fn(test_menu["name"], test_menu["click_fn"], test_menu["show_fn"]) # Confirm menus stored to registry for test_menu in test_menus: self.assertTrue(f'{test_menu["context"]}::{test_menu["name"]}' in registry.custom_menus()) # De-register all menus for test_menu in test_menus: test_menu["deregister_fn"](test_menu["name"]) # Confirm all menus removed from registry self.assertEqual(len(registry.custom_menus()), 0) async def test_selection_handlers(self): """Test registering selection handlers""" test_handler_1 = Mock() test_handler_2 = Mock() test_handlers = [test_handler_1, test_handler_2, test_handler_1] self.assertEqual(len(registry.selection_handlers()), 0) for test_handler in test_handlers: registry.register_selection_handler(test_handler) # Confirm each unique handler is stored only once in registry self.assertEqual(len(registry.selection_handlers()), 2) async def test_search_delegate(self): """Test registering search delegate""" test_search_delegate = Mock() self.assertEqual(registry.search_delegate(), None) registry.register_search_delegate(test_search_delegate) # Confirm search delegate stored in registry self.assertEqual(registry.search_delegate(), test_search_delegate)
4,061
Python
38.057692
111
0.581138
omniverse-code/kit/exts/omni.kit.window.content_browser_registry/docs/CHANGELOG.md
# Changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.0.1] - 2022-10-11 ### Updated - Initial version.
148
Markdown
23.833329
80
0.675676
omniverse-code/kit/exts/omni.kit.window.content_browser_registry/docs/README.md
# Content Browser registry extension [omni.kit.window.content_browser_registry] This helper registry maintains a list of customizations that are added to the content browser.
175
Markdown
57.666647
94
0.828571
omniverse-code/kit/exts/omni.kit.window.about/config/extension.toml
[package] # Semantic Versioning is used: https://semver.org/ version = "1.0.3" # Lists people or organizations that are considered the "authors" of the package. authors = ["NVIDIA"] # The title and description fields are primarily for displaying extension info in UI title = "Kit About Window" description="Show application/build information." # URL of the extension source repository. repository = "" # Preview image. Folder named "data" automatically goes in git lfs (see .gitattributes file). preview_image = "data/preview.png" # One of categories for UI. category = "Internal" # Keywords for the extension keywords = ["kit"] # https://keepachangelog.com/en/1.0.0/ changelog="docs/CHANGELOG.md" [dependencies] "omni.ui" = {} "omni.usd" = {} "omni.client" = {} "omni.kit.menu.utils" = {} "omni.kit.clipboard" = {} [[python.module]] name = "omni.kit.window.about" [[test]] args = [ "--/renderer/enabled=pxr", "--/renderer/active=pxr", "--/renderer/multiGpu/enabled=false", "--/renderer/multiGpu/autoEnable=false", # Disable mGPU with PXR due to OM-51026, OM-53611 "--/renderer/multiGpu/maxGpuCount=1", "--/app/asyncRendering=false", "--/app/window/dpiScaleOverride=1.0", "--/app/window/scaleToMonitor=false", # "--no-window", # Test crashes with this turned on, for some reason "--/testconfig/isTest=true" ] dependencies = [ "omni.hydra.pxr", "omni.kit.renderer.capture", "omni.kit.ui_test", "omni.kit.test_suite.helpers", ] stdoutFailPatterns.include = [] stdoutFailPatterns.exclude = []
1,559
TOML
25
94
0.686979
omniverse-code/kit/exts/omni.kit.window.about/omni/kit/window/about/about.py
import carb import carb.settings import omni.client import omni.kit.app import omni.kit.ui import omni.ext import omni.kit.menu.utils from omni.kit.menu.utils import MenuItemDescription from pathlib import Path from omni import ui from .about_actions import register_actions, deregister_actions from .about_window import AboutWindow WINDOW_NAME = "About" MENU_NAME = "Help" _extension_instance = None class AboutExtension(omni.ext.IExt): def on_startup(self, ext_id): self._ext_name = omni.ext.get_extension_name(ext_id) self._window = AboutWindow() self._window.set_visibility_changed_fn(self._on_visibility_changed) self._menu_entry = MenuItemDescription( name=WINDOW_NAME, ticked_fn=self._is_visible, onclick_action=(self._ext_name, "toggle_window"), ) omni.kit.menu.utils.add_menu_items([self._menu_entry], name=MENU_NAME) ui.Workspace.set_show_window_fn( "About", lambda value: self._toggle_window(), ) manager = omni.kit.app.get_app().get_extension_manager() extension_path = manager.get_extension_path(ext_id) global _extension_instance _extension_instance = self register_actions(self._ext_name, lambda: _extension_instance) def on_shutdown(self): global _extension_instance _extension_instance = None self._window.destroy() self._window = None omni.kit.menu.utils.remove_menu_items([self._menu_entry], name=MENU_NAME) self._menu_entry = None deregister_actions(self._ext_name) def _is_visible(self) -> bool: return False if self._window is None else self._window.visible def _on_visibility_changed(self, visible): self._menu_entry.ticked = visible omni.kit.menu.utils.refresh_menu_items(MENU_NAME) def toggle_window(self): self._window.visible = not self._window.visible def show(self, visible: bool): self._window.visible = visible def menu_show_about(self, plugins): version_infos = [ f"Omniverse Kit {self.kit_version}", f"App Name: {self.app_name}", f"App Version: {self.app_version}", f"Client Library Version: {self.client_library_version}", f"USD Resolver Version: {self.usd_resolver_version}", f"USD Version: {self.usd_version}", f"MDL SDK Version: {self.mdlsdk_version}", ] @staticmethod def _resize_window(window: ui.Window, scrolling_frame: ui.ScrollingFrame): scrolling_frame.width = ui.Pixel(window.width - 10) scrolling_frame.height = ui.Pixel(window.height - 305) def get_instance(): return _extension_instance
2,772
Python
29.811111
81
0.644661
omniverse-code/kit/exts/omni.kit.window.about/omni/kit/window/about/style.py
from pathlib import Path from omni import ui from omni.ui import color as cl CURRENT_PATH = Path(__file__).parent ICON_PATH = CURRENT_PATH.parent.parent.parent.parent.joinpath("data") ABOUT_STYLE = { "Window": {"background_color": cl("#1F2123")}, "Line": {"color": 0xFF353332, "border_width": 1.5}, "ScrollingFrame": {"background_color": cl.transparent, "margin_width": 1, "margin_height": 2}, "About.Background": {"image_url": f"{ICON_PATH}/about_backgroud.png"}, "About.Background.Fill": {"background_color": cl("#131415")}, "About.Logo": {"image_url": f"{ICON_PATH}/about_logo.png", "padding": 0, "margin": 0}, "Logo.Frame": {"background_color": cl("#202424"), "padding": 0, "margin": 0}, "Logo.Separator": {"color": cl("#7BB01E"), "border_width": 1.5}, "Text.App": {"font_size": 18, "margin_width": 10, "margin_height": 2}, "Text.Plugin": {"font_size": 14, "margin_width": 10, "margin_height": 2}, "Text.Version": {"font_size": 18, "margin_width": 10, "margin_height": 2}, "Text.Title": {"font_size": 16, "margin_width": 10}, }
1,083
Python
46.130433
98
0.626039
omniverse-code/kit/exts/omni.kit.window.about/omni/kit/window/about/about_window.py
import omni.ui as ui import omni.kit.clipboard from .about_widget import AboutWidget from .style import ABOUT_STYLE class AboutWindow(ui.Window): def __init__(self): super().__init__( "About", width=800, height=540, flags=ui.WINDOW_FLAGS_NO_SCROLLBAR | ui.WINDOW_FLAGS_NO_DOCKING, visible=False ) self.frame.set_build_fn(self._build_ui) self.frame.set_style(ABOUT_STYLE) def destroy(self): self.visible = False super().destroy() def _build_ui(self): with self.frame: with ui.ZStack(): with ui.VStack(): self._widget = AboutWidget() ui.Line(height=0) ui.Spacer(height=4) with ui.HStack(height=26): ui.Spacer() ui.Button("Close", width=80, clicked_fn=self._hide, style={"padding": 0, "margin": 0}) ui.Button( "###copy_to_clipboard", style={"background_color": 0x00000000}, mouse_pressed_fn=lambda x, y, b, a: self.__copy_to_clipboard(b), identifier="copy_to_clipboard", ) def _hide(self): self.visible = False def __copy_to_clipboard(self, button): if button != 1: return omni.kit.clipboard.copy("\n".join(self._widget.versions))
1,474
Python
30.382978
110
0.504071
omniverse-code/kit/exts/omni.kit.window.about/omni/kit/window/about/__init__.py
from .about import * from .about_widget import AboutWidget
59
Python
18.999994
37
0.79661
omniverse-code/kit/exts/omni.kit.window.about/omni/kit/window/about/about_widget.py
from typing import List import carb import carb.settings import omni.kit.app import omni.ui as ui from .style import ABOUT_STYLE class AboutWidget: def __init__(self): app = omni.kit.app.get_app() self._app_info = f"{app.get_app_name()} {app.get_app_version()}" self._versions = self.__get_versions() plugins = [p for p in carb.get_framework().get_plugins() if p.impl.name] self._plugins = sorted(plugins, key=lambda x: x.impl.name) custom_image = carb.settings.get_settings().get("/app/window/imagePath") if custom_image: ABOUT_STYLE['About.Logo']['image_url'] = carb.tokens.get_tokens_interface().resolve(custom_image) self._frame = ui.Frame(build_fn=self._build_ui, style=ABOUT_STYLE) @property def app_info(self) -> List[str]: return self._app_info @app_info.setter def app_info(self, value: str) -> None: self._app_info = value with self._frame: self._frame.call_build_fn() @property def versions(self) -> List[str]: return [self._app_info] + self._versions @versions.setter def versions(self, values: List[str]) -> None: self._versions = values with self._frame: self._frame.call_build_fn() @property def plugins(self) -> list: return self._plugins @plugins.setter def plugins(self, values: list) -> None: self._plugins = values with self._frame: self._frame.call_build_fn() def _build_ui(self): with ui.VStack(spacing=5): with ui.ZStack(height=0): with ui.ZStack(): ui.Rectangle(style_type_name_override="About.Background.Fill") ui.Image( style_type_name_override="About.Background", alignment=ui.Alignment.RIGHT_TOP, ) with ui.VStack(): ui.Spacer(height=10) self.__build_app_info() ui.Spacer(height=10) for version_info in self._versions: ui.Label(version_info, height=0, style_type_name_override="Text.Version") ui.Spacer(height=10) ui.Spacer(height=0) ui.Label("Loaded plugins", height=0, style_type_name_override="Text.Title") ui.Line(height=0) with ui.ScrollingFrame( horizontal_scrollbar_policy=ui.ScrollBarPolicy.SCROLLBAR_ALWAYS_OFF, vertical_scrollbar_policy=ui.ScrollBarPolicy.SCROLLBAR_ALWAYS_ON, ): with ui.VStack(height=0, spacing=1): for p in self._plugins: ui.Label(f"{p.impl.name} {p.interfaces}", tooltip=p.libPath, style_type_name_override="Text.Plugin") def __build_app_info(self): with ui.HStack(height=0): ui.Spacer(width=10) with ui.ZStack(width=0, height=0): ui.Rectangle(style_type_name_override="Logo.Frame") with ui.HStack(height=0): with ui.VStack(): ui.Spacer(height=5) ui.Image(width=80, height=80, alignment=ui.Alignment.CENTER, style_type_name_override="About.Logo") ui.Spacer(height=5) with ui.VStack(width=0): ui.Spacer(height=10) ui.Line(alignment=ui.Alignment.LEFT, style_type_name_override="Logo.Separator") ui.Spacer(height=18) with ui.VStack(width=0, height=80): ui.Spacer() ui.Label("OMNIVERSE", style_type_name_override="Text.App") ui.Label(self._app_info, style_type_name_override="Text.App") ui.Spacer() ui.Spacer() def __get_versions(self) -> List[str]: settings = carb.settings.get_settings() is_running_test = settings.get("/testconfig/isTest") # omni_usd_resolver isn't loaded until Ar.GetResolver is called. # In the ext test, nothing does that, so we need to do it # since the library isn't located in a PATH search entry. # Unforunately the ext is loaded before the test module runs, # so we can't do it there. try: if is_running_test: from pxr import Ar Ar.GetResolver() import omni.usd_resolver usd_resolver_version = omni.usd_resolver.get_version() except ImportError: usd_resolver_version = None try: import omni.usd_libs usd_version = omni.usd_libs.get_version() except ImportError: usd_version = None try: # OM-61509: Add MDL SDK and USD version in about window import omni.mdl.neuraylib from omni.mdl import pymdlsdk # get mdl sdk version neuraylib = omni.mdl.neuraylib.get_neuraylib() ineuray = neuraylib.getNeurayAPI() neuray = pymdlsdk.attach_ineuray(ineuray) # strip off the date and platform info and only keep the version and build info version = neuray.get_version().split(",")[:2] mdlsdk_version = ",".join(version) except ImportError: mdlsdk_version = None app = omni.kit.app.get_app() version_infos = [ f"Omniverse Kit {app.get_kit_version()}", f"Client Library Version: {omni.client.get_version()}", f"USD Resolver Version: {usd_resolver_version}", f"USD Version: {usd_version}", f"MDL SDK Version: {mdlsdk_version}", ] return version_infos
5,850
Python
36.993506
124
0.549915
omniverse-code/kit/exts/omni.kit.window.about/omni/kit/window/about/about_actions.py
import carb import omni.kit.actions.core def register_actions(extension_id, get_self_fn): action_registry = omni.kit.actions.core.get_action_registry() actions_tag = "About Actions" omni.kit.actions.core.get_action_registry().register_action( extension_id, "toggle_window", get_self_fn().toggle_window, display_name="Help->Toggle About Window", description="Toggle About", tag=actions_tag, ) omni.kit.actions.core.get_action_registry().register_action( extension_id, "show_window", lambda v=True: get_self_fn().show(v), display_name="Help->Show About Window", description="Show About", tag=actions_tag, ) omni.kit.actions.core.get_action_registry().register_action( extension_id, "hide_window", lambda v=False: get_self_fn().show(v), display_name="Help->Hide About Window", description="Hide About", tag=actions_tag, ) def deregister_actions(extension_id): action_registry = omni.kit.actions.core.get_action_registry() action_registry.deregister_all_actions_for_extension(extension_id)
1,176
Python
29.179486
70
0.643707
omniverse-code/kit/exts/omni.kit.window.about/omni/kit/window/about/tests/test_window_about.py
## Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. ## ## NVIDIA CORPORATION and its licensors retain all intellectual property ## and proprietary rights in and to this software, related documentation ## and any modifications thereto. Any use, reproduction, disclosure or ## distribution of this software and related documentation without an express ## license agreement from NVIDIA CORPORATION is strictly prohibited. ## from pathlib import Path import omni.kit.app import omni.kit.test import omni.ui as ui from omni.ui.tests.test_base import OmniUiTest CURRENT_PATH = Path(__file__).parent TEST_DATA_PATH = CURRENT_PATH.parent.parent.parent.parent.parent.joinpath("data").joinpath("tests") class TestAboutWindow(OmniUiTest): # Before running each test async def setUp(self): await super().setUp() self._golden_img_dir = TEST_DATA_PATH.absolute().joinpath("golden_img").absolute() # After running each test async def tearDown(self): await super().tearDown() async def test_about_ui(self): class FakePluginImpl(): def __init__(self, name): self.name = name class FakePlugin(): def __init__(self, name): self.libPath = "Lib Path " + name self.impl = FakePluginImpl("Impl " + name) self.interfaces = "Interface " + name about = omni.kit.window.about.get_instance() about.show(True) await omni.kit.app.get_app().next_update_async() await omni.kit.app.get_app().next_update_async() about._window._widget.app_info = "#App Name# #App Version#" about._window._widget.versions = [ "Omniverse Kit #Version#", "Client Library Version: #Client Library Version#", "USD Resolver Version: #USD Resolver Version#", "USD Version: #USD Version#", "MDL SDK Version: #MDL SDK Version#", ] about._window._widget.plugins = [FakePlugin("Test 1"), FakePlugin("Test 2"), FakePlugin("Test 3"), FakePlugin("Test 4")] for _ in range(10): await omni.kit.app.get_app().next_update_async() await self.docked_test_window( window=about._window, width=800, height=510) await self.finalize_test(golden_img_dir=self._golden_img_dir, golden_img_name="test_about_ui.png")
2,403
Python
37.774193
128
0.63712
omniverse-code/kit/exts/omni.kit.window.about/omni/kit/window/about/tests/__init__.py
from .test_window_about import * from .test_clipboard import *
63
Python
20.333327
32
0.761905
omniverse-code/kit/exts/omni.kit.window.about/omni/kit/window/about/tests/test_clipboard.py
## Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. ## ## NVIDIA CORPORATION and its licensors retain all intellectual property ## and proprietary rights in and to this software, related documentation ## and any modifications thereto. Any use, reproduction, disclosure or ## distribution of this software and related documentation without an express ## license agreement from NVIDIA CORPORATION is strictly prohibited. ## import pathlib import sys import unittest import omni.kit.app import omni.kit.test import omni.ui as ui from omni.kit import ui_test from omni.ui.tests.test_base import OmniUiTest class TestAboutWindowClipboard(OmniUiTest): # Before running each test async def setUp(self): await super().setUp() # After running each test async def tearDown(self): await super().tearDown() # @unittest.skipIf(sys.platform.startswith("linux"), "Pyperclip fails on some TeamCity agents") async def test_about_clipboard(self): class FakePluginImpl(): def __init__(self, name): self.name = name class FakePlugin(): def __init__(self, name): self.libPath = "Lib Path " + name self.impl = FakePluginImpl("Impl " + name) self.interfaces = "Interface " + name omni.kit.clipboard.copy("") about = omni.kit.window.about.get_instance() about.kit_version = "#Version#" about.nucleus_version = "#Nucleus Version#" about.client_library_version = "#Client Library Version#" about.app_name = "#App Name#" about.app_version = "#App Version#" about.usd_resolver_version = "#USD Resolver Version#" about.usd_version = "#USD Version#" about.mdlsdk_version = "#MDL SDK Version#" about_window = about.menu_show_about([FakePlugin("Test 1"), FakePlugin("Test 2"), FakePlugin("Test 3"), FakePlugin("Test 4")]) await ui_test.find("About//Frame/**/Button[*].identifier=='copy_to_clipboard'").click(right_click=True) await ui_test.human_delay() clipboard = omni.kit.clipboard.paste() self.assertEqual(clipboard, "#App Name# #App Version#\nOmniverse Kit #Version#\nClient Library Version: #Client Library Version#\nUSD Resolver Version: #USD Resolver Version#\nUSD Version: #USD Version#\nMDL SDK Version: #MDL SDK Version#")
2,390
Python
39.525423
248
0.669038
omniverse-code/kit/exts/omni.kit.window.about/docs/CHANGELOG.md
# Changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [1.0.3] - 2022-11-17 ### Updated - Swap out pyperclip with linux-friendly copy & paste ## [1.0.2] - 2022-09-13 ### Updated - Fix window/menu visibility issues ## [1.0.1] - 2021-08-18 ### Updated - Updated menu to match other menu styling ## [1.0.0] - 2021-02-26 ### Updated - Added test ## [0.2.1] - 2020-12-08 ### Updated - Added "App Version" - Added right mouse button copy to clipboard ## [0.2.0] - 2020-12-04 ### Updated - Updated to new UI and added resizing ## [0.1.0] - 2020-10-29 - Ported old version to extensions 2.0
632
Markdown
18.781249
80
0.651899
omniverse-code/kit/exts/omni.graph.nodes/ogn/docs/OgnGpuInteropRenderProductEntry.rst
.. _omni_graph_nodes_GpuInteropRenderProductEntry_1: .. _omni_graph_nodes_GpuInteropRenderProductEntry: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Gpu Interop Render Product Entry :keywords: lang-en omnigraph node internal threadsafe nodes gpu-interop-render-product-entry Gpu Interop Render Product Entry ================================ .. <description> Entry node for post-processing hydra render results for a single view .. </description> Installation ------------ To use this node enable :ref:`omni.graph.nodes<ext_omni_graph_nodes>` in the Extension Manager. Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:exec", "``execution``", "Trigger for scheduling dependencies", "None" "gpuFoundations (*outputs:gpu*)", "``uint64``", "Pointer to shared context containing gpu foundations", "None" "hydraTime (*outputs:hydraTime*)", "``double``", "Hydra time in stage", "None" "renderProduct (*outputs:rp*)", "``uint64``", "Pointer to render product for this view", "None" "simTime (*outputs:simTime*)", "``double``", "Simulation time", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.nodes.GpuInteropRenderProductEntry" "Version", "1" "Extension", "omni.graph.nodes" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "hidden", "true" "Categories", "internal" "Generated Class Name", "OgnGpuInteropRenderProductEntryDatabase" "Python Module", "omni.graph.nodes"
1,865
reStructuredText
28.619047
114
0.596783
omniverse-code/kit/exts/omni.graph.nodes/ogn/docs/OgnExtractAttr.rst
.. _omni_graph_nodes_ExtractAttribute_1: .. _omni_graph_nodes_ExtractAttribute: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Extract Attribute :keywords: lang-en omnigraph node bundle threadsafe nodes extract-attribute Extract Attribute ================= .. <description> Copies a single attribute from an input bundle to an output attribute directly on the node if it exists in the input bundle and matches the type of the output attribute .. </description> Installation ------------ To use this node enable :ref:`omni.graph.nodes<ext_omni_graph_nodes>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Attribute To Extract (*inputs:attrName*)", "``token``", "Name of the attribute to look for in the bundle", "points" "Bundle For Extraction (*inputs:data*)", "``bundle``", "Collection of attributes from which the named attribute is to be extracted", "None" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Extracted Attribute (*outputs:output*)", "``any``", "The single attribute extracted from the input bundle", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.nodes.ExtractAttribute" "Version", "1" "Extension", "omni.graph.nodes" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Extract Attribute" "Categories", "bundle" "Generated Class Name", "OgnExtractAttrDatabase" "Python Module", "omni.graph.nodes"
1,901
reStructuredText
26.565217
168
0.599684
omniverse-code/kit/exts/omni.graph.nodes/ogn/docs/OgnRotateVector.rst
.. _omni_graph_nodes_RotateVector_1: .. _omni_graph_nodes_RotateVector: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Rotate Vector :keywords: lang-en omnigraph node math:operator threadsafe nodes rotate-vector Rotate Vector ============= .. <description> Rotates a 3d direction vector by a specified rotation. Accepts 3x3 matrices, 4x4 matrices, euler angles (XYZ), or quaternions For 4x4 matrices, the transformation information in the matrix is ignored and the vector is treated as a 4-component vector where the fourth component is zero. The result is then projected back to a 3-vector. Supports mixed array inputs, eg a single quaternion and an array of vectors. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.nodes<ext_omni_graph_nodes>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Rotation (*inputs:rotation*)", "``['matrixd[3]', 'matrixd[3][]', 'matrixd[4]', 'matrixd[4][]', 'quatd[4]', 'quatd[4][]', 'quatf[4]', 'quatf[4][]', 'quath[4]', 'quath[4][]', 'vectord[3]', 'vectord[3][]', 'vectorf[3]', 'vectorf[3][]', 'vectorh[3]', 'vectorh[3][]']``", "The rotation to be applied", "None" "Vector (*inputs:vector*)", "``['vectord[3]', 'vectord[3][]', 'vectorf[3]', 'vectorf[3][]', 'vectorh[3]', 'vectorh[3][]']``", "The row vector(s) to be rotated", "None" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Result (*outputs:result*)", "``['vectord[3]', 'vectord[3][]', 'vectorf[3]', 'vectorf[3][]', 'vectorh[3]', 'vectorh[3][]']``", "The transformed row vector(s)", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.nodes.RotateVector" "Version", "1" "Extension", "omni.graph.nodes" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Rotate Vector" "Categories", "math:operator" "Generated Class Name", "OgnRotateVectorDatabase" "Python Module", "omni.graph.nodes"
2,396
reStructuredText
33.73913
413
0.586811