file_path
stringlengths
21
202
content
stringlengths
19
1.02M
size
int64
19
1.02M
lang
stringclasses
8 values
avg_line_length
float64
5.88
100
max_line_length
int64
12
993
alphanum_fraction
float64
0.27
0.93
omniverse-code/kit/exts/omni.kit.tool.collect/docs/CHANGELOG.md
# Changelog ## [2.1.20] - 2022-11-10 ### Added - Add texture grouping options for flat collection mode, textures can be grouped by MDL, USD or flat. ## [2.1.19] - 2022-11-07 ### Changed - Reduce size of test data. - Improve UI. - Make omni.kit.window.content_browser as optional. - Fix MDL parser that cannot handle spaces in texture define. ## [2.1.18] - 2022-09-05 ### Changed - Fix issue that won't hide progress bar. ## [2.1.17] - 2022-08-27 ### Changed - Move collect tool into Kit core. - More improvement to perf. - Hook collect tool to file menu. ## [2.1.16] - 2022-08-26 ### Changed - Fix file naming conflicts for flat collection. - More improvement about logging and perf. ## [2.1.15] - 2022-08-23 ### Changed - More test coverage. ## [2.1.14] - 2022-08-18 ### Changed - Fix refactoring issues. ## [2.1.13] - 2022-08-12 ### Changed - Refactoring collect tool to improve perf. - Fix tags collecting. ## [2.1.12] - 2022-07-28 ### Changed - Fix issues to collect read-only USD files. ## [2.1.11] - 2022-05-26 ### Changed - Workaround to solve usda collect issue by renaming extension to match its content format. ## [2.1.10] - 2022-05-20 ### Added - Fix collect issue that will miss tags for USD files. ## [2.1.9] - 2022-05-12 ### Added - add flag to elide copy if files that already in destination location. ## [2.1.8] - 2022-04-28 ### Changed - Revert maximum tasks to 8 to avoid influence interaction of UI. ## [2.1.7] - 2022-04-28 ### Changed - Add error options to customize error reporting. ## [2.1.6] - 2022-04-06 ### Changed - Match MDL resolve rule as new-MDL-Schema in USD. ## [2.1.5] - 2022-03-07 ### Changed - Fix missing changes from Kit release/103.1. ## [2.1.4] - 2022-03-07 ### Changed - Catch possible exceptions threw by UsdUtils.ExtractExternalReferences and UsdUtils.ModifyAssetPaths. ## [2.1.3] - 2022-02-21 ### Changed - Move collect tool to kit-tools repo. ## [2.1.2] - 2022-02-09 ### Changed - Fix an issue that UDIM textures are missing to be collected. ## [2.1.1] - 2022-01-12 ### Changed - Fix path decode issue for collecting projects from ov to ov. ## [2.1.0] - 2021-12-16 ### Changed - Fix path resolve that's with/without relative path prefix, like './' or '../' ## [2.0.8] - 2021-09-27 ### Changed - Fix texture collecting for cube/ptex textures - Fix mdl module replace. ## [2.0.7] - 2021-09-16 ### Changed - Improve UX of file picker to show folder name for folder picker. ## [2.0.6] - 2021-09-10 ### Fixes - Improve flat collect to resolve material dependencies. ## [2.0.5] - 2021-09-09 ### Added - Add API to collect. ## [2.0.4] - 2021-08-25 ### Fixes - Fix UDIM textures collect. ## [2.0.3] - 2021-07-28 ### Changed - More tests. ## [2.0.2] - 2021-07-21 ### Fixed - Fix collection to assets from http source. ## [2.0.1] - 2021-02-06 ### Changed - Initialize change log. - Remove old editor and content window dependencies.
2,897
Markdown
21.818897
102
0.667932
omniverse-code/kit/exts/omni.kit.tool.collect/docs/README.md
# Project Collector [omni.kit.tool.collect] This extension provides UI interfaces to collect USD project by resolving, re-pathing and gathering all dependencies, so project can be movable and sharable conveniently. ## UI Options Explained `USD Only`: If this option is enabled, it will only collect USD files and other other dependencies are ignored (like material files and textures.) `Material Only`: If this options is enabled, it will only collect all material related dependencies including textures, and USD files will be ignored. `Flat Collection`: By default, it will collect USD project by keeping the directory structure. If this option is enabled, the directory structure will not be kept and all dependencies will be put into specified folders. `Flat Collection Texture Options`: When collecting in Flat mode, users can specify the grouping for texture files via this option; Currently there are 3 available options: | Options | Description | | ------- | ----------- | | Group by MDL | Textures will be grouped by their parent MDL file name. | | Group by USD | Textures will be grouped by their parent USD file name. | | Flat | All textures will be collected under the same hierarchy under "textures" folder. Note that there might be potential danger of textures overwriting each other, if they have the same names but belong to different assets/mdls. | ## Limitations There is no USDZ support currently until Kit resolves MDL loading issue inside USDZ file.
1,478
Markdown
72.949996
234
0.778755
omniverse-code/kit/exts/omni.kit.tool.collect/docs/index.rst
omni.kit.tool.collector ####################### Python extension to collect all dependencies of an USD.
105
reStructuredText
20.199996
55
0.628571
omniverse-code/kit/exts/omni.graph.instancing/config/extension.toml
[package] version = "1.3.0" title = "OmniGraph Instancing" authors = ["NVIDIA"] repository = "" readme = "docs/README.md" changelog = "docs/CHANGELOG.md" description = "OmniGraph instance graph processing per USD Prim" category = "Graph" preview_image = "data/preview.png" icon = "data/icon.svg" [dependencies] "omni.graph.core" = {} [[python.module]] name = "omni.graph.instancing" [[test]] waiver = "Tests are in omni.graph.test" # RTX regression OM-51983 timeout = 600 unreliable = true # OM-51982 args = [ "--/app/extensions/registryEnabled=1" # needs to be fixed and removed: OM-49579 ]
599
TOML
21.222221
83
0.702838
omniverse-code/kit/exts/omni.graph.instancing/omni/graph/instancing/__init__.py
import carb carb.log_warn("omni.graph.instancing has been deprecated. All functionality has been moved to omni.graph.core and omni.graph.ui.")
144
Python
35.249991
130
0.791667
omniverse-code/kit/exts/omni.graph.instancing/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.0] - 2022-08-04 ### Changed - Marked extension for deprecated ## [1.2.4] - 2022-06-17 ### Removed - Moved ApplyOmniGraph and RemoveOmniGraph api commands to omni.graph.core - Moved ui elements to omni.graph.ui ## [1.2.3] - 2022-05-24 ### Fixed - Graph instances in references no longer require a stage reload to evaluate ## [1.2.2] - 2022-05-23 ### Removed - Explicit dependency on omni.kit.window.viewport ## [1.2.1] - 2022-04-27 ### Fixed - Fixed error thrown when extension is loaded. ### Changed - Removed dependency on tools, nodes and ui OmniGraph extensions ## [1.2.0] - 2022-04-19 ### Removed - ReadGraphVariable, WriteGraphVariable, GraphTarget nodes. - Instances are no longer run in this extension - OmniGraph no longer modifies compute graph pipeline automatically ## [1.1.2] - 2022-04-13 ### Changed - Warning will appear when a graph with incompatible nodes is set as an instance ## [1.1.1] - 2022-04-12 ### Fixed - Fixed errors thrown when variables nodes are multi-selected ## [1.1.0] - 2022-03-30 ### Changed - WriteGraphVariable value output port ## [1.0.3] - 2022-03-23 ### Fixed - Variable types are now synchronized between graph and instance - ReadGraphVariable and WriteGraphVariable listen for create and remove variable events ## [1.0.2] - 2022-02-14 ### Fixed - fixed unregistered notice handler causing crash ## [1.0.1] - 2022-02-14 ### Fixed - add additional extension enabled check for omni.graph.ui not enabled error ## [1.0.0] - 2022-01-17 ### Modified - Initial release.
1,795
Markdown
26.630769
87
0.718106
omniverse-code/kit/exts/omni.graph.instancing/docs/README.md
# OmniGraph Instancing [omni.graph.instancing] This extension is no longer required. Variable and Instancing OmniGraph functionality previously provided by this extension is available through the omni.graph.core and omni.graph.ui extensions.
245
Markdown
39.999993
194
0.828571
omniverse-code/kit/exts/omni.graph.instancing/docs/index.rst
.. _ogn_omni_graph_instancing: OmniGraph Instancing #################### .. tabularcolumns:: |L|R| .. csv-table:: :width: 100% **Extension**: omni.graph.instancing,**Documentation Generated**: |today| .. toctree:: :maxdepth: 1 CHANGELOG What Is It? =========== Instancing provides a mechanism to apply a single graph to multiple `UsdPrim` objects. Applying the `OmniGraph` component onto a `UsdPrim` will cause the graph to execute with the variable values stored on the `OmniGraph` component. Multiple Prims referencing the same graph will cause the graph to execute once for each Prim. The `GraphTarget` node exposes the path of the `UsdPrim` instance to the graph, allowing each execution to uniquely read or modify the primitive that initiated the execution. For more comprehensive documentation explaining the use of OmniGraph features in detail see :ref:`ogn_user_guide` Limitations =========== At present, each execution of the graph occurs sequentially and nodes in the graph share state across all instances. Nodes that use event callbacks, or use internal state may not behave as anticipated when multiple instances exists. For example, using the `OnKeyboardInput` action graph node will only trigger the event on the first instance executed. Instead, it is recommended to use the ReadKeyboardInput node instead. Another example is the `Counter` node - it will increment for each instance executed. The following is a noncomprehensive list of nodes that may not be suitable for instanced graphs * omni.graph.action.OgnCounter * omni.graph.action.OgnDelay * omni.graph.action.OgnForEach * omni.graph.action.OgnFlipFlop * omni.graph.action.OgnForEach * omni.graph.action.OgnGate * omni.graph.action.OgnMultiGate * omni.graph.action.OgnOnCustomEvent * omni.graph.action.OgnOnGamepadInput * omni.graph.action.OgnOnImpulseEvent * omni.graph.action.OgnOnKeyboardInput * omni.graph.action.OgnOnMouseInput * omni.graph.action.OgnOnObjectChange * omni.graph.action.OgnOnStageEvent * omni.graph.action.OgnSendCustomEvent * omni.graph.action.OgnSequence * omni.graph.action.OgnSyncGate
2,122
reStructuredText
34.98305
119
0.775683
omniverse-code/kit/exts/omni.rtx.ovtextureconverter/config/extension.toml
[core] [package] title = "OV Texture converter" category = "Internal" version = "1.0.0" [dependencies] "carb.windowing.plugins" = {} "omni.assets.plugins" = {} "omni.client" = {} # needed for carb.datasource-omniclient.plugin "omni.gpu_foundation" = {} [[python.module]] name = "omni.rtx.ovtextureconverter" [[native.plugin]] path = "bin/*.plugin" [settings] [[test]] args = [ ]
384
TOML
15.041666
65
0.669271
omniverse-code/kit/exts/omni.rtx.ovtextureconverter/omni/rtx/ovtextureconverter/__init__.py
from ._ovtextureconverter import * from .scripts import *
58
Python
18.66666
34
0.775862
omniverse-code/kit/exts/omni.rtx.ovtextureconverter/omni/rtx/ovtextureconverter/_ovtextureconverter.pyi
from __future__ import annotations import omni.rtx.ovtextureconverter._ovtextureconverter import typing __all__ = [ "IOVTextureConverter", "ResultList", "acquire_ovtextureconverter_interface" ] class IOVTextureConverter(): def compressFile(self, arg0: str, arg1: str, arg2: str) -> list: ... def compressFileOnly(self, arg0: str) -> bool: ... def compressJob(self, arg0: str) -> list: ... pass class ResultList(): pass def acquire_ovtextureconverter_interface(*args, **kwargs) -> typing.Any: pass
536
unknown
24.571427
72
0.686567
omniverse-code/kit/exts/omni.rtx.ovtextureconverter/omni/rtx/ovtextureconverter/scripts/commands.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.commands import omni.rtx.ovtextureconverter class IssueTextureCompressionRequest(omni.kit.commands.Command): def __init__( self, **kwargs, ): # pull out the stage name to process from the entry # check for a couple different forms self._path = None for key in ["path", "texture_path"]: if key in kwargs: self._path = kwargs[key] break # standardize the path separator character self._path = self._path.replace("\\", "/") if self._path else None self._convert_iface = omni.rtx.ovtextureconverter.acquire_ovtextureconverter_interface() def do(self): if not self._path: carb.log_warn("'path' not valid") return False carb.log_info("Processing Texture: " + self._path) # This inserts an async request, but we can't yet "await" it. # TODO: May need to sleep after this? return self._convert_iface.compressFileOnly(str(self._path)) omni.kit.commands.register_all_commands_in_module(__name__)
1,558
Python
34.431817
96
0.661746
omniverse-code/kit/exts/omni.rtx.ovtextureconverter/omni/rtx/ovtextureconverter/scripts/__init__.py
from .commands import *
23
Python
22.999977
23
0.782609
omniverse-code/kit/exts/omni.rtx.ovtextureconverter/omni/rtx/ovtextureconverter/tests/test_ovtextureconverter.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.app from omni.kit.test import AsyncTestCase import omni.rtx.ovtextureconverter class TestConverter(AsyncTestCase): async def setUp(self): self._convert_iface = omni.rtx.ovtextureconverter.acquire_ovtextureconverter_interface() async def tearDown(self): pass async def test_001_compress(self): print("Disabled because somehow on linux the gpufoundation shaders cannot be found 1/2.") #results = self._convert_iface.compressFile("./resources/test/dot.png", "./resources/test", "BlaBlaBla") #for x in results: # print(x)
1,039
Python
36.142856
112
0.739172
omniverse-code/kit/exts/omni.rtx.ovtextureconverter/omni/rtx/ovtextureconverter/tests/__init__.py
from .test_commands import *
29
Python
13.999993
28
0.758621
omniverse-code/kit/exts/omni.rtx.ovtextureconverter/omni/rtx/ovtextureconverter/tests/test_commands.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.settings import omni.kit.app from omni.kit.test import AsyncTestCase import omni.rtx.ovtextureconverter.scripts.commands as commands import asyncio import os import os.path import pathlib import shutil TEST_DATA_DIR = str(pathlib.Path(__file__).parent.joinpath("data")) TEST_OUTPUT_DIR = omni.kit.test.get_test_output_path() class TestCommands(AsyncTestCase): async def setUp(self): pass async def tearDown(self): pass async def test_IssueTextureCompressionRequest(self): """ Test Command to create texture caches with new UJITSO build system """ source_texture = pathlib.Path(TEST_DATA_DIR, "dot.png") tex_cache_dir = pathlib.Path(TEST_OUTPUT_DIR, "ujitso_texcache") settings = carb.settings.get_settings() self.assertTrue(settings.get_as_bool("/rtx-transient/resourcemanager/UJITSO/enabled")) # Set the destination for texture caching settings.set_string("/rtx-transient/resourcemanager/remoteTextureCachePath", str(tex_cache_dir)) # Clear the local texture cache path to allow repeated tests, otherwise only works first time. settings.set_string("/rtx-transient/resourcemanager/localTextureCachePath", "") # Disable omnihub settings.set_bool("/rtx-transient/resourcemanager/useOmniHubCache", False) settings.set_bool("/rtx-transient/resourcemanager/useMDBCache", False) # Remove results from any previous run if os.path.exists(tex_cache_dir): shutil.rmtree(tex_cache_dir) cmd = commands.IssueTextureCompressionRequest(path=str(source_texture)) self.assertTrue(cmd.do()) # NOTE: the datastore that handles the upload currently has no way to wait for all uploads to complete. print("Waiting for UJITSO texture uploads...") await asyncio.sleep(5) self.assertTrue(os.path.exists(tex_cache_dir)) files = os.listdir(tex_cache_dir) self.assertTrue(len(files) > 0)
2,454
Python
36.76923
111
0.714344
omniverse-code/kit/exts/omni.activity.profiler/omni/activity/profiler/tests/test_activity_profiler.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.activity.profiler import carb.profiler class TestActivityProfiler(omni.kit.test.AsyncTestCase): async def setUp(self): self._activity_profiler = omni.activity.profiler.get_activity_profiler() self._carb_profiler = carb.profiler.acquire_profiler_interface(plugin_name="omni.activity.profiler.plugin") async def tearDown(self): self._carb_profiler = None self._activity_profiler = None async def test_activity_profiler_masks(self): # Verify the initial value of the activity profiler capture mask. self.assertEqual(self._carb_profiler.get_capture_mask(), 0) # Set the base activity profiler capture mask directly through the carb profiler API. self._carb_profiler.set_capture_mask(omni.activity.profiler.CAPTURE_MASK_STARTUP) self.assertEqual(self._carb_profiler.get_capture_mask(), omni.activity.profiler.CAPTURE_MASK_STARTUP) # Enable an activity profiler capture mask through the activity profiler API. uid1 = self._activity_profiler.enable_capture_mask(omni.activity.profiler.CAPTURE_MASK_LATENCY) self.assertEqual(self._carb_profiler.get_capture_mask(), omni.activity.profiler.CAPTURE_MASK_STARTUP | omni.activity.profiler.CAPTURE_MASK_LATENCY) # Enable another activity profiler capture mask through the activity profiler API. uid2 = self._activity_profiler.enable_capture_mask(omni.activity.profiler.CAPTURE_MASK_SCENE_LOADING) self.assertEqual(self._carb_profiler.get_capture_mask(), omni.activity.profiler.CAPTURE_MASK_STARTUP | omni.activity.profiler.CAPTURE_MASK_LATENCY | omni.activity.profiler.CAPTURE_MASK_SCENE_LOADING) # Enable an activity profiler capture mask for the second time through the activity profiler API. uid3 = self._activity_profiler.enable_capture_mask(omni.activity.profiler.CAPTURE_MASK_LATENCY) self.assertEqual(self._carb_profiler.get_capture_mask(), omni.activity.profiler.CAPTURE_MASK_STARTUP | omni.activity.profiler.CAPTURE_MASK_LATENCY | omni.activity.profiler.CAPTURE_MASK_SCENE_LOADING) # Disable the activity profiler capture mask that was set a second time through the activity profiler API. self._activity_profiler.disable_capture_mask(uid3) self.assertEqual(self._carb_profiler.get_capture_mask(), omni.activity.profiler.CAPTURE_MASK_STARTUP | omni.activity.profiler.CAPTURE_MASK_LATENCY | omni.activity.profiler.CAPTURE_MASK_SCENE_LOADING) # Disable the first activity profiler capture mask that was set through the activity profiler API. self._activity_profiler.disable_capture_mask(uid1) self.assertEqual(self._carb_profiler.get_capture_mask(), omni.activity.profiler.CAPTURE_MASK_STARTUP | omni.activity.profiler.CAPTURE_MASK_SCENE_LOADING) # Enable the same base activity profiler capture mask through the activity profiler API. uid4 = self._activity_profiler.enable_capture_mask(omni.activity.profiler.CAPTURE_MASK_STARTUP) self.assertEqual(self._carb_profiler.get_capture_mask(), omni.activity.profiler.CAPTURE_MASK_STARTUP | omni.activity.profiler.CAPTURE_MASK_SCENE_LOADING) # Disable the same base activity profiler capture mask that was set through the activity profiler API. self._activity_profiler.disable_capture_mask(uid4) self.assertEqual(self._carb_profiler.get_capture_mask(), omni.activity.profiler.CAPTURE_MASK_STARTUP | omni.activity.profiler.CAPTURE_MASK_SCENE_LOADING) # Set the base activity profiler capture mask directly through the carb profiler API. self._carb_profiler.set_capture_mask(0) self.assertEqual(self._carb_profiler.get_capture_mask(), omni.activity.profiler.CAPTURE_MASK_SCENE_LOADING) # Disable the second activity profiler capture mask that was set through the activity profiler API. self._activity_profiler.disable_capture_mask(uid2) self.assertEqual(self._carb_profiler.get_capture_mask(), 0) # Set the base activity profiler capture mask to something that is not an activity mask. self._activity_profiler.disable_capture_mask(1) self.assertEqual(self._carb_profiler.get_capture_mask(), 0) # Enable an activity profiler capture mask that is not an activity mask. uid5 = self._activity_profiler.enable_capture_mask(1) self.assertEqual(self._carb_profiler.get_capture_mask(), 0) # Disable the activity profiler capture mask that is not an activity mask. self._activity_profiler.disable_capture_mask(uid5) self.assertEqual(self._carb_profiler.get_capture_mask(), 0)
5,761
Python
63.022222
115
0.664121
omniverse-code/kit/exts/omni.kit.widget.browser_bar/config/extension.toml
[package] title = "Kit Browser Bar Widget" version = "2.0.5" category = "Internal" description = "Treeview browser bar as embeddable widget" authors = ["NVIDIA"] slackids = ["UQY4RMR3N"] repository = "" keywords = ["kit", "ui"] changelog = "docs/CHANGELOG.md" preview_image = "data/preview.png" [dependencies] "omni.ui" = {} "omni.kit.widget.path_field" = {} [[python.module]] name = "omni.kit.widget.browser_bar" [[test]] args = [ "--/app/window/dpiScaleOverride=1.0", "--/app/window/scaleToMonitor=false", "--no-window" ] dependencies = [ "omni.kit.renderer.core" ]
584
TOML
19.172413
57
0.664384
omniverse-code/kit/exts/omni.kit.widget.browser_bar/omni/kit/widget/browser_bar/style.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.ui as ui from pathlib import Path CURRENT_PATH = Path(__file__).parent ICON_PATH = CURRENT_PATH.parent.parent.parent.parent.joinpath("icons") UI_STYLES = {} UI_STYLES["NvidiaLight"] = { "Rectangle": {"background_color": 0xFF535354}, "Button": {"background_color": 0xFFE0E0E0, "margin": 4, "padding": 0, "border_width": 0}, "Button:hovered": {"background_color": 0xFFACACAF}, "Button:selected": {"background_color": 0xFFACACAF}, "Button:disabled": {"background_color": 0xFFE0E0E0}, "Button.Image": {"color": 0xFF6E6E6E}, "Button.Image:disabled": {"color": 0x0}, "ComboBox": {"background_color": 0xFF535354, "selected_color": 0xFFACACAF, "color": 0xFFD6D6D6}, "ComboBox:hovered": {"background_color": 0xFFACACAF}, "ComboBox:selected": {"background_color": 0xFFACACAF}, } UI_STYLES["NvidiaDark"] = { "Rectangle": {"background_color": 0xFF23211F}, "Button": {"background_color": 0x0, "margin": 4, "padding": 0}, "Button:disabled": {"background_color": 0x0}, "Button.Image": {"color": 0xFFFFFFFF}, "Button.Image:disabled": {"color": 0xFF888888}, "ComboBox": { "background_color": 0xFF23211F, "selected_color": 0x0, "color": 0xFF4A4A4A, "border_radius": 0, "margin": 0, "padding": 4, "secondary_color": 0xFF23211F, }, "ComboBox.Active": { "background_color": 0xFF23211F, "selected_color": 0xFF3A3A3A, "color": 0xFF9E9E9E, "border_radius": 0, "margin": 0, "padding": 4, "secondary_selected_color": 0xFF9E9E9E, "secondary_color": 0xFF23211F, }, "ComboBox.Active:hovered": {"color": 0xFF4A4A4A, "secondary_color": 0x0,}, "ComboBox.Active:pressed": {"color": 0xFF4A4A4A, "secondary_color": 0x0,}, "ComboBox.Bg": { "background_color": 0x0, "margin": 0, "padding": 2, }, "ComboBox.Bg.Active": { "background_color": 0x0, "margin": 0, "padding": 2, }, "ComboBox.Bg.Active:hovered": { "background_color": 0xFF6E6E6E, }, "ComboBox.Bg.Active:pressed": { "background_color": 0xFF6E6E6E, }, }
2,623
Python
34.459459
100
0.633626
omniverse-code/kit/exts/omni.kit.widget.browser_bar/omni/kit/widget/browser_bar/__init__.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. # """ The :obj:`PathField` widget supes up tree navigation via keyboard entry. This widget extends that experience further by queuing up the user's navigation history. As in any modern day browser, the user can then directly jump to any previously visited path. Example: .. code-block:: python browser_bar = BrowserBar( visited_history_size=20, branching_options_provider=branching_options_provider, apply_path_handler=apply_path_handler, ) """ from .widget import BrowserBar
944
Python
35.346152
98
0.768008
omniverse-code/kit/exts/omni.kit.widget.browser_bar/omni/kit/widget/browser_bar/model.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 sys, os import omni.ui as ui class StringQueueItem(ui.AbstractItem): def __init__(self, value: str): super().__init__() self._model = ui.SimpleStringModel(value) @property def model(self): return self._model @property def value(self): return self._model.get_value_as_string() class StringQueueModel(ui.AbstractItemModel): def __init__(self, max_items: int = 4, value_changed_fn=None): super().__init__() self._value_changed_fn = value_changed_fn self._max_items = max_items self._items = [] self._selected_index = ui.SimpleIntModel(0) # TODO: There's a bug that if the item selected doesn't have a different # index, then it doesn't trigger this callback. It's better to trigger on # mouse pressed but we don't have this option. self._selected_index.add_value_changed_fn(self._on_selection_changed) def __getitem__(self, idx: int) -> StringQueueItem: if idx < len(self._items): return self._items[idx] return None @property def selected_index(self) -> int: return self._selected_index.get_value_as_int() @selected_index.setter def selected_index(self, index: int): self._selected_index.set_value(index) def get_selected_item(self) -> StringQueueItem: index = self._selected_index.get_value_as_int() if index >= 0 and index < len(self._items): return self._items[index] return None def get_item_children(self, item) -> [StringQueueItem]: if item is None: return self._items return [] def get_item_value_model(self, item, column_id) -> ui.AbstractValueModel: if item is None: return self._selected_index return item.model def find_item(self, value: str) -> StringQueueItem: for item in self._items: if item.value == value: return item return None def size(self) -> int: return len(self._items) def peek(self) -> StringQueueItem: if self._items: return self._items[0] return None def enqueue(self, value: str): if not value: return found = self.find_item(value) if not found: item = StringQueueItem(value) self._items.insert(0, item) while len(self._items) > self._max_items: self.dequeue() self.selected_index = 0 self._item_changed(None) def dequeue(self): if self._items: self._items.pop(-1) self.selected_index = min(self.selected_index, self.size()-1) self._item_changed(None) def _on_selection_changed(self, model: ui.AbstractValueModel): if self._value_changed_fn: self._value_changed_fn(model) self._item_changed(None) def destroy(self): self._items = None self._selected_index = None class VisitedHistory(): def __init__(self, max_items: int = 100): self._max_items = max_items self._items = [] self._selected_index = 0 # the activation state for the visited history; when we are jumping between history entries, the visited history # should not change; for example, when we click the prev/next button, the path field would update to that entry # but those should not be counted in visited history. self._active = True def __getitem__(self, idx: int) -> str: if idx < len(self._items): return self._items[idx] return None def activate(self): self._active = True def deactivate(self): self._active = False @property def selected_index(self) -> int: return self._selected_index @selected_index.setter def selected_index(self, index: int): self._selected_index = index def get_selected_item(self) -> str: index = self._selected_index if index >= 0 and index < len(self._items): return self._items[index] return None def size(self) -> int: return len(self._items) def insert(self, value: str): if self._active is False: return if not value: return # avoid adding the same entry twice # this could happen when actions on top sets the browser bar path to the same path twice if self.size() > 0 and self._items[0] == value: return self._items.insert(0, value) while self.size() > self._max_items: self.pop() self.selected_index = 0 def pop(self): if self._items: self._items.pop() self.selected_index = min(self.selected_index, self.size()-1) def destroy(self): self._items.clear()
5,320
Python
30.485207
120
0.603008
omniverse-code/kit/exts/omni.kit.widget.browser_bar/omni/kit/widget/browser_bar/widget.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 sys, os import omni.ui as ui from omni.kit.widget.path_field import PathField from .model import StringQueueModel, VisitedHistory from .style import UI_STYLES, ICON_PATH class BrowserBar: """ The Browser Bar extends the :obj:`PathField` UI widget for navigating tree views via the keyboard. Namely, it adds navigation history. As in any modern day browser, this allows the user to diectly jump to any previously visited path. Args: None Keyword Args: visited_history_size (int): Maximum number of previously visited paths to queue up. Default 10. apply_path_handler (Callable): This function is called when the user updates the path and is expected to update the caller app accordingly. The user can update the path in one of 3 ways: 1. by hitting Enter on the input field, 2. selecting a path from the dropdown, or 3. by clicking on the "prev" or "next" buttons. Function signature: void apply_path_handler(path: str) branching_options_handler (Callable): This function is required to provide a list of possible branches whenever prompted with a path. For example, if path = "C:", then the list of values produced might be ["Program Files", "temp", ..., "Users"]. Function signature: list(str) branching_options_handler(path: str, callback: func) modal (bool): Used for modal window. Default False. """ def __init__(self, **kwargs): self._path_field = None self._next_button = None self._prev_button = None self._visited_menu = None self._visited_queue = None self._visited_history = None self._visited_menu_bg = None import carb.settings theme = carb.settings.get_settings().get_as_string("/persistent/app/window/uiStyle") or "NvidiaDark" self._style = UI_STYLES[theme] self._icon_path = f"{ICON_PATH}/{theme}" self._visited_max_size = kwargs.get("visited_history_size", 10) self._visited_history_max_size = kwargs.get("visited_history_max_size", 100) self._apply_path_handler = kwargs.get("apply_path_handler", None) self._branching_options_handler = kwargs.get("branching_options_handler", None) # OM-49484: Add subscription to begin edit and apply callback, for example we could add callback to cancel # initial navigation upon user edit self._begin_edit_handler = kwargs.get("begin_edit_handler", None) self._branching_options_provider = kwargs.get("branching_options_provider", None) # OBSOLETE self._prefix_separator = kwargs.get("prefix_separator", None) self._modal = kwargs.get("modal", False) self._build_ui() @property def path(self) -> str: """str: Returns the current path as entered in the field box.""" if self._path_field: return self._path_field.path return None def set_path(self, path: str): """ Sets the path and adds it to the history queue. Args: path (str): The full path name. """ if not path: return if self._path_field: self._path_field.set_path(path) self._update_visited(path) def _build_ui(self): import carb.settings font_size = carb.settings.get_settings().get("/app/font/size") or 0 with ui.HStack(height=0, style=self._style): self._prev_button = ui.Button( image_url=f"{self._icon_path}/angle_left.svg", image_height=16, width=24, clicked_fn=self._on_prev_button_pressed, enabled=False, ) self._next_button = ui.Button( image_url=f"{self._icon_path}/angle_right.svg", image_height=16, width=24, clicked_fn=self._on_next_button_pressed, enabled=False, ) with ui.ZStack(): ui.Rectangle() # OM-66124: Update look for browser bar, use full width combobox and hide beneath Pathfield; # FIXME: this is because currently we cannot control the menu width for arrow_only combo box; with ui.ZStack(): # OM-66124: manually add combo box drop down background, since it is hard to control combo box height # FIXME: Ideally should fix in ui.ComboBox directly combo_dropdown_size = font_size + 8 with ui.HStack(): ui.Spacer() with ui.VStack(width=combo_dropdown_size): ui.Spacer() self._visited_menu_bg = ui.Rectangle(height=22, style=self._style, style_type_name_override="ComboBox.Bg") ui.Spacer() with ui.HStack(): self._path_field = PathField( apply_path_handler=self._apply_path_handler, branching_options_handler=self._branching_options_handler, prefix_separator=self._prefix_separator, modal=self._modal, begin_edit_handler=self._begin_edit_handler, ) ui.Spacer(width=combo_dropdown_size) self._build_visited_menu() def _build_visited_menu(self): self._visited_queue = StringQueueModel( max_items=self._visited_max_size, value_changed_fn=self._on_menu_item_selected ) self._visited_history = VisitedHistory(max_items=self._visited_history_max_size) self._visited_menu = ui.ComboBox(self._visited_queue, arrow_only=False, style=self._style) # Note: This callback is needed to trigger a refresh self._visited_menu.model.add_item_changed_fn(lambda model, item: None) def _update_visited(self, path: str): if self._visited_queue: self._visited_queue.enqueue(path) self._visited_menu.style_type_name_override = "ComboBox.Active" self._visited_menu_bg.style_type_name_override = "ComboBox.Bg.Active" # update visited history self._visited_history.insert(path) self._update_nav_buttons() self._visited_history.activate() def _on_prev_button_pressed(self): self._visited_history.deactivate() selected_index = self._visited_history.selected_index if selected_index >= self._visited_history.size() - 1: return else: self._visited_history.selected_index = selected_index + 1 if self._path_field: self._path_field.set_path(self._visited_history.get_selected_item()) if self._apply_path_handler: self._apply_path_handler(self._visited_history.get_selected_item()) self._update_nav_buttons() def _on_next_button_pressed(self): self._visited_history.deactivate() selected_index = self._visited_history.selected_index if selected_index <= 0: return else: self._visited_history.selected_index = selected_index - 1 if self._path_field: self._path_field.set_path(self._visited_history.get_selected_item()) if self._apply_path_handler: self._apply_path_handler(self._visited_history.get_selected_item()) self._update_nav_buttons() def _update_nav_buttons(self): if self._visited_history.selected_index > 0: self._next_button.enabled = True else: self._next_button.enabled = False if self._visited_history.selected_index < self._visited_history.size() - 1: self._prev_button.enabled = True else: self._prev_button.enabled = False def _on_menu_item_selected(self, model: ui.SimpleIntModel): if not model: return menu_item = self._visited_queue[model.get_value_as_int()] if menu_item: if self._path_field: self._path_field.set_path(menu_item.value) if self._apply_path_handler: self._apply_path_handler(menu_item.value) def destroy(self): if self._path_field: self._path_field.destroy() self._path_field = None self._next_button = None self._prev_button = None self._visited_menu = None self._visited_queue = None if self._visited_history: self._visited_history.destroy() self._visited_menu_bg = None self._style = None self._apply_path_handler = None self._branching_options_handler = None self._begin_edit_handler = None self._branching_options_provider = None
9,403
Python
42.537037
134
0.59917
omniverse-code/kit/exts/omni.kit.widget.browser_bar/omni/kit/widget/browser_bar/tests/test_widget.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 from omni.ui.tests.test_base import OmniUiTest from unittest.mock import Mock, call from ..widget import BrowserBar class TestBrowserBar(OmniUiTest): """Testing PathField.set_path""" async def setUp(self): pass async def tearDown(self): pass async def test_nav_buttons(self): """Testing navigation buttons""" window = await self.create_test_window() mock_path_handler = Mock() with window.frame: under_test = BrowserBar(apply_path_handler=mock_path_handler) for path in ["one", "two", "three", "two", "three"]: under_test.set_path(path) self.assertEqual(under_test.path, "three/") self.assertEqual(under_test._visited_history.size(), 5) self.assertEqual(under_test._visited_queue.size(), 3) under_test._prev_button.call_clicked_fn() self.assertEqual(under_test.path, "two/") under_test._prev_button.call_clicked_fn() self.assertEqual(under_test.path, "three/") under_test._prev_button.call_clicked_fn() under_test._prev_button.call_clicked_fn() self.assertEqual(under_test.path, "one/") self.assertFalse(under_test._prev_button.enabled) for _ in range(4): under_test._next_button.call_clicked_fn() self.assertEqual(under_test.path, "three/") self.assertFalse(under_test._next_button.enabled) self.assertEqual( mock_path_handler.call_args_list, [call('two'), call('three'), call('two'), call('one'), call('two'), call('three'), call('two'), call('three')] ) async def test_nav_menu(self): """Testing navigation menu""" window = await self.create_test_window() mock_path_handler = Mock() with window.frame: under_test = BrowserBar(apply_path_handler=mock_path_handler) for path in ["one", "two", "three"]: under_test.set_path(path) self.assertEqual(under_test.path, "three/") model = under_test._visited_menu.model self.assertEqual(model, under_test._visited_queue) model.selected_index = 2 self.assertEqual(under_test.path, "one/") # selecting one of navigation menu browse to that path, and will appear as the most recent visited history self.assertFalse(under_test._next_button.enabled) under_test.set_path("four") self.assertEqual(model.selected_index, 0) self.assertEqual(under_test.path, "four/")
2,988
Python
35.901234
122
0.649264
omniverse-code/kit/exts/omni.kit.widget.browser_bar/docs/CHANGELOG.md
# Changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [2.0.5] - 2022-12-19 ### Changes - Update browser bar combo box style, add custom rectangle background to match UX. ## [2.0.4] - 2022-11-09 ### Changes - Fix to toml file ## [2.0.3] - 2022-03-09 ### Changes - Fixed navigation bugs. Added unittests. ## [2.0.2] - 2021-06-07 ### Changes - More thorough destruction of class instances upon shutdown. ## [2.0.1] - 2021-02-10 ### Changes - Updated StyleUI handling ## [2.0.0] - 2020-01-03 ### Updated - Refactored for async directory listing to improve overall stability in case of network delays. ### Added - Keyword Arg: 'branching_options_handler' ### Deleted - Keyword Arg: 'branching_options_provider' ## [0.1.4] - 2020-09-18 ### Added - Initial commit to master.
818
Markdown
22.399999
96
0.680929
omniverse-code/kit/exts/omni.kit.widget.cache_indicator/omni/kit/widget/cache_indicator/cache_state_menu.py
import asyncio import aiohttp import carb import os import toml import time import omni.client import webbrowser from omni.kit.menu.utils import MenuItemDescription, MenuAlignment from omni import ui from typing import Union from .style import Styles class CacheStateDelegate(ui.MenuDelegate): def __init__(self, cache_enabled, hub_enabled, **kwargs): super().__init__(**kwargs) self._hub_enabled = hub_enabled self._cache_enabled = cache_enabled self._cache_widget = None def destroy(self): self._cache_widget = None def build_item(self, item: ui.MenuHelper): with ui.HStack(width=0, style={"margin" : 0}): self._cache_widget = ui.HStack(content_clipping=1, width=0, style=Styles.CACHE_STATE_ITEM_STYLE) ui.Spacer(width=10) self.update_cache_state(self._cache_enabled, self._hub_enabled) def get_menu_alignment(self): return MenuAlignment.RIGHT def update_menu_item(self, menu_item: Union[ui.Menu, ui.MenuItem], menu_refresh: bool): if isinstance(menu_item, ui.MenuItem): menu_item.visible = False def update_cache_state(self, cache_enabled, hub_enabled): self._hub_enabled = hub_enabled self._cache_enabled = cache_enabled if not self._cache_widget: return margin = 2 self._cache_widget.clear() with self._cache_widget: ui.Label("CACHE: ") if hub_enabled: ui.Label("HUB", style={"color": 0xff00b86b}) elif cache_enabled: ui.Label("ON", style={"color": 0xff00b86b}) else: with ui.VStack(): ui.Spacer(height=margin) with ui.ZStack(width=0): with ui.HStack(width=20): ui.Spacer() ui.Label("OFF", name="offline", width=0) ui.Spacer(width=margin) with ui.VStack(width=0): ui.Spacer() ui.Image(width=14, height=14, name="doc") ui.Spacer() ui.Spacer() button = ui.InvisibleButton(width=20) button.set_clicked_fn(lambda: webbrowser.open('https://docs.omniverse.nvidia.com/nucleus/cache_troubleshoot.html', new=2)) ui.Spacer(height=margin) class CacheStateMenu: def __init__(self): self._live_menu_name = "Cache State Widget" self._menu_list = [MenuItemDescription(name="placeholder", show_fn=lambda: False)] global_config_path = carb.tokens.get_tokens_interface().resolve("${omni_global_config}") self._omniverse_config_path = os.path.join(global_config_path, "omniverse.toml").replace("\\", "/") self._all_cache_apis = [] self._hub_enabled = False self._cache_enabled = False self._last_time_check = 0 self._ping_cache_future = None self._update_subscription = None def _load_cache_config(self): if os.path.exists(self._omniverse_config_path): try: contents = toml.load(self._omniverse_config_path) except Exception as e: carb.log_error(f"Unable to parse {self._omniverse_config_path}. File corrupted?") contents = None if contents: self._all_cache_apis = self._load_all_cache_server_apis(contents) if self._all_cache_apis: self._cache_enabled = True self._update_subscription = omni.kit.app.get_app().get_update_event_stream().create_subscription_to_pop( self._on_update, name="omni.kit.widget.live update" ) else: carb.log_warn("Unable to detect Omniverse Cache Server. Consider installing it for better IO performance.") self._cache_enabled = False else: carb.log_warn(f"Unable to detect Omniverse Cache Server. File {self._omniverse_config_path} is not found." f" Consider installing it for better IO performance.") def _get_hub_version_cb(self, result, version): if result == omni.client.Result.OK: self._hub_enabled = True else: self._hub_enabled = False self._load_cache_config() if self._cache_state_delegate: self._cache_state_delegate.update_cache_state(self._cache_enabled, self._hub_enabled) def _initialize(self): self._get_hub_version_request = omni.client.get_hub_version_with_callback(self._get_hub_version_cb) def register_menu_widgets(self): self._initialize() self._cache_state_delegate = CacheStateDelegate(self._cache_enabled, self._hub_enabled) omni.kit.menu.utils.add_menu_items(self._menu_list, name=self._live_menu_name, delegate=self._cache_state_delegate) def unregister_menu_widgets(self): omni.kit.menu.utils.remove_menu_items(self._menu_list, self._live_menu_name) if self._cache_state_delegate: self._cache_state_delegate.destroy() self._cache_state_delegate = None self._menu_list = None self._update_subscription = None self._all_cache_apis = [] try: if self._ping_cache_future and not self._ping_cache_future.done(): self._ping_cache_future.cancel() self._ping_cache_future = None except Exception: self._ping_cache_future = None def _on_update(self, dt): if not self._cache_state_delegate or not self._all_cache_apis: return if not self._ping_cache_future or self._ping_cache_future.done(): now = time.time() duration = now - self._last_time_check # 30s if duration < 30: return self._last_time_check = now async def _ping_cache(): async with aiohttp.ClientSession() as session: cache_enabled = None for cache_api in self._all_cache_apis: try: async with session.head(cache_api): ''' If we're here the service port is alive ''' cache_enabled = True except Exception as e: cache_enabled = False break if cache_enabled is not None and self._cache_enabled != cache_enabled: self._cache_enabled = cache_enabled if self._cache_state_delegate: self._cache_state_delegate.update_cache_state(self._cache_enabled, self._hub_enabled) self._ping_cache_future = asyncio.ensure_future(_ping_cache()) def _load_all_cache_server_apis(self, config_contents): mapping = os.environ.get("OMNI_CONN_CACHE", None) if mapping: mapping = f"*#{mapping},f" else: mapping = os.environ.get("OMNI_CONN_REDIRECTION_DICT", None) if not mapping: mapping = os.environ.get("OM_REDIRECTION_DICT", None) if not mapping: connection_library_dict = config_contents.get("connection_library", None) if connection_library_dict: mapping = connection_library_dict.get("proxy_dict", None) all_proxy_apis = set([]) if mapping: mapping = mapping.lstrip("\"") mapping = mapping.rstrip("\"") mapping = mapping.lstrip("'") mapping = mapping.rstrip("'") redirections = mapping.split(";") for redirection in redirections: parts = redirection.split("#") if not parts or len(parts) < 2: continue source, target = parts[0], parts[1] targets = target.split(",") if not targets: continue if len(targets) > 1: proxy_address = targets[0] else: proxy_address = target if not proxy_address.startswith("http://") and not proxy_address.startswith("https://"): proxy_address_api = f"http://{proxy_address}/ping" else: if proxy_address.endswith("/"): proxy_address_api = f"{proxy_address}ping" else: proxy_address_api = f"{proxy_address}/ping" all_proxy_apis.add(proxy_address_api) return all_proxy_apis
8,866
Python
38.584821
146
0.545906
omniverse-code/kit/exts/omni.kit.widget.cache_indicator/omni/kit/widget/cache_indicator/style.py
from .icons import Icons class Styles: CACHE_STATE_ITEM_STYLE = None LIVE_STATE_ITEM_STYLE = None @staticmethod def on_startup(): # It needs to delay initialization of style as icons need to be initialized firstly. Styles.CACHE_STATE_ITEM_STYLE = { "Image::doc": {"image_url": Icons.get("docs"), "color": 0xB04B4BFF}, "Label::offline": {"color": 0xB04B4BFF}, "Rectangle::offline": {"border_radius": 2.0}, "Rectangle::offline": {"background_color": 0xff808080}, "Rectangle::offline:hovered": {"background_color": 0xFF9E9E9E}, }
630
Python
34.055554
92
0.606349
omniverse-code/kit/exts/omni.kit.widget.cache_indicator/omni/kit/widget/cache_indicator/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 .cache_state_menu import CacheStateMenu from .icons import Icons from .style import Styles class OmniCacheIndicatorWidgetExtension(omni.ext.IExt): def on_startup(self, ext_id): extension_path = omni.kit.app.get_app_interface().get_extension_manager().get_extension_path(ext_id) Icons.on_startup(extension_path) Styles.on_startup() self._cache_state_menu = CacheStateMenu() self._cache_state_menu.register_menu_widgets() def on_shutdown(self): self._cache_state_menu.unregister_menu_widgets() Icons.on_shutdown()
1,056
Python
34.233332
108
0.746212
omniverse-code/kit/exts/omni.kit.widget.cache_indicator/omni/kit/widget/cache_indicator/__init__.py
from .extension import OmniCacheIndicatorWidgetExtension
56
Python
55.999944
56
0.928571
omniverse-code/kit/exts/omni.kit.widget.cache_indicator/omni/kit/widget/cache_indicator/tests/__init__.py
from .test_cache_indicator_widget import TestCacheIndicatorWidget
65
Python
64.999935
65
0.892308
omniverse-code/kit/exts/omni.kit.widget.cache_indicator/omni/kit/widget/cache_indicator/tests/test_cache_indicator_widget.py
import omni.kit.test import omni.client import omni.kit.app class TestCacheIndicatorWidget(omni.kit.test.AsyncTestCase): async def test_menu_setup(self): import omni.kit.ui_test as ui_test menu_widget = ui_test.get_menubar() menu = menu_widget.find_menu("Cache State Widget") self.assertTrue(menu)
337
Python
24.999998
60
0.700297
omniverse-code/kit/exts/omni.kit.widget.cache_indicator/docs/index.rst
omni.kit.widget.cache_indicator ################################## Omniverse Kit Cache Status Indicator
105
reStructuredText
20.199996
36
0.561905
omniverse-code/kit/exts/omni.kit.renderer.imgui/omni/kit/imgui_renderer/_imgui_renderer.pyi
from __future__ import annotations import omni.kit.imgui_renderer._imgui_renderer import typing import omni.appwindow._appwindow __all__ = [ "IImGuiRenderer", "acquire_imgui_renderer_interface", "release_imgui_renderer_interface" ] class IImGuiRenderer(): def attach_app_window(self, arg0: omni.appwindow._appwindow.IAppWindow) -> bool: ... @staticmethod def attach_app_window_with_imgui_context(*args, **kwargs) -> typing.Any: ... def clear_cursor_shape_override(self, arg0: omni.appwindow._appwindow.IAppWindow) -> None: ... def detach_app_window(self, arg0: omni.appwindow._appwindow.IAppWindow) -> None: ... def get_all_cursor_shape_names(self) -> typing.List[str]: ... @staticmethod def get_cursor_shape_override(*args, **kwargs) -> typing.Any: ... @staticmethod def get_cursor_shape_override_extend(*args, **kwargs) -> typing.Any: ... @staticmethod def get_window_set(*args, **kwargs) -> typing.Any: ... def has_cursor_shape_override(self, arg0: omni.appwindow._appwindow.IAppWindow) -> bool: ... def is_app_window_attached(self, arg0: omni.appwindow._appwindow.IAppWindow) -> bool: ... def register_cursor_shape_extend(self, arg0: str, arg1: str) -> None: ... @staticmethod def set_cursor_shape_override(*args, **kwargs) -> typing.Any: ... def set_cursor_shape_override_extend(self, arg0: omni.appwindow._appwindow.IAppWindow, arg1: str) -> None: ... def shutdown(self) -> None: ... def startup(self) -> None: ... def unregister_cursor_shape_extend(self, arg0: str) -> None: ... pass def acquire_imgui_renderer_interface(plugin_name: str = None, library_path: str = None) -> IImGuiRenderer: pass def release_imgui_renderer_interface(arg0: IImGuiRenderer) -> None: pass
1,787
unknown
43.699999
114
0.681589
omniverse-code/kit/exts/omni.kit.renderer.imgui/omni/kit/imgui_renderer/__init__.py
from ._imgui_renderer import * # Cached interface instance pointer def get_imgui_renderer_interface() -> IImGuiRenderer: """Returns cached :class:`omni.kit.renderer.IImGuiRenderer` interface""" if not hasattr(get_imgui_renderer_interface, "imgui_renderer"): get_imgui_renderer_interface.imgui_renderer = acquire_imgui_renderer_interface() return get_imgui_renderer_interface.imgui_renderer
413
Python
36.63636
88
0.755448
omniverse-code/kit/exts/omni.kit.renderer.imgui/omni/kit/imgui_renderer/tests/test_imgui_renderer.py
import inspect import pathlib import carb import carb.settings import carb.tokens import carb.windowing import omni.kit.app import omni.kit.test import omni.kit.test_helpers_gfx import omni.kit.renderer.bind import omni.kit.imgui_renderer import omni.kit.imgui_renderer_test # Maximum allowed difference of the same pixel between two images. If the object is moved, the difference will be # close to 255. 10 is enough to filter out the artifacts of antialiasing on the different systems. THRESHOLD = 10 OUTPUTS_DIR = omni.kit.test.get_test_output_path() EXTENSION_FOLDER_PATH = pathlib.Path(omni.kit.app.get_app().get_extension_manager().get_extension_path_by_module(__name__)) GOLDEN_DIR = EXTENSION_FOLDER_PATH.joinpath("data/tests") RENDERER_CAPTURE_EXT_NAME = "omni.kit.renderer.capture" class ImGuiRendererTest(omni.kit.test.AsyncTestCase): async def setUp(self): self._settings = carb.settings.acquire_settings_interface() self._app_window_factory = omni.appwindow.acquire_app_window_factory_interface() self._renderer = omni.kit.renderer.bind.acquire_renderer_interface() self._imgui_renderer = omni.kit.imgui_renderer.acquire_imgui_renderer_interface() self._imgui_renderer_test = omni.kit.imgui_renderer_test.acquire_imgui_renderer_test_interface() self._renderer.startup() self._imgui_renderer.startup() self._imgui_renderer_test.startup() async def tearDown(self): self._imgui_renderer_test.shutdown() self._imgui_renderer.shutdown() self._renderer.shutdown() self._imgui_renderer_test = None self._imgui_renderer = None self._renderer = None self._app_window_factory = None self._settings = None async def __create_app_window(self, title: str, width: int = 300, height: int = 300): app_window = self._app_window_factory.create_window_from_settings() app_window.startup_with_desc( title=f"ImGui renderer test {title}", width=width, height=height, x=omni.appwindow.POSITION_CENTERED, y=omni.appwindow.POSITION_CENTERED, decorations=True, resize=True, always_on_top=False, scale_to_monitor=False, dpi_scale_override=1.0 ) self._app_window_factory.set_default_window(app_window) self._renderer.attach_app_window(app_window) self._imgui_renderer.attach_app_window(app_window) self._imgui_renderer_test.register_empty_window( app_window, 50, 50, 200, 200, title ) # Test the carb.imgui is_valid returns True since it is now properly setup await self.test_carb_imgui_is_valid(True) await omni.kit.app.get_app().next_update_async() return app_window async def __destroy_app_window(self, app_window): self._app_window_factory.set_default_window(None) self._imgui_renderer.detach_app_window(app_window) self._renderer.detach_app_window(app_window) app_window.shutdown() await omni.kit.app.get_app().next_update_async() return None @omni.kit.test.omni_test_registry(guid="4ecaf4c3-17bd-40fa-8a76-f0e12291d0ef") async def test_1000_empty_imgui_window(self): TESTNAME = "test_1000_empty_imgui_window" FILENAME = f"{TESTNAME}.png" app_window = await self.__create_app_window("Test Empty Window") diff = await omni.kit.test_helpers_gfx.capture_and_compare(FILENAME, THRESHOLD, OUTPUTS_DIR, GOLDEN_DIR, app_window) if diff != 0: carb.log_warn(f"[TEST_NAME] the generated image has max difference {diff}") if diff > THRESHOLD: carb.log_error(f'The generated image {FILENAME} has a difference of {diff}, but max difference is {THRESHOLD}') self.assertTrue(False) app_window = await self.__destroy_app_window(app_window) @omni.kit.test.omni_test_registry(guid="bf09077f-e44a-11ed-ade6-ac91a108fede") async def test_null_app_window_0(self): """Test crash avoidance on API abuse 0""" result = self._imgui_renderer_test.attach_null_window(0) self.assertTrue(result) @omni.kit.test.omni_test_registry(guid="65059f66-e44d-11ed-9523-ac91a108fede") async def test_null_app_window_1(self): """Test crash avoidance on API abuse 1""" result = self._imgui_renderer_test.attach_null_window(1) self.assertTrue(result) async def test_set_cursor_shape_override(self): """Test crash avoidance on set_cursor_shape_override""" app_window = await self.__create_app_window("Test Empty Window") self._imgui_renderer.set_cursor_shape_override(app_window, carb.windowing.CursorStandardShape.HAND) app_window = await self.__destroy_app_window(app_window) async def test_cursor_shape_override_extend(self): """Test crash avoidance on set_cursor_shape_override_extend""" app_window = await self.__create_app_window("Test Empty Window") self._imgui_renderer.get_all_cursor_shape_names() self._imgui_renderer.set_cursor_shape_override_extend(app_window, "Arrow") self._imgui_renderer.get_cursor_shape_override_extend(app_window) self._imgui_renderer.register_cursor_shape_extend("test_cursor", r"${exe-path}/resources/icons/Ok_64.png") self._imgui_renderer.unregister_cursor_shape_extend("test_cursor") app_window = await self.__destroy_app_window(app_window) async def test_carb_imgui_is_valid(self, should_be_valid: bool = False): """Test low level carb.imgui is_valid API""" import carb.imgui imgui = carb.imgui.acquire_imgui() self.assertIsNotNone(imgui) self.assertEqual(imgui.is_valid(), should_be_valid)
5,904
Python
40.879432
127
0.667683
omniverse-code/kit/exts/omni.kit.renderer.imgui/omni/kit/imgui_renderer/tests/__init__.py
from .test_imgui_renderer import *
35
Python
16.999992
34
0.771429
omniverse-code/kit/exts/omni.kit.renderer.imgui/omni/kit/imgui_renderer_test/__init__.py
from ._imgui_renderer_test import * # Cached interface instance pointer def get_imgui_renderer_test_interface() -> IImGuiRendererTest: if not hasattr(get_imgui_renderer_test_interface, "imgui_renderer_test"): get_imgui_renderer_test_interface.imgui_renderer_test = acquire_imgui_renderer_test_interface() return get_imgui_renderer_test_interface.imgui_renderer_test
384
Python
41.777773
103
0.770833
omniverse-code/kit/exts/omni.kit.renderer.imgui/omni/kit/ui/editor_menu.py
import carb from typing import Callable, Union, Tuple extension_id = "omni.kit.ui.editor_menu_bridge" class EditorMenu(): active_menus = {} window_handler = {} setup_hook = False omni_kit_menu_utils_loaded = False def __init__(self): import omni.kit.app manager = omni.kit.app.get_app().get_extension_manager() self._hooks = [] self._hooks.append( manager.subscribe_to_extension_enable( on_enable_fn=lambda _: EditorMenu.set_menu_loaded(True), on_disable_fn=lambda _: EditorMenu.set_menu_loaded(False), ext_name="omni.kit.menu.utils", hook_name="editor menu omni.kit.menu.utils listener", ) ) @staticmethod def clean_menu_path(path): import re return re.sub(r"[^\x00-\x7F]+", "", path).lstrip() @staticmethod def set_menu_loaded(state: bool): EditorMenu.omni_kit_menu_utils_loaded = state class EditorMenuItem: def __init__(self, menu_path): self._menu_path = menu_path def __del__(self): carb.log_info(f"{self._menu_path} went out of scope and is being automatically removed from the menu system") EditorMenu.remove_item(self._menu_path) @staticmethod def sort_menu_hook(merged_menu): from omni.kit.menu.utils import MenuItemDescription def priority_sort(menu_entry): if hasattr(menu_entry, "priority"): return menu_entry.priority return 0 for name in ["Window", "Help"]: if name in merged_menu: merged_menu[name].sort(key=priority_sort) priority = 0 for index, menu_entry in enumerate(merged_menu[name]): if hasattr(menu_entry, "priority"): if index > 0 and abs(menu_entry.priority - priority) > 9: spacer = MenuItemDescription() spacer.priority = menu_entry.priority merged_menu[name].insert(index, spacer) priority = menu_entry.priority @staticmethod def get_action_name(menu_path): import re action = re.sub(r'[^\x00-\x7F]','', menu_path).lower().strip().replace('/', '_').replace(' ', '_').replace('__', '_') return(f"action_editor_menu_bridge_{action}") @staticmethod def convert_to_new_menu(menu_path:str, menu_name: Union[str, list], on_click: Callable, toggle: bool, priority: int, value: bool, enabled: bool, original_svg_color: bool): from omni.kit.menu.utils import MenuItemDescription action_name = EditorMenu.get_action_name(menu_path) if on_click: import omni.kit.actions.core omni.kit.actions.core.get_action_registry().register_action( extension_id, action_name, lambda: on_click(menu_path, EditorMenu.toggle_value(menu_path)), display_name=action_name, description=action_name, tag=action_name, ) if isinstance(menu_name, list): menu_item = menu_name.pop(-1) sub_menu_item = MenuItemDescription(name=menu_item, enabled=enabled, ticked=toggle, ticked_value=value if toggle else None, onclick_action=(extension_id, action_name), original_svg_color=original_svg_color) sub_menu = [sub_menu_item] while(len(menu_name) > 0): menu_item = menu_name.pop(-1) menu = MenuItemDescription(name=menu_item, sub_menu=sub_menu, original_svg_color=original_svg_color) menu.priority=priority sub_menu = [menu] return menu, sub_menu_item else: menu = MenuItemDescription(name=menu_name, enabled=enabled, ticked=toggle, ticked_value=value if toggle else None, onclick_action=(extension_id, action_name), original_svg_color=original_svg_color) menu.priority=priority return menu, menu @staticmethod def split_menu_path(menu_path: str): menu_name = None menu_parts = menu_path.replace("\/", "@TEMPSLASH@").split("/") menu_title = menu_parts.pop(0) if len(menu_parts) > 1: menu_name = menu_parts elif menu_parts: menu_name = menu_parts[0] if menu_name: if isinstance(menu_name, list): menu_name = [name.replace("@TEMPSLASH@", "\\") for name in menu_name] else: menu_name = menu_name.replace("@TEMPSLASH@", "\\") if menu_title: menu_title = menu_title.replace("@TEMPSLASH@", "\\") return menu_title, menu_name @staticmethod def add_item(menu_path: str, on_click: Callable=None, toggle: bool=False, priority: int=0, value: bool=False, enabled: bool=True, original_svg_color: bool=False, auto_release=True): if not EditorMenu.omni_kit_menu_utils_loaded: carb.log_warn(f"omni.kit.menu.utils not loaded for add_item({EditorMenu.clean_menu_path(menu_path)}) - Extension needs dependency to omni.kit.menu.utils") return import omni.kit.menu.utils if EditorMenu.setup_hook == False: omni.kit.menu.utils.add_hook(EditorMenu.sort_menu_hook) EditorMenu.setup_hook = True menu_title, menu_name = EditorMenu.split_menu_path(menu_path) menu, menuitem = EditorMenu.convert_to_new_menu(menu_path, menu_name, on_click, toggle, priority, value, enabled, original_svg_color) EditorMenu.active_menus[menu_path] = (menu, menuitem) omni.kit.menu.utils.add_menu_items([menu], menu_title) # disabled for fastShutdown as auto-release causes exceptions on shutdown, so editor_menus may leak as most are not removed if auto_release: return EditorMenu.EditorMenuItem(menu_path) return menu_path @staticmethod def set_on_click(menu_path: str, on_click: Callable=None): if not EditorMenu.omni_kit_menu_utils_loaded: carb.log_warn(f"omni.kit.menu.utils not loaded for set_on_click({EditorMenu.clean_menu_path(menu_path)}) - Extension needs dependency to omni.kit.menu.utils") return import omni.kit.menu.utils action_name = EditorMenu.get_action_name(menu_path) if menu_path in EditorMenu.active_menus: import omni.kit.actions.core omni.kit.actions.core.get_action_registry().deregister_action( extension_id, action_name ) if on_click: omni.kit.actions.core.get_action_registry().register_action( extension_id, action_name, lambda: on_click(menu_path, EditorMenu.toggle_value(menu_path)), display_name=action_name, description=action_name, tag=action_name, ) menu_title, menu_name = EditorMenu.split_menu_path(menu_path) menu, menuitem = EditorMenu.active_menus[menu_path] omni.kit.menu.utils.remove_menu_items([menu], menu_title) menuitem.onclick_action = None if on_click: menuitem.onclick_action=(extension_id, action_name) omni.kit.menu.utils.add_menu_items([menu], menu_title) return None carb.log_warn(f"set_on_click menu {EditorMenu.clean_menu_path(menu_path)} not found") return None @staticmethod def remove_item(menu_path: str): if not EditorMenu.omni_kit_menu_utils_loaded: carb.log_warn(f"omni.kit.menu.utils not loaded for remove_item({EditorMenu.clean_menu_path(menu_path)}) - Extension needs dependency to omni.kit.menu.utils") return import omni.kit.menu.utils import omni.kit.actions.core if menu_path in EditorMenu.active_menus: menu_title, menu_name = EditorMenu.split_menu_path(menu_path) menu, menuitem = EditorMenu.active_menus[menu_path] omni.kit.menu.utils.remove_menu_items([menu], menu_title) del EditorMenu.active_menus[menu_path] omni.kit.actions.core.get_action_registry().deregister_action( extension_id, EditorMenu.get_action_name(menu_path) ) return None carb.log_warn(f"remove_item menu {EditorMenu.clean_menu_path(menu_path)} not found") return None @staticmethod def set_priority(menu_path: str, priority: int): if not EditorMenu.omni_kit_menu_utils_loaded: carb.log_warn(f"omni.kit.menu.utils not loaded for set_priority({EditorMenu.clean_menu_path(menu_path)}) - Extension needs dependency to omni.kit.menu.utils") return import omni.kit.menu.utils menu_title_id, menu_name = EditorMenu.split_menu_path(menu_path) if menu_title_id and not menu_name: for menu_id in EditorMenu.active_menus: menu_title, menu_name = EditorMenu.split_menu_path(menu_id) if menu_title == menu_title_id: menu, menuitem = EditorMenu.active_menus[menu_id] omni.kit.menu.utils.remove_menu_items([menu], menu_title) omni.kit.menu.utils.add_menu_items([menu], menu_title, priority) return if menu_path in EditorMenu.active_menus: menu_title, menu_name = EditorMenu.split_menu_path(menu_path) menu, menuitem = EditorMenu.active_menus[menu_path] omni.kit.menu.utils.remove_menu_items([menu], menu_title) menuitem.priority = priority omni.kit.menu.utils.add_menu_items([menu], menu_title) return carb.log_warn(f"set_priority menu {EditorMenu.clean_menu_path(menu_path)} not found") return @staticmethod def set_enabled(menu_path: str, enabled: bool): if not EditorMenu.omni_kit_menu_utils_loaded: return None import omni.kit.menu.utils if menu_path in EditorMenu.active_menus: menu_title, menu_name = EditorMenu.split_menu_path(menu_path) menu, menuitem = EditorMenu.active_menus[menu_path] menuitem.enabled = enabled return None carb.log_warn(f"set_enabled menu {EditorMenu.clean_menu_path(menu_path)} not found") return None @staticmethod def set_hotkey(menu_path: str, modifier: int, key: int): if not EditorMenu.omni_kit_menu_utils_loaded: carb.log_warn(f"omni.kit.menu.utils not loaded for set_hotkey({EditorMenu.clean_menu_path(menu_path)}) - Extension needs dependency to omni.kit.menu.utils") return None import omni.kit.menu.utils if menu_path in EditorMenu.active_menus: menu_title, menu_name = EditorMenu.split_menu_path(menu_path) menu, menuitem = EditorMenu.active_menus[menu_path] omni.kit.menu.utils.remove_menu_items([menu], menu_title) menuitem.set_hotkey((modifier, key)) omni.kit.menu.utils.add_menu_items([menu], menu_title) return None carb.log_warn(f"set_hotkey menu {EditorMenu.clean_menu_path(menu_path)} not found") return None @staticmethod def set_value(menu_path: str, value: bool): if not EditorMenu.omni_kit_menu_utils_loaded: carb.log_warn(f"omni.kit.menu.utils not loaded for set_value({EditorMenu.clean_menu_path(menu_path)}) - Extension needs dependency to omni.kit.menu.utils") return None import omni.kit.menu.utils if menu_path in EditorMenu.active_menus: menu_title, menu_name = EditorMenu.split_menu_path(menu_path) menu, menuitem = EditorMenu.active_menus[menu_path] if menuitem.ticked_value != value: menuitem.ticked_value = value omni.kit.menu.utils.refresh_menu_items(menu_title) return None carb.log_warn(f"set_value menu {EditorMenu.clean_menu_path(menu_path)} not found") return None @staticmethod def get_value(menu_path: str): if not EditorMenu.omni_kit_menu_utils_loaded: carb.log_warn(f"omni.kit.menu.utils not loaded for get_value({EditorMenu.clean_menu_path(menu_path)}) - Extension needs dependency to omni.kit.menu.utils") return None if menu_path in EditorMenu.active_menus: menu, menuitem = EditorMenu.active_menus[menu_path] return menuitem.ticked_value carb.log_warn(f"get_value menu {EditorMenu.clean_menu_path(menu_path)} not found") return None @staticmethod def toggle_value(menu_path: str): if not EditorMenu.omni_kit_menu_utils_loaded: carb.log_warn(f"omni.kit.menu.utils not loaded for toggle_value({EditorMenu.clean_menu_path(menu_path)}) - Extension needs dependency to omni.kit.menu.utils") return None import omni.kit.menu.utils if menu_path in EditorMenu.active_menus: menu_title, menu_name = EditorMenu.split_menu_path(menu_path) menu, menuitem = EditorMenu.active_menus[menu_path] menuitem.ticked_value = not menuitem.ticked_value omni.kit.menu.utils.refresh_menu_items(menu_title) return menuitem.ticked_value carb.log_warn(f"toggle_value menu {EditorMenu.clean_menu_path(menu_path)} not found") return None @staticmethod def has_item(menu_path: str): return (menu_path in EditorMenu.active_menus) @staticmethod def set_on_right_click(menu_path: str, on_click: Callable=None): carb.log_warn(f"EditorMenu.set_on_right_click(menu_path='{EditorMenu.clean_menu_path(menu_path)}', on_click={on_click}) not supported") return None @staticmethod def set_action(menu_path: str, action_mapping_path: str, action_name: str): carb.log_warn(f"EditorMenu.set_action(menu_path='{EditorMenu.clean_menu_path(menu_path)}', action_mapping_path='{action_mapping_path}', action_name='{action_name}') not supported") return None @staticmethod def add_action_to_menu( menu_path: str, on_action: Callable, action_name: str = None, default_hotkey: Tuple[int, int] = None, on_rmb_click: Callable = None, ) -> None: if not EditorMenu.omni_kit_menu_utils_loaded: carb.log_warn(f"omni.kit.menu.utils not loaded for add_action_to_menu({EditorMenu.clean_menu_path(menu_path)}) - Extension needs dependency to omni.kit.menu.utils") return None import omni.kit.menu.utils from omni.kit.menu.utils import MenuActionControl if on_rmb_click: carb.log_warn(f"add_action_to_menu {EditorMenu.clean_menu_path(menu_path)} on_rmb_click not supported") if menu_path in EditorMenu.active_menus: menu_title, menu_name = EditorMenu.split_menu_path(menu_path) menu, menuitem = EditorMenu.active_menus[menu_path] omni.kit.menu.utils.remove_menu_items([menu], menu_title) action_name = EditorMenu.get_action_name(menu_path) if on_action: import omni.kit.actions.core omni.kit.actions.core.get_action_registry().deregister_action( extension_id, action_name ) omni.kit.actions.core.get_action_registry().register_action( extension_id, action_name, on_action, display_name=action_name, description=action_name, tag=action_name, ) # HACK - async/frame delay breaks fullscreen mode if action_name in ["action_editor_menu_bridge_window_fullscreen_mode"]: menuitem.onclick_action=(extension_id, action_name, MenuActionControl.NODELAY) else: menuitem.onclick_action=(extension_id, action_name) menuitem.set_hotkey(default_hotkey) omni.kit.menu.utils.add_menu_items([menu], menu_title) return None carb.log_warn(f"add_action_to_menu menu {EditorMenu.clean_menu_path(menu_path)} not found") return None
16,924
Python
41.848101
188
0.594718
omniverse-code/kit/exts/omni.kit.renderer.imgui/omni/kit/ui/_ui.pyi
from __future__ import annotations import omni.kit.ui._ui import typing import carb import carb._carb import carb.events._events import omni.ui._ui __all__ = [ "BroadcastModel", "Button", "CheckBox", "ClippingType", "CollapsingFrame", "ColorRgb", "ColorRgba", "ColumnLayout", "ComboBox", "ComboBoxInt", "Container", "ContainerBase", "ContentWindow", "DelegateAction", "DelegateResult", "DockPreference", "DragDouble", "DragDouble2", "DragDouble3", "DragDouble4", "DragInt", "DragInt2", "DragUInt", "DraggingType", "FieldDouble", "FieldInt", "FileDialogDataSource", "FileDialogOpenMode", "FileDialogSelectType", "FilePicker", "Image", "Label", "Length", "ListBox", "MODEL_META_SERIALIZED_CONTENTS", "MODEL_META_WIDGET_TYPE", "Mat44", "Menu", "MenuEventType", "Model", "ModelChangeInfo", "ModelEventType", "ModelNodeType", "ModelWidget", "Percent", "Pixel", "Popup", "ProgressBar", "RowColumnLayout", "RowLayout", "ScalarXYZ", "ScalarXYZW", "ScrollingFrame", "Separator", "SimpleTreeView", "SimpleValueWidgetBool", "SimpleValueWidgetColorRgb", "SimpleValueWidgetColorRgba", "SimpleValueWidgetDouble", "SimpleValueWidgetDouble2", "SimpleValueWidgetDouble3", "SimpleValueWidgetDouble4", "SimpleValueWidgetInt", "SimpleValueWidgetInt2", "SimpleValueWidgetMat44", "SimpleValueWidgetString", "SimpleValueWidgetUint", "SliderDouble", "SliderDouble2", "SliderDouble3", "SliderDouble4", "SliderInt", "SliderInt2", "SliderUInt", "Spacer", "TextBox", "Transform", "UnitType", "ValueWidgetBool", "ValueWidgetColorRgb", "ValueWidgetColorRgba", "ValueWidgetDouble", "ValueWidgetDouble2", "ValueWidgetDouble3", "ValueWidgetDouble4", "ValueWidgetInt", "ValueWidgetInt2", "ValueWidgetMat44", "ValueWidgetString", "ValueWidgetUint", "ViewCollapsing", "ViewFlat", "ViewTreeGrid", "WINDOW_FLAGS_FORCE_HORIZONTAL_SCROLLBAR", "WINDOW_FLAGS_FORCE_VERTICAL_SCROLLBAR", "WINDOW_FLAGS_MODAL", "WINDOW_FLAGS_NONE", "WINDOW_FLAGS_NO_CLOSE", "WINDOW_FLAGS_NO_COLLAPSE", "WINDOW_FLAGS_NO_FOCUS_ON_APPEARING", "WINDOW_FLAGS_NO_MOVE", "WINDOW_FLAGS_NO_RESIZE", "WINDOW_FLAGS_NO_SAVED_SETTINGS", "WINDOW_FLAGS_NO_SCROLLBAR", "WINDOW_FLAGS_NO_TITLE_BAR", "WINDOW_FLAGS_SHOW_HORIZONTAL_SCROLLBAR", "Widget", "Window", "WindowEventType", "WindowMainStandalone", "WindowStandalone", "activate_menu_item", "get_custom_glyph_code", "get_editor_menu_legacy", "get_main_window" ] class BroadcastModel(Model): def __init__(self) -> None: ... def add_target(self, arg0: Model, arg1: str, arg2: str) -> int: ... def remove_target(self, arg0: int) -> None: ... pass class Button(Label, Widget): """ Button Widget. Args: text (str): Text on button. is_image (bool): Text is an image filename. """ def __init__(self, text: str = '', is_image: bool = False, default_color: int = 4294967295) -> None: ... def set_clicked_fn(self, arg0: typing.Callable[[Widget], None]) -> None: ... @property def url(self) -> str: """ :type: str """ @url.setter def url(self, arg1: str) -> None: pass pass class CheckBox(SimpleValueWidgetBool, ValueWidgetBool, ModelWidget, Widget): """ CheckBox Widget. Args: text (str, default=""): Text on label. value (bool, default=False): Initial value. left_handed (bool, default=False): Initial value. styled (bool, default=False): Initial value """ def __init__(self, text: str = '', value: bool = False, left_handed: bool = False, styled: bool = False) -> None: ... @property def styled(self) -> bool: """ :type: bool """ @styled.setter def styled(self, arg0: bool) -> None: pass pass class ClippingType(): """ Supported text clipping types. Members: NONE ELLIPSIS_LEFT ELLIPSIS_RIGHT WRAP """ 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 """ ELLIPSIS_LEFT: omni.kit.ui._ui.ClippingType # value = <ClippingType.ELLIPSIS_LEFT: 1> ELLIPSIS_RIGHT: omni.kit.ui._ui.ClippingType # value = <ClippingType.ELLIPSIS_RIGHT: 2> NONE: omni.kit.ui._ui.ClippingType # value = <ClippingType.NONE: 0> WRAP: omni.kit.ui._ui.ClippingType # value = <ClippingType.WRAP: 3> __members__: dict # value = {'NONE': <ClippingType.NONE: 0>, 'ELLIPSIS_LEFT': <ClippingType.ELLIPSIS_LEFT: 1>, 'ELLIPSIS_RIGHT': <ClippingType.ELLIPSIS_RIGHT: 2>, 'WRAP': <ClippingType.WRAP: 3>} pass class CollapsingFrame(Container, Widget): def __init__(self, arg0: str, arg1: bool) -> None: ... @property def open(self) -> bool: """ :type: bool """ @open.setter def open(self, arg1: bool) -> None: pass @property def title(self) -> str: """ :type: str """ @title.setter def title(self, arg1: str) -> None: pass @property def use_frame_background_color(self) -> bool: """ :type: bool """ @use_frame_background_color.setter def use_frame_background_color(self, arg1: bool) -> None: pass @property def visible(self) -> bool: """ :type: bool """ @visible.setter def visible(self, arg1: bool) -> None: pass pass class ColorRgb(SimpleValueWidgetColorRgb, ValueWidgetColorRgb, ModelWidget, Widget): """ Color Picker Widget (Tuple[float, float, float]). Args: text (str, default=""): Text on label. value (Tuple[float, float, float], default=(0.0, 0.0, 0.0)): Initial value. """ def __init__(self, text: str = '', value: carb._carb.ColorRgb = carb.ColorRgb(0,0,0)) -> None: ... pass class ColorRgba(SimpleValueWidgetColorRgba, ValueWidgetColorRgba, ModelWidget, Widget): """ Color Picker Widget (Tuple[float, float, float, float]). Args: text (str, default=""): Text on label. value (Tuple[float, float, float, float], default=(0.0, 0.0, 0.0)): Initial value. """ def __init__(self, text: str = '', value: carb._carb.ColorRgba = carb.ColorRgba(0,0,0,0)) -> None: ... pass class ColumnLayout(Container, Widget): def __init__(self, spacing: int = -1, padding_x: int = -1, padding_y: int = -1) -> None: ... pass class ComboBox(SimpleValueWidgetString, ValueWidgetString, ModelWidget, Widget): """ ComboBox Widget. Args: text (str, default=""): Text on label. items (List[[str], default=[]): List of elements. display_names (List[str], default=[]): List of element display names. Optional. """ def __init__(self, text: str = '', items: typing.List[str] = [], display_names: typing.List[str] = []) -> None: ... def add_item(self, item: str, display_name: str = '') -> None: ... def clear_items(self) -> None: ... def get_item_at(self, arg0: int) -> str: ... def get_item_count(self) -> int: ... def remove_item(self, arg0: int) -> None: ... def set_items(self, items: typing.List[str], display_names: typing.List[str] = []) -> None: ... @property def selected_index(self) -> int: """ :type: int """ @selected_index.setter def selected_index(self, arg1: int) -> None: pass pass class ComboBoxInt(SimpleValueWidgetInt, ValueWidgetInt, ModelWidget, Widget): """ ComboBox Widget. Args: text (str, default=""): Text on label. items (List[[int], default=[]): List of elements. display_names (List[int], default=[]): List of element display names. Optional. """ def __init__(self, text: str = '', items: typing.List[int] = [], display_names: typing.List[str] = []) -> None: ... def add_item(self, item: int, display_name: str = '') -> None: ... def clear_items(self) -> None: ... def get_item_at(self, arg0: int) -> int: ... def get_item_count(self) -> int: ... def remove_item(self, arg0: int) -> None: ... def set_items(self, items: typing.List[int], display_names: typing.List[str] = []) -> None: ... @property def selected_index(self) -> int: """ :type: int """ @selected_index.setter def selected_index(self, arg1: int) -> None: pass pass class Container(Widget): """ Base class for all UI containers. Container can hold arbitrary number of other :class:`.Widget` s """ def add_child(self, arg0: Widget) -> Widget: ... def clear(self) -> None: ... def get_child_at(self, arg0: int) -> Widget: ... def get_child_count(self) -> int: ... def remove_child(self, arg0: Widget) -> None: ... @property def child_spacing(self) -> carb._carb.Float2: """ :type: carb._carb.Float2 """ @child_spacing.setter def child_spacing(self, arg1: carb._carb.Float2) -> None: pass pass class ContainerBase(Widget): """ Class for the complex widget that can have children, but doesn;t allow to add children for the external user. """ def draw(self, arg0: float) -> None: ... pass class ContentWindow(Widget): """ Content Window. Content Window is container that hosts a file picker widget. """ @typing.overload def __init__(self) -> None: ... @typing.overload def __init__(self, arg0: int, arg1: int) -> None: ... def get_selected_icon_paths(self) -> tuple: ... def get_selected_node_paths(self) -> tuple: ... def navigate_to(self, arg0: str) -> None: ... def refresh(self) -> None: ... def set_filter(self, arg0: str) -> None: ... pass class DelegateAction(): """ Members: CREATE_DEFAULT_WIDGET SKIP_KEY USE_CUSTOM_WIDGET """ 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 """ CREATE_DEFAULT_WIDGET: omni.kit.ui._ui.DelegateAction # value = <DelegateAction.CREATE_DEFAULT_WIDGET: 0> SKIP_KEY: omni.kit.ui._ui.DelegateAction # value = <DelegateAction.SKIP_KEY: 1> USE_CUSTOM_WIDGET: omni.kit.ui._ui.DelegateAction # value = <DelegateAction.USE_CUSTOM_WIDGET: 2> __members__: dict # value = {'CREATE_DEFAULT_WIDGET': <DelegateAction.CREATE_DEFAULT_WIDGET: 0>, 'SKIP_KEY': <DelegateAction.SKIP_KEY: 1>, 'USE_CUSTOM_WIDGET': <DelegateAction.USE_CUSTOM_WIDGET: 2>} pass class DelegateResult(): @typing.overload def __init__(self) -> None: ... @typing.overload def __init__(self, arg0: typing.Sequence) -> None: ... @typing.overload def __init__(self, arg0: DelegateAction) -> None: ... @typing.overload def __init__(self, arg0: Widget) -> None: ... @property def action(self) -> DelegateAction: """ :type: DelegateAction """ @action.setter def action(self, arg0: DelegateAction) -> None: pass @property def custom_widget(self) -> Widget: """ :type: Widget """ @custom_widget.setter def custom_widget(self, arg0: Widget) -> None: pass pass class DockPreference(): """ Members: DISABLED MAIN RIGHT LEFT RIGHT_TOP RIGHT_BOTTOM LEFT_BOTTOM """ 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 """ DISABLED: omni.kit.ui._ui.DockPreference # value = <DockPreference.DISABLED: 0> LEFT: omni.kit.ui._ui.DockPreference # value = <DockPreference.LEFT: 3> LEFT_BOTTOM: omni.kit.ui._ui.DockPreference # value = <DockPreference.LEFT_BOTTOM: 6> MAIN: omni.kit.ui._ui.DockPreference # value = <DockPreference.MAIN: 1> RIGHT: omni.kit.ui._ui.DockPreference # value = <DockPreference.RIGHT: 2> RIGHT_BOTTOM: omni.kit.ui._ui.DockPreference # value = <DockPreference.RIGHT_BOTTOM: 5> RIGHT_TOP: omni.kit.ui._ui.DockPreference # value = <DockPreference.RIGHT_TOP: 4> __members__: dict # value = {'DISABLED': <DockPreference.DISABLED: 0>, 'MAIN': <DockPreference.MAIN: 1>, 'RIGHT': <DockPreference.RIGHT: 2>, 'LEFT': <DockPreference.LEFT: 3>, 'RIGHT_TOP': <DockPreference.RIGHT_TOP: 4>, 'RIGHT_BOTTOM': <DockPreference.RIGHT_BOTTOM: 5>, 'LEFT_BOTTOM': <DockPreference.LEFT_BOTTOM: 6>} pass class DragDouble(SimpleValueWidgetDouble, ValueWidgetDouble, ModelWidget, Widget): """ Drag Widget (double). If `min` >= `max` widget value has no bound. Args: text (str, default=""): Text on label. value (double, default=0): Initial value. min (double, default=0): Lower value limit. max (double, default=0): Upper value limit. drag_speed (float, default=1.0): Drag speed. """ def __init__(self, text: str = '', value: float = 0.0, min: float = 0, max: float = 0, drag_speed: float = 1.0) -> None: ... @property def drag_speed(self) -> float: """ :type: float """ @drag_speed.setter def drag_speed(self, arg0: float) -> None: pass @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> float: """ :type: float """ @max.setter def max(self, arg0: float) -> None: pass @property def min(self) -> float: """ :type: float """ @min.setter def min(self, arg0: float) -> None: pass pass class DragDouble2(SimpleValueWidgetDouble2, ValueWidgetDouble2, ModelWidget, Widget): """ Drag Widget (Tuple[double, double]). If `min` >= `max` widget value has no bound. Args: text (str, default=""): Text on label. value (Tuple[double, double], default=0): Initial value. min (double, default=0): Lower value limit. max (double, default=0): Upper value limit. drag_speed (float, default=1.0): Drag speed. """ def __init__(self, text: str = '', value: carb._carb.Double2 = carb.Double2(0,0), min: float = 0, max: float = 0, drag_speed: float = 1.0) -> None: ... @property def drag_speed(self) -> float: """ :type: float """ @drag_speed.setter def drag_speed(self, arg0: float) -> None: pass @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> float: """ :type: float """ @max.setter def max(self, arg0: float) -> None: pass @property def min(self) -> float: """ :type: float """ @min.setter def min(self, arg0: float) -> None: pass pass class DragDouble3(SimpleValueWidgetDouble3, ValueWidgetDouble3, ModelWidget, Widget): """ Drag Widget (Tuple[double, double, double]). If `min` >= `max` widget value has no bound. Args: text (str, default=""): Text on label. value (Tuple[double, double, double], default=0): Initial value. min (double, default=0): Lower value limit. max (double, default=0): Upper value limit. drag_speed (float, default=1.0): Drag speed. """ def __init__(self, text: str = '', value: carb._carb.Double3 = carb.Double3(0,0,0), min: float = 0, max: float = 0, drag_speed: float = 1.0) -> None: ... @property def drag_speed(self) -> float: """ :type: float """ @drag_speed.setter def drag_speed(self, arg0: float) -> None: pass @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> float: """ :type: float """ @max.setter def max(self, arg0: float) -> None: pass @property def min(self) -> float: """ :type: float """ @min.setter def min(self, arg0: float) -> None: pass pass class DragDouble4(SimpleValueWidgetDouble4, ValueWidgetDouble4, ModelWidget, Widget): """ Drag Widget (Tuple[double, double, double, double]). If `min` >= `max` widget value has no bound. Args: text (str, default=""): Text on label. value (Tuple[double, double, double, double], default=0): Initial value. min (double, default=0): Lower value limit. max (double, default=0): Upper value limit. drag_speed (float, default=1.0): Drag speed. """ def __init__(self, text: str = '', value: carb._carb.Double4 = carb.Double4(0,0,0,0), min: float = 0, max: float = 0, drag_speed: float = 1.0) -> None: ... @property def drag_speed(self) -> float: """ :type: float """ @drag_speed.setter def drag_speed(self, arg0: float) -> None: pass @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> float: """ :type: float """ @max.setter def max(self, arg0: float) -> None: pass @property def min(self) -> float: """ :type: float """ @min.setter def min(self, arg0: float) -> None: pass pass class DragInt(SimpleValueWidgetInt, ValueWidgetInt, ModelWidget, Widget): """ Drag Widget (int). If `min` >= `max` widget value has no bound. Args: text (str, default=""): Text on label. value (int, default=0): Initial value. min (int, default=0): Lower value limit. max (int, default=0): Upper value limit. drag_speed (float, default=1.0): Drag speed. """ def __init__(self, text: str = '', value: int = 0, min: int = 0, max: int = 0, drag_speed: float = 1.0) -> None: ... @property def drag_speed(self) -> float: """ :type: float """ @drag_speed.setter def drag_speed(self, arg0: float) -> None: pass @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> int: """ :type: int """ @max.setter def max(self, arg0: int) -> None: pass @property def min(self) -> int: """ :type: int """ @min.setter def min(self, arg0: int) -> None: pass pass class DragInt2(SimpleValueWidgetInt2, ValueWidgetInt2, ModelWidget, Widget): """ Drag Widget (Tuple[int, int]). If `min` >= `max` widget value has no bound. Args: text (str, default=""): Text on label. value (Tuple[int, int], default=0): Initial value. min (int, default=0): Lower value limit. max (int, default=0): Upper value limit. drag_speed (float, default=1.0): Drag speed. """ def __init__(self, text: str = '', value: carb._carb.Int2 = carb.Int2(0,0), min: int = 0, max: int = 0, drag_speed: float = 1.0) -> None: ... @property def drag_speed(self) -> float: """ :type: float """ @drag_speed.setter def drag_speed(self, arg0: float) -> None: pass @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> int: """ :type: int """ @max.setter def max(self, arg0: int) -> None: pass @property def min(self) -> int: """ :type: int """ @min.setter def min(self, arg0: int) -> None: pass pass class DragUInt(SimpleValueWidgetUint, ValueWidgetUint, ModelWidget, Widget): """ Drag Widget (uint32_t). If `min` >= `max` widget value has no bound. Args: text (str, default=""): Text on label. value (uint32_t, default=0): Initial value. min (uint32_t, default=0): Lower value limit. max (uint32_t, default=0): Upper value limit. drag_speed (float, default=1.0): Drag speed. """ def __init__(self, text: str = '', value: int = 0, min: int = 0, max: int = 0, drag_speed: float = 1.0) -> None: ... @property def drag_speed(self) -> float: """ :type: float """ @drag_speed.setter def drag_speed(self, arg0: float) -> None: pass @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> int: """ :type: int """ @max.setter def max(self, arg0: int) -> None: pass @property def min(self) -> int: """ :type: int """ @min.setter def min(self, arg0: int) -> None: pass pass class DraggingType(): """ Supported dragging types. Members: STARTED STOPPED """ 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 """ STARTED: omni.kit.ui._ui.DraggingType # value = <DraggingType.STARTED: 0> STOPPED: omni.kit.ui._ui.DraggingType # value = <DraggingType.STOPPED: 1> __members__: dict # value = {'STARTED': <DraggingType.STARTED: 0>, 'STOPPED': <DraggingType.STOPPED: 1>} pass class FieldDouble(SimpleValueWidgetDouble, ValueWidgetDouble, ModelWidget, Widget): """ Field Widget (double). Args: text (str, default=""): Text on label. value (double, default=0): Initial value. step (double, default=1): Value step. step_fast (double, default=100): Fast value step. """ def __init__(self, text: str = '', value: float = 0.0, step: float = 1, step_fast: float = 100) -> None: ... @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def step(self) -> float: """ :type: float """ @step.setter def step(self, arg0: float) -> None: pass @property def step_fast(self) -> float: """ :type: float """ @step_fast.setter def step_fast(self, arg0: float) -> None: pass pass class FieldInt(SimpleValueWidgetInt, ValueWidgetInt, ModelWidget, Widget): """ Field Widget (int). Args: text (str, default=""): Text on label. value (int, default=0): Initial value. step (int, default=1): Value step. step_fast (int, default=100): Fast value step. """ def __init__(self, text: str = '', value: int = 0, step: int = 1, step_fast: int = 100) -> None: ... @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def step(self) -> int: """ :type: int """ @step.setter def step(self, arg0: int) -> None: pass @property def step_fast(self) -> int: """ :type: int """ @step_fast.setter def step_fast(self, arg0: int) -> None: pass pass class FileDialogDataSource(): """ Data source of File Dialog. Members: LOCAL OMNIVERSE ALL """ 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 """ ALL: omni.kit.ui._ui.FileDialogDataSource # value = <FileDialogDataSource.ALL: 2> LOCAL: omni.kit.ui._ui.FileDialogDataSource # value = <FileDialogDataSource.LOCAL: 0> OMNIVERSE: omni.kit.ui._ui.FileDialogDataSource # value = <FileDialogDataSource.OMNIVERSE: 1> __members__: dict # value = {'LOCAL': <FileDialogDataSource.LOCAL: 0>, 'OMNIVERSE': <FileDialogDataSource.OMNIVERSE: 1>, 'ALL': <FileDialogDataSource.ALL: 2>} pass class FileDialogOpenMode(): """ Open mode of File Dialog. Members: OPEN SAVE """ 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 """ OPEN: omni.kit.ui._ui.FileDialogOpenMode # value = <FileDialogOpenMode.OPEN: 0> SAVE: omni.kit.ui._ui.FileDialogOpenMode # value = <FileDialogOpenMode.SAVE: 1> __members__: dict # value = {'OPEN': <FileDialogOpenMode.OPEN: 0>, 'SAVE': <FileDialogOpenMode.SAVE: 1>} pass class FileDialogSelectType(): """ File selection type of File Dialog. Members: FILE DIRECTORY ALL """ 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 """ ALL: omni.kit.ui._ui.FileDialogSelectType # value = <FileDialogSelectType.ALL: 2> DIRECTORY: omni.kit.ui._ui.FileDialogSelectType # value = <FileDialogSelectType.DIRECTORY: 1> FILE: omni.kit.ui._ui.FileDialogSelectType # value = <FileDialogSelectType.FILE: 0> __members__: dict # value = {'FILE': <FileDialogSelectType.FILE: 0>, 'DIRECTORY': <FileDialogSelectType.DIRECTORY: 1>, 'ALL': <FileDialogSelectType.ALL: 2>} pass class FilePicker(): def __init__(self, title: str, mode: FileDialogOpenMode = FileDialogOpenMode.OPEN, file_type: FileDialogSelectType = FileDialogSelectType.FILE, on_file_selected: typing.Callable[[str], None] = None, on_dialog_cancelled: typing.Callable[[], None] = None, width: float = 800.0, height: float = 440.0) -> None: ... def add_filter(self, arg0: str, arg1: str) -> None: ... def clear_all_filters(self) -> None: ... def is_visible(self) -> bool: ... def set_current_directory(self, arg0: str) -> None: ... def set_default_save_name(self, name: str) -> None: """ sets the default name to use for the filename on save dialogs. This sets the default filename to be used when saving a file. This name will be ignored if the dialog is not in @ref FileDialogOpenMode::eSave mode. The given name will still be stored regardless. This default filename may omit the file extension to take the extension from the current filter. If an extension is explicitly given here, no extension will be appended regardless of the current filter. Args: name: the default filename to use for this dialog. This may be None or an empty string to use the USD stage's default prim name. In this case, if the prim name cannot be retrieved, "Untitled" will be used instead. If a non-empty string is given here, this will always be used as the initial suggested filename. Returns: No return value. """ def set_dialog_cancelled_fn(self, arg0: typing.Callable[[], None]) -> None: ... def set_file_selected_fn(self, arg0: typing.Callable[[str], None]) -> None: ... def show(self, data_source: FileDialogDataSource = FileDialogDataSource.ALL) -> None: ... @property def selection_type(self) -> FileDialogSelectType: """ :type: FileDialogSelectType """ @selection_type.setter def selection_type(self, arg1: FileDialogSelectType) -> None: pass @property def title(self) -> str: """ :type: str """ @title.setter def title(self, arg1: str) -> None: pass pass class Image(Widget): def __init__(self, url: str = '', width: int = 0, height: int = 0) -> None: ... @property def url(self) -> str: """ :type: str """ @url.setter def url(self, arg1: str) -> None: pass pass class Label(Widget): """ Label Widget. Displays non-editable text. Args: text (str, default=""): Text to display. """ def __init__(self, text: str = '', useclipboard: bool = False, clippingmode: ClippingType = ClippingType.NONE, font_style: omni.ui._ui.FontStyle = FontStyle.NONE) -> None: ... def reset_text_color(self) -> None: ... def set_clicked_fn(self, arg0: typing.Callable[[Widget], None]) -> None: ... def set_text_color(self, arg0: carb._carb.ColorRgba) -> None: ... @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg1: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip """ pass class Length(): """ Length. Represents any length as a value and unit type. Examples: >>> l1 = omni.kit.ui.Length(250, omni.kit.ui.UnitType.PIXEL) >>> l2 = omni.kit.ui.Pixel(250) >>> l3 = omni.kit.ui.Percent(30) `l1` and `l2` represent the same value: 250 in pixels. `l3` is 30%. """ @typing.overload def __init__(self) -> None: ... @staticmethod @typing.overload def __init__(*args, **kwargs) -> typing.Any: ... @typing.overload def __init__(self, arg0: float) -> None: ... @typing.overload def __init__(self, arg0: int) -> None: ... def __str__(self) -> str: ... @property def unit(self) -> omni::kit::ui::UnitType: """ (:obj:`.UnitType.`) Unit. :type: omni::kit::ui::UnitType """ @unit.setter def unit(self, arg0: omni::kit::ui::UnitType) -> None: """ (:obj:`.UnitType.`) Unit. """ @property def value(self) -> float: """ (float) Value :type: float """ @value.setter def value(self, arg0: float) -> None: """ (float) Value """ pass class ListBox(Label, Widget): """ ListBox Widget. Args: text (str, default=""): Text on label. multi_select (bool, default=True): Multi selection enabled. item_height_count (int, default=-1): Height in items. items (List[str], default=[]): List of elements. """ def __init__(self, text: str = '', multi_select: bool = True, item_height_count: int = -1, items: typing.List[str] = []) -> None: ... def add_item(self, arg0: str) -> None: ... def clear_items(self) -> None: ... def clear_selection(self) -> None: ... def get_item_at(self, arg0: int) -> str: ... def get_item_count(self) -> int: ... def get_selected(self) -> typing.List[int]: ... def remove_item(self, arg0: int) -> None: ... def set_selected(self, arg0: int, arg1: bool) -> None: ... def set_selection_changed_fn(self, arg0: typing.Callable[[Widget], None]) -> None: ... @property def item_height_count(self) -> int: """ :type: int """ @item_height_count.setter def item_height_count(self, arg1: int) -> None: pass @property def multi_select(self) -> bool: """ :type: bool """ @multi_select.setter def multi_select(self, arg1: bool) -> None: pass pass class Mat44(): @typing.overload def __getitem__(self, arg0: int) -> float: ... @typing.overload def __getitem__(self, arg0: slice) -> list: ... @typing.overload def __init__(self) -> None: ... @typing.overload def __init__(self, arg0: typing.Sequence) -> None: ... def __len__(self) -> int: ... def __repr__(self) -> str: ... @typing.overload def __setitem__(self, arg0: int, arg1: float) -> None: ... @typing.overload def __setitem__(self, arg0: slice, arg1: typing.Sequence) -> None: ... def __str__(self) -> str: ... def get_row(self, arg0: int) -> carb._carb.Double4: ... def set_row(self, arg0: int, arg1: carb._carb.Double4) -> carb._carb.Double4: ... pass class Menu(Widget): """ Menu. """ def __init__(self) -> None: ... def add_item(self, menu_path: str, on_click: typing.Callable[[str, bool], None] = None, toggle: bool = False, priority: int = 0, value: bool = False, enabled: bool = True, original_svg_color: bool = False, auto_release: bool = True) -> carb._carb.Subscription: ... def get_item_count(self) -> int: ... def get_items(self) -> typing.List[str]: ... def get_value(self, arg0: str) -> bool: ... def has_item(self, arg0: str) -> bool: ... def remove_item(self, arg0: str) -> None: ... def set_action(self, arg0: str, arg1: str, arg2: str) -> None: ... def set_enabled(self, arg0: str, arg1: bool) -> None: ... def set_hotkey(self, menu_path: str, modifier: int, key: int) -> None: """ Set menu hotkey. Args: menu_path (str): Path to menu item. modifier(int): Keyboard modifier from :mod:`carb.input`. key(int): Keyboard key code from :class:`carb.input.KeyboardInput`. """ def set_on_click(self, menu_path: str, on_click: typing.Callable[[str, bool], None] = None) -> None: ... def set_on_right_click(self, menu_path: str, on_click: typing.Callable[[str, bool], None] = None) -> None: ... def set_priority(self, arg0: str, arg1: int) -> None: ... def set_value(self, arg0: str, arg1: bool) -> None: ... static_class = None pass class MenuEventType(): """ menu operation results. Members: ACTIVATE """ 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 """ ACTIVATE: omni.kit.ui._ui.MenuEventType # value = <MenuEventType.ACTIVATE: 0> __members__: dict # value = {'ACTIVATE': <MenuEventType.ACTIVATE: 0>} pass class Model(): def __init__(self) -> None: ... def get_type(self, arg0: str, arg1: str) -> ModelNodeType: ... def signal_change(self, path: str, meta: str = '', type: ModelEventType = ModelEventType.NODE_VALUE_CHANGE, sender: int = 0) -> None: ... pass class ModelChangeInfo(): def __init__(self) -> None: ... @property def sender(self) -> int: """ :type: int """ @sender.setter def sender(self, arg0: int) -> None: pass @property def transient(self) -> bool: """ :type: bool """ @transient.setter def transient(self, arg0: bool) -> None: pass pass class ModelEventType(): """ Model event types. Members: NODE_ADD NODE_REMOVE NODE_TYPE_CHANGE NODE_VALUE_CHANGE """ 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 """ NODE_ADD: omni.kit.ui._ui.ModelEventType # value = <ModelEventType.NODE_ADD: 0> NODE_REMOVE: omni.kit.ui._ui.ModelEventType # value = <ModelEventType.NODE_REMOVE: 1> NODE_TYPE_CHANGE: omni.kit.ui._ui.ModelEventType # value = <ModelEventType.NODE_TYPE_CHANGE: 2> NODE_VALUE_CHANGE: omni.kit.ui._ui.ModelEventType # value = <ModelEventType.NODE_VALUE_CHANGE: 3> __members__: dict # value = {'NODE_ADD': <ModelEventType.NODE_ADD: 0>, 'NODE_REMOVE': <ModelEventType.NODE_REMOVE: 1>, 'NODE_TYPE_CHANGE': <ModelEventType.NODE_TYPE_CHANGE: 2>, 'NODE_VALUE_CHANGE': <ModelEventType.NODE_VALUE_CHANGE: 3>} pass class ModelNodeType(): """ Model node types. Members: UNKNOWN OBJECT ARRAY STRING BOOL NUMBER """ 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 """ ARRAY: omni.kit.ui._ui.ModelNodeType # value = <ModelNodeType.ARRAY: 2> BOOL: omni.kit.ui._ui.ModelNodeType # value = <ModelNodeType.BOOL: 4> NUMBER: omni.kit.ui._ui.ModelNodeType # value = <ModelNodeType.NUMBER: 5> OBJECT: omni.kit.ui._ui.ModelNodeType # value = <ModelNodeType.OBJECT: 1> STRING: omni.kit.ui._ui.ModelNodeType # value = <ModelNodeType.STRING: 3> UNKNOWN: omni.kit.ui._ui.ModelNodeType # value = <ModelNodeType.UNKNOWN: 0> __members__: dict # value = {'UNKNOWN': <ModelNodeType.UNKNOWN: 0>, 'OBJECT': <ModelNodeType.OBJECT: 1>, 'ARRAY': <ModelNodeType.ARRAY: 2>, 'STRING': <ModelNodeType.STRING: 3>, 'BOOL': <ModelNodeType.BOOL: 4>, 'NUMBER': <ModelNodeType.NUMBER: 5>} pass class ModelWidget(Widget): """ Model Widget. """ def get_model(self) -> Model: ... def get_model_root(self) -> str: ... def get_model_stream(self) -> carb.events._events.IEventStream: ... def set_model(self, model: Model, root: str = '', isTimeSampled: bool = False, value: float = -1.0) -> None: ... @property def is_time_sampled_widget(self) -> bool: """ :type: bool """ @property def time_code(self) -> float: """ :type: float """ pass class Percent(Length): """ Convenience class to express :class:`.Length` in percents. """ def __init__(self, arg0: float) -> None: ... pass class Pixel(Length): """ Convenience class to express :class:`.Length` in pixels. """ def __init__(self, arg0: float) -> None: ... pass class Popup(): def __init__(self, title: str, modal: bool = False, width: float = 0.0, height: float = 0.0, auto_resize: bool = False) -> None: ... def hide(self) -> None: ... def is_visible(self) -> bool: ... def set_close_fn(self, arg0: typing.Callable[[], None]) -> None: ... def set_update_fn(self, arg0: typing.Callable[[float], None]) -> None: ... def show(self) -> None: ... @property def height(self) -> float: """ :type: float """ @height.setter def height(self, arg1: float) -> None: pass @property def layout(self) -> Container: """ :type: Container """ @layout.setter def layout(self, arg1: Container) -> None: pass @property def pos(self) -> carb._carb.Float2: """ :type: carb._carb.Float2 """ @pos.setter def pos(self, arg1: carb._carb.Float2) -> None: pass @property def title(self) -> str: """ :type: str """ @title.setter def title(self, arg1: str) -> None: pass @property def width(self) -> float: """ :type: float """ @width.setter def width(self, arg1: float) -> None: pass pass class ProgressBar(Widget): """ ProgressBar Widget. Displays a progress bar. Args: width (:class:`.Length`): Width. height (:class:`.Length`, default=omni.kit.ui.Pixel(0)): Height. """ @typing.overload def __init__(self, width: Length, height: Length = ...) -> None: ... @typing.overload def __init__(self, width: float) -> None: ... def set_progress(self, value: float, text: str = None) -> None: ... @property def overlay(self) -> str: """ :type: str """ @overlay.setter def overlay(self, arg1: str) -> None: pass @property def progress(self) -> float: """ :type: float """ @progress.setter def progress(self, arg1: float) -> None: pass pass class RowColumnLayout(Container, Widget): def __init__(self, column_count: int, borders: bool = False) -> None: ... def get_column_width(self, arg0: int) -> Length: ... def set_column_width(self, index: int, val: object, min: float = 0.0, max: float = 0.0) -> None: """ Set column width. Args: index: column index. val: width value. Should be either a :class:`.Length` or `float` (treated as :class:`.Pixel` length). """ pass class RowLayout(Container, Widget): def __init__(self) -> None: ... pass class ScalarXYZ(ValueWidgetDouble3, ModelWidget, Widget): """ ScalarXYZ Widget. If `min` >= `max` widget value has no bound. Args: format_string (str, default="%0.1f"): Format string. drag_speed (float, default=1.0): Drag speed. value_wrap (float, default=0.0): Value wrap. min (double, default=0.0): Lower value limit. max (double, default=0.0): Upper value limit. value (Tuple[double, double, double], default=(0, 0, 0)): Initial value. """ def __init__(self, format_string: str = '%0.1f', drag_speed: float = 1.0, wrap_value: float = 0.0, min: float = 0.0, max: float = 0.0, dead_zone: float = 0.0, value: carb._carb.Double3 = carb.Double3(0,0,0)) -> None: ... def skip_ypos_update(self, arg0: bool) -> None: ... pass class ScalarXYZW(ValueWidgetDouble4, ModelWidget, Widget): """ ScalarXYZW Widget. If `min` >= `max` widget value has no bound. Args: format_string (str, default="%0.1f"): Format string. drag_speed (float, default=1.0): Drag speed. value_wrap (float, default=0.0): Value wrap. min (double, default=0.0): Lower value limit. max (double, default=0.0): Upper value limit. value (Tuple[double, double, double, double], default=(0, 0, 0, 0)): Initial value. """ def __init__(self, format_string: str = '%0.1f', drag_speed: float = 1.0, wrap_value: float = 0.0, min: float = 0.0, max: float = 0.0, value: carb._carb.Double4 = carb.Double4(0,0,0,0)) -> None: ... pass class ScrollingFrame(Container, Widget): def __init__(self, arg0: str, arg1: float, arg2: float) -> None: ... def scroll_to(self, arg0: float) -> None: ... pass class Separator(Widget): """ Separator. Separator UI element. """ def __init__(self) -> None: ... pass class SimpleTreeView(Widget): """ SimpleTreeView Widget. Args: items (List[str], default=[]): List of string as the source of the Tree hierarchy. separator(str, default='/'): A string separator to parse the strings into tree node tokens """ def __init__(self, items: typing.List[str] = [], separator: str = '/') -> None: ... def clear_selection(self) -> None: ... def get_selected_item_name(self) -> str: ... def set_clicked_fn(self, arg0: typing.Callable[[Widget], None]) -> None: ... def set_tree_data(self, arg0: typing.List[str]) -> None: ... pass class SimpleValueWidgetBool(ValueWidgetBool, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SimpleValueWidgetColorRgb(ValueWidgetColorRgb, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SimpleValueWidgetColorRgba(ValueWidgetColorRgba, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SimpleValueWidgetDouble(ValueWidgetDouble, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SimpleValueWidgetDouble2(ValueWidgetDouble2, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SimpleValueWidgetDouble3(ValueWidgetDouble3, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SimpleValueWidgetDouble4(ValueWidgetDouble4, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SimpleValueWidgetInt(ValueWidgetInt, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SimpleValueWidgetInt2(ValueWidgetInt2, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SimpleValueWidgetMat44(ValueWidgetMat44, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SimpleValueWidgetString(ValueWidgetString, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SimpleValueWidgetUint(ValueWidgetUint, ModelWidget, Widget): """ Model Widget with single value for simple controls. """ @property def left_handed(self) -> bool: """ :type: bool """ @left_handed.setter def left_handed(self, arg0: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg0: str) -> None: pass @property def tooltip(self) -> Widget: """ Widget to be shown when mouse is over the Widget as a tooltip. :type: Widget """ @tooltip.setter def tooltip(self, arg0: Widget) -> None: """ Widget to be shown when mouse is over the Widget as a tooltip. """ pass class SliderDouble(SimpleValueWidgetDouble, ValueWidgetDouble, ModelWidget, Widget): """ Slider Widget (double). Args: text (str, default=""): Text on label. value (double, default=0): Initial value. min (double, default=0): Lower value limit. max (double, default=100): Upper value limit. """ def __init__(self, text: str = '', value: float = 0.0, min: float = 0, max: float = 100) -> None: ... @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> float: """ :type: float """ @max.setter def max(self, arg0: float) -> None: pass @property def min(self) -> float: """ :type: float """ @min.setter def min(self, arg0: float) -> None: pass @property def power(self) -> float: """ :type: float """ @power.setter def power(self, arg0: float) -> None: pass pass class SliderDouble2(SimpleValueWidgetDouble2, ValueWidgetDouble2, ModelWidget, Widget): """ Slider Widget (Tuple[double, double]). Args: text (str, default=""): Text on label. value (Tuple[double, double], default=0): Initial value. min (Tuple[double, double], default=0): Lower value limit. max (Tuple[double, double], default=100): Upper value limit. """ def __init__(self, text: str = '', value: carb._carb.Double2 = carb.Double2(0,0), min: float = 0, max: float = 100) -> None: ... @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> float: """ :type: float """ @max.setter def max(self, arg0: float) -> None: pass @property def min(self) -> float: """ :type: float """ @min.setter def min(self, arg0: float) -> None: pass @property def power(self) -> float: """ :type: float """ @power.setter def power(self, arg0: float) -> None: pass pass class SliderDouble3(SimpleValueWidgetDouble3, ValueWidgetDouble3, ModelWidget, Widget): """ Slider Widget (Tuple[double, double, double]). Args: text (str, default=""): Text on label. value (Tuple[double, double, double], default=0): Initial value. min (Tuple[double, double, double], default=0): Lower value limit. max (Tuple[double, double, double], default=100): Upper value limit. """ def __init__(self, text: str = '', value: carb._carb.Double3 = carb.Double3(0,0,0), min: float = 0, max: float = 100) -> None: ... @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> float: """ :type: float """ @max.setter def max(self, arg0: float) -> None: pass @property def min(self) -> float: """ :type: float """ @min.setter def min(self, arg0: float) -> None: pass @property def power(self) -> float: """ :type: float """ @power.setter def power(self, arg0: float) -> None: pass pass class SliderDouble4(SimpleValueWidgetDouble4, ValueWidgetDouble4, ModelWidget, Widget): """ Slider Widget (Tuple[double, double, double, double]). Args: text (str, default=""): Text on label. value (Tuple[double, double, double, double], default=0): Initial value. min (Tuple[double, double, double, double], default=0): Lower value limit. max (Tuple[double, double, double, double], default=100): Upper value limit. """ def __init__(self, text: str = '', value: carb._carb.Double4 = carb.Double4(0,0,0,0), min: float = 0, max: float = 100) -> None: ... @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> float: """ :type: float """ @max.setter def max(self, arg0: float) -> None: pass @property def min(self) -> float: """ :type: float """ @min.setter def min(self, arg0: float) -> None: pass @property def power(self) -> float: """ :type: float """ @power.setter def power(self, arg0: float) -> None: pass pass class SliderInt(SimpleValueWidgetInt, ValueWidgetInt, ModelWidget, Widget): """ Slider Widget (int). Args: text (str, default=""): Text on label. value (int, default=0): Initial value. min (int, default=0): Lower value limit. max (int, default=100): Upper value limit. """ def __init__(self, text: str = '', value: int = 0, min: int = 0, max: int = 100) -> None: ... @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> int: """ :type: int """ @max.setter def max(self, arg0: int) -> None: pass @property def min(self) -> int: """ :type: int """ @min.setter def min(self, arg0: int) -> None: pass @property def power(self) -> float: """ :type: float """ @power.setter def power(self, arg0: float) -> None: pass pass class SliderInt2(SimpleValueWidgetInt2, ValueWidgetInt2, ModelWidget, Widget): """ Slider Widget (Tuple[int, int]). Args: text (str, default=""): Text on label. value (Tuple[int, int], default=0): Initial value. min (Tuple[int, int], default=0): Lower value limit. max (Tuple[int, int], default=100): Upper value limit. """ def __init__(self, text: str = '', value: carb._carb.Int2 = carb.Int2(0,0), min: int = 0, max: int = 100) -> None: ... @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> int: """ :type: int """ @max.setter def max(self, arg0: int) -> None: pass @property def min(self) -> int: """ :type: int """ @min.setter def min(self, arg0: int) -> None: pass @property def power(self) -> float: """ :type: float """ @power.setter def power(self, arg0: float) -> None: pass pass class SliderUInt(SimpleValueWidgetUint, ValueWidgetUint, ModelWidget, Widget): """ Slider Widget (uint32_t). Args: text (str, default=""): Text on label. value (uint32_t, default=0): Initial value. min (uint32_t, default=0): Lower value limit. max (uint32_t, default=100): Upper value limit. """ def __init__(self, text: str = '', value: int = 0, min: int = 0, max: int = 100) -> None: ... @property def format(self) -> str: """ :type: str """ @format.setter def format(self, arg0: str) -> None: pass @property def max(self) -> int: """ :type: int """ @max.setter def max(self, arg0: int) -> None: pass @property def min(self) -> int: """ :type: int """ @min.setter def min(self, arg0: int) -> None: pass @property def power(self) -> float: """ :type: float """ @power.setter def power(self, arg0: float) -> None: pass pass class Spacer(Widget): """ Spacer. Dummy UI element to fill in space. Args: width (:class:`.Length`): Width. height (:class:`.Length`, default=omni.kit.ui.Pixel(0)): Height. """ @typing.overload def __init__(self, width: Length, height: Length = ...) -> None: ... @typing.overload def __init__(self, width: float) -> None: ... pass class TextBox(ValueWidgetString, ModelWidget, Widget): """ TextBox Widget. Displays editable text. Args: value (str, default=""): Initial text. """ @typing.overload def __init__(self, value: str = '', hint: str = '', change_on_enter: bool = False) -> None: ... @typing.overload def __init__(self, value: str = '', change_on_enter: bool = False) -> None: ... def reset_text_color(self) -> None: ... def set_list_suggestions_fn(self, arg0: typing.Callable[[Widget, str], typing.List[str]]) -> None: ... def set_text_changed_fn(self, arg0: typing.Callable[[Widget], None]) -> None: ... def set_text_color(self, arg0: carb._carb.ColorRgba) -> None: ... def set_text_finalized_fn(self, arg0: typing.Callable[[Widget], None]) -> None: ... def text_width(self) -> float: ... @property def clipping_mode(self) -> ClippingType: """ :type: ClippingType """ @clipping_mode.setter def clipping_mode(self, arg1: ClippingType) -> None: pass @property def readonly(self) -> bool: """ :type: bool """ @readonly.setter def readonly(self, arg1: bool) -> None: pass @property def show_background(self) -> bool: """ :type: bool """ @show_background.setter def show_background(self, arg1: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg1: str) -> None: pass pass class Transform(ValueWidgetMat44, ModelWidget, Widget): def __init__(self, position_format_string: str = '%0.1f', position_drag_speed: float = 1.0, position_wrap_value: float = 0.0, position_min: float = 0.0, position_max: float = 0.0, rotation_format_string: str = '%0.1f', rotation_drag_speed: float = 1.0, rotation_wrap_value: float = 0.0, rotation_min: float = 0.0, rotation_max: float = 0.0) -> None: ... pass class UnitType(): """ Unit types. Widths, heights or other UI length can be specified in pixels or relative to window (or child window) size. Members: PIXEL PERCENT """ 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 """ PERCENT: omni.kit.ui._ui.UnitType # value = <UnitType.PERCENT: 1> PIXEL: omni.kit.ui._ui.UnitType # value = <UnitType.PIXEL: 0> __members__: dict # value = {'PIXEL': <UnitType.PIXEL: 0>, 'PERCENT': <UnitType.PERCENT: 1>} pass class ValueWidgetBool(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[bool], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetBool], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> bool: """ : Widget value property. :type: bool """ @value.setter def value(self, arg1: bool) -> None: """ : Widget value property. """ pass class ValueWidgetColorRgb(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[carb._carb.ColorRgb], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetColorRgb], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> carb._carb.ColorRgb: """ : Widget value property. :type: carb._carb.ColorRgb """ @value.setter def value(self, arg1: carb._carb.ColorRgb) -> None: """ : Widget value property. """ pass class ValueWidgetColorRgba(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[carb._carb.ColorRgba], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetColorRgba], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> carb._carb.ColorRgba: """ : Widget value property. :type: carb._carb.ColorRgba """ @value.setter def value(self, arg1: carb._carb.ColorRgba) -> None: """ : Widget value property. """ pass class ValueWidgetDouble(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[float], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetDouble], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> float: """ : Widget value property. :type: float """ @value.setter def value(self, arg1: float) -> None: """ : Widget value property. """ pass class ValueWidgetDouble2(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[carb._carb.Double2], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetDouble2], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> carb._carb.Double2: """ : Widget value property. :type: carb._carb.Double2 """ @value.setter def value(self, arg1: carb._carb.Double2) -> None: """ : Widget value property. """ pass class ValueWidgetDouble3(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[carb._carb.Double3], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetDouble3], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> carb._carb.Double3: """ : Widget value property. :type: carb._carb.Double3 """ @value.setter def value(self, arg1: carb._carb.Double3) -> None: """ : Widget value property. """ pass class ValueWidgetDouble4(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[carb._carb.Double4], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetDouble4], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> carb._carb.Double4: """ : Widget value property. :type: carb._carb.Double4 """ @value.setter def value(self, arg1: carb._carb.Double4) -> None: """ : Widget value property. """ pass class ValueWidgetInt(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[int], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetInt], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> int: """ : Widget value property. :type: int """ @value.setter def value(self, arg1: int) -> None: """ : Widget value property. """ pass class ValueWidgetInt2(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[carb._carb.Int2], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetInt2], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> carb._carb.Int2: """ : Widget value property. :type: carb._carb.Int2 """ @value.setter def value(self, arg1: carb._carb.Int2) -> None: """ : Widget value property. """ pass class ValueWidgetMat44(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[Mat44], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetMat44], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> Mat44: """ : Widget value property. :type: Mat44 """ @value.setter def value(self, arg1: Mat44) -> None: """ : Widget value property. """ pass class ValueWidgetString(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[str], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetString], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> str: """ : Widget value property. :type: str """ @value.setter def value(self, arg1: str) -> None: """ : Widget value property. """ pass class ValueWidgetUint(ModelWidget, Widget): """ Model Widget with single value. """ def get_value_ambiguous(self) -> bool: ... def set_on_changed_fn(self, fn: typing.Callable[[int], None]) -> None: """ Set a callback function to be called when value changes. Args: fn: Function to be called when value changes. New value is passed into the function. """ def set_on_right_click_fn(self, fn: typing.Callable[[ValueWidgetUint], None]) -> None: """ Set a callback function to be called when right mouse button is clicked. Args: fn: Function to be called when right mouse button is clicked. ValueWidget is passed into the function. """ def set_value_ambiguous(self, arg0: bool) -> None: ... @property def value(self) -> int: """ : Widget value property. :type: int """ @value.setter def value(self, arg1: int) -> None: """ : Widget value property. """ pass class ViewCollapsing(ModelWidget, Widget): def __init__(self, defaultOpen: bool, sort: bool = False) -> None: ... def set_filter(self, arg0: str) -> None: ... @property def use_frame_background_color(self) -> bool: """ :type: bool """ @use_frame_background_color.setter def use_frame_background_color(self, arg1: bool) -> None: pass pass class ViewFlat(ModelWidget, Widget): def __init__(self, sort: bool = False) -> None: ... def set_filter(self, arg0: str) -> int: ... pass class ViewTreeGrid(ModelWidget, Widget): def __init__(self, default_open: bool, sort: bool = False, column_count: int = 1) -> None: ... def get_header_cell_widget(self, arg0: int) -> Widget: ... def set_build_cell_fn(self, arg0: typing.Callable[[Model, str, int, int], DelegateResult]) -> None: ... def set_header_cell_text(self, arg0: int, arg1: str) -> None: ... def set_header_cell_widget(self, arg0: int, arg1: Widget) -> None: ... @property def draw_table_header(self) -> bool: """ :type: bool """ @draw_table_header.setter def draw_table_header(self, arg1: bool) -> None: pass @property def is_root(self) -> bool: """ :type: bool """ @is_root.setter def is_root(self, arg1: bool) -> None: pass @property def text(self) -> str: """ :type: str """ @text.setter def text(self, arg1: str) -> None: pass pass class Widget(): """ Widget. Base class for all UI elements. """ def get_font_size(self) -> float: ... def set_dragdrop_fn(self, arg0: typing.Callable[[Widget, str], None], arg1: str) -> None: ... @staticmethod def set_dragged_fn(*args, **kwargs) -> typing.Any: ... @property def enabled(self) -> bool: """ :type: bool """ @enabled.setter def enabled(self, arg1: bool) -> None: pass @property def font_style(self) -> omni.ui._ui.FontStyle: """ :type: omni.ui._ui.FontStyle """ @font_style.setter def font_style(self, arg1: omni.ui._ui.FontStyle) -> None: pass @property def height(self) -> Length: """ (:class:`.Length`, default=omni.kit.ui.Pixel(0)): Height. :type: Length """ @height.setter def height(self, arg1: object) -> None: """ (:class:`.Length`, default=omni.kit.ui.Pixel(0)): Height. """ @property def user_data(self) -> dict: """ :class:`dict` with additional user data attached to widget. Lifetime of it depends on lifetime of the widget. :type: dict """ @user_data.setter def user_data(self, arg1: dict) -> None: """ :class:`dict` with additional user data attached to widget. Lifetime of it depends on lifetime of the widget. """ @property def visible(self) -> bool: """ :type: bool """ @visible.setter def visible(self, arg1: bool) -> None: pass @property def width(self) -> Length: """ (:class:`.Length`, default=omni.kit.ui.Pixel(0)): Width. :type: Length """ @width.setter def width(self, arg1: object) -> None: """ (:class:`.Length`, default=omni.kit.ui.Pixel(0)): Width. """ pass class Window(): """ UI Window. Window is a starting point for every new UI. It contains a :class:`.Container`, which can contain other :class:`.Widget`'s. Args: title (str): The title to be displayed on window title bar. width (int, default=640): Window width in pixels. height (int, default=480): Window height in pixels. open (bool, default=True): Is window opened when created. add_to_menu (bool, default=True): Create main menu item with this window in the Kit. menu_path (str, default=""): Menu path if add_to_menu is True. If empty string is passed it is added under "Extensions" menu item. is_toggle_menu (bool, default=True): Can menu item be toggled? dock (:obj:`omni.ui.DockPreference`, default=LEFT_BOTTOM): Docking preference for a window, see :class:`.DockPreference` flags (:obj:`omni.kit.ui.Window`, default=NONE): flags for a window, see :class:`.Window` """ def hide(self) -> None: ... def is_modal(self) -> bool: ... def is_visible(self) -> bool: ... def set_alpha(self, arg0: float) -> None: ... def set_size(self, arg0: int, arg1: int) -> None: ... def set_update_fn(self, arg0: typing.Callable[[float], None]) -> None: ... def set_visibility_changed_fn(self, arg0: typing.Callable[[bool], None]) -> None: ... def show(self) -> None: ... def title(self) -> str: ... @property def event_stream(self) -> carb.events._events.IEventStream: """ Event stream with events of type: :class:`.WindowEventType` :type: carb.events._events.IEventStream """ @property def flags(self) -> int: """ :type: int """ @flags.setter def flags(self, arg1: int) -> None: pass @property def height(self) -> int: """ :type: int """ @height.setter def height(self, arg1: int) -> None: pass @property def layout(self) -> Container: """ :type: Container """ @layout.setter def layout(self, arg1: Container) -> None: pass @property def menu(self) -> omni::kit::ui::Menu: """ Window optional menu bar. :type: omni::kit::ui::Menu """ @menu.setter def menu(self, arg0: omni::kit::ui::Menu) -> None: """ Window optional menu bar. """ @property def mouse_pos(self) -> carb._carb.Float2: """ :type: carb._carb.Float2 """ @property def width(self) -> int: """ :type: int """ @width.setter def width(self, arg1: int) -> None: pass pass class WindowEventType(): """ Members: VISIBILITY_CHANGE UPDATE """ 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 """ UPDATE: omni.kit.ui._ui.WindowEventType # value = <WindowEventType.UPDATE: 1> VISIBILITY_CHANGE: omni.kit.ui._ui.WindowEventType # value = <WindowEventType.VISIBILITY_CHANGE: 0> __members__: dict # value = {'VISIBILITY_CHANGE': <WindowEventType.VISIBILITY_CHANGE: 0>, 'UPDATE': <WindowEventType.UPDATE: 1>} pass class WindowMainStandalone(Container, Widget): def __init__(self) -> None: ... pass class WindowStandalone(ContainerBase, Widget): """ UI Window. Window is a starting point for every new UI. It contains a :class:`.Container`, which can contain other :class:`.Widget`'s. Args: title (str): The title to be displayed on window title bar. width (int, default=640): Window width in pixels. height (int, default=480): Window height in pixels. open (bool, default=True): Is window opened when created. add_to_menu (bool, default=True): Create main menu item with this window in the Kit. menu_path (str, default=""): Menu path if add_to_menu is True. If empty string is passed it is added under "Extensions" menu item. is_toggle_menu (bool, default=True): Can menu item be toggled? dock (:obj:`omni.ui.DockPreference`, default=LEFT_BOTTOM): Docking preference for a window, see :class:`.DockPreference` flags (:obj:`omni.kit.ui.Window`, default=NONE): flags for a window, see :class:`.Window` """ def __init__(self, title: str, width: int = 640, height: int = 480, open: bool = True, add_to_menu: bool = True, menu_path: str = '', is_toggle_menu: bool = True, dock: DockPreference = DockPreference.LEFT_BOTTOM, flags: int = 0) -> None: ... def hide(self) -> None: ... def is_visible(self) -> bool: ... def set_alpha(self, arg0: float) -> None: ... def set_size(self, arg0: int, arg1: int) -> None: ... def set_update_fn(self, arg0: typing.Callable[[float], None]) -> None: ... def set_visibility_changed_fn(self, arg0: typing.Callable[[bool], None]) -> None: ... def show(self) -> None: ... @property def event_stream(self) -> carb.events._events.IEventStream: """ Event stream with events of type: :class:`.WindowEventType` :type: carb.events._events.IEventStream """ @property def flags(self) -> int: """ :type: int """ @flags.setter def flags(self, arg1: int) -> None: pass @property def height(self) -> int: """ :type: int """ @height.setter def height(self, arg1: int) -> None: pass @property def layout(self) -> Container: """ :type: Container """ @layout.setter def layout(self, arg1: Container) -> None: pass @property def menu(self) -> omni::kit::ui::Menu: """ Window optional menu bar. :type: omni::kit::ui::Menu """ @menu.setter def menu(self, arg0: omni::kit::ui::Menu) -> None: """ Window optional menu bar. """ @property def mouse_pos(self) -> carb._carb.Float2: """ :type: carb._carb.Float2 """ @property def width(self) -> int: """ :type: int """ @width.setter def width(self, arg1: int) -> None: pass pass def activate_menu_item(arg0: str) -> None: pass def get_custom_glyph_code(file_path: str, font_style: omni.ui._ui.FontStyle = FontStyle.NORMAL) -> str: """ Get glyph code. Args: file_path (str): Path to svg file font_style(:class:`.FontStyle`): font style to use. """ def get_editor_menu_legacy() -> Menu: pass def get_main_window(*args, **kwargs) -> typing.Any: pass MODEL_META_SERIALIZED_CONTENTS = 'serializedContents' MODEL_META_WIDGET_TYPE = 'widgetType' WINDOW_FLAGS_FORCE_HORIZONTAL_SCROLLBAR = 512 WINDOW_FLAGS_FORCE_VERTICAL_SCROLLBAR = 256 WINDOW_FLAGS_MODAL = 4096 WINDOW_FLAGS_NONE = 0 WINDOW_FLAGS_NO_CLOSE = 2048 WINDOW_FLAGS_NO_COLLAPSE = 16 WINDOW_FLAGS_NO_FOCUS_ON_APPEARING = 1024 WINDOW_FLAGS_NO_MOVE = 4 WINDOW_FLAGS_NO_RESIZE = 2 WINDOW_FLAGS_NO_SAVED_SETTINGS = 32 WINDOW_FLAGS_NO_SCROLLBAR = 8 WINDOW_FLAGS_NO_TITLE_BAR = 1 WINDOW_FLAGS_SHOW_HORIZONTAL_SCROLLBAR = 128
92,476
unknown
28.764081
357
0.555571
omniverse-code/kit/exts/omni.kit.renderer.imgui/omni/kit/ui/__init__.py
"""UI Toolkit Starting with the release 2020.1, Omniverse Kit UI Toolkit has been replaced by the alternative UI toolkit :mod:`Omni::UI <omni.ui>`. Currently the Omniverse Kit UI Toolkit is deprecated. Omniverse Kit UI Toolkit is retained mode UI library which enables extending and changing Omniverse Kit look and feel in any direction. It contains fundamental building primitives, like windows, containers, layouts, widgets. As well as additional API (built on top of it) to create widgets for USD attributes and omni.kit settings. Typical example to create a window with a drag slider widget: .. code-block:: import omni.kit.ui window = omni.kit.ui.Window('My Window') d = omni.kit.ui.DragDouble() d.width = omni.kit.ui.Percent(30) window.layout.add_child(d) All objects are python-friendly reference counted object. You don't need to explicitly release or control lifetime. In the code example above `window` will be kept alive until `window` is released. Core: ------ * :class:`.Window` * :class:`.Popup` * :class:`.Container` * :class:`.Value` * :class:`.Length` * :class:`.UnitType` * :class:`.Widget` Widgets: -------- * :class:`.Label` * :class:`.Button` * :class:`.Spacer` * :class:`.CheckBox` * :class:`.ComboBox` * :class:`.ComboBoxInt` * :class:`.ListBox` * :class:`.SliderInt` * :class:`.SliderDouble` * :class:`.DragInt` * :class:`.DragInt2` * :class:`.DragDouble` * :class:`.DragDouble2` * :class:`.DragDouble3` * :class:`.DragDouble4` * :class:`.Transform` * :class:`.FieldInt` * :class:`.FieldDouble` * :class:`.TextBox` * :class:`.ColorRgb` * :class:`.ColorRgba` * :class:`.Image` Containers: ----------- * :class:`.ColumnLayout` * :class:`.RowLayout` * :class:`.RowColumnLayout` * :class:`.CollapsingFrame` * :class:`.ScrollingFrame` """ # This module depends on other modules. VSCode python language server scrapes modules in an isolated environment # (ignoring PYTHONPATH set). import fails and for that we have separate code path to explicitly add it's folder to # sys.path and import again. try: import weakref import carb import carb.dictionary import omni.ui except: import os, sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", ".."))) import weakref import carb import carb.dictionary import omni.ui from ._ui import * from .editor_menu import EditorMenu legacy_mode = False def add_item_attached(self: _ui.Menu, *args, **kwargs): subscription = self.add_item(*args, **kwargs) self.user_data.setdefault("items", []).append(subscription) return subscription def create_window_hook(self, title:str, *args, **kwargs): menu_path = None add_to_menu = True if "menu_path" in kwargs: menu_path = kwargs["menu_path"] kwargs["menu_path"] = "" if "add_to_menu" in kwargs: add_to_menu = kwargs["add_to_menu"] kwargs["add_to_menu"] = False Window.create_window_hook(self, title, *args, **kwargs) if add_to_menu and not menu_path: menu_path = f"Window/{title}" if menu_path: def on_window_click(visible, weak_window): window = weak_window() if window: if visible: window.show() else: window.hide() def on_window_showhide(visible, weak_window): window = weak_window() if window: Menu.static_class.set_value(menu_path, visible) EditorMenu.window_handler[title] = omni.kit.ui.get_editor_menu().add_item(menu_path, on_click=lambda m, v, w=weakref.ref(self): on_window_click(v, w), toggle=True, value=self.is_visible()) self.set_visibility_changed_fn(lambda v, w=weakref.ref(self): on_window_showhide(v, w)) def get_editor_menu(): if legacy_mode: return get_editor_menu_legacy() elif Menu.static_class == None: Menu.static_class = EditorMenu() return Menu.static_class def using_legacy_mode(): carb.log_warn(f"using_legacy_mode: function is depricated as it always return False") return legacy_mode def init_ui(): import carb.settings import carb # Avoid calling code below at documentation building time with try/catch try: settings = carb.settings.get_settings() except RuntimeError: return if not legacy_mode: if hasattr(Window, "create_window_hook"): carb.log_warn(f"init_ui window hook already initialized") else: # hook into omni.kit.ui.window to override menu creation Window.create_window_hook = Window.__init__ Window.__init__ = create_window_hook Menu.static_class = None Menu.add_item_attached = add_item_attached Menu.get_editor_menu = get_editor_menu Menu.using_legacy_mode = using_legacy_mode init_ui()
4,868
Python
27.144509
197
0.658998
omniverse-code/kit/exts/omni.kit.renderer.imgui/omni/kit/extensionwindow/__init__.py
from ._extensionwindow import *
32
Python
15.499992
31
0.78125
omniverse-code/kit/exts/omni.kit.renderer.imgui/omni/kit/ui_windowmanager/__init__.py
from ._window_manager import *
31
Python
14.999993
30
0.741935
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialSimpleData.rst
.. _omni_graph_tutorials_SimpleData_1: .. _omni_graph_tutorials_SimpleData: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: Attributes With Simple Data :keywords: lang-en omnigraph node tutorials threadsafe tutorials simple-data Tutorial Node: Attributes With Simple Data ========================================== .. <description> This is a tutorial node. It creates both an input and output attribute of every simple supported data type. The values are modified in a simple way so that the compute modifies values. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Sample Boolean Input (*inputs:a_bool*)", "``bool``", "This is an attribute of type boolean", "True" "inputs:a_constant_input", "``int``", "This is an input attribute whose value can be set but can only be connected as a source.", "0" "", "*outputOnly*", "1", "" "inputs:a_double", "``double``", "This is an attribute of type 64 bit floating point", "0" "inputs:a_float", "``float``", "This is an attribute of type 32 bit floating point", "0" "Sample Half Precision Input (*inputs:a_half*)", "``half``", "This is an attribute of type 16 bit float", "0.0" "inputs:a_int", "``int``", "This is an attribute of type 32 bit integer", "0" "inputs:a_int64", "``int64``", "This is an attribute of type 64 bit integer", "0" "inputs:a_objectId", "``objectId``", "This is an attribute of type objectId", "0" "inputs:a_path", "``path``", "This is an attribute of type path", "" "inputs:a_string", "``string``", "This is an attribute of type string", "helloString" "inputs:a_token", "``token``", "This is an attribute of type interned string with fast comparison and hashing", "helloToken" "inputs:unsigned:a_uchar", "``uchar``", "This is an attribute of type unsigned 8 bit integer", "0" "inputs:unsigned:a_uint", "``uint``", "This is an attribute of type unsigned 32 bit integer", "0" "inputs:unsigned:a_uint64", "``uint64``", "This is an attribute of type unsigned 64 bit integer", "0" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Sample Boolean Output (*outputs:a_bool*)", "``bool``", "This is a computed attribute of type boolean", "False" "outputs:a_double", "``double``", "This is a computed attribute of type 64 bit floating point", "5.0" "outputs:a_float", "``float``", "This is a computed attribute of type 32 bit floating point", "4.0" "Sample Half Precision Output (*outputs:a_half*)", "``half``", "This is a computed attribute of type 16 bit float", "1.0" "outputs:a_int", "``int``", "This is a computed attribute of type 32 bit integer", "2" "outputs:a_int64", "``int64``", "This is a computed attribute of type 64 bit integer", "3" "outputs:a_objectId", "``objectId``", "This is a computed attribute of type objectId", "8" "outputs:a_path", "``path``", "This is a computed attribute of type path", "/" "outputs:a_string", "``string``", "This is a computed attribute of type string", "seven" "outputs:a_token", "``token``", "This is a computed attribute of type interned string with fast comparison and hashing", "six" "outputs:unsigned:a_uchar", "``uchar``", "This is a computed attribute of type unsigned 8 bit integer", "9" "outputs:unsigned:a_uint", "``uint``", "This is a computed attribute of type unsigned 32 bit integer", "10" "outputs:unsigned:a_uint64", "``uint64``", "This is a computed attribute of type unsigned 64 bit integer", "11" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.SimpleData" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.SimpleData.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: Attributes With Simple Data" "Categories", "tutorials" "Generated Class Name", "OgnTutorialSimpleDataDatabase" "Python Module", "omni.graph.tutorials"
4,529
reStructuredText
46.68421
184
0.628395
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialTokensPy.rst
.. _omni_graph_tutorials_TokensPy_1: .. _omni_graph_tutorials_TokensPy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Python Node: Tokens :keywords: lang-en omnigraph node tutorials tutorials tokens-py Tutorial Python Node: Tokens ============================ .. <description> This is a tutorial node. It exercises the feature of providing hardcoded token values in the database after a node type has been initialized. It sets output booleans to the truth value of whether corresponding inputs appear in the hardcoded token list. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:valuesToCheck", "``token[]``", "Array of tokens that are to be checked", "[]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:isColor", "``bool[]``", "True values if the corresponding input value appears in the token list", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.TokensPy" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.TokensPy.svg" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Python Node: Tokens" "__tokens", "[""red"", ""green"", ""blue""]" "Categories", "tutorials" "Generated Class Name", "OgnTutorialTokensPyDatabase" "Python Module", "omni.graph.tutorials"
1,962
reStructuredText
27.042857
252
0.595821
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialStatePy.rst
.. _omni_graph_tutorials_StatePy_1: .. _omni_graph_tutorials_StatePy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Python Node: Internal States :keywords: lang-en omnigraph node tutorials tutorials state-py Tutorial Python Node: Internal States ===================================== .. <description> This is a tutorial node. It makes use of internal state information to continuously increment an output. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:override", "``bool``", "When true get the output from the overrideValue, otherwise use the internal value", "False" "inputs:overrideValue", "``int64``", "Value to use instead of the monotonically increasing internal one when 'override' is true", "0" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:monotonic", "``int64``", "Monotonically increasing output, set by internal state information", "0" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.StatePy" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.StatePy.svg" "Has State?", "True" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Python Node: Internal States" "Categories", "tutorials" "Generated Class Name", "OgnTutorialStatePyDatabase" "Python Module", "omni.graph.tutorials"
1,964
reStructuredText
27.071428
137
0.600815
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialCpuGpuExtendedPy.rst
.. _omni_graph_tutorials_CpuGpuExtendedPy_1: .. _omni_graph_tutorials_CpuGpuExtendedPy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Python Node: CPU/GPU Extended Attributes :keywords: lang-en omnigraph node tutorials tutorials cpu-gpu-extended-py Tutorial Python Node: CPU/GPU Extended Attributes ================================================= .. <description> This is a tutorial node. It exercises functionality for accessing data in extended attributes that are on the GPU as well as those whose CPU/GPU location is decided at runtime. The compute adds the two inputs 'gpuData' and 'cpuData' together, placing the result in `cpuGpuSum`, whose memory location is determined by the 'gpu' flag. This node is identical to OgnTutorialCpuGpuExtended.ogn, except is is implemented in Python. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "CPU Input Attribute (*inputs:cpuData*)", "``any``", "Input attribute whose data always lives on the CPU", "None" "Results To GPU (*inputs:gpu*)", "``bool``", "If true then put the sum on the GPU, otherwise put it on the CPU", "False" "GPU Input Attribute (*inputs:gpuData*)", "``any``", "Input attribute whose data always lives on the GPU", "None" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Sum (*outputs:cpuGpuSum*)", "``any``", "This is the attribute with the selected data. If the 'gpu' attribute is set to true then this attribute's contents will be entirely on the GPU, otherwise it will be on the CPU.", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.CpuGpuExtendedPy" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.CpuGpuExtendedPy.svg" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "tags", "tutorial,extended,gpu" "uiName", "Tutorial Python Node: CPU/GPU Extended Attributes" "Categories", "tutorials" "Generated Class Name", "OgnTutorialCpuGpuExtendedPyDatabase" "Python Module", "omni.graph.tutorials"
2,640
reStructuredText
35.680555
425
0.634848
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialBundleAddAttributesPy.rst
.. _omni_graph_tutorials_BundleAddAttributesPy_1: .. _omni_graph_tutorials_BundleAddAttributesPy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Python Node: Bundle Add Attributes :keywords: lang-en omnigraph node tutorials tutorials bundle-add-attributes-py Tutorial Python Node: Bundle Add Attributes =========================================== .. <description> This is a Python tutorial node. It exercises functionality for adding and removing attributes on output bundles. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:addedAttributeNames", "``token[]``", "Names for the attribute types to be added. The size of this array must match the size of the 'typesToAdd' array to be legal.", "[]" "inputs:removedAttributeNames", "``token[]``", "Names for the attribute types to be removed. Non-existent attributes will be ignored.", "[]" "Attribute Types To Add (*inputs:typesToAdd*)", "``token[]``", "List of type descriptions to add to the bundle. The strings in this list correspond to the strings that represent the attribute types in the .ogn file (e.g. float[3][], colord[3], bool", "[]" "inputs:useBatchedAPI", "``bool``", "Controls whether or not to used batched APIS for adding/removing attributes", "False" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Constructed Bundle (*outputs:bundle*)", "``bundle``", "This is the bundle with all attributes added by compute.", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.BundleAddAttributesPy" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.BundleAddAttributesPy.svg" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Python Node: Bundle Add Attributes" "Categories", "tutorials" "Generated Class Name", "OgnTutorialBundleAddAttributesPyDatabase" "Python Module", "omni.graph.tutorials"
2,545
reStructuredText
34.361111
259
0.631041
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialTupleData.rst
.. _omni_tutorials_TupleData_1: .. _omni_tutorials_TupleData: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: Tuple Attributes :keywords: lang-en omnigraph node tutorials threadsafe tutorials tuple-data Tutorial Node: Tuple Attributes =============================== .. <description> This is a tutorial node. It creates both an input and output attribute of some of the supported tuple types. The values are modified in a simple way so that the compute can be tested. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:a_double2", "``double[2]``", "This is an attribute with two double values", "[1.1, 2.2]" "inputs:a_double3", "``double[3]``", "This is an attribute with three double values", "[1.1, 2.2, 3.3]" "inputs:a_float2", "``float[2]``", "This is an attribute with two float values", "[4.4, 5.5]" "inputs:a_float3", "``float[3]``", "This is an attribute with three float values", "[6.6, 7.7, 8.8]" "inputs:a_half2", "``half[2]``", "This is an attribute with two 16-bit float values", "[7.0, 8.0]" "inputs:a_int2", "``int[2]``", "This is an attribute with two 32-bit integer values", "[10, 11]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:a_double2", "``double[2]``", "This is a computed attribute with two double values", "None" "outputs:a_double3", "``double[3]``", "This is a computed attribute with three double values", "None" "outputs:a_float2", "``float[2]``", "This is a computed attribute with two float values", "None" "outputs:a_float3", "``float[3]``", "This is a computed attribute with three float values", "None" "outputs:a_half2", "``half[2]``", "This is a computed attribute with two 16-bit float values", "None" "outputs:a_int2", "``int[2]``", "This is a computed attribute with two 32-bit integer values", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.tutorials.TupleData" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.tutorials.TupleData.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: Tuple Attributes" "tags", "tuple,tutorial,internal" "Categories", "tutorials" "Generated Class Name", "OgnTutorialTupleDataDatabase" "Python Module", "omni.graph.tutorials"
2,919
reStructuredText
35.5
184
0.602261
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialOverrideType.rst
.. _omni_graph_tutorials_OverrideType_1: .. _omni_graph_tutorials_OverrideType: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: Overriding C++ Data Types :keywords: lang-en omnigraph node tutorials threadsafe tutorials override-type Tutorial Node: Overriding C++ Data Types ======================================== .. <description> This is a tutorial node. It has an input and output of type float[3], an input and output of type double[3], and a type override specification that lets the node use Carbonite types for the generated data on the float[3] attributes only. Ordinarily all of the types would be defined in a seperate configuration file so that it can be shared for a project. In that case the type definition build flag would also be used so that this information does not have to be embedded in every .ogn file in the project. It is placed directly in the file here solely for instructional purposes. The compute is just a rotation of components from x->y, y->z, and z->x, for each input type. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Input value with a standard double type (*inputs:data*)", "``double[3]``", "The value to rotate", "[0.0, 0.0, 0.0]" "Input value with a modified float type (*inputs:typedData*)", "``float[3]``", "The value to rotate", "[0.0, 0.0, 0.0]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Output value with a standard double type (*outputs:data*)", "``double[3]``", "The rotated version of inputs::data", "None" "Output value with a modified float type (*outputs:typedData*)", "``float[3]``", "The rotated version of inputs::typedData", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.OverrideType" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.OverrideType.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: Overriding C++ Data Types" "Categories", "tutorials" "Generated Class Name", "OgnTutorialOverrideTypeDatabase" "Python Module", "omni.graph.tutorials"
2,717
reStructuredText
37.28169
675
0.630843
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialSimpleDataPy.rst
.. _omni_graph_tutorials_SimpleDataPy_1: .. _omni_graph_tutorials_SimpleDataPy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Python Node: Attributes With Simple Data :keywords: lang-en omnigraph node tutorials tutorials simple-data-py Tutorial Python Node: Attributes With Simple Data ================================================= .. <description> This is a tutorial node. It creates both an input and output attribute of every simple supported data type. The values are modified in a simple way so that the compute modifies values. It is the same as node omni.graph.tutorials.SimpleData, except it is implemented in Python instead of C++. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Simple Boolean Input (*inputs:a_bool*)", "``bool``", "This is an attribute of type boolean", "True" "inputs:a_constant_input", "``int``", "This is an input attribute whose value can be set but can only be connected as a source.", "0" "", "*outputOnly*", "1", "" "inputs:a_double", "``double``", "This is an attribute of type 64 bit floating point", "0" "inputs:a_float", "``float``", "This is an attribute of type 32 bit floating point", "0" "inputs:a_half", "``half``", "This is an attribute of type 16 bit float", "0.0" "inputs:a_int", "``int``", "This is an attribute of type 32 bit integer", "0" "inputs:a_int64", "``int64``", "This is an attribute of type 64 bit integer", "0" "inputs:a_objectId", "``objectId``", "This is an attribute of type objectId", "0" "inputs:a_path", "``path``", "This is an attribute of type path", "" "inputs:a_string", "``string``", "This is an attribute of type string", "helloString" "inputs:a_token", "``token``", "This is an attribute of type interned string with fast comparison and hashing", "helloToken" "inputs:a_uchar", "``uchar``", "This is an attribute of type unsigned 8 bit integer", "0" "inputs:a_uint", "``uint``", "This is an attribute of type unsigned 32 bit integer", "0" "inputs:a_uint64", "``uint64``", "This is an attribute of type unsigned 64 bit integer", "0" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:a_a_boolUiName", "``string``", "Computed attribute containing the UI name of input a_bool", "None" "outputs:a_bool", "``bool``", "This is a computed attribute of type boolean", "None" "outputs:a_double", "``double``", "This is a computed attribute of type 64 bit floating point", "None" "outputs:a_float", "``float``", "This is a computed attribute of type 32 bit floating point", "None" "outputs:a_half", "``half``", "This is a computed attribute of type 16 bit float", "None" "outputs:a_int", "``int``", "This is a computed attribute of type 32 bit integer", "None" "outputs:a_int64", "``int64``", "This is a computed attribute of type 64 bit integer", "None" "outputs:a_nodeTypeUiName", "``string``", "Computed attribute containing the UI name of this node type", "None" "outputs:a_objectId", "``objectId``", "This is a computed attribute of type objectId", "None" "outputs:a_path", "``path``", "This is a computed attribute of type path", "/Child" "outputs:a_string", "``string``", "This is a computed attribute of type string", "This string is empty" "outputs:a_token", "``token``", "This is a computed attribute of type interned string with fast comparison and hashing", "None" "outputs:a_uchar", "``uchar``", "This is a computed attribute of type unsigned 8 bit integer", "None" "outputs:a_uint", "``uint``", "This is a computed attribute of type unsigned 32 bit integer", "None" "outputs:a_uint64", "``uint64``", "This is a computed attribute of type unsigned 64 bit integer", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.SimpleDataPy" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.SimpleDataPy.svg" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Python Node: Attributes With Simple Data" "__iconColor", "#FF00FF00" "__iconBackgroundColor", "#7FFF0000" "__iconBorderColor", "#FF0000FF" "Categories", "tutorials" "Generated Class Name", "OgnTutorialSimpleDataPyDatabase" "Python Module", "omni.graph.tutorials"
4,902
reStructuredText
48.03
293
0.633211
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialSIMDAdd.rst
.. _omni_graph_tutorials_TutorialSIMDFloatAdd_1: .. _omni_graph_tutorials_TutorialSIMDFloatAdd: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: SIMD Add :keywords: lang-en omnigraph node tutorials tutorials tutorial-s-i-m-d-float-add Tutorial Node: SIMD Add ======================= .. <description> Add 2 floats together using SIMD instruction set .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:a", "``float``", "first input operand", "0.0" "inputs:b", "``float``", "second input operand", "0.0" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:result", "``float``", "the sum of a and b", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.TutorialSIMDFloatAdd" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.TutorialSIMDFloatAdd.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: SIMD Add" "Categories", "tutorials" "Generated Class Name", "OgnTutorialSIMDAddDatabase" "Python Module", "omni.graph.tutorials"
1,723
reStructuredText
23.628571
103
0.571677
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialCpuGpuData.rst
.. _omni_graph_tutorials_CpuGpuData_1: .. _omni_graph_tutorials_CpuGpuData: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: Attributes With CPU/GPU Data :keywords: lang-en omnigraph node tutorials tutorials cpu-gpu-data Tutorial Node: Attributes With CPU/GPU Data =========================================== .. <description> This is a tutorial node. It illustrates how to access data whose memory location, CPU or GPU, is determined at runtime in the compute method. The data types are the same as for the purely CPU and purely GPU tutorials, it is only the access method that changes. The input 'is_gpu' determines where the data of the other attributes can be accessed. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:a", "``float``", "First value to be added in algorithm 1", "0.0" "inputs:b", "``float``", "Second value to be added in algorithm 1", "0.0" "inputs:is_gpu", "``bool``", "Runtime switch determining where the data for the other attributes lives.", "False" "inputs:multiplier", "``float[3]``", "Amplitude of the expansion for the input points in algorithm 2", "[1.0, 1.0, 1.0]" "inputs:points", "``float[3][]``", "Points to be moved by algorithm 2", "[]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:points", "``float[3][]``", "Final positions of points from algorithm 2", "None" "outputs:sum", "``float``", "Sum of the two inputs from algorithm 1", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.CpuGpuData" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.CpuGpuData.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "any" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: Attributes With CPU/GPU Data" "__memoryType", "any" "Categories", "tutorials" "Generated Class Name", "OgnTutorialCpuGpuDataDatabase" "Python Module", "omni.graph.tutorials"
2,551
reStructuredText
33.026666
349
0.605645
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialExtendedTypesPy.rst
.. _omni_graph_tutorials_ExtendedTypesPy_1: .. _omni_graph_tutorials_ExtendedTypesPy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Python Node: Extended Attribute Types :keywords: lang-en omnigraph node tutorials tutorials extended-types-py Tutorial Python Node: Extended Attribute Types ============================================== .. <description> This is a tutorial node. It exercises functionality for the manipulation of the extended attribute types. It is identical to OgnTutorialExtendedTypes.ogn, except the language of implementation is selected to be python. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Flexible Values (*inputs:flexible*)", "``['float[3][]', 'token']``", "Flexible data type input", "None" "Float Or Token (*inputs:floatOrToken*)", "``['float', 'token']``", "Attribute that can either be a float value or a token value", "None" "To Negate (*inputs:toNegate*)", "``['bool[]', 'float[]']``", "Attribute that can either be an array of booleans or an array of floats", "None" "Tuple Values (*inputs:tuple*)", "``any``", "Variable size/type tuple values", "None" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Doubled Input Value (*outputs:doubledResult*)", "``any``", "If the input 'floatOrToken' is a float this is 2x the value. If it is a token this contains the input token repeated twice.", "None" "Inverted Flexible Values (*outputs:flexible*)", "``['float[3][]', 'token']``", "Flexible data type output", "None" "Negated Array Values (*outputs:negatedResult*)", "``['bool[]', 'float[]']``", "Result of negating the data from the 'toNegate' input", "None" "Negative Tuple Values (*outputs:tuple*)", "``any``", "Negated values of the tuple input", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.ExtendedTypesPy" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.ExtendedTypesPy.svg" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Python Node: Extended Attribute Types" "Categories", "tutorials" "Generated Class Name", "OgnTutorialExtendedTypesPyDatabase" "Python Module", "omni.graph.tutorials"
2,842
reStructuredText
36.906666
218
0.61893
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialStateAttributesPy.rst
.. _omni_graph_tutorials_StateAttributesPy_1: .. _omni_graph_tutorials_StateAttributesPy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Python Node: State Attributes :keywords: lang-en omnigraph node tutorials tutorials state-attributes-py Tutorial Python Node: State Attributes ====================================== .. <description> This is a tutorial node. It exercises state attributes to remember data from on evaluation to the next. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:ignored", "``bool``", "Ignore me", "False" State ----- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "state:monotonic", "``int``", "The monotonically increasing output value, reset to 0 when the reset value is true", "None" "state:reset", "``bool``", "If true then the inputs are ignored and outputs are set to default values, then this flag is set to false for subsequent evaluations.", "True" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.StateAttributesPy" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.StateAttributesPy.svg" "Has State?", "True" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Python Node: State Attributes" "Categories", "tutorials" "Generated Class Name", "OgnTutorialStateAttributesPyDatabase" "Python Module", "omni.graph.tutorials"
2,003
reStructuredText
27.628571
174
0.606091
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialDefaults.rst
.. _omni_graph_tutorials_Defaults_1: .. _omni_graph_tutorials_Defaults: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: Defaults :keywords: lang-en omnigraph node tutorials threadsafe tutorials defaults Tutorial Node: Defaults ======================= .. <description> This is a tutorial node. It will move the values of inputs to corresponding outputs. Inputs all have unspecified, and therefore empty, default values. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:a_array", "``float[]``", "This is an attribute of type array of floats", "[]" "inputs:a_bool", "``bool``", "This is an attribute of type boolean", "False" "inputs:a_double", "``double``", "This is an attribute of type 64 bit floating point", "0.0" "inputs:a_float", "``float``", "This is an attribute of type 32 bit floating point", "0.0" "inputs:a_half", "``half``", "This is an attribute of type 16 bit floating point", "0.0" "inputs:a_int", "``int``", "This is an attribute of type 32 bit integer", "0" "inputs:a_int2", "``int[2]``", "This is an attribute of type 2-tuple of integers", "[0, 0]" "inputs:a_int64", "``int64``", "This is an attribute of type 64 bit integer", "0" "inputs:a_matrix", "``matrixd[2]``", "This is an attribute of type 2x2 matrix", "[[1.0, 0.0], [0.0, 1.0]]" "inputs:a_string", "``string``", "This is an attribute of type string", "" "inputs:a_token", "``token``", "This is an attribute of type interned string with fast comparison and hashing", "" "inputs:a_uchar", "``uchar``", "This is an attribute of type unsigned 8 bit integer", "0" "inputs:a_uint", "``uint``", "This is an attribute of type unsigned 32 bit integer", "0" "inputs:a_uint64", "``uint64``", "This is an attribute of type unsigned 64 bit integer", "0" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:a_array", "``float[]``", "This is a computed attribute of type array of floats", "None" "outputs:a_bool", "``bool``", "This is a computed attribute of type boolean", "None" "outputs:a_double", "``double``", "This is a computed attribute of type 64 bit floating point", "None" "outputs:a_float", "``float``", "This is a computed attribute of type 32 bit floating point", "None" "outputs:a_half", "``half``", "This is a computed attribute of type 16 bit floating point", "None" "outputs:a_int", "``int``", "This is a computed attribute of type 32 bit integer", "None" "outputs:a_int2", "``int[2]``", "This is a computed attribute of type 2-tuple of integers", "None" "outputs:a_int64", "``int64``", "This is a computed attribute of type 64 bit integer", "None" "outputs:a_matrix", "``matrixd[2]``", "This is a computed attribute of type 2x2 matrix", "None" "outputs:a_string", "``string``", "This is a computed attribute of type string", "None" "outputs:a_token", "``token``", "This is a computed attribute of type interned string with fast comparison and hashing", "None" "outputs:a_uchar", "``uchar``", "This is a computed attribute of type unsigned 8 bit integer", "None" "outputs:a_uint", "``uint``", "This is a computed attribute of type unsigned 32 bit integer", "None" "outputs:a_uint64", "``uint64``", "This is a computed attribute of type unsigned 64 bit integer", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.Defaults" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.Defaults.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: Defaults" "Categories", "tutorials" "Generated Class Name", "OgnTutorialDefaultsDatabase" "Python Module", "omni.graph.tutorials"
4,347
reStructuredText
44.768421
150
0.619278
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialCudaData.rst
.. _omni_graph_tutorials_CudaData_1: .. _omni_graph_tutorials_CudaData: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: Attributes With CUDA Data :keywords: lang-en omnigraph node tutorials threadsafe tutorials cuda-data Tutorial Node: Attributes With CUDA Data ======================================== .. <description> This is a tutorial node. It performs different functions on the GPU to illustrate different types of data access. The first adds inputs 'a' and 'b' to yield output 'sum', all of which are on the GPU. The second is a sample expansion deformation that multiplies every point on a set of input points, stored on the GPU, by a constant value, stored on the CPU, to yield a set of output points, also on the GPU. The third is an assortment of different data types illustrating how different data is passed to the GPU. This particular node uses CUDA for its GPU computations, as indicated in the memory type value. Normal use case for GPU compute is large amounts of data. For testing purposes this node only handles a very small amount but the principle is the same. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:a", "``float``", "First value to be added in algorithm 1", "0.0" "inputs:b", "``float``", "Second value to be added in algorithm 1", "0.0" "inputs:color", "``colord[3]``", "Input with three doubles as a color for algorithm 3", "[1.0, 0.5, 1.0]" "inputs:half", "``half``", "Input of type half for algorithm 3", "1.0" "inputs:matrix", "``matrixd[4]``", "Input with 16 doubles interpreted as a double-precision 4d matrix", "[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]" "inputs:multiplier", "``float[3]``", "Amplitude of the expansion for the input points in algorithm 2", "[1.0, 1.0, 1.0]" "inputs:points", "``float[3][]``", "Points to be moved by algorithm 2", "[]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:color", "``colord[3]``", "Output with three doubles as a color for algorithm 3", "None" "outputs:half", "``half``", "Output of type half for algorithm 3", "None" "outputs:matrix", "``matrixd[4]``", "Output with 16 doubles interpreted as a double-precision 4d matrix", "None" "outputs:points", "``float[3][]``", "Final positions of points from algorithm 2", "None" "outputs:sum", "``float``", "Sum of the two inputs from algorithm 1", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.CudaData" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.CudaData.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cuda" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: Attributes With CUDA Data" "__memoryType", "cuda" "Categories", "tutorials" "Generated Class Name", "OgnTutorialCudaDataDatabase" "Python Module", "omni.graph.tutorials"
3,513
reStructuredText
42.924999
761
0.625107
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialCudaDataCpuPy.rst
.. _omni_graph_tutorials_CudaCpuArraysPy_1: .. _omni_graph_tutorials_CudaCpuArraysPy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Python Tutorial Node: Attributes With CUDA Array Pointers In Cpu Memory :keywords: lang-en omnigraph node tutorials tutorials cuda-cpu-arrays-py Python Tutorial Node: Attributes With CUDA Array Pointers In Cpu Memory ======================================================================= .. <description> This is a tutorial node. It illustrates the alternative method of extracting pointers to GPU array data in which the pointer returned is a CPU pointer and can be dereferenced on the CPU side. Without the cudaPointers value set that pointer would be a GPU pointer to an array of GPU pointers and could only be dereferenced on the device. Both plain attribute and bundle attribute extraction are shown. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:multiplier", "``float[3]``", "Amplitude of the expansion for the input points", "[1.0, 1.0, 1.0]" "inputs:points", "``float[3][]``", "Array of points to be moved", "[]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:outBundle", "``bundle``", "Bundle containing a copy of the output points", "None" "outputs:points", "``float[3][]``", "Final positions of points", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.CudaCpuArraysPy" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.CudaCpuArraysPy.svg" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cuda" "Generated Code Exclusions", "None" "__memoryType", "cuda" "uiName", "Python Tutorial Node: Attributes With CUDA Array Pointers In Cpu Memory" "Categories", "tutorials" "Generated Class Name", "OgnTutorialCudaDataCpuPyDatabase" "Python Module", "omni.graph.tutorials"
2,451
reStructuredText
33.055555
400
0.618115
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialBundleDataPy.rst
.. _omni_graph_tutorials_BundleDataPy_1: .. _omni_graph_tutorials_BundleDataPy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Python Node: Bundle Data :keywords: lang-en omnigraph node tutorials tutorials bundle-data-py Tutorial Python Node: Bundle Data ================================= .. <description> This is a tutorial node. It exercises functionality for access of data within bundle attributes. The configuration is the same as omni.graph.tutorials.BundleData except that the implementation language is Python .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Input Bundle (*inputs:bundle*)", "``bundle``", "Bundle whose contents are modified for passing to the output", "None" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Output Bundle (*outputs:bundle*)", "``bundle``", "This is the bundle with values of known types doubled.", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.BundleDataPy" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.BundleDataPy.svg" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Python Node: Bundle Data" "Categories", "tutorials" "Generated Class Name", "OgnTutorialBundleDataPyDatabase" "Python Module", "omni.graph.tutorials"
1,951
reStructuredText
27.289855
211
0.606868
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialRoleData.rst
.. _omni_graph_tutorials_RoleData_1: .. _omni_graph_tutorials_RoleData: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: Role-Based Attributes :keywords: lang-en omnigraph node tutorials threadsafe tutorials role-data Tutorial Node: Role-Based Attributes ==================================== .. <description> This is a tutorial node. It creates both an input and output attribute of every supported role-based data type. The values are modified in a simple way so that the compute modifies values. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:a_color3d", "``colord[3]``", "This is an attribute interpreted as a double-precision 3d color", "[0.0, 0.0, 0.0]" "inputs:a_color3f", "``colorf[3]``", "This is an attribute interpreted as a single-precision 3d color", "[0.0, 0.0, 0.0]" "inputs:a_color3h", "``colorh[3]``", "This is an attribute interpreted as a half-precision 3d color", "[0.0, 0.0, 0.0]" "inputs:a_color4d", "``colord[4]``", "This is an attribute interpreted as a double-precision 4d color", "[0.0, 0.0, 0.0, 0.0]" "inputs:a_color4f", "``colorf[4]``", "This is an attribute interpreted as a single-precision 4d color", "[0.0, 0.0, 0.0, 0.0]" "inputs:a_color4h", "``colorh[4]``", "This is an attribute interpreted as a half-precision 4d color", "[0.0, 0.0, 0.0, 0.0]" "inputs:a_frame", "``frame[4]``", "This is an attribute interpreted as a coordinate frame", "[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]" "inputs:a_matrix2d", "``matrixd[2]``", "This is an attribute interpreted as a double-precision 2d matrix", "[[1.0, 0.0], [0.0, 1.0]]" "inputs:a_matrix3d", "``matrixd[3]``", "This is an attribute interpreted as a double-precision 3d matrix", "[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]" "inputs:a_matrix4d", "``matrixd[4]``", "This is an attribute interpreted as a double-precision 4d matrix", "[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]" "inputs:a_normal3d", "``normald[3]``", "This is an attribute interpreted as a double-precision 3d normal", "[0.0, 0.0, 0.0]" "inputs:a_normal3f", "``normalf[3]``", "This is an attribute interpreted as a single-precision 3d normal", "[0.0, 0.0, 0.0]" "inputs:a_normal3h", "``normalh[3]``", "This is an attribute interpreted as a half-precision 3d normal", "[0.0, 0.0, 0.0]" "inputs:a_point3d", "``pointd[3]``", "This is an attribute interpreted as a double-precision 3d point", "[0.0, 0.0, 0.0]" "inputs:a_point3f", "``pointf[3]``", "This is an attribute interpreted as a single-precision 3d point", "[0.0, 0.0, 0.0]" "inputs:a_point3h", "``pointh[3]``", "This is an attribute interpreted as a half-precision 3d point", "[0.0, 0.0, 0.0]" "inputs:a_quatd", "``quatd[4]``", "This is an attribute interpreted as a double-precision 4d quaternion", "[0.0, 0.0, 0.0, 0.0]" "inputs:a_quatf", "``quatf[4]``", "This is an attribute interpreted as a single-precision 4d quaternion", "[0.0, 0.0, 0.0, 0.0]" "inputs:a_quath", "``quath[4]``", "This is an attribute interpreted as a half-precision 4d quaternion", "[0.0, 0.0, 0.0, 0.0]" "inputs:a_texcoord2d", "``texcoordd[2]``", "This is an attribute interpreted as a double-precision 2d texcoord", "[0.0, 0.0]" "inputs:a_texcoord2f", "``texcoordf[2]``", "This is an attribute interpreted as a single-precision 2d texcoord", "[0.0, 0.0]" "inputs:a_texcoord2h", "``texcoordh[2]``", "This is an attribute interpreted as a half-precision 2d texcoord", "[0.0, 0.0]" "inputs:a_texcoord3d", "``texcoordd[3]``", "This is an attribute interpreted as a double-precision 3d texcoord", "[0.0, 0.0, 0.0]" "inputs:a_texcoord3f", "``texcoordf[3]``", "This is an attribute interpreted as a single-precision 3d texcoord", "[0.0, 0.0, 0.0]" "inputs:a_texcoord3h", "``texcoordh[3]``", "This is an attribute interpreted as a half-precision 3d texcoord", "[0.0, 0.0, 0.0]" "inputs:a_timecode", "``timecode``", "This is a computed attribute interpreted as a timecode", "1.0" "inputs:a_vector3d", "``vectord[3]``", "This is an attribute interpreted as a double-precision 3d vector", "[0.0, 0.0, 0.0]" "inputs:a_vector3f", "``vectorf[3]``", "This is an attribute interpreted as a single-precision 3d vector", "[0.0, 0.0, 0.0]" "inputs:a_vector3h", "``vectorh[3]``", "This is an attribute interpreted as a half-precision 3d vector", "[0.0, 0.0, 0.0]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:a_color3d", "``colord[3]``", "This is a computed attribute interpreted as a double-precision 3d color", "None" "outputs:a_color3f", "``colorf[3]``", "This is a computed attribute interpreted as a single-precision 3d color", "None" "outputs:a_color3h", "``colorh[3]``", "This is a computed attribute interpreted as a half-precision 3d color", "None" "outputs:a_color4d", "``colord[4]``", "This is a computed attribute interpreted as a double-precision 4d color", "None" "outputs:a_color4f", "``colorf[4]``", "This is a computed attribute interpreted as a single-precision 4d color", "None" "outputs:a_color4h", "``colorh[4]``", "This is a computed attribute interpreted as a half-precision 4d color", "None" "outputs:a_frame", "``frame[4]``", "This is a computed attribute interpreted as a coordinate frame", "None" "outputs:a_matrix2d", "``matrixd[2]``", "This is a computed attribute interpreted as a double-precision 2d matrix", "None" "outputs:a_matrix3d", "``matrixd[3]``", "This is a computed attribute interpreted as a double-precision 3d matrix", "None" "outputs:a_matrix4d", "``matrixd[4]``", "This is a computed attribute interpreted as a double-precision 4d matrix", "None" "outputs:a_normal3d", "``normald[3]``", "This is a computed attribute interpreted as a double-precision 3d normal", "None" "outputs:a_normal3f", "``normalf[3]``", "This is a computed attribute interpreted as a single-precision 3d normal", "None" "outputs:a_normal3h", "``normalh[3]``", "This is a computed attribute interpreted as a half-precision 3d normal", "None" "outputs:a_point3d", "``pointd[3]``", "This is a computed attribute interpreted as a double-precision 3d point", "None" "outputs:a_point3f", "``pointf[3]``", "This is a computed attribute interpreted as a single-precision 3d point", "None" "outputs:a_point3h", "``pointh[3]``", "This is a computed attribute interpreted as a half-precision 3d point", "None" "outputs:a_quatd", "``quatd[4]``", "This is a computed attribute interpreted as a double-precision 4d quaternion", "None" "outputs:a_quatf", "``quatf[4]``", "This is a computed attribute interpreted as a single-precision 4d quaternion", "None" "outputs:a_quath", "``quath[4]``", "This is a computed attribute interpreted as a half-precision 4d quaternion", "None" "outputs:a_texcoord2d", "``texcoordd[2]``", "This is a computed attribute interpreted as a double-precision 2d texcoord", "None" "outputs:a_texcoord2f", "``texcoordf[2]``", "This is a computed attribute interpreted as a single-precision 2d texcoord", "None" "outputs:a_texcoord2h", "``texcoordh[2]``", "This is a computed attribute interpreted as a half-precision 2d texcoord", "None" "outputs:a_texcoord3d", "``texcoordd[3]``", "This is a computed attribute interpreted as a double-precision 3d texcoord", "None" "outputs:a_texcoord3f", "``texcoordf[3]``", "This is a computed attribute interpreted as a single-precision 3d texcoord", "None" "outputs:a_texcoord3h", "``texcoordh[3]``", "This is a computed attribute interpreted as a half-precision 3d texcoord", "None" "outputs:a_timecode", "``timecode``", "This is a computed attribute interpreted as a timecode", "None" "outputs:a_vector3d", "``vectord[3]``", "This is a computed attribute interpreted as a double-precision 3d vector", "None" "outputs:a_vector3f", "``vectorf[3]``", "This is a computed attribute interpreted as a single-precision 3d vector", "None" "outputs:a_vector3h", "``vectorh[3]``", "This is a computed attribute interpreted as a half-precision 3d vector", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.RoleData" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.RoleData.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: Role-Based Attributes" "Categories", "tutorials" "Generated Class Name", "OgnTutorialRoleDataDatabase" "Python Module", "omni.graph.tutorials"
9,219
reStructuredText
72.759999
201
0.647793
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialVectorizedABIPassthrough.rst
.. _omni_graph_tutorials_TutorialVectorizedABIPassThrough_1: .. _omni_graph_tutorials_TutorialVectorizedABIPassThrough: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: Vectorized Passthrough via ABI :keywords: lang-en omnigraph node tutorials tutorials tutorial-vectorized-a-b-i-pass-through Tutorial Node: Vectorized Passthrough via ABI ============================================= .. <description> Simple passthrough node that copy its input to its output in a vectorized way .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:value", "``float``", "input value", "0.0" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:value", "``float``", "output value", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.TutorialVectorizedABIPassThrough" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.TutorialVectorizedABIPassThrough.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: Vectorized Passthrough via ABI" "Categories", "tutorials" "Generated Class Name", "OgnTutorialVectorizedABIPassthroughDatabase" "Python Module", "omni.graph.tutorials"
1,847
reStructuredText
25.782608
103
0.59935
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialComplexDataPy.rst
.. _omni_graph_tutorials_ComplexDataPy_1: .. _omni_graph_tutorials_ComplexDataPy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Python Node: Attributes With Arrays of Tuples :keywords: lang-en omnigraph node tutorials tutorials complex-data-py Tutorial Python Node: Attributes With Arrays of Tuples ====================================================== .. <description> This is a tutorial node written in Python. It will compute the point3f array by multiplying each element of the float array by the three element vector in the multiplier. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:a_inputArray", "``float[]``", "Input array", "[]" "inputs:a_vectorMultiplier", "``float[3]``", "Vector multiplier", "[1.0, 2.0, 3.0]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:a_productArray", "``pointf[3][]``", "Output array", "[]" "outputs:a_tokenArray", "``token[]``", "String representations of the input array", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.ComplexDataPy" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.ComplexDataPy.svg" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Python Node: Attributes With Arrays of Tuples" "Categories", "tutorials" "Generated Class Name", "OgnTutorialComplexDataPyDatabase" "Python Module", "omni.graph.tutorials"
2,073
reStructuredText
28.211267
170
0.591413
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialBundles.rst
.. _omni_graph_tutorials_BundleManipulation_1: .. _omni_graph_tutorials_BundleManipulation: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: Bundle Manipulation :keywords: lang-en omnigraph node tutorials tutorials bundle-manipulation Tutorial Node: Bundle Manipulation ================================== .. <description> This is a tutorial node. It exercises functionality for the manipulation of bundle attribute contents. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Filtered Bundle (*inputs:filteredBundle*)", "``bundle``", "Bundle whose contents are filtered before being added to the output", "None" "inputs:filters", "``token[]``", "List of filter names to be applied to the filteredBundle. Any filter name appearing in this list will be applied to members of that bundle and only those passing all filters will be added to the output bundle. Legal filter values are 'big' (arrays of size > 10), 'x' (attributes whose name contains the letter x), and 'int' (attributes whose base type is integer).", "[]" "Full Bundle (*inputs:fullBundle*)", "``bundle``", "Bundle whose contents are passed to the output in their entirety", "None" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:combinedBundle", "``bundle``", "This is the union of fullBundle and filtered members of the filteredBundle.", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.BundleManipulation" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.BundleManipulation.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: Bundle Manipulation" "Categories", "tutorials" "Generated Class Name", "OgnTutorialBundlesDatabase" "Python Module", "omni.graph.tutorials"
2,437
reStructuredText
33.338028
410
0.632335
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialTupleArrays.rst
.. _omni_graph_tutorials_TupleArrays_1: .. _omni_graph_tutorials_TupleArrays: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: Attributes With Arrays of Tuples :keywords: lang-en omnigraph node tutorials threadsafe tutorials tuple-arrays Tutorial Node: Attributes With Arrays of Tuples =============================================== .. <description> This is a tutorial node. It will compute the float array 'result' as the elementwise dot product of the input arrays 'a' and 'b'. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:a", "``float[3][]``", "First array", "[]" "inputs:b", "``float[3][]``", "Second array", "[]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:result", "``float[]``", "Dot-product array", "[]" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.TupleArrays" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.TupleArrays.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: Attributes With Arrays of Tuples" "Categories", "tutorials" "Generated Class Name", "OgnTutorialTupleArraysDatabase" "Python Module", "omni.graph.tutorials"
1,857
reStructuredText
25.542857
130
0.568659
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialArrayData.rst
.. _omni_graph_tutorials_ArrayData_1: .. _omni_graph_tutorials_ArrayData: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: Array Attributes :keywords: lang-en omnigraph node tutorials threadsafe tutorials array-data Tutorial Node: Array Attributes =============================== .. <description> This is a tutorial node. It will compute the array 'result' as the input array 'original' with every element multiplied by the constant 'multiplier'. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:gates", "``bool[]``", "Boolean mask telling which elements of the array should be multiplied", "[]" "inputs:info", "``token[]``", "List of strings providing commentary", "['There', 'is', 'no', 'data']" "inputs:multiplier", "``float``", "Multiplier of the array elements", "1.0" "inputs:original", "``float[]``", "Array to be multiplied", "[]" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:infoSize", "``int``", "Number of letters in all strings in the info input", "None" "outputs:negativeValues", "``bool[]``", "Array of booleans set to true if the corresponding 'result' is negative", "None" "outputs:result", "``float[]``", "Multiplied array", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.ArrayData" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.ArrayData.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: Array Attributes" "Categories", "tutorials" "Generated Class Name", "OgnTutorialArrayDataDatabase" "Python Module", "omni.graph.tutorials"
2,282
reStructuredText
29.851351
150
0.593777
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialCpuGpuBundles.rst
.. _omni_graph_tutorials_CpuGpuBundles_1: .. _omni_graph_tutorials_CpuGpuBundles: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: CPU/GPU Bundles :keywords: lang-en omnigraph node tutorials tutorials cpu-gpu-bundles Tutorial Node: CPU/GPU Bundles ============================== .. <description> This is a tutorial node. It exercises functionality for accessing data in bundles that are on the GPU as well as bundles whose CPU/GPU location is decided at runtime. The compute looks for bundled attributes named 'points' and, if they are found, computes their dot products. If the bundle on the output contains an integer array type named 'dotProducts' then the results are placed there, otherwise a new attribute of that name and type is created on the output bundle to hold the results. This node is identical to OgnTutorialCpuGpuBundlesPy.ogn, except it is implemented in C++. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "CPU Input Bundle (*inputs:cpuBundle*)", "``bundle``", "Input bundle whose data always lives on the CPU", "None" "Results To GPU (*inputs:gpu*)", "``bool``", "If true then copy gpuBundle onto the output, otherwise copy cpuBundle", "False" "GPU Input Bundle (*inputs:gpuBundle*)", "``bundle``", "Input bundle whose data always lives on the GPU", "None" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Constructed Bundle (*outputs:cpuGpuBundle*)", "``bundle``", "This is the bundle with the merged data. If the 'gpu' attribute is set to true then this bundle's contents will be entirely on the GPU, otherwise they will be on the CPU.", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.CpuGpuBundles" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.CpuGpuBundles.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "tags", "tutorial,bundle,gpu" "uiName", "Tutorial Node: CPU/GPU Bundles" "__tokens", "[""points"", ""dotProducts""]" "Categories", "tutorials" "Generated Class Name", "OgnTutorialCpuGpuBundlesDatabase" "Python Module", "omni.graph.tutorials"
2,762
reStructuredText
36.849315
581
0.64084
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialABI.rst
.. _omni_graph_tutorials_Abi_1: .. _omni_graph_tutorials_Abi: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: ABI Overrides :keywords: lang-en omnigraph node tutorials,tutorial:abi tutorials abi Tutorial Node: ABI Overrides ============================ .. <description> This tutorial node shows how to override ABI methods on your node. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "inputs:namespace:a_bool", "``bool``", "The input is any boolean value", "True" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:namespace:a_bool", "``bool``", "The output is computed as the negation of the input", "True" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.Abi" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.Abi.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "python" "uiName", "Tutorial Node: ABI Overrides" "Categories", "tutorials,tutorial:abi" "__categoryDescriptions", "tutorial:abi,Tutorial nodes that override the ABI functions" "Generated Class Name", "OgnTutorialABIDatabase" "Python Module", "omni.graph.tutorials"
1,795
reStructuredText
24.657143
105
0.582173
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialEmpty.rst
.. _omni_graph_tutorials_Empty_1: .. _omni_graph_tutorials_Empty: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Node: No Attributes :keywords: lang-en omnigraph node tutorials threadsafe tutorials empty Tutorial Node: No Attributes ============================ .. <description> This is a tutorial node. It does absolutely nothing and is only meant to serve as an example to use for setting up your build. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.Empty" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.Empty.svg" "Has State?", "False" "Implementation Language", "C++" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Node: No Attributes" "Categories", "tutorials" "Generated Class Name", "OgnTutorialEmptyDatabase" "Python Module", "omni.graph.tutorials"
1,341
reStructuredText
25.313725
127
0.577927
omniverse-code/kit/exts/omni.graph.tutorials/ogn/docs/OgnTutorialABIPy.rst
.. _omni_graph_tutorials_AbiPy_1: .. _omni_graph_tutorials_AbiPy: .. ================================================================================ .. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT. .. ================================================================================ :orphan: .. meta:: :title: Tutorial Python Node: ABI Overrides :keywords: lang-en omnigraph node tutorials,tutorial:abiPy tutorials abi-py Tutorial Python Node: ABI Overrides =================================== .. <description> This tutorial node shows how to override ABI methods on your Python node. The algorithm of the node converts an RGB color into HSV components. .. </description> Installation ------------ To use this node enable :ref:`omni.graph.tutorials<ext_omni_graph_tutorials>` in the Extension Manager. Inputs ------ .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "Color To Convert (*inputs:color*)", "``colord[3]``", "The color to be converted", "[0.0, 0.0, 0.0]" "", "*multipleValues*", "value1,value2,value3", "" Outputs ------- .. csv-table:: :header: "Name", "Type", "Descripton", "Default" :widths: 20, 20, 50, 10 "outputs:h", "``double``", "The hue component of the input color", "None" "outputs:s", "``double``", "The saturation component of the input color", "None" "outputs:v", "``double``", "The value component of the input color", "None" Metadata -------- .. csv-table:: :header: "Name", "Value" :widths: 30,70 "Unique ID", "omni.graph.tutorials.AbiPy" "Version", "1" "Extension", "omni.graph.tutorials" "Icon", "ogn/icons/omni.graph.tutorials.AbiPy.svg" "Has State?", "False" "Implementation Language", "Python" "Default Memory Type", "cpu" "Generated Code Exclusions", "None" "uiName", "Tutorial Python Node: ABI Overrides" "Categories", "tutorials,tutorial:abiPy" "__categoryDescriptions", "tutorial:abiPy,Tutorial nodes that override the Python ABI functions" "Generated Class Name", "OgnTutorialABIPyDatabase" "Python Module", "omni.graph.tutorials"
2,139
reStructuredText
28.315068
142
0.59467
omniverse-code/kit/exts/omni.graph.tutorials/config/extension.toml
[package] title = "OmniGraph Tutorials" version = "1.3.3" category = "Graph" readme = "docs/README.md" changelog = "docs/CHANGELOG.md" description = "Contains a collection of tutorials on constructing OmniGraph nodes." repository = "" keywords = ["kit", "omnigraph", "core", "tutorials"] # Main Python module, available as "import omni.graph.tutorials" [[python.module]] name = "omni.graph.tutorials" # Watch the .ogn files for hot reloading (only works for Python files) [fswatcher.patterns] include = ["*.ogn", "*.py"] exclude = ["Ogn*Database.py"] # Other extensions on which this one relies [dependencies] "omni.graph" = {} "omni.graph.nodes" = {} "omni.graph.tools" = {} "omni.kit.test" = {} "omni.kit.stage_templates" = {} "omni.usd" = {} "omni.kit.pipapi" = {} [python.pipapi] requirements = ["numpy"] # SWIPAT filed under: http://nvbugs/3193231 [[native.plugin]] path = "bin/*.plugin" recursive = false [[test]] timeout = 300 stdoutFailPatterns.exclude = [ # Exclude carb.events leak that only shows up locally "*[Error] [carb.events.plugin]*PooledAllocator*", ] pythonTests.unreliable = [ "*test_bundle_gpu_py", # OM-50554 "*test_setting_in_ogn_python_api", # OM-55532 ] [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,400
TOML
24.017857
108
0.68
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialBundlesDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.BundleManipulation This is a tutorial node. It exercises functionality for the manipulation of bundle attribute contents. """ import carb import numpy import carb import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialBundlesDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.BundleManipulation Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.filteredBundle inputs.filters inputs.fullBundle Outputs: outputs.combinedBundle """ # 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:filteredBundle', 'bundle', 0, 'Filtered Bundle', 'Bundle whose contents are filtered before being added to the output', {}, True, None, False, ''), ('inputs:filters', 'token[]', 0, None, "List of filter names to be applied to the filteredBundle. Any filter name\nappearing in this list will be applied to members of that bundle and only those\npassing all filters will be added to the output bundle. Legal filter values are\n'big' (arrays of size > 10), 'x' (attributes whose name contains the letter x), \nand 'int' (attributes whose base type is integer).", {ogn.MetadataKeys.DEFAULT: '[]'}, True, [], False, ''), ('inputs:fullBundle', 'bundle', 0, 'Full Bundle', 'Bundle whose contents are passed to the output in their entirety', {}, True, None, False, ''), ('outputs:combinedBundle', 'bundle', 0, None, 'This is the union of fullBundle and filtered members of the filteredBundle.', {}, 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.filteredBundle = og.AttributeRole.BUNDLE role_data.inputs.fullBundle = og.AttributeRole.BUNDLE role_data.outputs.combinedBundle = og.AttributeRole.BUNDLE return role_data 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.__bundles = og.BundleContainer(context, node, attributes, [], read_only=True, gpu_ptr_kinds={}) self._batchedReadAttributes = [] self._batchedReadValues = [] @property def filteredBundle(self) -> og.BundleContents: """Get the bundle wrapper class for the attribute inputs.filteredBundle""" return self.__bundles.filteredBundle @property def filters(self): data_view = og.AttributeValueHelper(self._attributes.filters) return data_view.get() @filters.setter def filters(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.filters) data_view = og.AttributeValueHelper(self._attributes.filters) data_view.set(value) self.filters_size = data_view.get_array_size() @property def fullBundle(self) -> og.BundleContents: """Get the bundle wrapper class for the attribute inputs.fullBundle""" return self.__bundles.fullBundle 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.__bundles = og.BundleContainer(context, node, attributes, [], read_only=False, gpu_ptr_kinds={}) self._batchedWriteValues = { } @property def combinedBundle(self) -> og.BundleContents: """Get the bundle wrapper class for the attribute outputs.combinedBundle""" return self.__bundles.combinedBundle @combinedBundle.setter def combinedBundle(self, bundle: og.BundleContents): """Overwrite the bundle attribute outputs.combinedBundle with a new bundle""" if not isinstance(bundle, og.BundleContents): carb.log_error("Only bundle attributes can be assigned to another bundle attribute") self.__bundles.combinedBundle.bundle = bundle 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 = OgnTutorialBundlesDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialBundlesDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialBundlesDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
7,335
Python
51.4
475
0.678391
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialCudaDataDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.CudaData This is a tutorial node. It performs different functions on the GPU to illustrate different types of data access. The first adds inputs 'a' and 'b' to yield output 'sum', all of which are on the GPU. The second is a sample expansion deformation that multiplies every point on a set of input points, stored on the GPU, by a constant value, stored on the CPU, to yield a set of output points, also on the GPU. The third is an assortment of different data types illustrating how different data is passed to the GPU. This particular node uses CUDA for its GPU computations, as indicated in the memory type value. Normal use case for GPU compute is large amounts of data. For testing purposes this node only handles a very small amount but the principle is the same. """ import carb import numpy import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialCudaDataDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.CudaData Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.a inputs.b inputs.color inputs.half inputs.matrix inputs.multiplier inputs.points Outputs: outputs.color outputs.half outputs.matrix outputs.points outputs.sum """ # 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:a', 'float', 0, None, 'First value to be added in algorithm 1', {ogn.MetadataKeys.DEFAULT: '0.0'}, True, 0.0, False, ''), ('inputs:b', 'float', 0, None, 'Second value to be added in algorithm 1', {ogn.MetadataKeys.DEFAULT: '0.0'}, True, 0.0, False, ''), ('inputs:color', 'color3d', 0, None, 'Input with three doubles as a color for algorithm 3', {ogn.MetadataKeys.DEFAULT: '[1.0, 0.5, 1.0]'}, True, [1.0, 0.5, 1.0], False, ''), ('inputs:half', 'half', 0, None, 'Input of type half for algorithm 3', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''), ('inputs:matrix', 'matrix4d', 0, None, 'Input with 16 doubles interpreted as a double-precision 4d matrix', {ogn.MetadataKeys.DEFAULT: '[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]'}, True, [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]], False, ''), ('inputs:multiplier', 'float3', 0, None, 'Amplitude of the expansion for the input points in algorithm 2', {ogn.MetadataKeys.MEMORY_TYPE: 'cpu', ogn.MetadataKeys.DEFAULT: '[1.0, 1.0, 1.0]'}, True, [1.0, 1.0, 1.0], False, ''), ('inputs:points', 'float3[]', 0, None, 'Points to be moved by algorithm 2', {ogn.MetadataKeys.DEFAULT: '[]'}, True, [], False, ''), ('outputs:color', 'color3d', 0, None, 'Output with three doubles as a color for algorithm 3', {}, True, None, False, ''), ('outputs:half', 'half', 0, None, 'Output of type half for algorithm 3', {}, True, None, False, ''), ('outputs:matrix', 'matrix4d', 0, None, 'Output with 16 doubles interpreted as a double-precision 4d matrix', {}, True, None, False, ''), ('outputs:points', 'float3[]', 0, None, 'Final positions of points from algorithm 2', {}, True, None, False, ''), ('outputs:sum', 'float', 0, None, 'Sum of the two inputs from algorithm 1', {}, 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 = og.AttributeRole.COLOR role_data.inputs.matrix = og.AttributeRole.MATRIX role_data.outputs.color = og.AttributeRole.COLOR role_data.outputs.matrix = og.AttributeRole.MATRIX return role_data 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 = [] @property def a(self): data_view = og.AttributeValueHelper(self._attributes.a) return data_view.get(on_gpu=True) @a.setter def a(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a) data_view = og.AttributeValueHelper(self._attributes.a) data_view.set(value, on_gpu=True) @property def b(self): data_view = og.AttributeValueHelper(self._attributes.b) return data_view.get(on_gpu=True) @b.setter def b(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.b) data_view = og.AttributeValueHelper(self._attributes.b) data_view.set(value, on_gpu=True) @property def color(self): data_view = og.AttributeValueHelper(self._attributes.color) return data_view.get(on_gpu=True) @color.setter def color(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.color) data_view = og.AttributeValueHelper(self._attributes.color) data_view.set(value, on_gpu=True) @property def half(self): data_view = og.AttributeValueHelper(self._attributes.half) return data_view.get(on_gpu=True) @half.setter def half(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.half) data_view = og.AttributeValueHelper(self._attributes.half) data_view.set(value, on_gpu=True) @property def matrix(self): data_view = og.AttributeValueHelper(self._attributes.matrix) return data_view.get(on_gpu=True) @matrix.setter def matrix(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.matrix) data_view = og.AttributeValueHelper(self._attributes.matrix) data_view.set(value, on_gpu=True) @property def multiplier(self): data_view = og.AttributeValueHelper(self._attributes.multiplier) return data_view.get() @multiplier.setter def multiplier(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.multiplier) data_view = og.AttributeValueHelper(self._attributes.multiplier) data_view.set(value) @property def points(self): data_view = og.AttributeValueHelper(self._attributes.points) return data_view.get(on_gpu=True) @points.setter def points(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.points) data_view = og.AttributeValueHelper(self._attributes.points) data_view.set(value, on_gpu=True) self.points_size = data_view.get_array_size() 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.points_size = None self._batchedWriteValues = { } @property def color(self): data_view = og.AttributeValueHelper(self._attributes.color) return data_view.get(on_gpu=True) @color.setter def color(self, value): data_view = og.AttributeValueHelper(self._attributes.color) data_view.set(value, on_gpu=True) @property def half(self): data_view = og.AttributeValueHelper(self._attributes.half) return data_view.get(on_gpu=True) @half.setter def half(self, value): data_view = og.AttributeValueHelper(self._attributes.half) data_view.set(value, on_gpu=True) @property def matrix(self): data_view = og.AttributeValueHelper(self._attributes.matrix) return data_view.get(on_gpu=True) @matrix.setter def matrix(self, value): data_view = og.AttributeValueHelper(self._attributes.matrix) data_view.set(value, on_gpu=True) @property def points(self): data_view = og.AttributeValueHelper(self._attributes.points) return data_view.get(reserved_element_count=self.points_size, on_gpu=True) @points.setter def points(self, value): data_view = og.AttributeValueHelper(self._attributes.points) data_view.set(value, on_gpu=True) self.points_size = data_view.get_array_size() @property def sum(self): data_view = og.AttributeValueHelper(self._attributes.sum) return data_view.get(on_gpu=True) @sum.setter def sum(self, value): data_view = og.AttributeValueHelper(self._attributes.sum) data_view.set(value, on_gpu=True) 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 = OgnTutorialCudaDataDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialCudaDataDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialCudaDataDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
12,300
Python
45.950382
343
0.633252
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialCpuGpuDataDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.CpuGpuData This is a tutorial node. It illustrates how to access data whose memory location, CPU or GPU, is determined at runtime in the compute method. The data types are the same as for the purely CPU and purely GPU tutorials, it is only the access method that changes. The input 'is_gpu' determines where the data of the other attributes can be accessed. """ import carb import numpy import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialCpuGpuDataDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.CpuGpuData Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.a inputs.b inputs.is_gpu inputs.multiplier inputs.points Outputs: outputs.points outputs.sum """ # 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:a', 'float', 0, None, 'First value to be added in algorithm 1', {ogn.MetadataKeys.DEFAULT: '0.0'}, True, 0.0, False, ''), ('inputs:b', 'float', 0, None, 'Second value to be added in algorithm 1', {ogn.MetadataKeys.DEFAULT: '0.0'}, True, 0.0, False, ''), ('inputs:is_gpu', 'bool', 0, None, 'Runtime switch determining where the data for the other attributes lives.', {ogn.MetadataKeys.MEMORY_TYPE: 'cpu', ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''), ('inputs:multiplier', 'float3', 0, None, 'Amplitude of the expansion for the input points in algorithm 2', {ogn.MetadataKeys.DEFAULT: '[1.0, 1.0, 1.0]'}, True, [1.0, 1.0, 1.0], False, ''), ('inputs:points', 'float3[]', 0, None, 'Points to be moved by algorithm 2', {ogn.MetadataKeys.DEFAULT: '[]'}, True, [], False, ''), ('outputs:points', 'float3[]', 0, None, 'Final positions of points from algorithm 2', {}, True, None, False, ''), ('outputs:sum', 'float', 0, None, 'Sum of the two inputs from algorithm 1', {}, 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 = [] class __a: def __init__(self, parent): self._parent = parent @property def cpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.a) return data_view.get() @cpu.setter def cpu(self, value): if self._parent._setting_locked: raise og.ReadOnlyError(self._parent._attributes.cpu) data_view = og.AttributeValueHelper(self._parent._attributes.cpu) data_view.set(value) @property def gpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.a) return data_view.get(on_gpu=True) @gpu.setter def gpu(self, value): if self._parent._setting_locked: raise og.ReadOnlyError(self._parent._attributes.gpu) data_view = og.AttributeValueHelper(self._parent._attributes.gpu) data_view.set(value) @property def a(self): return self.__class__.__a(self) class __b: def __init__(self, parent): self._parent = parent @property def cpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.b) return data_view.get() @cpu.setter def cpu(self, value): if self._parent._setting_locked: raise og.ReadOnlyError(self._parent._attributes.cpu) data_view = og.AttributeValueHelper(self._parent._attributes.cpu) data_view.set(value) @property def gpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.b) return data_view.get(on_gpu=True) @gpu.setter def gpu(self, value): if self._parent._setting_locked: raise og.ReadOnlyError(self._parent._attributes.gpu) data_view = og.AttributeValueHelper(self._parent._attributes.gpu) data_view.set(value) @property def b(self): return self.__class__.__b(self) @property def is_gpu(self): data_view = og.AttributeValueHelper(self._attributes.is_gpu) return data_view.get() @is_gpu.setter def is_gpu(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.is_gpu) data_view = og.AttributeValueHelper(self._attributes.is_gpu) data_view.set(value) class __multiplier: def __init__(self, parent): self._parent = parent @property def cpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.multiplier) return data_view.get() @cpu.setter def cpu(self, value): if self._parent._setting_locked: raise og.ReadOnlyError(self._parent._attributes.cpu) data_view = og.AttributeValueHelper(self._parent._attributes.cpu) data_view.set(value) @property def gpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.multiplier) return data_view.get(on_gpu=True) @gpu.setter def gpu(self, value): if self._parent._setting_locked: raise og.ReadOnlyError(self._parent._attributes.gpu) data_view = og.AttributeValueHelper(self._parent._attributes.gpu) data_view.set(value) @property def multiplier(self): return self.__class__.__multiplier(self) class __points: def __init__(self, parent): self._parent = parent @property def cpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.points) return data_view.get() @cpu.setter def cpu(self, value): if self._parent._setting_locked: raise og.ReadOnlyError(self._parent._attributes.cpu) data_view = og.AttributeValueHelper(self._parent._attributes.cpu) data_view.set(value) self._parent.cpu_size = data_view.get_array_size() @property def gpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.points) return data_view.get(on_gpu=True) @gpu.setter def gpu(self, value): if self._parent._setting_locked: raise og.ReadOnlyError(self._parent._attributes.gpu) data_view = og.AttributeValueHelper(self._parent._attributes.gpu) data_view.set(value) self._parent.gpu_size = data_view.get_array_size() @property def points(self): return self.__class__.__points(self) 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.points_size = None self._batchedWriteValues = { } class __points: def __init__(self, parent): self._parent = parent @property def cpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.points) return data_view.get(reserved_element_count=self._parent.points_size) @cpu.setter def cpu(self, value): data_view = og.AttributeValueHelper(self._parent._attributes.cpu) data_view.set(value) self._parent.cpu_size = data_view.get_array_size() @property def gpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.points) return data_view.get(reserved_element_count=self._parent.points_size, on_gpu=True) @gpu.setter def gpu(self, value): data_view = og.AttributeValueHelper(self._parent._attributes.gpu) data_view.set(value) self._parent.gpu_size = data_view.get_array_size() @property def points(self): return self.__class__.__points(self) class __sum: def __init__(self, parent): self._parent = parent @property def cpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.sum) return data_view.get() @cpu.setter def cpu(self, value): data_view = og.AttributeValueHelper(self._parent._attributes.cpu) data_view.set(value) @property def gpu(self): data_view = og.AttributeValueHelper(self._parent._attributes.sum) return data_view.get(on_gpu=True) @gpu.setter def gpu(self, value): data_view = og.AttributeValueHelper(self._parent._attributes.gpu) data_view.set(value) @property def sum(self): return self.__class__.__sum(self) 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 = OgnTutorialCpuGpuDataDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialCpuGpuDataDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialCpuGpuDataDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
12,813
Python
41.430463
218
0.590806
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialStateAttributesPyDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.StateAttributesPy This is a tutorial node. It exercises state attributes to remember data from on evaluation to the next. """ import carb 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 OgnTutorialStateAttributesPyDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.StateAttributesPy Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.ignored State: state.monotonic state.reset """ # 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:ignored', 'bool', 0, None, 'Ignore me', {}, True, False, False, ''), ('state:monotonic', 'int', 0, None, 'The monotonically increasing output value, reset to 0 when the reset value is true', {}, True, None, False, ''), ('state:reset', 'bool', 0, None, 'If true then the inputs are ignored and outputs are set to default values, then this\nflag is set to false for subsequent evaluations.', {ogn.MetadataKeys.DEFAULT: 'true'}, True, True, False, ''), ]) class ValuesForInputs(og.DynamicAttributeAccess): LOCAL_PROPERTY_NAMES = {"ignored", "_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.ignored] self._batchedReadValues = [False] @property def ignored(self): return self._batchedReadValues[0] @ignored.setter def ignored(self, value): self._batchedReadValues[0] = 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._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) @property def monotonic(self): data_view = og.AttributeValueHelper(self._attributes.monotonic) return data_view.get() @monotonic.setter def monotonic(self, value): data_view = og.AttributeValueHelper(self._attributes.monotonic) data_view.set(value) @property def reset(self): data_view = og.AttributeValueHelper(self._attributes.reset) return data_view.get() @reset.setter def reset(self, value): data_view = og.AttributeValueHelper(self._attributes.reset) data_view.set(value) def __init__(self, node): super().__init__(node) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT) self.inputs = OgnTutorialStateAttributesPyDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialStateAttributesPyDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialStateAttributesPyDatabase.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(OgnTutorialStateAttributesPyDatabase.NODE_TYPE_CLASS, 'get_node_type', None) if callable(get_node_type_function): return get_node_type_function() return 'omni.graph.tutorials.StateAttributesPy' @staticmethod def compute(context, node): def database_valid(): return True try: per_node_data = OgnTutorialStateAttributesPyDatabase.PER_NODE_DATA[node.node_id()] db = per_node_data.get('_db') if db is None: db = OgnTutorialStateAttributesPyDatabase(node) per_node_data['_db'] = db if not database_valid(): per_node_data['_db'] = None return False except: db = OgnTutorialStateAttributesPyDatabase(node) try: compute_function = getattr(OgnTutorialStateAttributesPyDatabase.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 OgnTutorialStateAttributesPyDatabase.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): OgnTutorialStateAttributesPyDatabase._initialize_per_node_data(node) initialize_function = getattr(OgnTutorialStateAttributesPyDatabase.NODE_TYPE_CLASS, 'initialize', None) if callable(initialize_function): initialize_function(context, node) per_node_data = OgnTutorialStateAttributesPyDatabase.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(OgnTutorialStateAttributesPyDatabase.NODE_TYPE_CLASS, 'release', None) if callable(release_function): release_function(node) OgnTutorialStateAttributesPyDatabase._release_per_node_data(node) @staticmethod def release_instance(node, target): OgnTutorialStateAttributesPyDatabase._release_per_node_instance_data(node, target) @staticmethod def update_node_version(context, node, old_version, new_version): update_node_version_function = getattr(OgnTutorialStateAttributesPyDatabase.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(OgnTutorialStateAttributesPyDatabase.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.tutorials") node_type.set_metadata(ogn.MetadataKeys.UI_NAME, "Tutorial Python Node: State Attributes") node_type.set_metadata(ogn.MetadataKeys.CATEGORIES, "tutorials") node_type.set_metadata(ogn.MetadataKeys.DESCRIPTION, "This is a tutorial node. It exercises state attributes to remember data from on evaluation to the next.") node_type.set_metadata(ogn.MetadataKeys.LANGUAGE, "Python") icon_path = carb.tokens.get_tokens_interface().resolve("${omni.graph.tutorials}") icon_path = icon_path + '/' + "ogn/icons/omni.graph.tutorials.StateAttributesPy.svg" node_type.set_metadata(ogn.MetadataKeys.ICON_PATH, icon_path) OgnTutorialStateAttributesPyDatabase.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(OgnTutorialStateAttributesPyDatabase.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): OgnTutorialStateAttributesPyDatabase.NODE_TYPE_CLASS = node_type_class og.register_node_type(OgnTutorialStateAttributesPyDatabase.abi, 1) @staticmethod def deregister(): og.deregister_node_type("omni.graph.tutorials.StateAttributesPy")
11,647
Python
47.132231
238
0.649008
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialBundlesPyDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.BundleManipulationPy This is a tutorial node. It exercises functionality for the manipulation of bundle attribute contents. The configuration is the same as omni.graph.tutorials.BundleManipulation except that the implementation language is Python """ import carb import numpy import sys import traceback import carb import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialBundlesPyDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.BundleManipulationPy Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.filteredBundle inputs.filters inputs.fullBundle Outputs: outputs.combinedBundle """ # 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:filteredBundle', 'bundle', 0, 'Filtered Bundle', 'Bundle whose contents are filtered before being added to the output', {}, True, None, False, ''), ('inputs:filters', 'token[]', 0, None, "List of filter names to be applied to the filteredBundle. Any filter name\nappearing in this list will be applied to members of that bundle and only those\npassing all filters will be added to the output bundle. Legal filter values are\n'big' (arrays of size > 10), 'x' (attributes whose name contains the letter x), \nand 'int' (attributes whose base type is integer).", {ogn.MetadataKeys.DEFAULT: '[]'}, True, [], False, ''), ('inputs:fullBundle', 'bundle', 0, 'Full Bundle', 'Bundle whose contents are passed to the output in their entirety', {}, True, None, False, ''), ('outputs:combinedBundle', 'bundle', 0, None, 'This is the union of fullBundle and filtered members of the filteredBundle.', {}, 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.filteredBundle = og.AttributeRole.BUNDLE role_data.inputs.fullBundle = og.AttributeRole.BUNDLE role_data.outputs.combinedBundle = og.AttributeRole.BUNDLE return role_data 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.__bundles = og.BundleContainer(context, node, attributes, [], read_only=True, gpu_ptr_kinds={}) self._batchedReadAttributes = [] self._batchedReadValues = [] @property def filteredBundle(self) -> og.BundleContents: """Get the bundle wrapper class for the attribute inputs.filteredBundle""" return self.__bundles.filteredBundle @property def filters(self): data_view = og.AttributeValueHelper(self._attributes.filters) return data_view.get() @filters.setter def filters(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.filters) data_view = og.AttributeValueHelper(self._attributes.filters) data_view.set(value) self.filters_size = data_view.get_array_size() @property def fullBundle(self) -> og.BundleContents: """Get the bundle wrapper class for the attribute inputs.fullBundle""" return self.__bundles.fullBundle 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.__bundles = og.BundleContainer(context, node, attributes, [], read_only=False, gpu_ptr_kinds={}) self._batchedWriteValues = { } @property def combinedBundle(self) -> og.BundleContents: """Get the bundle wrapper class for the attribute outputs.combinedBundle""" return self.__bundles.combinedBundle @combinedBundle.setter def combinedBundle(self, bundle: og.BundleContents): """Overwrite the bundle attribute outputs.combinedBundle with a new bundle""" if not isinstance(bundle, og.BundleContents): carb.log_error("Only bundle attributes can be assigned to another bundle attribute") self.__bundles.combinedBundle.bundle = bundle 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 = OgnTutorialBundlesPyDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialBundlesPyDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialBundlesPyDatabase.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(OgnTutorialBundlesPyDatabase.NODE_TYPE_CLASS, 'get_node_type', None) if callable(get_node_type_function): return get_node_type_function() return 'omni.graph.tutorials.BundleManipulationPy' @staticmethod def compute(context, node): def database_valid(): if not db.inputs.filteredBundle.valid: db.log_warning('Required bundle inputs.filteredBundle is invalid or not connected, compute skipped') return False if not db.inputs.fullBundle.valid: db.log_warning('Required bundle inputs.fullBundle is invalid or not connected, compute skipped') return False if not db.outputs.combinedBundle.valid: db.log_error('Required bundle outputs.combinedBundle is invalid, compute skipped') return False return True try: per_node_data = OgnTutorialBundlesPyDatabase.PER_NODE_DATA[node.node_id()] db = per_node_data.get('_db') if db is None: db = OgnTutorialBundlesPyDatabase(node) per_node_data['_db'] = db if not database_valid(): per_node_data['_db'] = None return False except: db = OgnTutorialBundlesPyDatabase(node) try: compute_function = getattr(OgnTutorialBundlesPyDatabase.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 OgnTutorialBundlesPyDatabase.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): OgnTutorialBundlesPyDatabase._initialize_per_node_data(node) initialize_function = getattr(OgnTutorialBundlesPyDatabase.NODE_TYPE_CLASS, 'initialize', None) if callable(initialize_function): initialize_function(context, node) per_node_data = OgnTutorialBundlesPyDatabase.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(OgnTutorialBundlesPyDatabase.NODE_TYPE_CLASS, 'release', None) if callable(release_function): release_function(node) OgnTutorialBundlesPyDatabase._release_per_node_data(node) @staticmethod def release_instance(node, target): OgnTutorialBundlesPyDatabase._release_per_node_instance_data(node, target) @staticmethod def update_node_version(context, node, old_version, new_version): update_node_version_function = getattr(OgnTutorialBundlesPyDatabase.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(OgnTutorialBundlesPyDatabase.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.tutorials") node_type.set_metadata(ogn.MetadataKeys.UI_NAME, "Tutorial Python Node: Bundle Manipulation") node_type.set_metadata(ogn.MetadataKeys.CATEGORIES, "tutorials") node_type.set_metadata(ogn.MetadataKeys.DESCRIPTION, "This is a tutorial node. It exercises functionality for the manipulation of bundle attribute contents. The configuration is the same as omni.graph.tutorials.BundleManipulation except that the implementation language is Python") node_type.set_metadata(ogn.MetadataKeys.LANGUAGE, "Python") icon_path = carb.tokens.get_tokens_interface().resolve("${omni.graph.tutorials}") icon_path = icon_path + '/' + "ogn/icons/omni.graph.tutorials.BundleManipulationPy.svg" node_type.set_metadata(ogn.MetadataKeys.ICON_PATH, icon_path) OgnTutorialBundlesPyDatabase.INTERFACE.add_to_node_type(node_type) @staticmethod def on_connection_type_resolve(node): on_connection_type_resolve_function = getattr(OgnTutorialBundlesPyDatabase.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): OgnTutorialBundlesPyDatabase.NODE_TYPE_CLASS = node_type_class og.register_node_type(OgnTutorialBundlesPyDatabase.abi, 1) @staticmethod def deregister(): og.deregister_node_type("omni.graph.tutorials.BundleManipulationPy")
13,575
Python
51.015325
475
0.657459
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialRoleDataDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.RoleData This is a tutorial node. It creates both an input and output attribute of every supported role-based data type. The values are modified in a simple way so that the compute modifies values. """ import carb import numpy import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialRoleDataDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.RoleData Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.a_color3d inputs.a_color3f inputs.a_color3h inputs.a_color4d inputs.a_color4f inputs.a_color4h inputs.a_frame inputs.a_matrix2d inputs.a_matrix3d inputs.a_matrix4d inputs.a_normal3d inputs.a_normal3f inputs.a_normal3h inputs.a_point3d inputs.a_point3f inputs.a_point3h inputs.a_quatd inputs.a_quatf inputs.a_quath inputs.a_texcoord2d inputs.a_texcoord2f inputs.a_texcoord2h inputs.a_texcoord3d inputs.a_texcoord3f inputs.a_texcoord3h inputs.a_timecode inputs.a_vector3d inputs.a_vector3f inputs.a_vector3h Outputs: outputs.a_color3d outputs.a_color3f outputs.a_color3h outputs.a_color4d outputs.a_color4f outputs.a_color4h outputs.a_frame outputs.a_matrix2d outputs.a_matrix3d outputs.a_matrix4d outputs.a_normal3d outputs.a_normal3f outputs.a_normal3h outputs.a_point3d outputs.a_point3f outputs.a_point3h outputs.a_quatd outputs.a_quatf outputs.a_quath outputs.a_texcoord2d outputs.a_texcoord2f outputs.a_texcoord2h outputs.a_texcoord3d outputs.a_texcoord3f outputs.a_texcoord3h outputs.a_timecode outputs.a_vector3d outputs.a_vector3f outputs.a_vector3h """ # 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:a_color3d', 'color3d', 0, None, 'This is an attribute interpreted as a double-precision 3d color', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_color3f', 'color3f', 0, None, 'This is an attribute interpreted as a single-precision 3d color', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_color3h', 'color3h', 0, None, 'This is an attribute interpreted as a half-precision 3d color', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_color4d', 'color4d', 0, None, 'This is an attribute interpreted as a double-precision 4d color', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0, 0.0], False, ''), ('inputs:a_color4f', 'color4f', 0, None, 'This is an attribute interpreted as a single-precision 4d color', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0, 0.0], False, ''), ('inputs:a_color4h', 'color4h', 0, None, 'This is an attribute interpreted as a half-precision 4d color', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0, 0.0], False, ''), ('inputs:a_frame', 'frame4d', 0, None, 'This is an attribute interpreted as a coordinate frame', {ogn.MetadataKeys.DEFAULT: '[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]'}, True, [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]], False, ''), ('inputs:a_matrix2d', 'matrix2d', 0, None, 'This is an attribute interpreted as a double-precision 2d matrix', {ogn.MetadataKeys.DEFAULT: '[[1.0, 0.0], [0.0, 1.0]]'}, True, [[1.0, 0.0], [0.0, 1.0]], False, ''), ('inputs:a_matrix3d', 'matrix3d', 0, None, 'This is an attribute interpreted as a double-precision 3d matrix', {ogn.MetadataKeys.DEFAULT: '[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]'}, True, [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], False, ''), ('inputs:a_matrix4d', 'matrix4d', 0, None, 'This is an attribute interpreted as a double-precision 4d matrix', {ogn.MetadataKeys.DEFAULT: '[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]'}, True, [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]], False, ''), ('inputs:a_normal3d', 'normal3d', 0, None, 'This is an attribute interpreted as a double-precision 3d normal', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_normal3f', 'normal3f', 0, None, 'This is an attribute interpreted as a single-precision 3d normal', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_normal3h', 'normal3h', 0, None, 'This is an attribute interpreted as a half-precision 3d normal', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_point3d', 'point3d', 0, None, 'This is an attribute interpreted as a double-precision 3d point', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_point3f', 'point3f', 0, None, 'This is an attribute interpreted as a single-precision 3d point', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_point3h', 'point3h', 0, None, 'This is an attribute interpreted as a half-precision 3d point', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_quatd', 'quatd', 0, None, 'This is an attribute interpreted as a double-precision 4d quaternion', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0, 0.0], False, ''), ('inputs:a_quatf', 'quatf', 0, None, 'This is an attribute interpreted as a single-precision 4d quaternion', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0, 0.0], False, ''), ('inputs:a_quath', 'quath', 0, None, 'This is an attribute interpreted as a half-precision 4d quaternion', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0, 0.0], False, ''), ('inputs:a_texcoord2d', 'texCoord2d', 0, None, 'This is an attribute interpreted as a double-precision 2d texcoord', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0]'}, True, [0.0, 0.0], False, ''), ('inputs:a_texcoord2f', 'texCoord2f', 0, None, 'This is an attribute interpreted as a single-precision 2d texcoord', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0]'}, True, [0.0, 0.0], False, ''), ('inputs:a_texcoord2h', 'texCoord2h', 0, None, 'This is an attribute interpreted as a half-precision 2d texcoord', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0]'}, True, [0.0, 0.0], False, ''), ('inputs:a_texcoord3d', 'texCoord3d', 0, None, 'This is an attribute interpreted as a double-precision 3d texcoord', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_texcoord3f', 'texCoord3f', 0, None, 'This is an attribute interpreted as a single-precision 3d texcoord', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_texcoord3h', 'texCoord3h', 0, None, 'This is an attribute interpreted as a half-precision 3d texcoord', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_timecode', 'timecode', 0, None, 'This is a computed attribute interpreted as a timecode', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''), ('inputs:a_vector3d', 'vector3d', 0, None, 'This is an attribute interpreted as a double-precision 3d vector', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_vector3f', 'vector3f', 0, None, 'This is an attribute interpreted as a single-precision 3d vector', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('inputs:a_vector3h', 'vector3h', 0, None, 'This is an attribute interpreted as a half-precision 3d vector', {ogn.MetadataKeys.DEFAULT: '[0.0, 0.0, 0.0]'}, True, [0.0, 0.0, 0.0], False, ''), ('outputs:a_color3d', 'color3d', 0, None, 'This is a computed attribute interpreted as a double-precision 3d color', {}, True, None, False, ''), ('outputs:a_color3f', 'color3f', 0, None, 'This is a computed attribute interpreted as a single-precision 3d color', {}, True, None, False, ''), ('outputs:a_color3h', 'color3h', 0, None, 'This is a computed attribute interpreted as a half-precision 3d color', {}, True, None, False, ''), ('outputs:a_color4d', 'color4d', 0, None, 'This is a computed attribute interpreted as a double-precision 4d color', {}, True, None, False, ''), ('outputs:a_color4f', 'color4f', 0, None, 'This is a computed attribute interpreted as a single-precision 4d color', {}, True, None, False, ''), ('outputs:a_color4h', 'color4h', 0, None, 'This is a computed attribute interpreted as a half-precision 4d color', {}, True, None, False, ''), ('outputs:a_frame', 'frame4d', 0, None, 'This is a computed attribute interpreted as a coordinate frame', {}, True, None, False, ''), ('outputs:a_matrix2d', 'matrix2d', 0, None, 'This is a computed attribute interpreted as a double-precision 2d matrix', {}, True, None, False, ''), ('outputs:a_matrix3d', 'matrix3d', 0, None, 'This is a computed attribute interpreted as a double-precision 3d matrix', {}, True, None, False, ''), ('outputs:a_matrix4d', 'matrix4d', 0, None, 'This is a computed attribute interpreted as a double-precision 4d matrix', {}, True, None, False, ''), ('outputs:a_normal3d', 'normal3d', 0, None, 'This is a computed attribute interpreted as a double-precision 3d normal', {}, True, None, False, ''), ('outputs:a_normal3f', 'normal3f', 0, None, 'This is a computed attribute interpreted as a single-precision 3d normal', {}, True, None, False, ''), ('outputs:a_normal3h', 'normal3h', 0, None, 'This is a computed attribute interpreted as a half-precision 3d normal', {}, True, None, False, ''), ('outputs:a_point3d', 'point3d', 0, None, 'This is a computed attribute interpreted as a double-precision 3d point', {}, True, None, False, ''), ('outputs:a_point3f', 'point3f', 0, None, 'This is a computed attribute interpreted as a single-precision 3d point', {}, True, None, False, ''), ('outputs:a_point3h', 'point3h', 0, None, 'This is a computed attribute interpreted as a half-precision 3d point', {}, True, None, False, ''), ('outputs:a_quatd', 'quatd', 0, None, 'This is a computed attribute interpreted as a double-precision 4d quaternion', {}, True, None, False, ''), ('outputs:a_quatf', 'quatf', 0, None, 'This is a computed attribute interpreted as a single-precision 4d quaternion', {}, True, None, False, ''), ('outputs:a_quath', 'quath', 0, None, 'This is a computed attribute interpreted as a half-precision 4d quaternion', {}, True, None, False, ''), ('outputs:a_texcoord2d', 'texCoord2d', 0, None, 'This is a computed attribute interpreted as a double-precision 2d texcoord', {}, True, None, False, ''), ('outputs:a_texcoord2f', 'texCoord2f', 0, None, 'This is a computed attribute interpreted as a single-precision 2d texcoord', {}, True, None, False, ''), ('outputs:a_texcoord2h', 'texCoord2h', 0, None, 'This is a computed attribute interpreted as a half-precision 2d texcoord', {}, True, None, False, ''), ('outputs:a_texcoord3d', 'texCoord3d', 0, None, 'This is a computed attribute interpreted as a double-precision 3d texcoord', {}, True, None, False, ''), ('outputs:a_texcoord3f', 'texCoord3f', 0, None, 'This is a computed attribute interpreted as a single-precision 3d texcoord', {}, True, None, False, ''), ('outputs:a_texcoord3h', 'texCoord3h', 0, None, 'This is a computed attribute interpreted as a half-precision 3d texcoord', {}, True, None, False, ''), ('outputs:a_timecode', 'timecode', 0, None, 'This is a computed attribute interpreted as a timecode', {}, True, None, False, ''), ('outputs:a_vector3d', 'vector3d', 0, None, 'This is a computed attribute interpreted as a double-precision 3d vector', {}, True, None, False, ''), ('outputs:a_vector3f', 'vector3f', 0, None, 'This is a computed attribute interpreted as a single-precision 3d vector', {}, True, None, False, ''), ('outputs:a_vector3h', 'vector3h', 0, None, 'This is a computed attribute interpreted as a half-precision 3d vector', {}, 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.a_color3d = og.AttributeRole.COLOR role_data.inputs.a_color3f = og.AttributeRole.COLOR role_data.inputs.a_color3h = og.AttributeRole.COLOR role_data.inputs.a_color4d = og.AttributeRole.COLOR role_data.inputs.a_color4f = og.AttributeRole.COLOR role_data.inputs.a_color4h = og.AttributeRole.COLOR role_data.inputs.a_frame = og.AttributeRole.FRAME role_data.inputs.a_matrix2d = og.AttributeRole.MATRIX role_data.inputs.a_matrix3d = og.AttributeRole.MATRIX role_data.inputs.a_matrix4d = og.AttributeRole.MATRIX role_data.inputs.a_normal3d = og.AttributeRole.NORMAL role_data.inputs.a_normal3f = og.AttributeRole.NORMAL role_data.inputs.a_normal3h = og.AttributeRole.NORMAL role_data.inputs.a_point3d = og.AttributeRole.POSITION role_data.inputs.a_point3f = og.AttributeRole.POSITION role_data.inputs.a_point3h = og.AttributeRole.POSITION role_data.inputs.a_quatd = og.AttributeRole.QUATERNION role_data.inputs.a_quatf = og.AttributeRole.QUATERNION role_data.inputs.a_quath = og.AttributeRole.QUATERNION role_data.inputs.a_texcoord2d = og.AttributeRole.TEXCOORD role_data.inputs.a_texcoord2f = og.AttributeRole.TEXCOORD role_data.inputs.a_texcoord2h = og.AttributeRole.TEXCOORD role_data.inputs.a_texcoord3d = og.AttributeRole.TEXCOORD role_data.inputs.a_texcoord3f = og.AttributeRole.TEXCOORD role_data.inputs.a_texcoord3h = og.AttributeRole.TEXCOORD role_data.inputs.a_timecode = og.AttributeRole.TIMECODE role_data.inputs.a_vector3d = og.AttributeRole.VECTOR role_data.inputs.a_vector3f = og.AttributeRole.VECTOR role_data.inputs.a_vector3h = og.AttributeRole.VECTOR role_data.outputs.a_color3d = og.AttributeRole.COLOR role_data.outputs.a_color3f = og.AttributeRole.COLOR role_data.outputs.a_color3h = og.AttributeRole.COLOR role_data.outputs.a_color4d = og.AttributeRole.COLOR role_data.outputs.a_color4f = og.AttributeRole.COLOR role_data.outputs.a_color4h = og.AttributeRole.COLOR role_data.outputs.a_frame = og.AttributeRole.FRAME role_data.outputs.a_matrix2d = og.AttributeRole.MATRIX role_data.outputs.a_matrix3d = og.AttributeRole.MATRIX role_data.outputs.a_matrix4d = og.AttributeRole.MATRIX role_data.outputs.a_normal3d = og.AttributeRole.NORMAL role_data.outputs.a_normal3f = og.AttributeRole.NORMAL role_data.outputs.a_normal3h = og.AttributeRole.NORMAL role_data.outputs.a_point3d = og.AttributeRole.POSITION role_data.outputs.a_point3f = og.AttributeRole.POSITION role_data.outputs.a_point3h = og.AttributeRole.POSITION role_data.outputs.a_quatd = og.AttributeRole.QUATERNION role_data.outputs.a_quatf = og.AttributeRole.QUATERNION role_data.outputs.a_quath = og.AttributeRole.QUATERNION role_data.outputs.a_texcoord2d = og.AttributeRole.TEXCOORD role_data.outputs.a_texcoord2f = og.AttributeRole.TEXCOORD role_data.outputs.a_texcoord2h = og.AttributeRole.TEXCOORD role_data.outputs.a_texcoord3d = og.AttributeRole.TEXCOORD role_data.outputs.a_texcoord3f = og.AttributeRole.TEXCOORD role_data.outputs.a_texcoord3h = og.AttributeRole.TEXCOORD role_data.outputs.a_timecode = og.AttributeRole.TIMECODE role_data.outputs.a_vector3d = og.AttributeRole.VECTOR role_data.outputs.a_vector3f = og.AttributeRole.VECTOR role_data.outputs.a_vector3h = og.AttributeRole.VECTOR return role_data 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 = [] @property def a_color3d(self): data_view = og.AttributeValueHelper(self._attributes.a_color3d) return data_view.get() @a_color3d.setter def a_color3d(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_color3d) data_view = og.AttributeValueHelper(self._attributes.a_color3d) data_view.set(value) @property def a_color3f(self): data_view = og.AttributeValueHelper(self._attributes.a_color3f) return data_view.get() @a_color3f.setter def a_color3f(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_color3f) data_view = og.AttributeValueHelper(self._attributes.a_color3f) data_view.set(value) @property def a_color3h(self): data_view = og.AttributeValueHelper(self._attributes.a_color3h) return data_view.get() @a_color3h.setter def a_color3h(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_color3h) data_view = og.AttributeValueHelper(self._attributes.a_color3h) data_view.set(value) @property def a_color4d(self): data_view = og.AttributeValueHelper(self._attributes.a_color4d) return data_view.get() @a_color4d.setter def a_color4d(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_color4d) data_view = og.AttributeValueHelper(self._attributes.a_color4d) data_view.set(value) @property def a_color4f(self): data_view = og.AttributeValueHelper(self._attributes.a_color4f) return data_view.get() @a_color4f.setter def a_color4f(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_color4f) data_view = og.AttributeValueHelper(self._attributes.a_color4f) data_view.set(value) @property def a_color4h(self): data_view = og.AttributeValueHelper(self._attributes.a_color4h) return data_view.get() @a_color4h.setter def a_color4h(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_color4h) data_view = og.AttributeValueHelper(self._attributes.a_color4h) data_view.set(value) @property def a_frame(self): data_view = og.AttributeValueHelper(self._attributes.a_frame) return data_view.get() @a_frame.setter def a_frame(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_frame) data_view = og.AttributeValueHelper(self._attributes.a_frame) data_view.set(value) @property def a_matrix2d(self): data_view = og.AttributeValueHelper(self._attributes.a_matrix2d) return data_view.get() @a_matrix2d.setter def a_matrix2d(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_matrix2d) data_view = og.AttributeValueHelper(self._attributes.a_matrix2d) data_view.set(value) @property def a_matrix3d(self): data_view = og.AttributeValueHelper(self._attributes.a_matrix3d) return data_view.get() @a_matrix3d.setter def a_matrix3d(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_matrix3d) data_view = og.AttributeValueHelper(self._attributes.a_matrix3d) data_view.set(value) @property def a_matrix4d(self): data_view = og.AttributeValueHelper(self._attributes.a_matrix4d) return data_view.get() @a_matrix4d.setter def a_matrix4d(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_matrix4d) data_view = og.AttributeValueHelper(self._attributes.a_matrix4d) data_view.set(value) @property def a_normal3d(self): data_view = og.AttributeValueHelper(self._attributes.a_normal3d) return data_view.get() @a_normal3d.setter def a_normal3d(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_normal3d) data_view = og.AttributeValueHelper(self._attributes.a_normal3d) data_view.set(value) @property def a_normal3f(self): data_view = og.AttributeValueHelper(self._attributes.a_normal3f) return data_view.get() @a_normal3f.setter def a_normal3f(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_normal3f) data_view = og.AttributeValueHelper(self._attributes.a_normal3f) data_view.set(value) @property def a_normal3h(self): data_view = og.AttributeValueHelper(self._attributes.a_normal3h) return data_view.get() @a_normal3h.setter def a_normal3h(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_normal3h) data_view = og.AttributeValueHelper(self._attributes.a_normal3h) data_view.set(value) @property def a_point3d(self): data_view = og.AttributeValueHelper(self._attributes.a_point3d) return data_view.get() @a_point3d.setter def a_point3d(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_point3d) data_view = og.AttributeValueHelper(self._attributes.a_point3d) data_view.set(value) @property def a_point3f(self): data_view = og.AttributeValueHelper(self._attributes.a_point3f) return data_view.get() @a_point3f.setter def a_point3f(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_point3f) data_view = og.AttributeValueHelper(self._attributes.a_point3f) data_view.set(value) @property def a_point3h(self): data_view = og.AttributeValueHelper(self._attributes.a_point3h) return data_view.get() @a_point3h.setter def a_point3h(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_point3h) data_view = og.AttributeValueHelper(self._attributes.a_point3h) data_view.set(value) @property def a_quatd(self): data_view = og.AttributeValueHelper(self._attributes.a_quatd) return data_view.get() @a_quatd.setter def a_quatd(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_quatd) data_view = og.AttributeValueHelper(self._attributes.a_quatd) data_view.set(value) @property def a_quatf(self): data_view = og.AttributeValueHelper(self._attributes.a_quatf) return data_view.get() @a_quatf.setter def a_quatf(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_quatf) data_view = og.AttributeValueHelper(self._attributes.a_quatf) data_view.set(value) @property def a_quath(self): data_view = og.AttributeValueHelper(self._attributes.a_quath) return data_view.get() @a_quath.setter def a_quath(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_quath) data_view = og.AttributeValueHelper(self._attributes.a_quath) data_view.set(value) @property def a_texcoord2d(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord2d) return data_view.get() @a_texcoord2d.setter def a_texcoord2d(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_texcoord2d) data_view = og.AttributeValueHelper(self._attributes.a_texcoord2d) data_view.set(value) @property def a_texcoord2f(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord2f) return data_view.get() @a_texcoord2f.setter def a_texcoord2f(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_texcoord2f) data_view = og.AttributeValueHelper(self._attributes.a_texcoord2f) data_view.set(value) @property def a_texcoord2h(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord2h) return data_view.get() @a_texcoord2h.setter def a_texcoord2h(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_texcoord2h) data_view = og.AttributeValueHelper(self._attributes.a_texcoord2h) data_view.set(value) @property def a_texcoord3d(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord3d) return data_view.get() @a_texcoord3d.setter def a_texcoord3d(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_texcoord3d) data_view = og.AttributeValueHelper(self._attributes.a_texcoord3d) data_view.set(value) @property def a_texcoord3f(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord3f) return data_view.get() @a_texcoord3f.setter def a_texcoord3f(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_texcoord3f) data_view = og.AttributeValueHelper(self._attributes.a_texcoord3f) data_view.set(value) @property def a_texcoord3h(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord3h) return data_view.get() @a_texcoord3h.setter def a_texcoord3h(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_texcoord3h) data_view = og.AttributeValueHelper(self._attributes.a_texcoord3h) data_view.set(value) @property def a_timecode(self): data_view = og.AttributeValueHelper(self._attributes.a_timecode) return data_view.get() @a_timecode.setter def a_timecode(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_timecode) data_view = og.AttributeValueHelper(self._attributes.a_timecode) data_view.set(value) @property def a_vector3d(self): data_view = og.AttributeValueHelper(self._attributes.a_vector3d) return data_view.get() @a_vector3d.setter def a_vector3d(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_vector3d) data_view = og.AttributeValueHelper(self._attributes.a_vector3d) data_view.set(value) @property def a_vector3f(self): data_view = og.AttributeValueHelper(self._attributes.a_vector3f) return data_view.get() @a_vector3f.setter def a_vector3f(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_vector3f) data_view = og.AttributeValueHelper(self._attributes.a_vector3f) data_view.set(value) @property def a_vector3h(self): data_view = og.AttributeValueHelper(self._attributes.a_vector3h) return data_view.get() @a_vector3h.setter def a_vector3h(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_vector3h) data_view = og.AttributeValueHelper(self._attributes.a_vector3h) data_view.set(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._batchedWriteValues = { } @property def a_color3d(self): data_view = og.AttributeValueHelper(self._attributes.a_color3d) return data_view.get() @a_color3d.setter def a_color3d(self, value): data_view = og.AttributeValueHelper(self._attributes.a_color3d) data_view.set(value) @property def a_color3f(self): data_view = og.AttributeValueHelper(self._attributes.a_color3f) return data_view.get() @a_color3f.setter def a_color3f(self, value): data_view = og.AttributeValueHelper(self._attributes.a_color3f) data_view.set(value) @property def a_color3h(self): data_view = og.AttributeValueHelper(self._attributes.a_color3h) return data_view.get() @a_color3h.setter def a_color3h(self, value): data_view = og.AttributeValueHelper(self._attributes.a_color3h) data_view.set(value) @property def a_color4d(self): data_view = og.AttributeValueHelper(self._attributes.a_color4d) return data_view.get() @a_color4d.setter def a_color4d(self, value): data_view = og.AttributeValueHelper(self._attributes.a_color4d) data_view.set(value) @property def a_color4f(self): data_view = og.AttributeValueHelper(self._attributes.a_color4f) return data_view.get() @a_color4f.setter def a_color4f(self, value): data_view = og.AttributeValueHelper(self._attributes.a_color4f) data_view.set(value) @property def a_color4h(self): data_view = og.AttributeValueHelper(self._attributes.a_color4h) return data_view.get() @a_color4h.setter def a_color4h(self, value): data_view = og.AttributeValueHelper(self._attributes.a_color4h) data_view.set(value) @property def a_frame(self): data_view = og.AttributeValueHelper(self._attributes.a_frame) return data_view.get() @a_frame.setter def a_frame(self, value): data_view = og.AttributeValueHelper(self._attributes.a_frame) data_view.set(value) @property def a_matrix2d(self): data_view = og.AttributeValueHelper(self._attributes.a_matrix2d) return data_view.get() @a_matrix2d.setter def a_matrix2d(self, value): data_view = og.AttributeValueHelper(self._attributes.a_matrix2d) data_view.set(value) @property def a_matrix3d(self): data_view = og.AttributeValueHelper(self._attributes.a_matrix3d) return data_view.get() @a_matrix3d.setter def a_matrix3d(self, value): data_view = og.AttributeValueHelper(self._attributes.a_matrix3d) data_view.set(value) @property def a_matrix4d(self): data_view = og.AttributeValueHelper(self._attributes.a_matrix4d) return data_view.get() @a_matrix4d.setter def a_matrix4d(self, value): data_view = og.AttributeValueHelper(self._attributes.a_matrix4d) data_view.set(value) @property def a_normal3d(self): data_view = og.AttributeValueHelper(self._attributes.a_normal3d) return data_view.get() @a_normal3d.setter def a_normal3d(self, value): data_view = og.AttributeValueHelper(self._attributes.a_normal3d) data_view.set(value) @property def a_normal3f(self): data_view = og.AttributeValueHelper(self._attributes.a_normal3f) return data_view.get() @a_normal3f.setter def a_normal3f(self, value): data_view = og.AttributeValueHelper(self._attributes.a_normal3f) data_view.set(value) @property def a_normal3h(self): data_view = og.AttributeValueHelper(self._attributes.a_normal3h) return data_view.get() @a_normal3h.setter def a_normal3h(self, value): data_view = og.AttributeValueHelper(self._attributes.a_normal3h) data_view.set(value) @property def a_point3d(self): data_view = og.AttributeValueHelper(self._attributes.a_point3d) return data_view.get() @a_point3d.setter def a_point3d(self, value): data_view = og.AttributeValueHelper(self._attributes.a_point3d) data_view.set(value) @property def a_point3f(self): data_view = og.AttributeValueHelper(self._attributes.a_point3f) return data_view.get() @a_point3f.setter def a_point3f(self, value): data_view = og.AttributeValueHelper(self._attributes.a_point3f) data_view.set(value) @property def a_point3h(self): data_view = og.AttributeValueHelper(self._attributes.a_point3h) return data_view.get() @a_point3h.setter def a_point3h(self, value): data_view = og.AttributeValueHelper(self._attributes.a_point3h) data_view.set(value) @property def a_quatd(self): data_view = og.AttributeValueHelper(self._attributes.a_quatd) return data_view.get() @a_quatd.setter def a_quatd(self, value): data_view = og.AttributeValueHelper(self._attributes.a_quatd) data_view.set(value) @property def a_quatf(self): data_view = og.AttributeValueHelper(self._attributes.a_quatf) return data_view.get() @a_quatf.setter def a_quatf(self, value): data_view = og.AttributeValueHelper(self._attributes.a_quatf) data_view.set(value) @property def a_quath(self): data_view = og.AttributeValueHelper(self._attributes.a_quath) return data_view.get() @a_quath.setter def a_quath(self, value): data_view = og.AttributeValueHelper(self._attributes.a_quath) data_view.set(value) @property def a_texcoord2d(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord2d) return data_view.get() @a_texcoord2d.setter def a_texcoord2d(self, value): data_view = og.AttributeValueHelper(self._attributes.a_texcoord2d) data_view.set(value) @property def a_texcoord2f(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord2f) return data_view.get() @a_texcoord2f.setter def a_texcoord2f(self, value): data_view = og.AttributeValueHelper(self._attributes.a_texcoord2f) data_view.set(value) @property def a_texcoord2h(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord2h) return data_view.get() @a_texcoord2h.setter def a_texcoord2h(self, value): data_view = og.AttributeValueHelper(self._attributes.a_texcoord2h) data_view.set(value) @property def a_texcoord3d(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord3d) return data_view.get() @a_texcoord3d.setter def a_texcoord3d(self, value): data_view = og.AttributeValueHelper(self._attributes.a_texcoord3d) data_view.set(value) @property def a_texcoord3f(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord3f) return data_view.get() @a_texcoord3f.setter def a_texcoord3f(self, value): data_view = og.AttributeValueHelper(self._attributes.a_texcoord3f) data_view.set(value) @property def a_texcoord3h(self): data_view = og.AttributeValueHelper(self._attributes.a_texcoord3h) return data_view.get() @a_texcoord3h.setter def a_texcoord3h(self, value): data_view = og.AttributeValueHelper(self._attributes.a_texcoord3h) data_view.set(value) @property def a_timecode(self): data_view = og.AttributeValueHelper(self._attributes.a_timecode) return data_view.get() @a_timecode.setter def a_timecode(self, value): data_view = og.AttributeValueHelper(self._attributes.a_timecode) data_view.set(value) @property def a_vector3d(self): data_view = og.AttributeValueHelper(self._attributes.a_vector3d) return data_view.get() @a_vector3d.setter def a_vector3d(self, value): data_view = og.AttributeValueHelper(self._attributes.a_vector3d) data_view.set(value) @property def a_vector3f(self): data_view = og.AttributeValueHelper(self._attributes.a_vector3f) return data_view.get() @a_vector3f.setter def a_vector3f(self, value): data_view = og.AttributeValueHelper(self._attributes.a_vector3f) data_view.set(value) @property def a_vector3h(self): data_view = og.AttributeValueHelper(self._attributes.a_vector3h) return data_view.get() @a_vector3h.setter def a_vector3h(self, value): data_view = og.AttributeValueHelper(self._attributes.a_vector3h) data_view.set(value) 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 = OgnTutorialRoleDataDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialRoleDataDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialRoleDataDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
42,891
Python
46.446903
346
0.616936
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialTokensPyDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.TokensPy This is a tutorial node. It exercises the feature of providing hardcoded token values in the database after a node type has been initialized. It sets output booleans to the truth value of whether corresponding inputs appear in the hardcoded token list. """ import carb 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 OgnTutorialTokensPyDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.TokensPy Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.valuesToCheck Outputs: outputs.isColor Predefined Tokens: tokens.red tokens.green tokens.blue """ # 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:valuesToCheck', 'token[]', 0, None, 'Array of tokens that are to be checked', {}, True, [], False, ''), ('outputs:isColor', 'bool[]', 0, None, 'True values if the corresponding input value appears in the token list', {}, True, None, False, ''), ]) class tokens: red = "red" green = "green" blue = "blue" 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 = [] @property def valuesToCheck(self): data_view = og.AttributeValueHelper(self._attributes.valuesToCheck) return data_view.get() @valuesToCheck.setter def valuesToCheck(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.valuesToCheck) data_view = og.AttributeValueHelper(self._attributes.valuesToCheck) data_view.set(value) self.valuesToCheck_size = data_view.get_array_size() 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.isColor_size = None self._batchedWriteValues = { } @property def isColor(self): data_view = og.AttributeValueHelper(self._attributes.isColor) return data_view.get(reserved_element_count=self.isColor_size) @isColor.setter def isColor(self, value): data_view = og.AttributeValueHelper(self._attributes.isColor) data_view.set(value) self.isColor_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 = OgnTutorialTokensPyDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialTokensPyDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialTokensPyDatabase.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(OgnTutorialTokensPyDatabase.NODE_TYPE_CLASS, 'get_node_type', None) if callable(get_node_type_function): return get_node_type_function() return 'omni.graph.tutorials.TokensPy' @staticmethod def compute(context, node): def database_valid(): return True try: per_node_data = OgnTutorialTokensPyDatabase.PER_NODE_DATA[node.node_id()] db = per_node_data.get('_db') if db is None: db = OgnTutorialTokensPyDatabase(node) per_node_data['_db'] = db if not database_valid(): per_node_data['_db'] = None return False except: db = OgnTutorialTokensPyDatabase(node) try: compute_function = getattr(OgnTutorialTokensPyDatabase.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 OgnTutorialTokensPyDatabase.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): OgnTutorialTokensPyDatabase._initialize_per_node_data(node) initialize_function = getattr(OgnTutorialTokensPyDatabase.NODE_TYPE_CLASS, 'initialize', None) if callable(initialize_function): initialize_function(context, node) per_node_data = OgnTutorialTokensPyDatabase.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(OgnTutorialTokensPyDatabase.NODE_TYPE_CLASS, 'release', None) if callable(release_function): release_function(node) OgnTutorialTokensPyDatabase._release_per_node_data(node) @staticmethod def release_instance(node, target): OgnTutorialTokensPyDatabase._release_per_node_instance_data(node, target) @staticmethod def update_node_version(context, node, old_version, new_version): update_node_version_function = getattr(OgnTutorialTokensPyDatabase.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(OgnTutorialTokensPyDatabase.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.tutorials") node_type.set_metadata(ogn.MetadataKeys.UI_NAME, "Tutorial Python Node: Tokens") node_type.set_metadata(ogn.MetadataKeys.TOKENS, "[\"red\", \"green\", \"blue\"]") node_type.set_metadata(ogn.MetadataKeys.CATEGORIES, "tutorials") node_type.set_metadata(ogn.MetadataKeys.DESCRIPTION, "This is a tutorial node. It exercises the feature of providing hardcoded token values in the database after a node type has been initialized. It sets output booleans to the truth value of whether corresponding inputs appear in the hardcoded token list.") node_type.set_metadata(ogn.MetadataKeys.LANGUAGE, "Python") icon_path = carb.tokens.get_tokens_interface().resolve("${omni.graph.tutorials}") icon_path = icon_path + '/' + "ogn/icons/omni.graph.tutorials.TokensPy.svg" node_type.set_metadata(ogn.MetadataKeys.ICON_PATH, icon_path) OgnTutorialTokensPyDatabase.INTERFACE.add_to_node_type(node_type) @staticmethod def on_connection_type_resolve(node): on_connection_type_resolve_function = getattr(OgnTutorialTokensPyDatabase.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): OgnTutorialTokensPyDatabase.NODE_TYPE_CLASS = node_type_class og.register_node_type(OgnTutorialTokensPyDatabase.abi, 1) @staticmethod def deregister(): og.deregister_node_type("omni.graph.tutorials.TokensPy")
11,282
Python
46.407563
324
0.649885
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialStateDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.State This is a tutorial node. It makes use of internal state information to continuously increment an output. """ import carb import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialStateDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.State Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.override inputs.overrideValue Outputs: outputs.monotonic """ # 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:override', 'bool', 0, 'Enable Override', 'When true get the output from the overrideValue, otherwise use the internal value', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''), ('inputs:overrideValue', 'int64', 0, 'Override Value', "Value to use instead of the monotonically increasing internal one when 'override' is true", {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('outputs:monotonic', 'int64', 0, 'State-Based Output', 'Monotonically increasing output, set by internal state information', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, 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 = [] @property def override(self): data_view = og.AttributeValueHelper(self._attributes.override) return data_view.get() @override.setter def override(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.override) data_view = og.AttributeValueHelper(self._attributes.override) data_view.set(value) @property def overrideValue(self): data_view = og.AttributeValueHelper(self._attributes.overrideValue) return data_view.get() @overrideValue.setter def overrideValue(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.overrideValue) data_view = og.AttributeValueHelper(self._attributes.overrideValue) data_view.set(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._batchedWriteValues = { } @property def monotonic(self): data_view = og.AttributeValueHelper(self._attributes.monotonic) return data_view.get() @monotonic.setter def monotonic(self, value): data_view = og.AttributeValueHelper(self._attributes.monotonic) data_view.set(value) 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 = OgnTutorialStateDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialStateDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialStateDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
5,974
Python
47.185483
209
0.67392
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialDynamicAttributesDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.DynamicAttributes This is a C++ node that exercises the ability to add and remove database attribute accessors for dynamic attributes. When the dynamic attribute is added the property will exist and be able to get/set the attribute values. When it does not the property will not exist. The dynamic attribute names are found in the tokens below. If neither exist then the input value is copied to the output directly. If 'firstBit' exists then the 'firstBit'th bit of the input is x-ored for the copy. If 'secondBit' exists then the 'secondBit'th bit of the input is x-ored for the copy. (Recall bitwise match xor(0,0)=0, xor(0,1)=1, xor(1,0)=1, and xor(1,1)=0.) For example, if 'firstBit' is present and set to 1 then the bitmask will be b0010, where bit 1 is set. If the input is 7, or b0111, then the xor operation will flip bit 1, yielding b0101, or 5 as the result. If on the next run 'secondBit' is also present and set to 2 then its bitmask will be b0100, where bit 2 is set. The input of 7 (b0111) flips bit 1 because firstBit=1 and flips bit 2 because secondBit=2, yielding a final result of 1 (b0001). """ import carb import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialDynamicAttributesDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.DynamicAttributes Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.value Outputs: outputs.result Predefined Tokens: tokens.firstBit tokens.secondBit tokens.invert """ # 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:value', 'uint', 0, None, 'Original value to be modified.', {}, True, 0, False, ''), ('outputs:result', 'uint', 0, None, 'Modified value', {}, True, None, False, ''), ]) class tokens: firstBit = "inputs:firstBit" secondBit = "inputs:secondBit" invert = "inputs:invert" 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 = [] @property def value(self): data_view = og.AttributeValueHelper(self._attributes.value) return data_view.get() @value.setter def value(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.value) data_view = og.AttributeValueHelper(self._attributes.value) data_view.set(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._batchedWriteValues = { } @property def result(self): data_view = og.AttributeValueHelper(self._attributes.result) return data_view.get() @result.setter def result(self, value): data_view = og.AttributeValueHelper(self._attributes.result) data_view.set(value) 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 = OgnTutorialDynamicAttributesDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialDynamicAttributesDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialDynamicAttributesDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
6,314
Python
48.335937
128
0.684194
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialDefaultsDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.Defaults This is a tutorial node. It will move the values of inputs to corresponding outputs. Inputs all have unspecified, and therefore empty, default values. """ import carb import numpy import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialDefaultsDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.Defaults Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.a_array inputs.a_bool inputs.a_double inputs.a_float inputs.a_half inputs.a_int inputs.a_int2 inputs.a_int64 inputs.a_matrix inputs.a_string inputs.a_token inputs.a_uchar inputs.a_uint inputs.a_uint64 Outputs: outputs.a_array outputs.a_bool outputs.a_double outputs.a_float outputs.a_half outputs.a_int outputs.a_int2 outputs.a_int64 outputs.a_matrix outputs.a_string outputs.a_token outputs.a_uchar outputs.a_uint outputs.a_uint64 """ # 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:a_array', 'float[]', 0, None, 'This is an attribute of type array of floats', {}, True, [], False, ''), ('inputs:a_bool', 'bool', 0, None, 'This is an attribute of type boolean', {}, True, False, False, ''), ('inputs:a_double', 'double', 0, None, 'This is an attribute of type 64 bit floating point', {}, True, 0.0, False, ''), ('inputs:a_float', 'float', 0, None, 'This is an attribute of type 32 bit floating point', {}, True, 0.0, False, ''), ('inputs:a_half', 'half', 0, None, 'This is an attribute of type 16 bit floating point', {}, True, 0.0, False, ''), ('inputs:a_int', 'int', 0, None, 'This is an attribute of type 32 bit integer', {}, True, 0, False, ''), ('inputs:a_int2', 'int2', 0, None, 'This is an attribute of type 2-tuple of integers', {}, True, [0, 0], False, ''), ('inputs:a_int64', 'int64', 0, None, 'This is an attribute of type 64 bit integer', {}, True, 0, False, ''), ('inputs:a_matrix', 'matrix2d', 0, None, 'This is an attribute of type 2x2 matrix', {}, True, [[1.0, 0.0], [0.0, 1.0]], False, ''), ('inputs:a_string', 'string', 0, None, 'This is an attribute of type string', {}, True, "", False, ''), ('inputs:a_token', 'token', 0, None, 'This is an attribute of type interned string with fast comparison and hashing', {}, True, "", False, ''), ('inputs:a_uchar', 'uchar', 0, None, 'This is an attribute of type unsigned 8 bit integer', {}, True, 0, False, ''), ('inputs:a_uint', 'uint', 0, None, 'This is an attribute of type unsigned 32 bit integer', {}, True, 0, False, ''), ('inputs:a_uint64', 'uint64', 0, None, 'This is an attribute of type unsigned 64 bit integer', {}, True, 0, False, ''), ('outputs:a_array', 'float[]', 0, None, 'This is a computed attribute of type array of floats', {}, True, None, False, ''), ('outputs:a_bool', 'bool', 0, None, 'This is a computed attribute of type boolean', {}, True, None, False, ''), ('outputs:a_double', 'double', 0, None, 'This is a computed attribute of type 64 bit floating point', {}, True, None, False, ''), ('outputs:a_float', 'float', 0, None, 'This is a computed attribute of type 32 bit floating point', {}, True, None, False, ''), ('outputs:a_half', 'half', 0, None, 'This is a computed attribute of type 16 bit floating point', {}, True, None, False, ''), ('outputs:a_int', 'int', 0, None, 'This is a computed attribute of type 32 bit integer', {}, True, None, False, ''), ('outputs:a_int2', 'int2', 0, None, 'This is a computed attribute of type 2-tuple of integers', {}, True, None, False, ''), ('outputs:a_int64', 'int64', 0, None, 'This is a computed attribute of type 64 bit integer', {}, True, None, False, ''), ('outputs:a_matrix', 'matrix2d', 0, None, 'This is a computed attribute of type 2x2 matrix', {}, True, None, False, ''), ('outputs:a_string', 'string', 0, None, 'This is a computed attribute of type string', {}, True, None, False, ''), ('outputs:a_token', 'token', 0, None, 'This is a computed attribute of type interned string with fast comparison and hashing', {}, True, None, False, ''), ('outputs:a_uchar', 'uchar', 0, None, 'This is a computed attribute of type unsigned 8 bit integer', {}, True, None, False, ''), ('outputs:a_uint', 'uint', 0, None, 'This is a computed attribute of type unsigned 32 bit integer', {}, True, None, False, ''), ('outputs:a_uint64', 'uint64', 0, None, 'This is a computed attribute of type unsigned 64 bit integer', {}, 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.a_matrix = og.AttributeRole.MATRIX role_data.inputs.a_string = og.AttributeRole.TEXT role_data.outputs.a_matrix = og.AttributeRole.MATRIX role_data.outputs.a_string = og.AttributeRole.TEXT return role_data 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 = [] @property def a_array(self): data_view = og.AttributeValueHelper(self._attributes.a_array) return data_view.get() @a_array.setter def a_array(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_array) data_view = og.AttributeValueHelper(self._attributes.a_array) data_view.set(value) self.a_array_size = data_view.get_array_size() @property def a_bool(self): data_view = og.AttributeValueHelper(self._attributes.a_bool) return data_view.get() @a_bool.setter def a_bool(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_bool) data_view = og.AttributeValueHelper(self._attributes.a_bool) data_view.set(value) @property def a_double(self): data_view = og.AttributeValueHelper(self._attributes.a_double) return data_view.get() @a_double.setter def a_double(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_double) data_view = og.AttributeValueHelper(self._attributes.a_double) data_view.set(value) @property def a_float(self): data_view = og.AttributeValueHelper(self._attributes.a_float) return data_view.get() @a_float.setter def a_float(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_float) data_view = og.AttributeValueHelper(self._attributes.a_float) data_view.set(value) @property def a_half(self): data_view = og.AttributeValueHelper(self._attributes.a_half) return data_view.get() @a_half.setter def a_half(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_half) data_view = og.AttributeValueHelper(self._attributes.a_half) data_view.set(value) @property def a_int(self): data_view = og.AttributeValueHelper(self._attributes.a_int) return data_view.get() @a_int.setter def a_int(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_int) data_view = og.AttributeValueHelper(self._attributes.a_int) data_view.set(value) @property def a_int2(self): data_view = og.AttributeValueHelper(self._attributes.a_int2) return data_view.get() @a_int2.setter def a_int2(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_int2) data_view = og.AttributeValueHelper(self._attributes.a_int2) data_view.set(value) @property def a_int64(self): data_view = og.AttributeValueHelper(self._attributes.a_int64) return data_view.get() @a_int64.setter def a_int64(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_int64) data_view = og.AttributeValueHelper(self._attributes.a_int64) data_view.set(value) @property def a_matrix(self): data_view = og.AttributeValueHelper(self._attributes.a_matrix) return data_view.get() @a_matrix.setter def a_matrix(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_matrix) data_view = og.AttributeValueHelper(self._attributes.a_matrix) data_view.set(value) @property def a_string(self): data_view = og.AttributeValueHelper(self._attributes.a_string) return data_view.get() @a_string.setter def a_string(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_string) data_view = og.AttributeValueHelper(self._attributes.a_string) data_view.set(value) self.a_string_size = data_view.get_array_size() @property def a_token(self): data_view = og.AttributeValueHelper(self._attributes.a_token) return data_view.get() @a_token.setter def a_token(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_token) data_view = og.AttributeValueHelper(self._attributes.a_token) data_view.set(value) @property def a_uchar(self): data_view = og.AttributeValueHelper(self._attributes.a_uchar) return data_view.get() @a_uchar.setter def a_uchar(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_uchar) data_view = og.AttributeValueHelper(self._attributes.a_uchar) data_view.set(value) @property def a_uint(self): data_view = og.AttributeValueHelper(self._attributes.a_uint) return data_view.get() @a_uint.setter def a_uint(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_uint) data_view = og.AttributeValueHelper(self._attributes.a_uint) data_view.set(value) @property def a_uint64(self): data_view = og.AttributeValueHelper(self._attributes.a_uint64) return data_view.get() @a_uint64.setter def a_uint64(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_uint64) data_view = og.AttributeValueHelper(self._attributes.a_uint64) data_view.set(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.a_array_size = None self.a_string_size = None self._batchedWriteValues = { } @property def a_array(self): data_view = og.AttributeValueHelper(self._attributes.a_array) return data_view.get(reserved_element_count=self.a_array_size) @a_array.setter def a_array(self, value): data_view = og.AttributeValueHelper(self._attributes.a_array) data_view.set(value) self.a_array_size = data_view.get_array_size() @property def a_bool(self): data_view = og.AttributeValueHelper(self._attributes.a_bool) return data_view.get() @a_bool.setter def a_bool(self, value): data_view = og.AttributeValueHelper(self._attributes.a_bool) data_view.set(value) @property def a_double(self): data_view = og.AttributeValueHelper(self._attributes.a_double) return data_view.get() @a_double.setter def a_double(self, value): data_view = og.AttributeValueHelper(self._attributes.a_double) data_view.set(value) @property def a_float(self): data_view = og.AttributeValueHelper(self._attributes.a_float) return data_view.get() @a_float.setter def a_float(self, value): data_view = og.AttributeValueHelper(self._attributes.a_float) data_view.set(value) @property def a_half(self): data_view = og.AttributeValueHelper(self._attributes.a_half) return data_view.get() @a_half.setter def a_half(self, value): data_view = og.AttributeValueHelper(self._attributes.a_half) data_view.set(value) @property def a_int(self): data_view = og.AttributeValueHelper(self._attributes.a_int) return data_view.get() @a_int.setter def a_int(self, value): data_view = og.AttributeValueHelper(self._attributes.a_int) data_view.set(value) @property def a_int2(self): data_view = og.AttributeValueHelper(self._attributes.a_int2) return data_view.get() @a_int2.setter def a_int2(self, value): data_view = og.AttributeValueHelper(self._attributes.a_int2) data_view.set(value) @property def a_int64(self): data_view = og.AttributeValueHelper(self._attributes.a_int64) return data_view.get() @a_int64.setter def a_int64(self, value): data_view = og.AttributeValueHelper(self._attributes.a_int64) data_view.set(value) @property def a_matrix(self): data_view = og.AttributeValueHelper(self._attributes.a_matrix) return data_view.get() @a_matrix.setter def a_matrix(self, value): data_view = og.AttributeValueHelper(self._attributes.a_matrix) data_view.set(value) @property def a_string(self): data_view = og.AttributeValueHelper(self._attributes.a_string) return data_view.get(reserved_element_count=self.a_string_size) @a_string.setter def a_string(self, value): data_view = og.AttributeValueHelper(self._attributes.a_string) data_view.set(value) self.a_string_size = data_view.get_array_size() @property def a_token(self): data_view = og.AttributeValueHelper(self._attributes.a_token) return data_view.get() @a_token.setter def a_token(self, value): data_view = og.AttributeValueHelper(self._attributes.a_token) data_view.set(value) @property def a_uchar(self): data_view = og.AttributeValueHelper(self._attributes.a_uchar) return data_view.get() @a_uchar.setter def a_uchar(self, value): data_view = og.AttributeValueHelper(self._attributes.a_uchar) data_view.set(value) @property def a_uint(self): data_view = og.AttributeValueHelper(self._attributes.a_uint) return data_view.get() @a_uint.setter def a_uint(self, value): data_view = og.AttributeValueHelper(self._attributes.a_uint) data_view.set(value) @property def a_uint64(self): data_view = og.AttributeValueHelper(self._attributes.a_uint64) return data_view.get() @a_uint64.setter def a_uint64(self, value): data_view = og.AttributeValueHelper(self._attributes.a_uint64) data_view.set(value) 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 = OgnTutorialDefaultsDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialDefaultsDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialDefaultsDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
19,763
Python
41.412017
162
0.601882
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialTupleDataDatabase.py
"""Support for simplified access to data on nodes of type omni.tutorials.TupleData This is a tutorial node. It creates both an input and output attribute of some of the supported tuple types. The values are modified in a simple way so that the compute can be tested. """ import carb import numpy import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialTupleDataDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.tutorials.TupleData Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.a_double2 inputs.a_double3 inputs.a_float2 inputs.a_float3 inputs.a_half2 inputs.a_int2 Outputs: outputs.a_double2 outputs.a_double3 outputs.a_float2 outputs.a_float3 outputs.a_half2 outputs.a_int2 """ # 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:a_double2', 'double2', 0, None, 'This is an attribute with two double values', {ogn.MetadataKeys.DEFAULT: '[1.1, 2.2]'}, True, [1.1, 2.2], False, ''), ('inputs:a_double3', 'double3', 0, None, 'This is an attribute with three double values', {ogn.MetadataKeys.DEFAULT: '[1.1, 2.2, 3.3]'}, True, [1.1, 2.2, 3.3], False, ''), ('inputs:a_float2', 'float2', 0, None, 'This is an attribute with two float values', {ogn.MetadataKeys.DEFAULT: '[4.4, 5.5]'}, True, [4.4, 5.5], False, ''), ('inputs:a_float3', 'float3', 0, None, 'This is an attribute with three float values', {ogn.MetadataKeys.DEFAULT: '[6.6, 7.7, 8.8]'}, True, [6.6, 7.7, 8.8], False, ''), ('inputs:a_half2', 'half2', 0, None, 'This is an attribute with two 16-bit float values', {ogn.MetadataKeys.DEFAULT: '[7.0, 8.0]'}, True, [7.0, 8.0], False, ''), ('inputs:a_int2', 'int2', 0, None, 'This is an attribute with two 32-bit integer values', {ogn.MetadataKeys.DEFAULT: '[10, 11]'}, True, [10, 11], False, ''), ('outputs:a_double2', 'double2', 0, None, 'This is a computed attribute with two double values', {}, True, None, False, ''), ('outputs:a_double3', 'double3', 0, None, 'This is a computed attribute with three double values', {}, True, None, False, ''), ('outputs:a_float2', 'float2', 0, None, 'This is a computed attribute with two float values', {}, True, None, False, ''), ('outputs:a_float3', 'float3', 0, None, 'This is a computed attribute with three float values', {}, True, None, False, ''), ('outputs:a_half2', 'half2', 0, None, 'This is a computed attribute with two 16-bit float values', {}, True, None, False, ''), ('outputs:a_int2', 'int2', 0, None, 'This is a computed attribute with two 32-bit integer values', {}, 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 = [] @property def a_double2(self): data_view = og.AttributeValueHelper(self._attributes.a_double2) return data_view.get() @a_double2.setter def a_double2(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_double2) data_view = og.AttributeValueHelper(self._attributes.a_double2) data_view.set(value) @property def a_double3(self): data_view = og.AttributeValueHelper(self._attributes.a_double3) return data_view.get() @a_double3.setter def a_double3(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_double3) data_view = og.AttributeValueHelper(self._attributes.a_double3) data_view.set(value) @property def a_float2(self): data_view = og.AttributeValueHelper(self._attributes.a_float2) return data_view.get() @a_float2.setter def a_float2(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_float2) data_view = og.AttributeValueHelper(self._attributes.a_float2) data_view.set(value) @property def a_float3(self): data_view = og.AttributeValueHelper(self._attributes.a_float3) return data_view.get() @a_float3.setter def a_float3(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_float3) data_view = og.AttributeValueHelper(self._attributes.a_float3) data_view.set(value) @property def a_half2(self): data_view = og.AttributeValueHelper(self._attributes.a_half2) return data_view.get() @a_half2.setter def a_half2(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_half2) data_view = og.AttributeValueHelper(self._attributes.a_half2) data_view.set(value) @property def a_int2(self): data_view = og.AttributeValueHelper(self._attributes.a_int2) return data_view.get() @a_int2.setter def a_int2(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_int2) data_view = og.AttributeValueHelper(self._attributes.a_int2) data_view.set(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._batchedWriteValues = { } @property def a_double2(self): data_view = og.AttributeValueHelper(self._attributes.a_double2) return data_view.get() @a_double2.setter def a_double2(self, value): data_view = og.AttributeValueHelper(self._attributes.a_double2) data_view.set(value) @property def a_double3(self): data_view = og.AttributeValueHelper(self._attributes.a_double3) return data_view.get() @a_double3.setter def a_double3(self, value): data_view = og.AttributeValueHelper(self._attributes.a_double3) data_view.set(value) @property def a_float2(self): data_view = og.AttributeValueHelper(self._attributes.a_float2) return data_view.get() @a_float2.setter def a_float2(self, value): data_view = og.AttributeValueHelper(self._attributes.a_float2) data_view.set(value) @property def a_float3(self): data_view = og.AttributeValueHelper(self._attributes.a_float3) return data_view.get() @a_float3.setter def a_float3(self, value): data_view = og.AttributeValueHelper(self._attributes.a_float3) data_view.set(value) @property def a_half2(self): data_view = og.AttributeValueHelper(self._attributes.a_half2) return data_view.get() @a_half2.setter def a_half2(self, value): data_view = og.AttributeValueHelper(self._attributes.a_half2) data_view.set(value) @property def a_int2(self): data_view = og.AttributeValueHelper(self._attributes.a_int2) return data_view.get() @a_int2.setter def a_int2(self, value): data_view = og.AttributeValueHelper(self._attributes.a_int2) data_view.set(value) 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 = OgnTutorialTupleDataDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialTupleDataDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialTupleDataDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
10,851
Python
43.842975
179
0.625933
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialExtendedTypesPyDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.ExtendedTypesPy This is a tutorial node. It exercises functionality for the manipulation of the extended attribute types. It is identical to OgnTutorialExtendedTypes.ogn, except the language of implementation is selected to be python. """ from typing import Any import carb 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 OgnTutorialExtendedTypesPyDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.ExtendedTypesPy Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.flexible inputs.floatOrToken inputs.toNegate inputs.tuple Outputs: outputs.doubledResult outputs.flexible outputs.negatedResult outputs.tuple """ # 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:flexible', 'float[3][],token', 1, 'Flexible Values', 'Flexible data type input', {}, True, None, False, ''), ('inputs:floatOrToken', 'float,token', 1, 'Float Or Token', 'Attribute that can either be a float value or a token value', {}, True, None, False, ''), ('inputs:toNegate', 'bool[],float[]', 1, 'To Negate', 'Attribute that can either be an array of booleans or an array of floats', {}, True, None, False, ''), ('inputs:tuple', 'any', 2, 'Tuple Values', 'Variable size/type tuple values', {}, True, None, False, ''), ('outputs:doubledResult', 'any', 2, 'Doubled Input Value', "If the input 'floatOrToken' is a float this is 2x the value.\nIf it is a token this contains the input token repeated twice.", {}, True, None, False, ''), ('outputs:flexible', 'float[3][],token', 1, 'Inverted Flexible Values', 'Flexible data type output', {}, True, None, False, ''), ('outputs:negatedResult', 'bool[],float[]', 1, 'Negated Array Values', "Result of negating the data from the 'toNegate' input", {}, True, None, False, ''), ('outputs:tuple', 'any', 2, 'Negative Tuple Values', 'Negated values of the tuple input', {}, 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 = [] @property def flexible(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute inputs.flexible""" return og.RuntimeAttribute(self._attributes.flexible.get_attribute_data(), self._context, True) @flexible.setter def flexible(self, value_to_set: Any): """Assign another attribute's value to outputs.flexible""" if isinstance(value_to_set, og.RuntimeAttribute): self.flexible.value = value_to_set.value else: self.flexible.value = value_to_set @property def floatOrToken(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute inputs.floatOrToken""" return og.RuntimeAttribute(self._attributes.floatOrToken.get_attribute_data(), self._context, True) @floatOrToken.setter def floatOrToken(self, value_to_set: Any): """Assign another attribute's value to outputs.floatOrToken""" if isinstance(value_to_set, og.RuntimeAttribute): self.floatOrToken.value = value_to_set.value else: self.floatOrToken.value = value_to_set @property def toNegate(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute inputs.toNegate""" return og.RuntimeAttribute(self._attributes.toNegate.get_attribute_data(), self._context, True) @toNegate.setter def toNegate(self, value_to_set: Any): """Assign another attribute's value to outputs.toNegate""" if isinstance(value_to_set, og.RuntimeAttribute): self.toNegate.value = value_to_set.value else: self.toNegate.value = value_to_set @property def tuple(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute inputs.tuple""" return og.RuntimeAttribute(self._attributes.tuple.get_attribute_data(), self._context, True) @tuple.setter def tuple(self, value_to_set: Any): """Assign another attribute's value to outputs.tuple""" if isinstance(value_to_set, og.RuntimeAttribute): self.tuple.value = value_to_set.value else: self.tuple.value = value_to_set 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 = { } @property def doubledResult(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute outputs.doubledResult""" return og.RuntimeAttribute(self._attributes.doubledResult.get_attribute_data(), self._context, False) @doubledResult.setter def doubledResult(self, value_to_set: Any): """Assign another attribute's value to outputs.doubledResult""" if isinstance(value_to_set, og.RuntimeAttribute): self.doubledResult.value = value_to_set.value else: self.doubledResult.value = value_to_set @property def flexible(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute outputs.flexible""" return og.RuntimeAttribute(self._attributes.flexible.get_attribute_data(), self._context, False) @flexible.setter def flexible(self, value_to_set: Any): """Assign another attribute's value to outputs.flexible""" if isinstance(value_to_set, og.RuntimeAttribute): self.flexible.value = value_to_set.value else: self.flexible.value = value_to_set @property def negatedResult(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute outputs.negatedResult""" return og.RuntimeAttribute(self._attributes.negatedResult.get_attribute_data(), self._context, False) @negatedResult.setter def negatedResult(self, value_to_set: Any): """Assign another attribute's value to outputs.negatedResult""" if isinstance(value_to_set, og.RuntimeAttribute): self.negatedResult.value = value_to_set.value else: self.negatedResult.value = value_to_set @property def tuple(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute outputs.tuple""" return og.RuntimeAttribute(self._attributes.tuple.get_attribute_data(), self._context, False) @tuple.setter def tuple(self, value_to_set: Any): """Assign another attribute's value to outputs.tuple""" if isinstance(value_to_set, og.RuntimeAttribute): self.tuple.value = value_to_set.value else: self.tuple.value = value_to_set 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 = OgnTutorialExtendedTypesPyDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialExtendedTypesPyDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialExtendedTypesPyDatabase.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(OgnTutorialExtendedTypesPyDatabase.NODE_TYPE_CLASS, 'get_node_type', None) if callable(get_node_type_function): return get_node_type_function() return 'omni.graph.tutorials.ExtendedTypesPy' @staticmethod def compute(context, node): def database_valid(): return True try: per_node_data = OgnTutorialExtendedTypesPyDatabase.PER_NODE_DATA[node.node_id()] db = per_node_data.get('_db') if db is None: db = OgnTutorialExtendedTypesPyDatabase(node) per_node_data['_db'] = db if not database_valid(): per_node_data['_db'] = None return False except: db = OgnTutorialExtendedTypesPyDatabase(node) try: compute_function = getattr(OgnTutorialExtendedTypesPyDatabase.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 OgnTutorialExtendedTypesPyDatabase.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): OgnTutorialExtendedTypesPyDatabase._initialize_per_node_data(node) initialize_function = getattr(OgnTutorialExtendedTypesPyDatabase.NODE_TYPE_CLASS, 'initialize', None) if callable(initialize_function): initialize_function(context, node) per_node_data = OgnTutorialExtendedTypesPyDatabase.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(OgnTutorialExtendedTypesPyDatabase.NODE_TYPE_CLASS, 'release', None) if callable(release_function): release_function(node) OgnTutorialExtendedTypesPyDatabase._release_per_node_data(node) @staticmethod def release_instance(node, target): OgnTutorialExtendedTypesPyDatabase._release_per_node_instance_data(node, target) @staticmethod def update_node_version(context, node, old_version, new_version): update_node_version_function = getattr(OgnTutorialExtendedTypesPyDatabase.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(OgnTutorialExtendedTypesPyDatabase.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.tutorials") node_type.set_metadata(ogn.MetadataKeys.UI_NAME, "Tutorial Python Node: Extended Attribute Types") node_type.set_metadata(ogn.MetadataKeys.CATEGORIES, "tutorials") node_type.set_metadata(ogn.MetadataKeys.DESCRIPTION, "This is a tutorial node. It exercises functionality for the manipulation of the extended attribute types. It is identical to OgnTutorialExtendedTypes.ogn, except the language of implementation is selected to be python.") node_type.set_metadata(ogn.MetadataKeys.LANGUAGE, "Python") icon_path = carb.tokens.get_tokens_interface().resolve("${omni.graph.tutorials}") icon_path = icon_path + '/' + "ogn/icons/omni.graph.tutorials.ExtendedTypesPy.svg" node_type.set_metadata(ogn.MetadataKeys.ICON_PATH, icon_path) OgnTutorialExtendedTypesPyDatabase.INTERFACE.add_to_node_type(node_type) @staticmethod def on_connection_type_resolve(node): on_connection_type_resolve_function = getattr(OgnTutorialExtendedTypesPyDatabase.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): OgnTutorialExtendedTypesPyDatabase.NODE_TYPE_CLASS = node_type_class og.register_node_type(OgnTutorialExtendedTypesPyDatabase.abi, 1) @staticmethod def deregister(): og.deregister_node_type("omni.graph.tutorials.ExtendedTypesPy")
16,110
Python
49.823344
290
0.646369
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialCpuGpuExtendedDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.CpuGpuExtended This is a tutorial node. It exercises functionality for accessing data in extended attributes that are on the GPU as well as those whose CPU/GPU location is decided at runtime. The compute adds the two inputs 'gpuData' and 'cpuData' together, placing the result in `cpuGpuSum`, whose memory location is determined by the 'gpu' flag. This node is identical to OgnTutorialCpuGpuExtendedPy.ogn, except is is implemented in C++. """ from typing import Any import carb import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialCpuGpuExtendedDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.CpuGpuExtended Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.cpuData inputs.gpu inputs.gpuData Outputs: outputs.cpuGpuSum """ # 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:cpuData', 'any', 2, 'CPU Input Attribute', 'Input attribute whose data always lives on the CPU', {}, True, None, False, ''), ('inputs:gpu', 'bool', 0, 'Results To GPU', 'If true then put the sum on the GPU, otherwise put it on the CPU', {}, True, False, False, ''), ('inputs:gpuData', 'any', 2, 'GPU Input Attribute', 'Input attribute whose data always lives on the GPU', {ogn.MetadataKeys.MEMORY_TYPE: 'cuda'}, True, None, False, ''), ('outputs:cpuGpuSum', 'any', 2, 'Sum', "This is the attribute with the selected data. If the 'gpu' attribute is set to true then this\nattribute's contents will be entirely on the GPU, otherwise it will be on the CPU.", {ogn.MetadataKeys.MEMORY_TYPE: 'any'}, 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 = [] @property def cpuData(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute inputs.cpuData""" return og.RuntimeAttribute(self._attributes.cpuData.get_attribute_data(), self._context, True) @cpuData.setter def cpuData(self, value_to_set: Any): """Assign another attribute's value to outputs.cpuData""" if isinstance(value_to_set, og.RuntimeAttribute): self.cpuData.value = value_to_set.value else: self.cpuData.value = value_to_set @property def gpu(self): data_view = og.AttributeValueHelper(self._attributes.gpu) return data_view.get() @gpu.setter def gpu(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.gpu) data_view = og.AttributeValueHelper(self._attributes.gpu) data_view.set(value) @property def gpuData(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute inputs.gpuData""" return og.RuntimeAttribute(self._attributes.gpuData.get_attribute_data(), self._context, True) @gpuData.setter def gpuData(self, value_to_set: Any): """Assign another attribute's value to outputs.gpuData""" if isinstance(value_to_set, og.RuntimeAttribute): self.gpuData.value = value_to_set.value else: self.gpuData.value = value_to_set 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 = { } @property def cpuGpuSum(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute outputs.cpuGpuSum""" return og.RuntimeAttribute(self._attributes.cpuGpuSum.get_attribute_data(), self._context, False) @cpuGpuSum.setter def cpuGpuSum(self, value_to_set: Any): """Assign another attribute's value to outputs.cpuGpuSum""" if isinstance(value_to_set, og.RuntimeAttribute): self.cpuGpuSum.value = value_to_set.value else: self.cpuGpuSum.value = value_to_set 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 = OgnTutorialCpuGpuExtendedDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialCpuGpuExtendedDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialCpuGpuExtendedDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
7,494
Python
49.986394
290
0.667734
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialSimpleDataDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.SimpleData This is a tutorial node. It creates both an input and output attribute of every simple supported data type. The values are modified in a simple way so that the compute modifies values. """ import carb import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialSimpleDataDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.SimpleData Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.a_bool inputs.a_constant_input inputs.a_double inputs.a_float inputs.a_half inputs.a_int inputs.a_int64 inputs.a_objectId inputs.a_path inputs.a_string inputs.a_token inputs.unsigned_a_uchar inputs.unsigned_a_uint inputs.unsigned_a_uint64 Outputs: outputs.a_bool outputs.a_double outputs.a_float outputs.a_half outputs.a_int outputs.a_int64 outputs.a_objectId outputs.a_path outputs.a_string outputs.a_token outputs.unsigned_a_uchar outputs.unsigned_a_uint outputs.unsigned_a_uint64 """ # 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:a_bool', 'bool', 0, 'Sample Boolean Input', 'This is an attribute of type boolean', {ogn.MetadataKeys.DEFAULT: 'true'}, True, True, False, ''), ('inputs:a_constant_input', 'int', 0, None, 'This is an input attribute whose value can be set but can only be connected as a source.', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, 0, False, ''), ('inputs:a_double', 'double', 0, None, 'This is an attribute of type 64 bit floating point', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_float', 'float', 0, None, 'This is an attribute of type 32 bit floating point', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_half', 'half', 0, 'Sample Half Precision Input', 'This is an attribute of type 16 bit float', {ogn.MetadataKeys.DEFAULT: '0.0'}, True, 0.0, False, ''), ('inputs:a_int', 'int', 0, None, 'This is an attribute of type 32 bit integer', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_int64', 'int64', 0, None, 'This is an attribute of type 64 bit integer', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_objectId', 'objectId', 0, None, 'This is an attribute of type objectId', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_path', 'path', 0, None, 'This is an attribute of type path', {ogn.MetadataKeys.DEFAULT: '""'}, True, "", False, ''), ('inputs:a_string', 'string', 0, None, 'This is an attribute of type string', {ogn.MetadataKeys.DEFAULT: '"helloString"'}, True, "helloString", False, ''), ('inputs:a_token', 'token', 0, None, 'This is an attribute of type interned string with fast comparison and hashing', {ogn.MetadataKeys.DEFAULT: '"helloToken"'}, True, "helloToken", False, ''), ('inputs:unsigned:a_uchar', 'uchar', 0, None, 'This is an attribute of type unsigned 8 bit integer', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:unsigned:a_uint', 'uint', 0, None, 'This is an attribute of type unsigned 32 bit integer', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:unsigned:a_uint64', 'uint64', 0, None, 'This is an attribute of type unsigned 64 bit integer', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('outputs:a_bool', 'bool', 0, 'Sample Boolean Output', 'This is a computed attribute of type boolean', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''), ('outputs:a_double', 'double', 0, None, 'This is a computed attribute of type 64 bit floating point', {ogn.MetadataKeys.DEFAULT: '5.0'}, True, 5.0, False, ''), ('outputs:a_float', 'float', 0, None, 'This is a computed attribute of type 32 bit floating point', {ogn.MetadataKeys.DEFAULT: '4.0'}, True, 4.0, False, ''), ('outputs:a_half', 'half', 0, 'Sample Half Precision Output', 'This is a computed attribute of type 16 bit float', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''), ('outputs:a_int', 'int', 0, None, 'This is a computed attribute of type 32 bit integer', {ogn.MetadataKeys.DEFAULT: '2'}, True, 2, False, ''), ('outputs:a_int64', 'int64', 0, None, 'This is a computed attribute of type 64 bit integer', {ogn.MetadataKeys.DEFAULT: '3'}, True, 3, False, ''), ('outputs:a_objectId', 'objectId', 0, None, 'This is a computed attribute of type objectId', {ogn.MetadataKeys.DEFAULT: '8'}, True, 8, False, ''), ('outputs:a_path', 'path', 0, None, 'This is a computed attribute of type path', {ogn.MetadataKeys.DEFAULT: '"/"'}, True, "/", False, ''), ('outputs:a_string', 'string', 0, None, 'This is a computed attribute of type string', {ogn.MetadataKeys.DEFAULT: '"seven"'}, True, "seven", False, ''), ('outputs:a_token', 'token', 0, None, 'This is a computed attribute of type interned string with fast comparison and hashing', {ogn.MetadataKeys.DEFAULT: '"six"'}, True, "six", False, ''), ('outputs:unsigned:a_uchar', 'uchar', 0, None, 'This is a computed attribute of type unsigned 8 bit integer', {ogn.MetadataKeys.DEFAULT: '9'}, True, 9, False, ''), ('outputs:unsigned:a_uint', 'uint', 0, None, 'This is a computed attribute of type unsigned 32 bit integer', {ogn.MetadataKeys.DEFAULT: '10'}, True, 10, False, ''), ('outputs:unsigned:a_uint64', 'uint64', 0, None, 'This is a computed attribute of type unsigned 64 bit integer', {ogn.MetadataKeys.DEFAULT: '11'}, True, 11, 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.a_objectId = og.AttributeRole.OBJECT_ID role_data.inputs.a_path = og.AttributeRole.PATH role_data.inputs.a_string = og.AttributeRole.TEXT role_data.outputs.a_objectId = og.AttributeRole.OBJECT_ID role_data.outputs.a_path = og.AttributeRole.PATH role_data.outputs.a_string = og.AttributeRole.TEXT return role_data 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 = [] @property def a_bool(self): data_view = og.AttributeValueHelper(self._attributes.a_bool) return data_view.get() @a_bool.setter def a_bool(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_bool) data_view = og.AttributeValueHelper(self._attributes.a_bool) data_view.set(value) @property def a_constant_input(self): data_view = og.AttributeValueHelper(self._attributes.a_constant_input) return data_view.get() @a_constant_input.setter def a_constant_input(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_constant_input) data_view = og.AttributeValueHelper(self._attributes.a_constant_input) data_view.set(value) @property def a_double(self): data_view = og.AttributeValueHelper(self._attributes.a_double) return data_view.get() @a_double.setter def a_double(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_double) data_view = og.AttributeValueHelper(self._attributes.a_double) data_view.set(value) @property def a_float(self): data_view = og.AttributeValueHelper(self._attributes.a_float) return data_view.get() @a_float.setter def a_float(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_float) data_view = og.AttributeValueHelper(self._attributes.a_float) data_view.set(value) @property def a_half(self): data_view = og.AttributeValueHelper(self._attributes.a_half) return data_view.get() @a_half.setter def a_half(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_half) data_view = og.AttributeValueHelper(self._attributes.a_half) data_view.set(value) @property def a_int(self): data_view = og.AttributeValueHelper(self._attributes.a_int) return data_view.get() @a_int.setter def a_int(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_int) data_view = og.AttributeValueHelper(self._attributes.a_int) data_view.set(value) @property def a_int64(self): data_view = og.AttributeValueHelper(self._attributes.a_int64) return data_view.get() @a_int64.setter def a_int64(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_int64) data_view = og.AttributeValueHelper(self._attributes.a_int64) data_view.set(value) @property def a_objectId(self): data_view = og.AttributeValueHelper(self._attributes.a_objectId) return data_view.get() @a_objectId.setter def a_objectId(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_objectId) data_view = og.AttributeValueHelper(self._attributes.a_objectId) data_view.set(value) @property def a_path(self): data_view = og.AttributeValueHelper(self._attributes.a_path) return data_view.get() @a_path.setter def a_path(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_path) data_view = og.AttributeValueHelper(self._attributes.a_path) data_view.set(value) self.a_path_size = data_view.get_array_size() @property def a_string(self): data_view = og.AttributeValueHelper(self._attributes.a_string) return data_view.get() @a_string.setter def a_string(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_string) data_view = og.AttributeValueHelper(self._attributes.a_string) data_view.set(value) self.a_string_size = data_view.get_array_size() @property def a_token(self): data_view = og.AttributeValueHelper(self._attributes.a_token) return data_view.get() @a_token.setter def a_token(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.a_token) data_view = og.AttributeValueHelper(self._attributes.a_token) data_view.set(value) @property def unsigned_a_uchar(self): data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uchar) return data_view.get() @unsigned_a_uchar.setter def unsigned_a_uchar(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.unsigned_a_uchar) data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uchar) data_view.set(value) @property def unsigned_a_uint(self): data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uint) return data_view.get() @unsigned_a_uint.setter def unsigned_a_uint(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.unsigned_a_uint) data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uint) data_view.set(value) @property def unsigned_a_uint64(self): data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uint64) return data_view.get() @unsigned_a_uint64.setter def unsigned_a_uint64(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.unsigned_a_uint64) data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uint64) data_view.set(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.a_path_size = 1 self.a_string_size = 5 self._batchedWriteValues = { } @property def a_bool(self): data_view = og.AttributeValueHelper(self._attributes.a_bool) return data_view.get() @a_bool.setter def a_bool(self, value): data_view = og.AttributeValueHelper(self._attributes.a_bool) data_view.set(value) @property def a_double(self): data_view = og.AttributeValueHelper(self._attributes.a_double) return data_view.get() @a_double.setter def a_double(self, value): data_view = og.AttributeValueHelper(self._attributes.a_double) data_view.set(value) @property def a_float(self): data_view = og.AttributeValueHelper(self._attributes.a_float) return data_view.get() @a_float.setter def a_float(self, value): data_view = og.AttributeValueHelper(self._attributes.a_float) data_view.set(value) @property def a_half(self): data_view = og.AttributeValueHelper(self._attributes.a_half) return data_view.get() @a_half.setter def a_half(self, value): data_view = og.AttributeValueHelper(self._attributes.a_half) data_view.set(value) @property def a_int(self): data_view = og.AttributeValueHelper(self._attributes.a_int) return data_view.get() @a_int.setter def a_int(self, value): data_view = og.AttributeValueHelper(self._attributes.a_int) data_view.set(value) @property def a_int64(self): data_view = og.AttributeValueHelper(self._attributes.a_int64) return data_view.get() @a_int64.setter def a_int64(self, value): data_view = og.AttributeValueHelper(self._attributes.a_int64) data_view.set(value) @property def a_objectId(self): data_view = og.AttributeValueHelper(self._attributes.a_objectId) return data_view.get() @a_objectId.setter def a_objectId(self, value): data_view = og.AttributeValueHelper(self._attributes.a_objectId) data_view.set(value) @property def a_path(self): data_view = og.AttributeValueHelper(self._attributes.a_path) return data_view.get(reserved_element_count=self.a_path_size) @a_path.setter def a_path(self, value): data_view = og.AttributeValueHelper(self._attributes.a_path) data_view.set(value) self.a_path_size = data_view.get_array_size() @property def a_string(self): data_view = og.AttributeValueHelper(self._attributes.a_string) return data_view.get(reserved_element_count=self.a_string_size) @a_string.setter def a_string(self, value): data_view = og.AttributeValueHelper(self._attributes.a_string) data_view.set(value) self.a_string_size = data_view.get_array_size() @property def a_token(self): data_view = og.AttributeValueHelper(self._attributes.a_token) return data_view.get() @a_token.setter def a_token(self, value): data_view = og.AttributeValueHelper(self._attributes.a_token) data_view.set(value) @property def unsigned_a_uchar(self): data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uchar) return data_view.get() @unsigned_a_uchar.setter def unsigned_a_uchar(self, value): data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uchar) data_view.set(value) @property def unsigned_a_uint(self): data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uint) return data_view.get() @unsigned_a_uint.setter def unsigned_a_uint(self, value): data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uint) data_view.set(value) @property def unsigned_a_uint64(self): data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uint64) return data_view.get() @unsigned_a_uint64.setter def unsigned_a_uint64(self, value): data_view = og.AttributeValueHelper(self._attributes.unsigned_a_uint64) data_view.set(value) 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 = OgnTutorialSimpleDataDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialSimpleDataDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialSimpleDataDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
20,824
Python
44.769231
201
0.618565
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialExtendedTypesDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.ExtendedTypes This is a tutorial node. It exercises functionality for the manipulation of the extended attribute types. """ from typing import Any import carb import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialExtendedTypesDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.ExtendedTypes Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.flexible inputs.floatOrToken inputs.toNegate inputs.tuple Outputs: outputs.doubledResult outputs.flexible outputs.negatedResult outputs.tuple """ # 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:flexible', 'float[3][],token', 1, 'Flexible Values', 'Flexible data type input', {}, True, None, False, ''), ('inputs:floatOrToken', 'float,token', 1, 'Float Or Token', 'Attribute that can either be a float value or a token value', {}, True, None, False, ''), ('inputs:toNegate', 'bool[],float[]', 1, 'To Negate', 'Attribute that can either be an array of booleans or an array of floats', {}, True, None, False, ''), ('inputs:tuple', 'any', 2, 'Tuple Values', 'Variable size/type tuple values', {}, True, None, False, ''), ('outputs:doubledResult', 'any', 2, 'Doubled Input Value', "If the input 'simpleInput' is a float this is 2x the value.\nIf it is a token this contains the input token repeated twice.", {}, True, None, False, ''), ('outputs:flexible', 'float[3][],token', 1, 'Inverted Flexible Values', 'Flexible data type output', {}, True, None, False, ''), ('outputs:negatedResult', 'bool[],float[]', 1, 'Negated Array Values', "Result of negating the data from the 'toNegate' input", {}, True, None, False, ''), ('outputs:tuple', 'any', 2, 'Negative Tuple Values', 'Negated values of the tuple input', {}, 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 = [] @property def flexible(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute inputs.flexible""" return og.RuntimeAttribute(self._attributes.flexible.get_attribute_data(), self._context, True) @flexible.setter def flexible(self, value_to_set: Any): """Assign another attribute's value to outputs.flexible""" if isinstance(value_to_set, og.RuntimeAttribute): self.flexible.value = value_to_set.value else: self.flexible.value = value_to_set @property def floatOrToken(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute inputs.floatOrToken""" return og.RuntimeAttribute(self._attributes.floatOrToken.get_attribute_data(), self._context, True) @floatOrToken.setter def floatOrToken(self, value_to_set: Any): """Assign another attribute's value to outputs.floatOrToken""" if isinstance(value_to_set, og.RuntimeAttribute): self.floatOrToken.value = value_to_set.value else: self.floatOrToken.value = value_to_set @property def toNegate(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute inputs.toNegate""" return og.RuntimeAttribute(self._attributes.toNegate.get_attribute_data(), self._context, True) @toNegate.setter def toNegate(self, value_to_set: Any): """Assign another attribute's value to outputs.toNegate""" if isinstance(value_to_set, og.RuntimeAttribute): self.toNegate.value = value_to_set.value else: self.toNegate.value = value_to_set @property def tuple(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute inputs.tuple""" return og.RuntimeAttribute(self._attributes.tuple.get_attribute_data(), self._context, True) @tuple.setter def tuple(self, value_to_set: Any): """Assign another attribute's value to outputs.tuple""" if isinstance(value_to_set, og.RuntimeAttribute): self.tuple.value = value_to_set.value else: self.tuple.value = value_to_set 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 = { } @property def doubledResult(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute outputs.doubledResult""" return og.RuntimeAttribute(self._attributes.doubledResult.get_attribute_data(), self._context, False) @doubledResult.setter def doubledResult(self, value_to_set: Any): """Assign another attribute's value to outputs.doubledResult""" if isinstance(value_to_set, og.RuntimeAttribute): self.doubledResult.value = value_to_set.value else: self.doubledResult.value = value_to_set @property def flexible(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute outputs.flexible""" return og.RuntimeAttribute(self._attributes.flexible.get_attribute_data(), self._context, False) @flexible.setter def flexible(self, value_to_set: Any): """Assign another attribute's value to outputs.flexible""" if isinstance(value_to_set, og.RuntimeAttribute): self.flexible.value = value_to_set.value else: self.flexible.value = value_to_set @property def negatedResult(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute outputs.negatedResult""" return og.RuntimeAttribute(self._attributes.negatedResult.get_attribute_data(), self._context, False) @negatedResult.setter def negatedResult(self, value_to_set: Any): """Assign another attribute's value to outputs.negatedResult""" if isinstance(value_to_set, og.RuntimeAttribute): self.negatedResult.value = value_to_set.value else: self.negatedResult.value = value_to_set @property def tuple(self) -> og.RuntimeAttribute: """Get the runtime wrapper class for the attribute outputs.tuple""" return og.RuntimeAttribute(self._attributes.tuple.get_attribute_data(), self._context, False) @tuple.setter def tuple(self, value_to_set: Any): """Assign another attribute's value to outputs.tuple""" if isinstance(value_to_set, og.RuntimeAttribute): self.tuple.value = value_to_set.value else: self.tuple.value = value_to_set 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 = OgnTutorialExtendedTypesDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialExtendedTypesDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialExtendedTypesDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
10,390
Python
49.687805
221
0.648893
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialBundleAddAttributesDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.BundleAddAttributes This is a tutorial node. It exercises functionality for adding and removing attributes on output bundles. """ import carb import numpy import carb import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialBundleAddAttributesDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.BundleAddAttributes Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.addedAttributeNames inputs.removedAttributeNames inputs.typesToAdd inputs.useBatchedAPI Outputs: outputs.bundle """ # 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:addedAttributeNames', 'token[]', 0, None, "Names for the attribute types to be added. The size of this array must match the size\nof the 'typesToAdd' array to be legal.", {}, True, [], False, ''), ('inputs:removedAttributeNames', 'token[]', 0, None, 'Names for the attribute types to be removed. Non-existent attributes will be ignored.', {}, True, [], False, ''), ('inputs:typesToAdd', 'token[]', 0, 'Attribute Types To Add', 'List of type descriptions to add to the bundle. The strings in this list correspond to the\nstrings that represent the attribute types in the .ogn file (e.g. float[3][], colord[3], bool', {}, True, [], False, ''), ('inputs:useBatchedAPI', 'bool', 0, None, 'Controls whether or not to used batched APIS for adding/removing attributes', {}, True, False, False, ''), ('outputs:bundle', 'bundle', 0, 'Constructed Bundle', 'This is the bundle with all attributes added by compute.', {}, 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.outputs.bundle = og.AttributeRole.BUNDLE return role_data 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 = [] @property def addedAttributeNames(self): data_view = og.AttributeValueHelper(self._attributes.addedAttributeNames) return data_view.get() @addedAttributeNames.setter def addedAttributeNames(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.addedAttributeNames) data_view = og.AttributeValueHelper(self._attributes.addedAttributeNames) data_view.set(value) self.addedAttributeNames_size = data_view.get_array_size() @property def removedAttributeNames(self): data_view = og.AttributeValueHelper(self._attributes.removedAttributeNames) return data_view.get() @removedAttributeNames.setter def removedAttributeNames(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.removedAttributeNames) data_view = og.AttributeValueHelper(self._attributes.removedAttributeNames) data_view.set(value) self.removedAttributeNames_size = data_view.get_array_size() @property def typesToAdd(self): data_view = og.AttributeValueHelper(self._attributes.typesToAdd) return data_view.get() @typesToAdd.setter def typesToAdd(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.typesToAdd) data_view = og.AttributeValueHelper(self._attributes.typesToAdd) data_view.set(value) self.typesToAdd_size = data_view.get_array_size() @property def useBatchedAPI(self): data_view = og.AttributeValueHelper(self._attributes.useBatchedAPI) return data_view.get() @useBatchedAPI.setter def useBatchedAPI(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.useBatchedAPI) data_view = og.AttributeValueHelper(self._attributes.useBatchedAPI) data_view.set(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.__bundles = og.BundleContainer(context, node, attributes, [], read_only=False, gpu_ptr_kinds={}) self._batchedWriteValues = { } @property def bundle(self) -> og.BundleContents: """Get the bundle wrapper class for the attribute outputs.bundle""" return self.__bundles.bundle @bundle.setter def bundle(self, bundle: og.BundleContents): """Overwrite the bundle attribute outputs.bundle with a new bundle""" if not isinstance(bundle, og.BundleContents): carb.log_error("Only bundle attributes can be assigned to another bundle attribute") self.__bundles.bundle.bundle = bundle 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 = OgnTutorialBundleAddAttributesDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialBundleAddAttributesDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialBundleAddAttributesDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
8,372
Python
49.137724
284
0.671046
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialStatePyDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.StatePy This is a tutorial node. It makes use of internal state information to continuously increment an output. """ import carb 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 OgnTutorialStatePyDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.StatePy Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.override inputs.overrideValue Outputs: outputs.monotonic """ # 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:override', 'bool', 0, None, 'When true get the output from the overrideValue, otherwise use the internal value', {ogn.MetadataKeys.DEFAULT: 'false'}, True, False, False, ''), ('inputs:overrideValue', 'int64', 0, None, "Value to use instead of the monotonically increasing internal one when 'override' is true", {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('outputs:monotonic', 'int64', 0, None, 'Monotonically increasing output, set by internal state information', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ]) class ValuesForInputs(og.DynamicAttributeAccess): LOCAL_PROPERTY_NAMES = {"override", "overrideValue", "_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.override, self._attributes.overrideValue] self._batchedReadValues = [False, 0] @property def override(self): return self._batchedReadValues[0] @override.setter def override(self, value): self._batchedReadValues[0] = value @property def overrideValue(self): return self._batchedReadValues[1] @overrideValue.setter def overrideValue(self, value): self._batchedReadValues[1] = 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 = {"monotonic", "_batchedWriteValues"} """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 = { } @property def monotonic(self): value = self._batchedWriteValues.get(self._attributes.monotonic) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.monotonic) return data_view.get() @monotonic.setter def monotonic(self, value): self._batchedWriteValues[self._attributes.monotonic] = 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 _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 = OgnTutorialStatePyDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialStatePyDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialStatePyDatabase.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(OgnTutorialStatePyDatabase.NODE_TYPE_CLASS, 'get_node_type', None) if callable(get_node_type_function): return get_node_type_function() return 'omni.graph.tutorials.StatePy' @staticmethod def compute(context, node): def database_valid(): return True try: per_node_data = OgnTutorialStatePyDatabase.PER_NODE_DATA[node.node_id()] db = per_node_data.get('_db') if db is None: db = OgnTutorialStatePyDatabase(node) per_node_data['_db'] = db if not database_valid(): per_node_data['_db'] = None return False except: db = OgnTutorialStatePyDatabase(node) try: compute_function = getattr(OgnTutorialStatePyDatabase.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 OgnTutorialStatePyDatabase.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): OgnTutorialStatePyDatabase._initialize_per_node_data(node) initialize_function = getattr(OgnTutorialStatePyDatabase.NODE_TYPE_CLASS, 'initialize', None) if callable(initialize_function): initialize_function(context, node) per_node_data = OgnTutorialStatePyDatabase.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(OgnTutorialStatePyDatabase.NODE_TYPE_CLASS, 'release', None) if callable(release_function): release_function(node) OgnTutorialStatePyDatabase._release_per_node_data(node) @staticmethod def release_instance(node, target): OgnTutorialStatePyDatabase._release_per_node_instance_data(node, target) @staticmethod def update_node_version(context, node, old_version, new_version): update_node_version_function = getattr(OgnTutorialStatePyDatabase.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(OgnTutorialStatePyDatabase.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.tutorials") node_type.set_metadata(ogn.MetadataKeys.UI_NAME, "Tutorial Python Node: Internal States") node_type.set_metadata(ogn.MetadataKeys.CATEGORIES, "tutorials") node_type.set_metadata(ogn.MetadataKeys.DESCRIPTION, "This is a tutorial node. It makes use of internal state information to continuously increment an output.") node_type.set_metadata(ogn.MetadataKeys.LANGUAGE, "Python") icon_path = carb.tokens.get_tokens_interface().resolve("${omni.graph.tutorials}") icon_path = icon_path + '/' + "ogn/icons/omni.graph.tutorials.StatePy.svg" node_type.set_metadata(ogn.MetadataKeys.ICON_PATH, icon_path) OgnTutorialStatePyDatabase.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(OgnTutorialStatePyDatabase.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): OgnTutorialStatePyDatabase.NODE_TYPE_CLASS = node_type_class og.register_node_type(OgnTutorialStatePyDatabase.abi, 1) @staticmethod def deregister(): og.deregister_node_type("omni.graph.tutorials.StatePy")
12,036
Python
46.203921
197
0.638003
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialArrayDataDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.ArrayData This is a tutorial node. It will compute the array 'result' as the input array 'original' with every element multiplied by the constant 'multiplier'. """ import carb import numpy import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialArrayDataDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.ArrayData Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.gates inputs.info inputs.multiplier inputs.original Outputs: outputs.infoSize outputs.negativeValues outputs.result """ # 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:gates', 'bool[]', 0, None, 'Boolean mask telling which elements of the array should be multiplied', {ogn.MetadataKeys.DEFAULT: '[]'}, True, [], False, ''), ('inputs:info', 'token[]', 0, None, 'List of strings providing commentary', {ogn.MetadataKeys.DEFAULT: '["There", "is", "no", "data"]'}, True, ['There', 'is', 'no', 'data'], False, ''), ('inputs:multiplier', 'float', 0, None, 'Multiplier of the array elements', {ogn.MetadataKeys.DEFAULT: '1.0'}, True, 1.0, False, ''), ('inputs:original', 'float[]', 0, None, 'Array to be multiplied', {ogn.MetadataKeys.DEFAULT: '[]'}, True, [], False, ''), ('outputs:infoSize', 'int', 0, None, 'Number of letters in all strings in the info input', {}, True, None, False, ''), ('outputs:negativeValues', 'bool[]', 0, None, "Array of booleans set to true if the corresponding 'result' is negative", {}, True, None, False, ''), ('outputs:result', 'float[]', 0, None, 'Multiplied array', {}, 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 = [] @property def gates(self): data_view = og.AttributeValueHelper(self._attributes.gates) return data_view.get() @gates.setter def gates(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.gates) data_view = og.AttributeValueHelper(self._attributes.gates) data_view.set(value) self.gates_size = data_view.get_array_size() @property def info(self): data_view = og.AttributeValueHelper(self._attributes.info) return data_view.get() @info.setter def info(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.info) data_view = og.AttributeValueHelper(self._attributes.info) data_view.set(value) self.info_size = data_view.get_array_size() @property def multiplier(self): data_view = og.AttributeValueHelper(self._attributes.multiplier) return data_view.get() @multiplier.setter def multiplier(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.multiplier) data_view = og.AttributeValueHelper(self._attributes.multiplier) data_view.set(value) @property def original(self): data_view = og.AttributeValueHelper(self._attributes.original) return data_view.get() @original.setter def original(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.original) data_view = og.AttributeValueHelper(self._attributes.original) data_view.set(value) self.original_size = data_view.get_array_size() 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.negativeValues_size = None self.result_size = None self._batchedWriteValues = { } @property def infoSize(self): data_view = og.AttributeValueHelper(self._attributes.infoSize) return data_view.get() @infoSize.setter def infoSize(self, value): data_view = og.AttributeValueHelper(self._attributes.infoSize) data_view.set(value) @property def negativeValues(self): data_view = og.AttributeValueHelper(self._attributes.negativeValues) return data_view.get(reserved_element_count=self.negativeValues_size) @negativeValues.setter def negativeValues(self, value): data_view = og.AttributeValueHelper(self._attributes.negativeValues) data_view.set(value) self.negativeValues_size = data_view.get_array_size() @property def result(self): data_view = og.AttributeValueHelper(self._attributes.result) return data_view.get(reserved_element_count=self.result_size) @result.setter def result(self, value): data_view = og.AttributeValueHelper(self._attributes.result) data_view.set(value) self.result_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 = OgnTutorialArrayDataDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialArrayDataDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialArrayDataDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
8,507
Python
44.989189
193
0.645233
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialCpuGpuBundlesDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.CpuGpuBundles This is a tutorial node. It exercises functionality for accessing data in bundles that are on the GPU as well as bundles whose CPU/GPU location is decided at runtime. The compute looks for bundled attributes named 'points' and, if they are found, computes their dot products. If the bundle on the output contains an integer array type named 'dotProducts' then the results are placed there, otherwise a new attribute of that name and type is created on the output bundle to hold the results. This node is identical to OgnTutorialCpuGpuBundlesPy.ogn, except it is implemented in C++. """ import carb import carb import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialCpuGpuBundlesDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.CpuGpuBundles Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.cpuBundle inputs.gpu inputs.gpuBundle Outputs: outputs.cpuGpuBundle Predefined Tokens: tokens.points tokens.dotProducts """ # 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:cpuBundle', 'bundle', 0, 'CPU Input Bundle', 'Input bundle whose data always lives on the CPU', {}, True, None, False, ''), ('inputs:gpu', 'bool', 0, 'Results To GPU', 'If true then copy gpuBundle onto the output, otherwise copy cpuBundle', {}, True, False, False, ''), ('inputs:gpuBundle', 'bundle', 0, 'GPU Input Bundle', 'Input bundle whose data always lives on the GPU', {ogn.MetadataKeys.MEMORY_TYPE: 'cuda'}, True, None, False, ''), ('outputs:cpuGpuBundle', 'bundle', 0, 'Constructed Bundle', "This is the bundle with the merged data. If the 'gpu' attribute is set to true then this\nbundle's contents will be entirely on the GPU, otherwise they will be on the CPU.", {ogn.MetadataKeys.MEMORY_TYPE: 'any'}, True, None, False, ''), ]) class tokens: points = "points" dotProducts = "dotProducts" @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.cpuBundle = og.AttributeRole.BUNDLE role_data.inputs.gpuBundle = og.AttributeRole.BUNDLE role_data.outputs.cpuGpuBundle = og.AttributeRole.BUNDLE return role_data 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.__bundles = og.BundleContainer(context, node, attributes, ['inputs:gpuBundle'], read_only=True, gpu_ptr_kinds={}) self._batchedReadAttributes = [] self._batchedReadValues = [] @property def cpuBundle(self) -> og.BundleContents: """Get the bundle wrapper class for the attribute inputs.cpuBundle""" return self.__bundles.cpuBundle @property def gpu(self): data_view = og.AttributeValueHelper(self._attributes.gpu) return data_view.get() @gpu.setter def gpu(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.gpu) data_view = og.AttributeValueHelper(self._attributes.gpu) data_view.set(value) @property def gpuBundle(self) -> og.BundleContents: """Get the bundle wrapper class for the attribute inputs.gpuBundle""" return self.__bundles.gpuBundle 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.__bundles = og.BundleContainer(context, node, attributes, ['outputs_cpuGpuBundle'], read_only=False, gpu_ptr_kinds={}) self._batchedWriteValues = { } @property def cpuGpuBundle(self) -> og.BundleContents: """Get the bundle wrapper class for the attribute outputs.cpuGpuBundle""" return self.__bundles.cpuGpuBundle @cpuGpuBundle.setter def cpuGpuBundle(self, bundle: og.BundleContents): """Overwrite the bundle attribute outputs.cpuGpuBundle with a new bundle""" if not isinstance(bundle, og.BundleContents): carb.log_error("Only bundle attributes can be assigned to another bundle attribute") self.__bundles.cpuGpuBundle.bundle = bundle 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 = OgnTutorialCpuGpuBundlesDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialCpuGpuBundlesDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialCpuGpuBundlesDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
7,696
Python
50.313333
305
0.680223
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialTokensDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.Tokens This is a tutorial node. It exercises the feature of providing hardcoded token values in the database after a node type has been initialized. It sets output booleans to the truth value of whether corresponding inputs appear in the hardcoded token list. """ import carb import numpy import omni.graph.core as og import omni.graph.core._omni_graph_core as _og import omni.graph.tools.ogn as ogn class OgnTutorialTokensDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.Tokens Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.valuesToCheck Outputs: outputs.isColor Predefined Tokens: tokens.red tokens.green tokens.blue """ # 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:valuesToCheck', 'token[]', 0, None, 'Array of tokens that are to be checked', {}, True, [], False, ''), ('outputs:isColor', 'bool[]', 0, None, 'True values if the corresponding input value appears in the token list', {}, True, None, False, ''), ]) class tokens: red = "red" green = "green" blue = "blue" 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 = [] @property def valuesToCheck(self): data_view = og.AttributeValueHelper(self._attributes.valuesToCheck) return data_view.get() @valuesToCheck.setter def valuesToCheck(self, value): if self._setting_locked: raise og.ReadOnlyError(self._attributes.valuesToCheck) data_view = og.AttributeValueHelper(self._attributes.valuesToCheck) data_view.set(value) self.valuesToCheck_size = data_view.get_array_size() 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.isColor_size = None self._batchedWriteValues = { } @property def isColor(self): data_view = og.AttributeValueHelper(self._attributes.isColor) return data_view.get(reserved_element_count=self.isColor_size) @isColor.setter def isColor(self, value): data_view = og.AttributeValueHelper(self._attributes.isColor) data_view.set(value) self.isColor_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 = OgnTutorialTokensDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialTokensDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialTokensDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
5,709
Python
44.31746
148
0.673148
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/OgnTutorialSimpleDataPyDatabase.py
"""Support for simplified access to data on nodes of type omni.graph.tutorials.SimpleDataPy This is a tutorial node. It creates both an input and output attribute of every simple supported data type. The values are modified in a simple way so that the compute modifies values. It is the same as node omni.graph.tutorials.SimpleData, except it is implemented in Python instead of C++. """ import carb 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 OgnTutorialSimpleDataPyDatabase(og.Database): """Helper class providing simplified access to data on nodes of type omni.graph.tutorials.SimpleDataPy Class Members: node: Node being evaluated Attribute Value Properties: Inputs: inputs.a_bool inputs.a_constant_input inputs.a_double inputs.a_float inputs.a_half inputs.a_int inputs.a_int64 inputs.a_objectId inputs.a_path inputs.a_string inputs.a_token inputs.a_uchar inputs.a_uint inputs.a_uint64 Outputs: outputs.a_a_boolUiName outputs.a_bool outputs.a_double outputs.a_float outputs.a_half outputs.a_int outputs.a_int64 outputs.a_nodeTypeUiName outputs.a_objectId outputs.a_path outputs.a_string outputs.a_token outputs.a_uchar outputs.a_uint outputs.a_uint64 """ # 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:a_bool', 'bool', 0, 'Simple Boolean Input', 'This is an attribute of type boolean', {ogn.MetadataKeys.DEFAULT: 'true'}, False, True, False, ''), ('inputs:a_constant_input', 'int', 0, None, 'This is an input attribute whose value can be set but can only be connected as a source.', {ogn.MetadataKeys.OUTPUT_ONLY: '1'}, True, 0, False, ''), ('inputs:a_double', 'double', 0, None, 'This is an attribute of type 64 bit floating point', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_float', 'float', 0, None, 'This is an attribute of type 32 bit floating point', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_half', 'half', 0, None, 'This is an attribute of type 16 bit float', {ogn.MetadataKeys.DEFAULT: '0.0'}, True, 0.0, False, ''), ('inputs:a_int', 'int', 0, None, 'This is an attribute of type 32 bit integer', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_int64', 'int64', 0, None, 'This is an attribute of type 64 bit integer', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_objectId', 'objectId', 0, None, 'This is an attribute of type objectId', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_path', 'path', 0, None, 'This is an attribute of type path', {ogn.MetadataKeys.DEFAULT: '""'}, True, "", False, ''), ('inputs:a_string', 'string', 0, None, 'This is an attribute of type string', {ogn.MetadataKeys.DEFAULT: '"helloString"'}, True, "helloString", False, ''), ('inputs:a_token', 'token', 0, None, 'This is an attribute of type interned string with fast comparison and hashing', {ogn.MetadataKeys.DEFAULT: '"helloToken"'}, True, "helloToken", False, ''), ('inputs:a_uchar', 'uchar', 0, None, 'This is an attribute of type unsigned 8 bit integer', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_uint', 'uint', 0, None, 'This is an attribute of type unsigned 32 bit integer', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('inputs:a_uint64', 'uint64', 0, None, 'This is an attribute of type unsigned 64 bit integer', {ogn.MetadataKeys.DEFAULT: '0'}, True, 0, False, ''), ('outputs:a_a_boolUiName', 'string', 0, None, 'Computed attribute containing the UI name of input a_bool', {}, True, None, False, ''), ('outputs:a_bool', 'bool', 0, None, 'This is a computed attribute of type boolean', {}, True, None, False, ''), ('outputs:a_double', 'double', 0, None, 'This is a computed attribute of type 64 bit floating point', {}, True, None, False, ''), ('outputs:a_float', 'float', 0, None, 'This is a computed attribute of type 32 bit floating point', {}, True, None, False, ''), ('outputs:a_half', 'half', 0, None, 'This is a computed attribute of type 16 bit float', {}, True, None, False, ''), ('outputs:a_int', 'int', 0, None, 'This is a computed attribute of type 32 bit integer', {}, True, None, False, ''), ('outputs:a_int64', 'int64', 0, None, 'This is a computed attribute of type 64 bit integer', {}, True, None, False, ''), ('outputs:a_nodeTypeUiName', 'string', 0, None, 'Computed attribute containing the UI name of this node type', {}, True, None, False, ''), ('outputs:a_objectId', 'objectId', 0, None, 'This is a computed attribute of type objectId', {}, True, None, False, ''), ('outputs:a_path', 'path', 0, None, 'This is a computed attribute of type path', {ogn.MetadataKeys.DEFAULT: '"/Child"'}, True, "/Child", False, ''), ('outputs:a_string', 'string', 0, None, 'This is a computed attribute of type string', {ogn.MetadataKeys.DEFAULT: '"This string is empty"'}, True, "This string is empty", False, ''), ('outputs:a_token', 'token', 0, None, 'This is a computed attribute of type interned string with fast comparison and hashing', {}, True, None, False, ''), ('outputs:a_uchar', 'uchar', 0, None, 'This is a computed attribute of type unsigned 8 bit integer', {}, True, None, False, ''), ('outputs:a_uint', 'uint', 0, None, 'This is a computed attribute of type unsigned 32 bit integer', {}, True, None, False, ''), ('outputs:a_uint64', 'uint64', 0, None, 'This is a computed attribute of type unsigned 64 bit integer', {}, 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.a_objectId = og.AttributeRole.OBJECT_ID role_data.inputs.a_path = og.AttributeRole.PATH role_data.inputs.a_string = og.AttributeRole.TEXT role_data.outputs.a_a_boolUiName = og.AttributeRole.TEXT role_data.outputs.a_nodeTypeUiName = og.AttributeRole.TEXT role_data.outputs.a_objectId = og.AttributeRole.OBJECT_ID role_data.outputs.a_path = og.AttributeRole.PATH role_data.outputs.a_string = og.AttributeRole.TEXT return role_data class ValuesForInputs(og.DynamicAttributeAccess): LOCAL_PROPERTY_NAMES = {"a_bool", "a_constant_input", "a_double", "a_float", "a_half", "a_int", "a_int64", "a_objectId", "a_path", "a_string", "a_token", "a_uchar", "a_uint", "a_uint64", "_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.a_bool, self._attributes.a_constant_input, self._attributes.a_double, self._attributes.a_float, self._attributes.a_half, self._attributes.a_int, self._attributes.a_int64, self._attributes.a_objectId, self._attributes.a_path, self._attributes.a_string, self._attributes.a_token, self._attributes.a_uchar, self._attributes.a_uint, self._attributes.a_uint64] self._batchedReadValues = [True, 0, 0, 0, 0.0, 0, 0, 0, "", "helloString", "helloToken", 0, 0, 0] @property def a_bool(self): return self._batchedReadValues[0] @a_bool.setter def a_bool(self, value): self._batchedReadValues[0] = value @property def a_constant_input(self): return self._batchedReadValues[1] @a_constant_input.setter def a_constant_input(self, value): self._batchedReadValues[1] = value @property def a_double(self): return self._batchedReadValues[2] @a_double.setter def a_double(self, value): self._batchedReadValues[2] = value @property def a_float(self): return self._batchedReadValues[3] @a_float.setter def a_float(self, value): self._batchedReadValues[3] = value @property def a_half(self): return self._batchedReadValues[4] @a_half.setter def a_half(self, value): self._batchedReadValues[4] = value @property def a_int(self): return self._batchedReadValues[5] @a_int.setter def a_int(self, value): self._batchedReadValues[5] = value @property def a_int64(self): return self._batchedReadValues[6] @a_int64.setter def a_int64(self, value): self._batchedReadValues[6] = value @property def a_objectId(self): return self._batchedReadValues[7] @a_objectId.setter def a_objectId(self, value): self._batchedReadValues[7] = value @property def a_path(self): return self._batchedReadValues[8] @a_path.setter def a_path(self, value): self._batchedReadValues[8] = value @property def a_string(self): return self._batchedReadValues[9] @a_string.setter def a_string(self, value): self._batchedReadValues[9] = value @property def a_token(self): return self._batchedReadValues[10] @a_token.setter def a_token(self, value): self._batchedReadValues[10] = value @property def a_uchar(self): return self._batchedReadValues[11] @a_uchar.setter def a_uchar(self, value): self._batchedReadValues[11] = value @property def a_uint(self): return self._batchedReadValues[12] @a_uint.setter def a_uint(self, value): self._batchedReadValues[12] = value @property def a_uint64(self): return self._batchedReadValues[13] @a_uint64.setter def a_uint64(self, value): self._batchedReadValues[13] = 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 = {"a_a_boolUiName", "a_bool", "a_double", "a_float", "a_half", "a_int", "a_int64", "a_nodeTypeUiName", "a_objectId", "a_path", "a_string", "a_token", "a_uchar", "a_uint", "a_uint64", "_batchedWriteValues"} """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.a_a_boolUiName_size = None self.a_nodeTypeUiName_size = None self.a_path_size = 6 self.a_string_size = 20 self._batchedWriteValues = { } @property def a_a_boolUiName(self): value = self._batchedWriteValues.get(self._attributes.a_a_boolUiName) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_a_boolUiName) return data_view.get() @a_a_boolUiName.setter def a_a_boolUiName(self, value): self._batchedWriteValues[self._attributes.a_a_boolUiName] = value @property def a_bool(self): value = self._batchedWriteValues.get(self._attributes.a_bool) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_bool) return data_view.get() @a_bool.setter def a_bool(self, value): self._batchedWriteValues[self._attributes.a_bool] = value @property def a_double(self): value = self._batchedWriteValues.get(self._attributes.a_double) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_double) return data_view.get() @a_double.setter def a_double(self, value): self._batchedWriteValues[self._attributes.a_double] = value @property def a_float(self): value = self._batchedWriteValues.get(self._attributes.a_float) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_float) return data_view.get() @a_float.setter def a_float(self, value): self._batchedWriteValues[self._attributes.a_float] = value @property def a_half(self): value = self._batchedWriteValues.get(self._attributes.a_half) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_half) return data_view.get() @a_half.setter def a_half(self, value): self._batchedWriteValues[self._attributes.a_half] = value @property def a_int(self): value = self._batchedWriteValues.get(self._attributes.a_int) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_int) return data_view.get() @a_int.setter def a_int(self, value): self._batchedWriteValues[self._attributes.a_int] = value @property def a_int64(self): value = self._batchedWriteValues.get(self._attributes.a_int64) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_int64) return data_view.get() @a_int64.setter def a_int64(self, value): self._batchedWriteValues[self._attributes.a_int64] = value @property def a_nodeTypeUiName(self): value = self._batchedWriteValues.get(self._attributes.a_nodeTypeUiName) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_nodeTypeUiName) return data_view.get() @a_nodeTypeUiName.setter def a_nodeTypeUiName(self, value): self._batchedWriteValues[self._attributes.a_nodeTypeUiName] = value @property def a_objectId(self): value = self._batchedWriteValues.get(self._attributes.a_objectId) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_objectId) return data_view.get() @a_objectId.setter def a_objectId(self, value): self._batchedWriteValues[self._attributes.a_objectId] = value @property def a_path(self): value = self._batchedWriteValues.get(self._attributes.a_path) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_path) return data_view.get() @a_path.setter def a_path(self, value): self._batchedWriteValues[self._attributes.a_path] = value @property def a_string(self): value = self._batchedWriteValues.get(self._attributes.a_string) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_string) return data_view.get() @a_string.setter def a_string(self, value): self._batchedWriteValues[self._attributes.a_string] = value @property def a_token(self): value = self._batchedWriteValues.get(self._attributes.a_token) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_token) return data_view.get() @a_token.setter def a_token(self, value): self._batchedWriteValues[self._attributes.a_token] = value @property def a_uchar(self): value = self._batchedWriteValues.get(self._attributes.a_uchar) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_uchar) return data_view.get() @a_uchar.setter def a_uchar(self, value): self._batchedWriteValues[self._attributes.a_uchar] = value @property def a_uint(self): value = self._batchedWriteValues.get(self._attributes.a_uint) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_uint) return data_view.get() @a_uint.setter def a_uint(self, value): self._batchedWriteValues[self._attributes.a_uint] = value @property def a_uint64(self): value = self._batchedWriteValues.get(self._attributes.a_uint64) if value: return value else: data_view = og.AttributeValueHelper(self._attributes.a_uint64) return data_view.get() @a_uint64.setter def a_uint64(self, value): self._batchedWriteValues[self._attributes.a_uint64] = 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 _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 = OgnTutorialSimpleDataPyDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT) self.outputs = OgnTutorialSimpleDataPyDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes) dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE) self.state = OgnTutorialSimpleDataPyDatabase.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(OgnTutorialSimpleDataPyDatabase.NODE_TYPE_CLASS, 'get_node_type', None) if callable(get_node_type_function): return get_node_type_function() return 'omni.graph.tutorials.SimpleDataPy' @staticmethod def compute(context, node): def database_valid(): return True try: per_node_data = OgnTutorialSimpleDataPyDatabase.PER_NODE_DATA[node.node_id()] db = per_node_data.get('_db') if db is None: db = OgnTutorialSimpleDataPyDatabase(node) per_node_data['_db'] = db if not database_valid(): per_node_data['_db'] = None return False except: db = OgnTutorialSimpleDataPyDatabase(node) try: compute_function = getattr(OgnTutorialSimpleDataPyDatabase.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 OgnTutorialSimpleDataPyDatabase.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): OgnTutorialSimpleDataPyDatabase._initialize_per_node_data(node) initialize_function = getattr(OgnTutorialSimpleDataPyDatabase.NODE_TYPE_CLASS, 'initialize', None) if callable(initialize_function): initialize_function(context, node) per_node_data = OgnTutorialSimpleDataPyDatabase.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(OgnTutorialSimpleDataPyDatabase.NODE_TYPE_CLASS, 'release', None) if callable(release_function): release_function(node) OgnTutorialSimpleDataPyDatabase._release_per_node_data(node) @staticmethod def release_instance(node, target): OgnTutorialSimpleDataPyDatabase._release_per_node_instance_data(node, target) @staticmethod def update_node_version(context, node, old_version, new_version): update_node_version_function = getattr(OgnTutorialSimpleDataPyDatabase.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(OgnTutorialSimpleDataPyDatabase.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.tutorials") node_type.set_metadata(ogn.MetadataKeys.UI_NAME, "Tutorial Python Node: Attributes With Simple Data") node_type.set_metadata(ogn.MetadataKeys.ICON_COLOR, "#FF00FF00") node_type.set_metadata(ogn.MetadataKeys.ICON_BACKGROUND_COLOR, "#7FFF0000") node_type.set_metadata(ogn.MetadataKeys.ICON_BORDER_COLOR, "#FF0000FF") node_type.set_metadata(ogn.MetadataKeys.CATEGORIES, "tutorials") node_type.set_metadata(ogn.MetadataKeys.DESCRIPTION, "This is a tutorial node. It creates both an input and output attribute of every simple supported data type. The values are modified in a simple way so that the compute modifies values. It is the same as node omni.graph.tutorials.SimpleData, except it is implemented in Python instead of C++.") node_type.set_metadata(ogn.MetadataKeys.LANGUAGE, "Python") icon_path = carb.tokens.get_tokens_interface().resolve("${omni.graph.tutorials}") icon_path = icon_path + '/' + "ogn/icons/omni.graph.tutorials.SimpleDataPy.svg" node_type.set_metadata(ogn.MetadataKeys.ICON_PATH, icon_path) OgnTutorialSimpleDataPyDatabase.INTERFACE.add_to_node_type(node_type) @staticmethod def on_connection_type_resolve(node): on_connection_type_resolve_function = getattr(OgnTutorialSimpleDataPyDatabase.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): OgnTutorialSimpleDataPyDatabase.NODE_TYPE_CLASS = node_type_class og.register_node_type(OgnTutorialSimpleDataPyDatabase.abi, 1) @staticmethod def deregister(): og.deregister_node_type("omni.graph.tutorials.SimpleDataPy")
27,413
Python
44.163097
415
0.605735
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/tutorials/tutorial2/tutorial2.rst
.. _ogn_tutorial_simpleData: Tutorial 2 - Simple Data Node ============================= The simple data node creates one input attribute and one output attribute of each of the simple types, where "simple" refers to data types that have a single component and are not arrays. (e.g. "float" is simple, "float[3]" is not, nor is "float[]"). See also :ref:`ogn_tutorial_simpleDataPy` for a similar example in Python. OgnTutorialSimpleData.ogn ------------------------- The *ogn* file shows the implementation of a node named "omni.graph.tutorials.SimpleData", which has one input and one output attribute of each simple type. .. literalinclude:: OgnTutorialSimpleData.ogn :linenos: :language: json OgnTutorialSimpleData.cpp ------------------------- The *cpp* file contains the implementation of the compute method, which modifies each of the inputs in a simple way to create outputs that have different values. .. literalinclude:: OgnTutorialSimpleData.cpp :linenos: :language: c++ Note how the attribute values are available through the OgnTutorialSimpleDataDatabase class. The generated interface creates access methods for every attribute, named for the attribute itself. Inputs will be returned as const references, outputs will be returned as non-const references. Attribute Data -------------- Two types of attribute data are created, which help with ease of access and of use - the attribute name lookup information, and the attribute type definition. Attribute data is accessed via a name-based lookup. This is not particularly efficient, so to facilitate this process the attribute name is translated into a fast access token. In addition, the information about the attribute's type and default value is constant for all nodes of the same type so that is stored as well, in static data. Normally you would use an *auto* declaration for attribute types. Sometimes you want to pass around attribute data so it is helpful to have access to the attribute's data type. In the generated code a ``using namespace`` is set up to provide a very simple syntax for accessing the attribute's metadata from within the node: .. code-block:: c++ std::cout << "Attribute name is " << inputs::a_bool.m_name << std::endl; std::cout << "Attribute type is " << inputs::a_bool.m_dataType << std::endl; extern "C" void processAttribute(inputs::a_bool_t& value); // Equivalent to extern "C" void processAttribute(bool& value); Attribute Data Access --------------------- The attributes are automatically namespaced with *inputs* and *outputs*. In the USD file the attribute names will appear as *inputs:XXX* or *outputs:XXX*. In the C++ interface the colon is illegal so a contained struct is used to make use of the period equivalent, as *inputs.XXX* or *outputs.XXX*. The minimum information provided by these wrapper classes is a reference to the underlying data, accessed by ``operator()``. For this class, these are the types it provides: +--------------------+--------------------+ | Database Function | Returned Type | +====================+====================+ | inputs.a_bool() | const bool& | +--------------------+--------------------+ | inputs.a_half() | const pxr::GfHalf& | +--------------------+--------------------+ | inputs.a_int() | const int& | +--------------------+--------------------+ | inputs.a_int64() | const int64_t& | +--------------------+--------------------+ | inputs.a_float() | const float& | +--------------------+--------------------+ | inputs.a_double() | const double& | +--------------------+--------------------+ | inputs.a_path() | const std::string& | +--------------------+--------------------+ | inputs.a_string() | const std::string& | +--------------------+--------------------+ | inputs.a_token() | const NameToken& | +--------------------+--------------------+ | outputs.a_bool() | bool& | +--------------------+--------------------+ | outputs.a_half() | pxr::GfHalf& | +--------------------+--------------------+ | outputs.a_int() | int& | +--------------------+--------------------+ | outputs.a_int64() | int64_t& | +--------------------+--------------------+ | outputs.a_float() | float& | +--------------------+--------------------+ | outputs.a_double() | double& | +--------------------+--------------------+ | outputs.a_string() | std::string& | +--------------------+--------------------+ | outputs.a_token() | NameToken& | +--------------------+--------------------+ The data returned are all references to the real data in the FlatCache, our managed memory store, pointed to the correct location at evaluation time. Note how input attributes return *const* data while output attributes do not. This reinforces the restriction that input data should never be written to, as it would cause graph synchronization problems. The type *pxr::GfHalf* is an implementation of a 16-bit floating point value, though any other may also be used with a runtime cast of the value. *omni::graph::core::NameToken* is a simple token through which a unique string can be looked up at runtime. Helpers ------- A few helpers are provided in the database class definition to help make coding with it more natural. initializeType ++++++++++++++ Function signature ``static void initializeType(const NodeTypeObj& nodeTypeObj)`` is an implementation of the ABI function that is called once for each node type, initializing such things as its mandatory attributes and their default values. validate ++++++++ Function signature ``bool validate()``. If any of the mandatory attributes do not have values then the generated code will exit early with an error message and not actually call the node's compute method. token +++++ Function signature ``NameToken token(const char* tokenName)``. Provides a simple conversion from a string to the unique token representing that string, for fast comparison of strings and for use with the attributes whose data types are *token*. Compute Status Logging ++++++++++++++++++++++ Two helper functions are providing in the database class to help provide more information when the compute method of a node has failed. Two methods are provided, both taking printf-like variable sets of parameters. ``void logError(Args...)`` is used when the compute has run into some inconsistent or unexpected data, such as two input arrays that are supposed to have the same size but do not, like the normals and vertexes on a mesh. ``void logWarning(Args...)`` can be used when the compute has hit an unusual case but can still provide a consistent output for it, for example the deformation of an empty mesh would result in an empty mesh and a warning since that is not a typical use for the node. typedefs ++++++++ Although not part of the database class per se, a typedef alias is created for every attribute so that you can use its type directly without knowing the detailed type; a midway point between exact types and *auto*. The main use for such types might be passing attribute data between functions. Here are the corresponding typedef names for each of the attributes: +--------------------+--------------------+ | Typedef Alias | Actual Type | +====================+====================+ | inputs.a_bool_t | const bool& | +--------------------+--------------------+ | inputs.a_half_t | const pxr::GfHalf& | +--------------------+--------------------+ | inputs.a_int_t | const int& | +--------------------+--------------------+ | inputs.a_int64_t | const int64_t& | +--------------------+--------------------+ | inputs.a_float_t | const float& | +--------------------+--------------------+ | inputs.a_double_t | const double& | +--------------------+--------------------+ | inputs.a_token_t | const NameToken& | +--------------------+--------------------+ | outputs.a_bool_t | bool& | +--------------------+--------------------+ | outputs.a_half_t | pxr::GfHalf& | +--------------------+--------------------+ | outputs.a_int_t | int& | +--------------------+--------------------+ | outputs.a_int64_t | int64_t& | +--------------------+--------------------+ | outputs.a_float_t | float& | +--------------------+--------------------+ | outputs.a_double_t | double& | +--------------------+--------------------+ | outputs.a_token_t | NameToken& | +--------------------+--------------------+ Notice the similarity between this table and the one above. The typedef name is formed by adding the extension *_t* to the attribute accessor name, similar to C++ standard type naming conventions. The typedef should always correspond to the return value of the attribute's ``operator()``. Direct ABI Access +++++++++++++++++ All of the generated database classes provide access to the underlying *INodeType* ABI for those rare situations where you want to access the ABI directly. There are two methods provided, which correspond to the objects passed in to the ABI compute method. Context function signature ``const GraphContextObj& abi_context() const``, for accessing the underlying OmniGraph evaluation context and its interface. Node function signature ``const NodeObj& nodeObj abi_node() const``, for accessing the underlying OmniGraph node object and its interface. In addition, the attribute ABI objects are extracted into a shared structure so that they can be accessed in a manner similar to the attribute data. For example ``db.attributes.inputs.a_bool()`` returns the `AttributeObj` that refers to the input attribute named `a_bool`. It can be used to directly call ABI functions when required, though again it should be emphasized that this will be a rare occurrence - all of the common operations can be performed more easily using the database interfaces. Node Computation Tests ---------------------- The "tests" section of the .ogn file contains a list of tests consisting of a description and attribute values, both inputs and outputs, that will be used for the test. The test runs by setting all of the named input attributes to their values, running the compute, then comparing the resulting output attribute values against those specified by the test. For example to test the computation of the boolean attribute, whose output is the negation of the input, these two test values could be specified: .. code::json { "tests": [ { "description": "Check that true becomes false", "inputs": { "a_bool": true }, "outputs": { "a_bool": false } } ] } The "description" field is optional, though highly recommended to aid in debugging which tests are failing. Any unspecified inputs take their default value, and any unspecified outputs do not get checked after the compute. For simple attribute lists an abbreviated version of the syntax can be used, where the inputs and outputs get their fully namespaced names so that there is no need for the "inputs" and "outputs" objects. .. code::json { "tests": [ { "description": "Check that false becomes true", "inputs:a_bool": false, "outputs:a_bool": true } ] }
11,492
reStructuredText
44.607143
120
0.607031
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/tutorials/tutorial2/OgnTutorialSimpleData.cpp
// Copyright (c) 2020-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. // #include <OgnTutorialSimpleDataDatabase.h> #include <string> // Even though the path is stored as a string this tutorial will use the SdfPath API to manipulate it #include <pxr/usd/sdf/path.h> // This class exercises access to the DataModel through the generated database class for all simple data types // It's a good practice to namespace your nodes, so that they are guaranteed to be unique. Using this practice // you can shorten your class names as well. This class could have equally been named "OgnSimpleData", since // the "Tutorial" part of it is just another incarnation of the namespace. namespace omni { namespace graph { namespace core { namespace tutorial { class OgnTutorialSimpleData { public: static bool compute(OgnTutorialSimpleDataDatabase& db) { // Inside the database the contained object "inputs" holds the data references for all input attributes and the // contained object "outputs" holds the data references for all output attributes. // Each of the attribute accessors are named for the name of the attribute, with the ":" replaced by "_". // The colon is used in USD as a convention for creating namespaces so it's safe to replace it without // modifying the meaning. The "inputs:" and "outputs:" prefixes in the generated attributes are matched // by the container names. // // For example attribute "inputs:translate:x" would be accessible as "db.inputs.translate_x" and attribute // "outputs:matrix" would be accessible as "db.outputs.matrix". // The "compute" of this method modifies each attribute in a subtle way so that a test can be written // to verify the operation of the node. See the .ogn file for a description of tests. db.outputs.a_bool() = !db.inputs.a_bool(); db.outputs.a_half() = 1.0f + db.inputs.a_half(); db.outputs.a_int() = 1 + db.inputs.a_int(); db.outputs.a_int64() = 1 + db.inputs.a_int64(); db.outputs.a_double() = 1.0 + db.inputs.a_double(); db.outputs.a_float() = 1.0f + db.inputs.a_float(); db.outputs.a_objectId() = 1 + db.inputs.a_objectId(); // The namespace separator ":" has special meaning in C++ so it is replaced by "_" when it appears in names // Attribute "outputs:unsigned:a_uchar" becomes "outputs.unsigned_a_uchar". db.outputs.unsigned_a_uchar() = 1 + db.inputs.unsigned_a_uchar(); db.outputs.unsigned_a_uint() = 1 + db.inputs.unsigned_a_uint(); db.outputs.unsigned_a_uint64() = 1 + db.inputs.unsigned_a_uint64(); // Internally the string type is more akin to a std::string_view, not available until C++17. // The data is a pair of (const char*, size_t), but the interface provided through the accessor is // castable to a std::string. // // This code shows the recommended way to use it, extracting inputs into a std::string for manipulation and // then assigning outputs from the results. Using the referenced object directly could cause a lot of // unnecessary fabric allocations. (i.e. avoid auto& outputStringView = db.outputs.a_string()) std::string outputString(db.inputs.a_string()); if (outputString.length() > 0) { auto foundStringAt = outputString.find("hello"); if (foundStringAt != std::string::npos) { outputString.replace(foundStringAt, 5, "world"); } db.outputs.a_string() = outputString; } else { db.outputs.a_string() = ""; } // The token interface is made available in the database as well, for convenience. // By calling "db.stringToToken()" you can look up the token ID of a given string. // There is also a symmetrical "db.tokenToString()" for going the other way. std::string outputTokenString = db.tokenToString(db.inputs.a_token()); if (outputTokenString.length() > 0) { auto foundTokenAt = outputTokenString.find("hello"); if (foundTokenAt != std::string::npos) { outputTokenString.replace(foundTokenAt, 5, "world"); db.outputs.a_token() = db.stringToToken(outputTokenString.c_str()); } } else { db.outputs.a_token() = db.stringToToken(""); } // Path just gets a new child named "Child". There's not requirement that the path point to anything // that exists in the scene so any string will work here. // std::string outputPath = (std::string)db.inputs.a_path(); // In the implementation the string is manipulated directly, as it does not care if the SdfPath is valid or // not. If you want to manipulate it using the pxr::SdfPath API this is how you could do it: // // pxr::SdfPath sdfPath{outputPath}; // pxr::TfToken childToken{asTfToken(db.stringToToken("/Child"))}; // if (sdfPath.IsValid()) // { // db.outputs.a_path() = sdfPath.AppendChild(childToken).GetString(); // } // outputPath += "/Child"; db.outputs.a_path() = outputPath; // Drop down to the ABI to find attribute metadata, currently not available through the database auto& nodeObj = db.abi_node(); auto attributeObj = nodeObj.iNode->getAttribute(nodeObj, "inputs:a_bool"); // The hardcoded metadata keyword is available through the node auto uiName = attributeObj.iAttribute->getMetadata(attributeObj, kOgnMetadataUiName); std::string expectedUiName{ "Sample Boolean Input" }; CARB_ASSERT(uiName && (expectedUiName == uiName)); // Confirm that the piece of metadata that differentiates objectId from regular uint64 is in place auto objectIdAttributeObj = nodeObj.iNode->getAttribute(nodeObj, "inputs:a_objectId"); auto objectIdMetadata = attributeObj.iAttribute->getMetadata(objectIdAttributeObj, kOgnMetadataObjectId); CARB_ASSERT(objectIdMetadata); return true; } }; // namespaces are closed after the registration macro, to ensure the correct class is registered REGISTER_OGN_NODE() } // namespace tutorial } // namespace core } // namespace graph } // namespace omni
6,814
C++
46.657342
119
0.657617
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/tutorials/tutorial20/OgnTutorialTokens.cpp
// 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. // #include <OgnTutorialTokensDatabase.h> class OgnTutorialTokens { public: static bool compute(OgnTutorialTokensDatabase& db) { const auto& valuesToCheck = db.inputs.valuesToCheck(); auto& isColor = db.outputs.isColor(); isColor.resize( valuesToCheck.size() ); if (valuesToCheck.size() == 0) { return true; } // Walk the list of inputs, setting the corresponding output to true if and only if the input is in // the list of allowable tokens. size_t index{ 0 }; for (const auto& inputValue : valuesToCheck) { // When the database is available you can use it to access the token values directly. When it is not // you can access them statically (e.g. OgnTutorialTokensDatabase.token.red) if ((inputValue == db.tokens.red) || (inputValue == db.tokens.green) || (inputValue == db.tokens.blue)) { isColor[index] = true; } else { isColor[index] = false; } index++; } return true; } }; REGISTER_OGN_NODE()
1,617
C++
32.708333
115
0.619666
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/tutorials/tutorial20/OgnTutorialTokensPy.py
""" Implementation of a node handling hardcoded tokens. Tokens are a fixed set of strings, usually used for things like keywords and enum names. In C++ tokens are more efficient than strings for lookup as they are represented as a single long integer. The Python access methods are set up the same way, though at present there is no differentiation between strings and tokens in Python code. """ class OgnTutorialTokensPy: """Exercise access to hardcoded tokens""" @staticmethod def compute(db) -> bool: """ Run through a list of input tokens and set booleans in a corresponding output array indicating if the token appears in the list of hardcoded color names. """ values_to_check = db.inputs.valuesToCheck # When assigning the entire array the size does not have to be set in advance db.outputs.isColor = [value in [db.tokens.red, db.tokens.green, db.tokens.blue] for value in values_to_check] return True
990
Python
38.639998
117
0.717172
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/tutorials/tutorial20/tutorial20.rst
.. _ogn_tutorial_tokens: Tutorial 20 - Tokens ==================== Tokens are a method of providing fast access to strings that have fixed contents. All strings with the same contents can be translated into the same shared token. Token comparison is as fast as integer comparisons, rather than the more expensive string comparisons you would need for a general string. One example of where they are useful is in having a fixed set of allowable values for an input string. For example you might choose a color channel by selecting from the names "red", "green", and "blue", or you might know that a mesh bundle's contents always use the attribute names "normals", "points", and "faces". Tokens can be accessed through the database methods ``tokenToString()`` and ``stringToToken()``. Using the ``tokens`` keyword in a .ogn file merely provides a shortcut to always having certain tokens available. In the color case then if you have a token input containing the color your comparison code changes from this: .. code-block:: c++ const auto& colorToken = db.inputs.colorToken(); if (colorToken == db.stringToToken("red")) { // do red stuff } else if (colorToken == db.stringToToken("green")) { // do green stuff } else if (colorToken == db.stringToToken("blue")) { // do blue stuff } to this, which has much faster comparison times: .. code-block:: c++ const auto& colorToken = db.inputs.colorToken(); if (colorToken == db.tokens.red) { // do red stuff } else if (colorToken == db.tokens.green) { // do green stuff } else if (colorToken == db.tokens.blue) { // do blue stuff } In Python there isn't a first-class object that is a token but the same token access is provided for consistency: .. code-block:: python color_token = db.inputs.colorToken if color_token == db.tokens.red: # do red stuff elif color_token == db.tokens.green: # do green stuff elif color_token == db.tokens.blue: # do blue stuff OgnTutorialTokens.ogn --------------------- The *ogn* file shows the implementation of a node named "omni.graph.tutorials.Tokens", which contains some hardcoded tokens to use in the compute method. .. literalinclude:: OgnTutorialTokens.ogn :linenos: :language: json OgnTutorialTokens.cpp --------------------- The *cpp* file contains the implementation of the compute method. It illustrates how to access the hardcoded tokens to avoid writing the boilerplate code yourself. .. literalinclude:: OgnTutorialTokens.cpp :linenos: :language: c++ OgnTutorialTokensPy.py ---------------------- The *py* file contains the implementation of the compute method in Python. The .ogn file is the same as the above, except for the addition of the implementation language key ``"language": "python"``. The compute follows the same algorithm as the *cpp* equivalent. .. literalinclude:: OgnTutorialTokensPy.py :linenos: :language: python
3,032
reStructuredText
32.32967
118
0.686016
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/tutorials/tutorial7/tutorial7.rst
.. _ogn_tutorial_roleData: Tutorial 7 - Role-Based Data Node ================================= The role-based data node creates one input attribute and one output attribute of each of the role-based type. A role-based type is defined as data with an underlying simple data type, with an interpretation of that simple data, called a "role". Examples of roles are **color**, **quat**, and **timecode**. For consistency the tuple counts for each of the roles are included in the declaration so that the "shape" of the underlying data is more obvious. OgnTutorialRoleData.ogn ----------------------- The *ogn* file shows the implementation of a node named "omni.graph.tutorials.RoleData", which has one input and one output attribute of each Role type. .. literalinclude:: OgnTutorialRoleData.ogn :linenos: :language: json OgnTutorialRoleData.cpp ----------------------- The *cpp* file contains the implementation of the compute method, which modifies each of the inputs by adding 1.0 to all components to create outputs that have different, testable, values. .. literalinclude:: OgnTutorialRoleData.cpp :linenos: :language: c++ Role-Based Attribute Access --------------------------- Here is a subset of the generated role-based attributes from the database. It contains color attributes, a matrix attribute, and a timecode attribute. Notice how the underlying data types of the attributes are provided, again with the ability to cast to different interface classes with the same memory layout. +----------------------+-------------------+ | Database Function | Returned Type | +======================+===================+ | inputs.a_color3d() | const GfVec3d& | +----------------------+-------------------+ | inputs.a_color4f() | const GfVec4f& | +----------------------+-------------------+ | inputs.a_frame() | const GfMatrix4d& | +----------------------+-------------------+ | inputs.a_timecode() | const double& | +----------------------+-------------------+ | outputs.a_color3d() | GfVec3d& | +----------------------+-------------------+ | outputs.a_color4f() | GfVec4f& | +----------------------+-------------------+ | outputs.a_frame() | GfMatrix4d& | +----------------------+-------------------+ | outputs.a_timecode() | double& | +----------------------+-------------------+ The full set of corresponding data types can be found in :ref:`ogn_attribute_roles`. This role information is available on all attribute interfaces through the ``role()`` method. For example you can find that the first attribute is a color by making this check: .. code-block:: c++ static bool compute(OgnTutorialRoleDataDatabase& db) { if (db.inputs.a_color3d.role == eColor ) { processValueAsAColor( db.inputs.a_color3d() ); } }
2,856
reStructuredText
38.680555
113
0.576681
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/tutorials/tutorial7/OgnTutorialRoleData.cpp
// Copyright (c) 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. // #include <OgnTutorialRoleDataDatabase.h> // This class exercises access to the DataModel through the generated database class for all role-based data types namespace { // Helper values to make it easy to add 1 to values of different lengths GfHalf h1{ 1.0f }; GfVec2d increment2d{ 1.0, 1.0 }; GfVec2f increment2f{ 1.0f, 1.0f }; GfVec2h increment2h{ h1, h1 }; GfVec3d increment3d{ 1.0, 1.0, 1.0 }; GfVec3f increment3f{ 1.0f, 1.0f, 1.0f }; GfVec3h increment3h{ h1, h1, h1 }; GfVec4d increment4d{ 1.0, 1.0, 1.0, 1.0 }; GfVec4f increment4f{ 1.0f, 1.0f, 1.0f, 1.0f }; GfVec4h increment4h{ h1, h1, h1, h1 }; GfQuatd incrementQd{ 1.0, 1.0, 1.0, 1.0 }; GfQuatf incrementQf{ 1.0f, 1.0f, 1.0f, 1.0f }; GfQuath incrementQh{ h1, h1, h1, h1 }; GfMatrix4d incrementM4d{ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; GfMatrix3d incrementM3d{ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; GfMatrix2d incrementM2d{ 1.0, 1.0, 1.0, 1.0 }; } // Helper macro to simplify the code but include all of the error checking #define ComputeOne(ATTRIBUTE_NAME, INCREMENT_VARIABLE, ROLE_EXPECTED) \ foundError = false; \ if (db.inputs.ATTRIBUTE_NAME.role() != ROLE_EXPECTED) \ { \ db.logWarning("Input role type %d != %d", (int)db.inputs.ATTRIBUTE_NAME.role(), (int)ROLE_EXPECTED); \ foundError = true; \ foundAnyErrors = true; \ } \ if (db.outputs.ATTRIBUTE_NAME.role() != ROLE_EXPECTED) \ { \ db.logWarning("output role type %d != %d", (int)db.outputs.ATTRIBUTE_NAME.role(), (int)ROLE_EXPECTED); \ foundError = true; \ foundAnyErrors = true; \ } \ if (!foundError) \ { \ db.outputs.ATTRIBUTE_NAME() = db.inputs.ATTRIBUTE_NAME() + INCREMENT_VARIABLE; \ } class OgnTutorialRoleData { public: static bool compute(OgnTutorialRoleDataDatabase& db) { // The roles for the attributes only serve to guide how to interpret them. When accessed from the // database they take the form of their raw underlying type. For example a point3d will have the // same GfVec3d type as a double[3], as will a vector3d and a normal3d. // Keep track if any role errors were found with this, continuing to the end of evaluation after errors bool foundAnyErrors{ false }; // Toggled on as soon as any error is found bool foundError{ false }; // Toggled off and on for each attribute // Walk through all of the data types, using the macro to perform error checking ComputeOne(a_color3d, increment3d, AttributeRole::eColor); ComputeOne(a_color3f, increment3f, AttributeRole::eColor); ComputeOne(a_color3h, increment3h, AttributeRole::eColor); // ComputeOne(a_color4d, increment4d, AttributeRole::eColor); ComputeOne(a_color4f, increment4f, AttributeRole::eColor); ComputeOne(a_color4h, increment4h, AttributeRole::eColor); // ComputeOne(a_frame, incrementM4d, AttributeRole::eFrame); // ComputeOne(a_matrix2d, incrementM2d, AttributeRole::eMatrix ); ComputeOne(a_matrix3d, incrementM3d, AttributeRole::eMatrix ); ComputeOne(a_matrix4d, incrementM4d, AttributeRole::eMatrix ); // ComputeOne(a_normal3d, increment3d, AttributeRole::eNormal); ComputeOne(a_normal3f, increment3f, AttributeRole::eNormal); ComputeOne(a_normal3h, increment3h, AttributeRole::eNormal); // ComputeOne(a_point3d, increment3d, AttributeRole::ePosition); ComputeOne(a_point3f, increment3f, AttributeRole::ePosition); ComputeOne(a_point3h, increment3h, AttributeRole::ePosition); // ComputeOne(a_quatd, incrementQd, AttributeRole::eQuaternion); ComputeOne(a_quatf, incrementQf, AttributeRole::eQuaternion); ComputeOne(a_quath, incrementQh, AttributeRole::eQuaternion); // ComputeOne(a_texcoord2d, increment2d, AttributeRole::eTexCoord); ComputeOne(a_texcoord2f, increment2f, AttributeRole::eTexCoord); ComputeOne(a_texcoord2h, increment2h, AttributeRole::eTexCoord); // ComputeOne(a_texcoord3d, increment3d, AttributeRole::eTexCoord); ComputeOne(a_texcoord3f, increment3f, AttributeRole::eTexCoord); ComputeOne(a_texcoord3h, increment3h, AttributeRole::eTexCoord); // ComputeOne(a_timecode, 1.0, AttributeRole::eTimeCode); // ComputeOne(a_vector3d, increment3d, AttributeRole::eVector); ComputeOne(a_vector3f, increment3f, AttributeRole::eVector); ComputeOne(a_vector3h, increment3h, AttributeRole::eVector); return foundAnyErrors; } }; REGISTER_OGN_NODE()
6,498
C++
55.025862
120
0.538319
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/tutorials/tutorial29/OgnTutorialVectorizedABIPassthrough.cpp
// 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. // #include <OgnTutorialVectorizedABIPassthroughDatabase.h> // The method used by the computation to perform the passthrough // 0 = simple copy, no vectorization #define TUTO_ABI_PASSTHROUGH_METHOD_SIMPLE 0 // 1 = vectorized copy by indexing the instance directly per attribute #define TUTO_ABI_PASSTHROUGH_METHOD_ATTR 1 // 2 = vectorized copy by mutating attribute data handles #define TUTO_ABI_PASSTHROUGH_METHOD_MUTATE 2 // 3 = vectorized copy using raw data #define TUTO_ABI_PASSTHROUGH_METHOD_RAW 3 //By default, use the most efficient method #define TUTO_ABI_PASSTHROUGH_METHOD TUTO_ABI_PASSTHROUGH_METHOD_RAW // This node perform a copy of its input to its output class OgnTutorialVectorizedABIPassthrough { public: #if TUTO_ABI_PASSTHROUGH_METHOD == TUTO_ABI_PASSTHROUGH_METHOD_SIMPLE // begin-regular static bool compute(GraphContextObj const& contextObj, NodeObj const& nodeObj) { NodeContextHandle nodeHandle = nodeObj.nodeContextHandle; auto inputValueAttr = getAttributeR(contextObj, nodeHandle, Token("inputs:value"), kAccordingToContextIndex); const float* inputValue = getDataR<float>(contextObj, inputValueAttr); auto outputValueAttr = getAttributeW(contextObj, nodeHandle, Token("outputs:value"), kAccordingToContextIndex); float* outputValue = getDataW<float>(contextObj, outputValueAttr); if(inputValue && outputValue) { *outputValue = *inputValue; return true; } return false; } // end-regular #elif TUTO_ABI_PASSTHROUGH_METHOD == TUTO_ABI_PASSTHROUGH_METHOD_ATTR // begin-attr static size_t computeVectorized(GraphContextObj const& contextObj, NodeObj const& nodeObj, size_t count) { GraphContextObj const* contexts = nullptr; NodeObj const* nodes = nullptr; //When using auto instancing, similiar graphs can get merged together, and computed vectorized // In such case, each instance represent a different node in a different graph // Accessing the data either through the provided node, or through the actual auto-insance node would work properly // But any other ABI call requiring the node would need to provide the proper node // While not necessary in this contezt, do the work of using the proper auto-instance node // in order to demonstrate how to use it. size_t handleCount = nodeObj.iNode->getAutoInstances(nodeObj, contexts, nodes); auto nodeHandle = [&](InstanceIndex index) -> NodeContextHandle { return nodes[handleCount == 1 ? 0 : index.index].nodeContextHandle; }; auto context = [&](InstanceIndex index) -> GraphContextObj { return contexts[handleCount == 1 ? 0 : index.index]; }; size_t ret = 0; const float* inputValue{ nullptr }; float* outputValue{ nullptr }; auto inToken = Token("inputs:value"); auto outToken = Token("outputs:value"); for (InstanceIndex idx{ 0 }; idx < InstanceIndex{ count }; ++idx) { auto inputValueAttr = getAttributeR(context(idx), nodeHandle(idx), inToken, idx); inputValue = getDataR<float>(context(idx), inputValueAttr); auto outputValueAttr = getAttributeW(context(idx), nodeHandle(idx), outToken, idx); outputValue = getDataW<float>(context(idx), outputValueAttr); if(inputValue && outputValue) { *outputValue = *inputValue; ++ret; } } return ret; } // end-attr #elif TUTO_ABI_PASSTHROUGH_METHOD == TUTO_ABI_PASSTHROUGH_METHOD_MUTATE // begin-mutate static size_t computeVectorized(GraphContextObj const& contextObj, NodeObj const& nodeObj, size_t count) { NodeContextHandle nodeHandle = nodeObj.nodeContextHandle; size_t ret = 0; const float* inputValue{ nullptr }; float* outputValue{ nullptr }; auto inputValueAttr = getAttributeR(contextObj, nodeHandle, Token("inputs:value"), kAccordingToContextIndex); auto outputValueAttr = getAttributeW(contextObj, nodeHandle, Token("outputs:value"), kAccordingToContextIndex); while (count--) { inputValue = getDataR<float>(contextObj, inputValueAttr); outputValue = getDataW<float>(contextObj, outputValueAttr); if(inputValue && outputValue) { *outputValue = *inputValue; ++ret; } inputValueAttr = contextObj.iAttributeData->moveToAnotherInstanceR(contextObj, inputValueAttr, 1); outputValueAttr = contextObj.iAttributeData->moveToAnotherInstanceW(contextObj, outputValueAttr, 1); } return ret; } // end-mutate #elif TUTO_ABI_PASSTHROUGH_METHOD == TUTO_ABI_PASSTHROUGH_METHOD_RAW // begin-raw static size_t computeVectorized(GraphContextObj const& contextObj, NodeObj const& nodeObj, size_t count) { NodeContextHandle nodeHandle = nodeObj.nodeContextHandle; auto inputValueAttr = getAttributeR(contextObj, nodeHandle, Token("inputs:value"), kAccordingToContextIndex); const float* inputValue = getDataR<float>(contextObj, inputValueAttr); auto outputValueAttr = getAttributeW(contextObj, nodeHandle, Token("outputs:value"), kAccordingToContextIndex); float* outputValue = getDataW<float>(contextObj, outputValueAttr); if(inputValue && outputValue) { memcpy(outputValue, inputValue, count * sizeof(float)); return count; } return 0; } // end-raw #endif }; REGISTER_OGN_NODE()
6,186
C++
38.407643
123
0.676043
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/tutorials/tutorial17/tutorial17.rst
.. _ogn_tutorial_state_attributes_py: Tutorial 17 - Python State Attributes Node ========================================== This node illustrates how you can use state attributes. These are attributes that are not meant to be connected to other nodes as they maintain a node's internal state, persistent from one evaluation to the next. As they are persistent, care must be taken that they be initialized properly. This can take the form of a reset flag, as seen on this node, state flag values with known defaults that describe the validity of the state attribute data, or using a checksum on inputs, among other possibilities. State attributes can be both read and written, like output attributes. The presence of state attributes will also inform the evaluators on what type of parallel scheduling is appropriate. These attributes provide a similar functionality to those found in :ref:`ogn_tutorial_state_py`, except that being node attributes the structure is visible to the outside world, making it easier to construct UI and visualizers for it. OgnTutorialStateAttributesPy.ogn -------------------------------- The *.ogn* file containing the implementation of a node named "omni.graph.tutorials.StateAttributesPy", with a couple of state attributes that both read and write values during the compute. .. literalinclude:: OgnTutorialStateAttributesPy.ogn :linenos: :language: json OgnTutorialStateAttributesPy.py ------------------------------- The *.py* file contains the compute method that uses the state attributes to run the algorithm. .. literalinclude:: OgnTutorialStateAttributesPy.py :linenos: :language: python Test Script ----------- The .ogn test infrastructure currently only supports single evaluation, which will not be sufficient to test state attribute manipulations. This test script runs multiple evaluations and verifies that the state information is updated as expected after each evaluation. .. literalinclude:: ../../python/tests/test_tutorial_state_attributes_py.py :linenos: :language: python
2,060
reStructuredText
42.851063
126
0.752913
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/tutorials/tutorial17/OgnTutorialStateAttributesPy.py
""" Implementation of a Python node that uses state attributes to maintain information between evaluations. The node has a simple monotonically increasing state output "monotonic" that can be reset by setting the state attribute "reset" to true. """ class OgnTutorialStateAttributesPy: """Use internal node state information in addition to inputs""" @staticmethod def compute(db) -> bool: """Compute the output based on inputs and internal state""" # State attributes are the only ones guaranteed to remember and modify their values. # Care must be taken to set proper defaults when the node initializes, otherwise you could be # starting in an unknown state. if db.state.reset: db.state.monotonic = 0 db.state.reset = False else: db.state.monotonic = db.state.monotonic + 1 return True
897
Python
33.53846
110
0.688963
omniverse-code/kit/exts/omni.graph.tutorials/omni/graph/tutorials/ogn/tutorials/tutorial11/tutorial11.rst
.. _ogn_tutorial_complexData_py: Tutorial 11 - Complex Data Node in Python ========================================= This node fills on the remainder of the (CPU for now) data types available through Python. It combines the progressive introduction in C++ of :ref:`ogn_tutorial_tupleData`, :ref:`ogn_tutorial_arrayData`, :ref:`ogn_tutorial_tupleArrays`, and :ref:`ogn_tutorial_roleData`. Rather than providing an exhaustive set of attribute types there will be one chosen from each of the aforementioned categories of types. See the section `Pythonic Complex Attribute Type Access`_ for details on how to access the representative types. OgnTutorialComplexDataPy.ogn ---------------------------- The *ogn* file shows the implementation of a node named "omni.graph.tutorials.ComplexDataPy", which has one input and one output attribute of each complex (arrays, tuples, roles) type. .. literalinclude:: OgnTutorialComplexDataPy.ogn :linenos: :language: json OgnTutorialComplexDataPy.py --------------------------- The *py* file contains the implementation of the compute method, which modifies each of the inputs in a simple way to create outputs that have different values. .. literalinclude:: OgnTutorialComplexDataPy.py :linenos: :language: python Note how the attribute values are available through the ``OgnTutorialComplexDataPyDatabase`` class. The generated interface creates access methods for every attribute, named for the attribute itself. They are all implemented as Python properties, where inputs only have get methods and outputs have both get and set methods. Pythonic Complex Attribute Type Access -------------------------------------- Complex data in Python takes advantage of the numpy library to handle arrays so you should always include this line at the top of your node if you have array data: .. code-block:: python import numpy +----------------------+---------------------+-------------------------+ | Database Property | Representative Type | Returned Type | +======================+=====================+=========================+ | inputs.a_float3 | Tuple | [float, float, float] | +----------------------+---------------------+-------------------------+ | inputs.a_floatArray | Array | numpy.ndarray[float, 1] | +----------------------+---------------------+-------------------------+ | inputs.a_point3Array | Role-Based | numpy.ndarray[float, 3] | +----------------------+---------------------+-------------------------+ As with simple data, the values returned are all references to the real data in the FlatCache, our managed memory store, pointing to the correct location at evaluation time. Python Role Information ----------------------- The attribute roles can be checked in Python similar to C++ by using the ``role()`` method on the generated database class. .. code-block:: python def compute(db) -> bool: """Run my algorithm""" if db.role(db.outputs.a_pointArray) == db.ROLE_POINT: print("Hey, I did get the correct role") This table shows the list of Python role names and the corresponding attribute types that match them: +-----------------+---------------------------------+ | Python Role | Attribute Types | +=================+=================================+ | ROLE_COLOR | colord, colorf, colorh | +-----------------+---------------------------------+ | ROLE_FRAME | frame | +-----------------+---------------------------------+ | ROLE_NORMAL | normald, normalf, normalh | +-----------------+---------------------------------+ | ROLE_POSITION | positiond, positionf, positionh | +-----------------+---------------------------------+ | ROLE_QUATERNION | quatd, quatf, quath | +-----------------+---------------------------------+ | ROLE_TEXCOORD | texcoordd, texcoordf, texcoordh | +-----------------+---------------------------------+ | ROLE_TIMECODE | timecode | +-----------------+---------------------------------+ | ROLE_TRANSFORM | transform | +-----------------+---------------------------------+ | ROLE_VECTOR | vectord, vectorf, vectorh | +-----------------+---------------------------------+
4,331
reStructuredText
43.659793
120
0.525745