NodeTypeBuilder

class Nodes3DAPI.NodeTypeBuilder.NodeTypeBuilder(nodeTypeName)

Bases: object

Class used for defining Node3D node types via an abstracted interface.

class OpChainInterface(opChainInterface)

Bases: Nodes3DAPI.NodeTypeBuilder.BaseOpChainInterface

Interface to the op chain passed to the node NodeTypeBuilder’s callback.

FAIL = 0
NO_OP = 2
SKIP = 1
__init__(opChainInterface)
__module__ = 'Nodes3DAPI.NodeTypeBuilder'
addInputRequest(inputPortName, graphState, invalidInputBehavior=0)
appendOp(opType, opArgs=None)

Append the given Op of type ‘opType’ to the op chain.

setExplicitInputRequestsEnabled(state)
setMinRequiredInputs(value)
classmethod NodeTypeBuilder.SetGenericAssignPolicyRegistrationCallback(callback)
NodeTypeBuilder.__dict__ = dict_proxy({'setBuildOpChainFnc': <function setBuildOpChainFnc at 0x184c5f0>, '__module__': 'Nodes3DAPI.NodeTypeBuilder', 'setAppendToParametersOpChainFnc': <function setAppendToParametersOpChainFnc at 0x184c668>, 'addTransformParameters': <function addTransformParameters at 0x184c488>, 'addMakeInteractiveParameter': <function addMakeInteractiveParameter at 0x184c578>, 'addTimingParameters': <function addTimingParameters at 0x184c410>, 'setInputPortNames': <function setInputPortNames at 0x184c0c8>, 'setGenericAssignRoots': <function setGenericAssignRoots at 0x184c230>, 'setAddParameterHintsFnc': <function setAddParameterHintsFnc at 0x184c758>, 'OpChainInterface': <class 'Nodes3DAPI.NodeTypeBuilder.OpChainInterface'>, '__dict__': <attribute '__dict__' of 'NodeTypeBuilder' objects>, 'SetGenericAssignPolicyRegistrationCallback': <classmethod object at 0x18458d8>, 'setOutputPortNames': <function setOutputPortNames at 0x184c140>, '__init__': <function __init__ at 0x184bed8>, 'setHintsForNode': <function setHintsForNode at 0x184c398>, 'setCustomMethod': <function setCustomMethod at 0x184c7d0>, 'setHintsForParameter': <function setHintsForParameter at 0x184c320>, '_NodeTypeBuilder__queuedPolicyRootValues': {}, 'setParametersTemplateAttr': <function setParametersTemplateAttr at 0x184c1b8>, 'addInteractiveTransformCallbacks': <function addInteractiveTransformCallbacks at 0x184c500>, '__weakref__': <attribute '__weakref__' of 'NodeTypeBuilder' objects>, 'setNodeTypeVersion': <function setNodeTypeVersion at 0x184bf50>, 'setGetScenegraphLocationFnc': <function setGetScenegraphLocationFnc at 0x184c6e0>, 'setIsHiddenFromMenus': <function setIsHiddenFromMenus at 0x184c848>, 'setNodeTypeVersionUpdateFnc': <function setNodeTypeVersionUpdateFnc at 0x184c050>, '_NodeTypeBuilder__registeredTypes': {'_LightFilterPackageInternal': <class 'Nodes3DAPI.NodeTypeBuilder._LightFilterPackageInternal'>, '_GafferTagAdopted': <class 'Nodes3DAPI.NodeTypeBuilder._GafferTagAdopted'>, '_LightFilterLightListInternal': <class 'Nodes3DAPI.NodeTypeBuilder._LightFilterLightListInternal'>, '_LightFilterReferencePackageInternal': <class 'Nodes3DAPI.NodeTypeBuilder._LightFilterReferencePackageInternal'>}, 'build': <function build at 0x184c8c0>, 'setBuildParametersFnc': <function setBuildParametersFnc at 0x184c2a8>, '__doc__': '\n Class used for defining Node3D node types via an abstracted interface.\n '})
NodeTypeBuilder.__init__(nodeTypeName)

Initializes an instance of the class.

