Basics
Node Types
- NodegraphAPI.GetNodeTypes()
Get all the registered node types. Builds a list of all
Node
types that have been registered.- Returns:
All names
- Return type:
list
ofstr
Node Type Registration
The following lower-level APIs are called by Katana to register Python-based
node types. The methods are called automatically when using higher-level APIs
like Nodes3DAPI.NodeTypeBuilder
.
- NodegraphAPI.RegisterPythonNodeFactory(type, factory)
Register a callback to create nodes. The
Node
factory must create and return a single node. It is almost always required that the callback disables the undo stack while it builds and decorates the node.- The callback must have the following signature::
def factory(type): return Node
- Attention:
Registering a type name that already exists will terminate the process.
- Parameters:
type (
str
) – Name of the node type.factory (
function
) – Callback to create the node
- NodegraphAPI.RegisterPythonNodeType(type, ctor)
Register a python node class. The ctor class argument must be derived from
PythonNode
. The constructor will be called with no arguments when the requested node type is created.If
type
is a subclass of a type supplied toRegisterBasePythonNodeRegisterFunc()
, we will forward to the register function provided in that call.- Attention:
Registering a type name that already exists will terminate the process.
- Parameters:
type (
str
) – Name of the node type.ctor (
type
ofPythonNode
) – The node class
- NodegraphAPI.RegisterPythonGroupType(type, ctor)
Register a python group node class. The ctor class argument must be derived from
PythonGroupNode
. The constructor will be called with no arguments when the requested node type is created.- Attention:
Registering a type name that already exists will terminate the process.
- Parameters:
type (
str
) – Name of the node type.ctor (
type
ofPythonGroupNode
) – The node class
Node Flavors
- NodegraphAPI.AddNodeFlavor(nodeType, flavor)
Tag a node type with a flavor. The flavor name is created if it has never been used. It is safe to tag the node multiple times with the same flavor, the tag is only recorded once. It is also safe to call this if the node type has never been registered.
- Parameters:
nodeType –
str
of the node nameflavor –
str
of the flavor name
- NodegraphAPI.ClearFlavorNodes(flavor)
Untag all nodes from the flavor. All nodes types previously tagged with the flavor or untagged. This is safe to call if the flavor has never been defined.
- Parameters:
flavor –
str
of the flavor name
- NodegraphAPI.GetAllFlavors()
Untag all nodes from the flavor. Get a list of all defined flavors
- Returns:
list
- NodegraphAPI.GetFlavorNodes(flavor, filterExists=False)
Get all node types tagged with a flavor. If the filterExists flag is passed as True, then only nodes types that have been registered will be returned. Otherwise node types may be returned that have been tagged but not defined.
- Parameters:
flavor –
str
filterExists –
bool
- Returns:
list
- NodegraphAPI.GetNodeFlavors(nodeType)
Get all tagged flavors for a node type. :param nodeType:
str
:return:list
- NodegraphAPI.NodeMatchesFlavors(nodeType, flavors, ignoreFlavors)
Return True if the node type matches the list of flavors. The flavors represent the required flavors to use, or None for all. The match will fail if ignoreFlavors is given and matches one of the flavors.
- Parameters:
nodeType –
str
flavors –
sequence
ofstr
ignoreFlavors –
sequence
ofstr
- Returns:
bool
- NodegraphAPI.RemoveNodeFlavor(nodeType, flavor)
Untag a node type with a flavor. This is safe to call if the node has never been tagged with this flavor, or neither has been previously registered.
- Parameters:
nodeType –
str
of the node nameflavor –
str
of the flavor name