create_node_type

omni.graph.core.create_node_type(func: Optional[callable] = None, *, unique_name: Optional[str] = None, ui_name: Optional[str] = None, add_execution_pins: bool = False, metadata: Optional[dict[str, str]] = None) callable

Decorator to transform a Python function into an OmniGraph node type definition. The decorator is configured to allow use with and without parameters. When used without parameters all of the default values for the parameters are assumed.

If the function is called from the __main__ context, as it would if it were executed from the script editor or from a file, then the decorator is assumed to be creating a short-lived node type definition and the default module name “__autonode__” is applied to indicate this. Any attempts to save a scene containing these short-term node types will be flagged as a warning.

Examples

>>> import omni.graph.core as og
>>> @og.create_node_type
>>> def double_float(a: ogdt.Float) -> ogdt.Float:
>>>     return a * 2.0
>>>
>>> @og.create_node_type(add_execution_pins=True)
>>> def double_float(a: ogdt.Float) -> ogdt.Float:
>>>     return a * 2.0
Parameters
  • func – the function object being wrapped. Should be a pure python function object or any other callable which

  • form (has an `__annotations__` property. If "None" then the decorator was called using the parameterized) –

  • "@create_node_type

  • unique_name – Override the default unique name, which is the function name in the module namespace

  • ui_name – Name that appears in the node type’s menu and node display.

  • add_execution_pins – Include both input and output execution pins so that this can be used as a trigger node

  • graph. (type in an action) –

  • metadata – Dictionary of extra metadata to apply to the node type

Returns

Decorated version of the function that will create the node type definition