Parameters:nodeTypeName (str) – The name of the node type to register in NodegraphAPI’s factory.
NodeTypeBuilder.__module__ = 'Nodes3DAPI.NodeTypeBuilder'
NodeTypeBuilder.__weakref__

list of weak references to the object (if defined)

NodeTypeBuilder.addInteractiveTransformCallbacks(gb)

Sets up the callbacks to interactively modify the ‘transform’ parameter exposed by the node. If the node doesn’t have a ‘transform’ parameter, it will be created.

Parameters:gb (FnAttribute.GroupBuilder) – The group builder to which add the transform group attribute if not already available.
NodeTypeBuilder.addMakeInteractiveParameter(gb)

Adds the ‘makeInteractive’ attribute to the given group builder. Useful to expose the ‘makeInteractive’ parameter in the node’s parameter interface.

Parameters:gb (FnAttribute.GroupBuilder) – The group builder to which the ‘makeInteractive’ attribute should be added.
NodeTypeBuilder.addTimingParameters(gb)

Adds the timing group attribute to the given group builder. Useful to expose a timing parameter in the node’s parameter interface.

Parameters:gb (FnAttribute.GroupBuilder) – The group builder to which add the timing group attribute.
NodeTypeBuilder.addTransformParameters(gb)

Adds the transform group attribute to the given group builder. Useful to expose a transform parameter in the node’s parameter interface.

Parameters:gb (FnAttribute.GroupBuilder) – The group builder to which add the transform group attribute.
NodeTypeBuilder.build()

Commits the definitions and registers as a node type. This should be called only once.

NodeTypeBuilder.setAddParameterHintsFnc(fnc)

Defines an optional callback function which allows a node to add additional parameter hints when a new parameter is added.

The function should have a signature matching: addCustomParameterHints(self, attrName, inputDict)

It does not return anything.

NodeTypeBuilder.setAppendToParametersOpChainFnc(fnc)

Allows users of NodeTypeBuilder to modify the standard Op chain with additional Ops (and their arguments) to influence the appearance of values in parameters of an edited node.

NodeTypeBuilder.setBuildOpChainFnc(fnc)

Registers the function to be used for building the node’s Op chain.

NodeTypeBuilder.setBuildParametersFnc(fnc)

Defines an optional callback function which has an opportunity to procedurally create parameters on the newly created node instance. This is called following the conversion of values provided by setParametersTemplateAttr.

The function should have a signature matching: buildParameters(node)

Its return value (if any) is discarded.

NodeTypeBuilder.setCustomMethod(fncName, fnc)

Allows specification of custom methods on the resulting node type. If the name is not valid or clashes with an existing member function on the base class, an exception will be thrown during build.

NodeTypeBuilder.setGenericAssignRoots(paramRoot, attrRoot)

Sets the parameter and attribute name to be used as roots by the GenericAssign mechanism.

Parameters:
  • paramRoot (str) – The name of a group parameter in the hierarchy of parameters on a node under which child parameters should show values from the incoming scene, in the form of //Enableable Parameter Groups//.
  • attrRoot (str) – The name of a group attribute that is the target for attributes that correspond to //Enableable Parameter Groups// under the group parameter specified by paramRoot.
NodeTypeBuilder.setGetScenegraphLocationFnc(fnc)

Defines an optional callback function which allows a node to partipate in widgets and parameter expressions

The function should have a signature matching: getScenegraphLocation(node, frameTime)

It should return a single str value in the form of a scenegraph location path. It is allowed to inspect but not mutate its parameters to do so.

NodeTypeBuilder.setHintsForNode(hints)

Sets the hint dictionary used for the node type itself. This is most useful for setting “help” text.

NodeTypeBuilder.setHintsForParameter(paramPath, hints)

Sets the hint dictionary for a given parameter path relative to the node’s top-level parameter group.

NodeTypeBuilder.setInputPortNames(names)

Defines the names and order of input ports to be created on node initialization. By default, newly created types have no input ports.

Parameters:names (sequence of str) – A list of names
NodeTypeBuilder.setIsHiddenFromMenus(state)

Allows you to specify whether the created node type should be hidden from UI menus.

