Python Script Node API (PyPythonNode class)
This is the class for manipulating Python Script nodes in the tracking tree. This class inherits from the generic PyNode class.
Please note that this API is only for constructing Macros. Please refer to the Python Node API documentation for details on how to write scripts for custom Python nodes.
string getScript()
- returns the Python script of this node.
void setScript(string)
- sets the Python script to the specified value. Setting the Python script automatically executes it.
void run()
- executes the Python script of this node.
The Python Script node stores a set of user-defined key-value pair attributes. These attributes are typically used to pass information between the node and, for example, macros or compound nodes. For example, the Python Script node stores in an attribute the number of selected user-features which makes that information available to a compound node which could alter the state of its GUI accordingly. The following functions access those attributes:
string getAttribute(string key)
- returns the specified attribute.
void setAttribute(string key, string value)
- sets the specified attribute.
int hasAttribute(string key)
- returns 1 if the specified attribute exists, 0 otherwise.
void clearAttribute(string key)
- removes the specified attribute.
void clearAttributes()
- removes all attributes.