.. _omni_graph_scriptnode_ScriptNode_2:

.. _omni_graph_scriptnode_ScriptNode:

.. ================================================================================
.. THIS PAGE IS AUTO-GENERATED. DO NOT MANUALLY EDIT.
.. ================================================================================

:orphan:

.. meta::
    :title: Script Node
    :keywords: lang-en omnigraph node script WriteOnly scriptnode script-node


Script Node
===========

.. <description>

This script node allows you to execute arbitrary Python code.
 `import` statements, function/class definitions, and global variables may be placed
 outside of the callbacks, and variables may be added to the ``db.internal_state`` state object
 
 The following callback functions may be defined in the script
     - ``setup(db)`` is called before compute the first time, or after reset is pressed
     - ``compute(db)`` is called every time the node computes (should always be defined)
     - ``cleanup(db)`` is called when the node is deleted or the reset button is pressed
 
 Predefined Variables
     - ``db (og.Database)`` is the node interface, attributes are exposed like ``db.inputs.foo``. Use ``db.log_error``, ``db.log_warning`` to report problems
     - ``og``: is the `omni.graph.core` module
 


.. </description>


Installation
------------

To use this node enable :ref:`omni.graph.scriptnode<ext_omni_graph_scriptnode>` in the Extension Manager.


Inputs
------
.. csv-table::
    :header: "Name", "Type", "Descripton", "Default"
    :widths: 20, 20, 50, 10

    "inputs:execIn", "``execution``", "The input execution", "None"
    "Inline Script (*inputs:script*)", "``string``", "A string containing a Python script that may define code to be executed when the script node computes. See the default and example scripts for more info.", "None"
    "Script File Path (*inputs:scriptPath*)", "``token``", "The path of a file containing a Python script that may define code to be executed when the script node computes. See the default and example scripts for more info.", "None"
    "", "*uiType*", "filePath", ""
    "", "*fileExts*", "Python Scripts (\\*.py)", ""
    "Use Script File (*inputs:usePath*)", "``bool``", "When true, the python script is read from the file specified in 'Script File Path', instead of the string in 'Inline Script'", "False"


Outputs
-------
.. csv-table::
    :header: "Name", "Type", "Descripton", "Default"
    :widths: 20, 20, 50, 10

    "outputs:execOut", "``execution``", "The output execution", "None"


State
-----
.. csv-table::
    :header: "Name", "Type", "Descripton", "Default"
    :widths: 20, 20, 50, 10

    "state:omni_initialized", "``bool``", "State attribute used to control when the script should be reloaded. This should be set to False to trigger a reload of the script.", "None"


Metadata
--------
.. csv-table::
    :header: "Name", "Value"
    :widths: 30,70

    "Unique ID", "omni.graph.scriptnode.ScriptNode"
    "Version", "2"
    "Extension", "omni.graph.scriptnode"
    "Icon", "ogn/icons/omni.graph.scriptnode.ScriptNode.svg"
    "Has State?", "True"
    "Implementation Language", "Python"
    "Default Memory Type", "cpu"
    "Generated Code Exclusions", "None"
    "uiName", "Script Node"
    "Categories", "script"
    "Generated Class Name", "OgnScriptNodeDatabase"
    "Python Module", "omni.graph.scriptnode"