NodeTypeBuilder.setNodeTypeVersion(nodeTypeVersion)

Setting this allows you to tag node instances with a version so that you can provide upgrade paths at katana document parse time. The value defaults to 1 if not set. As only one plug-in can register a node type of a given name, the version of the registered type is considered current for document update purposes. This value is recorded in the node’s XML representation as a “nodetypeversion” attribute.

NodeTypeBuilder.setNodeTypeVersionUpdateFnc(nodeTypeVersion, updateFnc)

Calling this allows you to register a version upgrade function to the specified version from earlier versions. These functions are called during katana document parse and have this signature:

upgradeFnc(nodeElement)

The node element is an instance of PyXmlIO.Element and can be queried and manipulated with the NodegraphAPI.Xio module.

When parsing the document (prior to instantiating nodes), these scripts are run in sequence for the relevant version range. That range is defined by versions greater than document’s recorded version (via the “nodetypeversion” element attribute) and less than or equal to the current registered version.

NodeTypeBuilder.setOutputPortNames(names)

Defines the names and order of output ports to be created on node initialization. By default, newly created types have a single output port named ‘out’.

Parameters:names (sequence of str) – A list of names
NodeTypeBuilder.setParametersTemplateAttr(groupAttr, forceArrayNames=())

Defines the parameter layout of the node using a GroupAttribute as a template. Single-element FloatAttribute, IntAttribute and DoubleAttribute children are converted to number parameters. Single-element StringAttribute children are converted to string parameters. Multi-element attrs are created as array parameters of equivalent type. If forceArrayNames is specified, single-element attrs at the matching relative attribute paths will be created as equivalent array parameters. Child GroupAttributes are created as group parameters.

Op Chain Interfaces

class Nodes3DAPI.NodeTypeBuilder.BaseOpChainInterface(port, graphState)

Bases: object

This is the interface passed to the opchain’s builder method. It exposes some useful methods to get parameters from the node and pass them as arguments to the given Op.

__dict__ = dict_proxy({'__module__': 'Nodes3DAPI.NodeTypeBuilder', 'getModifiedFrameTime': <function getModifiedFrameTime at 0x184b2a8>, 'getShutterOpen': <function getShutterOpen at 0x184b1b8>, 'getFrameTime': <function getFrameTime at 0x184b0c8>, 'getShutterClose': <function getShutterClose at 0x184b230>, '__dict__': <attribute '__dict__' of 'BaseOpChainInterface' objects>, 'getOutputPortName': <function getOutputPortName at 0x1849f50>, '_BaseOpChainInterface__buildScalarAttrFromParam': <function __buildScalarAttrFromParam at 0x184b398>, 'FnAttribute': <module 'PyFnAttribute' from '/workspace/builder/jenkinsii/workspace/Katana_2.6dev/3b6e9fbc/Apps/Katana/objects/linux-64-x86-release-410-gcc/Dist/bin/PyFnAttribute.so'>, 'getNumSamples': <function getNumSamples at 0x184b140>, 'getGraphState': <function getGraphState at 0x184b050>, '__weakref__': <attribute '__weakref__' of 'BaseOpChainInterface' objects>, '__init__': <function __init__ at 0x1849ed8>, 'getExclusiveToNameAndAttribute': <function getExclusiveToNameAndAttribute at 0x184b5f0>, '_BaseOpChainInterface__buildArrayAttrFromParam': <function __buildArrayAttrFromParam at 0x184b410>, 'addOpSystemArgs': <function addOpSystemArgs at 0x184b320>, 'getTransformAsAttribute': <function getTransformAsAttribute at 0x184b578>, 'FnGeolib': <module 'PyFnGeolib' from '/workspace/builder/jenkinsii/workspace/Katana_2.6dev/3b6e9fbc/Apps/Katana/objects/linux-64-x86-release-410-gcc/Dist/bin/PyFnGeolib.so'>, 'buildAttrFromParam': <function buildAttrFromParam at 0x184b488>, '__doc__': "\n This is the interface passed to the opchain's builder method. It exposes\n some useful methods to get parameters from the node and pass them as\n arguments to the given Op.\n ", 'buildAttrListForEnableableParameters': <function buildAttrListForEnableableParameters at 0x184b500>})
__init__(port, graphState)

BuildInterface instances should only be constructed internal to the types created with NodeTypeBuilder. User code has no reason to create them directly.

__module__ = 'Nodes3DAPI.NodeTypeBuilder'
__weakref__

list of weak references to the object (if defined)

addOpSystemArgs(gb)

Adds the default Op system arguments to the given group builder.

Parameters:gb (FnAttribute.GroupBuilder) – The GroupBuilder to be filled with the op system args.
buildAttrFromParam(param, multisample=False, numberType=<type 'PyFnAttribute.FloatAttribute'>, groupInherit=True)

Utility for converting parameters into attributes, optionally with multi-sampling. This can be run on scalar, array or group parameters. Unless specified, number and number array parameters are converted as FnAttribute.FloatAttribute

Parameters:
buildAttrListForEnableableParameters(enclosingGroupParam)

Utility for converting GenericAssign-style enableable parameter groups into a list of attrPath, attr pairs. This is useful for custom node types with GenericAssign-like behavior.

Parameters:enclosingGroupParam (NodegraphAPI.Parameter) – This should be a group parameter containing child parameters in the enableable parameter group form.
getExclusiveToNameAndAttribute()

Utility function to be used by nodes that accept interactive transformation, that returns a named tuple representing the relative ‘exclusiveTo’ attribute value, if present.

Return type:tuple of (str, StringAttribute) or tuple of (str, None).
Returns:A tuple whose first element is the string ‘attributeEditor.exclusiveTo’. The second element is a StringAttribute with the node’s name if the ‘makeInteractive’ parameter isn’t ‘No’, otherwise None.
getFrameTime()

Returns the frameTime from the context in which the current node is being cooked. This should be used instead of NodegraphAPI.GetCurrentTime() for any parameter evaluation.

Return type:float
getGraphState()

Returns the graphState from the context in which the current node is being cooked.

Return type:GraphState
getModifiedFrameTime()
Return type:float
Returns:The current frame time modified depending on the timing mode, assuming the node has a timing parameter.
getNumSamples()

Returns the “numSamples” hint available to nodes which are concerned with multi-sample values. For pre-sampled data, typical interpretation is to process animation when the value is greater than 1. For data sampled on the fly, this value is the recommendation for how frequently to sample.

Return type:int
getOutputPortName()

Returns the name of the output port from which the current node is being cooked.

Return type:str
getShutterClose()

Returns the “shutterClose” hint available to nodes which are concerned with multi-sample values. This is a frame-relative value.

Return type:float
getShutterOpen()

Returns the “shutterOpen” hint available to nodes which are concerned with multi-sample values. This is a frame-relative value.

Return type:float
getTransformAsAttribute()
Return type:FnAttribute.GroupAttribute
Returns:A GroupAttribute containing the values from the transform group parameter, if available.
class Nodes3DAPI.NodeTypeBuilder.OpChainInterface(opChainInterface)

Bases: Nodes3DAPI.NodeTypeBuilder.BaseOpChainInterface

Interface to the op chain passed to the node NodeTypeBuilder’s callback.

FAIL = 0
NO_OP = 2
SKIP = 1
__init__(opChainInterface)
__module__ = 'Nodes3DAPI.NodeTypeBuilder'
addInputRequest(inputPortName, graphState, invalidInputBehavior=0)
appendOp(opType, opArgs=None)

Append the given Op of type ‘opType’ to the op chain.

setExplicitInputRequestsEnabled(state)
setMinRequiredInputs(value)
class Nodes3DAPI.NodeTypeBuilder.ParametersOpChainInterface(port, graphState)

Bases: Nodes3DAPI.NodeTypeBuilder.BaseOpChainInterface

Extended interface to the op chain passed to the node NodeTypeBuilder’s callback used for controlling what’s shown as values of enableable parameters that depend on the GenericAssign mechanism.

__init__(port, graphState)
__module__ = 'Nodes3DAPI.NodeTypeBuilder'
appendOp(opType, opArgs=None)
getOps()