Terminal Op Delegates¶
Terminal Op Delegates are a method of appending an arbitrary Op Chain to the end of the Op Tree that is generated from a node in the node graph.
A Terminal Op Delegate class should implement the
TerminalOpDelegate
interface, then an instance can be registered with
RegisterTerminalOpDelegate
Terminal Op Delegates are responsible for caching their Ops. It is strongly encouraged for performance and memory management reasons that a Terminal Op Delegate should retain references to Ops it creates, then re-use/update them where possible, rather than creating new Ops on every evaluation.
API Reference¶
- Nodes3DAPI.RegisterTerminalOpDelegate(name, terminalOpDelegate)¶
Registers the given
TerminalOpDelegate
under the given name.A
TerminalOpDelegate
allows Terminal Ops to be appended to any Op Tree returned by nodes. The Op Args of these Ops can change arbitrarily, forcing the Op Tree to be recooked.- Parameters:
name (
str
) – A key used to identify theTerminalOpDelegate
.terminalOpDelegate (
TerminalOpDelegate
) – TheTerminalOpDelegate
to register.
- Nodes3DAPI.UnregisterTerminalOpDelegate(name)¶
Unregisters a
TerminalOpDelegate
previously registered withRegisterTerminalOpDelegate()
.- Parameters:
name (
str
) – A key used to identify theTerminalOpDelegate
to unregister.
- Nodes3DAPI.GetRegisteredTerminalOpDelegateNames()¶
- Return type:
list
ofstr
- Returns:
A list of names of every
TerminalOpDelegate
previously registered withRegisterTerminalOpDelegate()
.
- Nodes3DAPI.GetRegisteredTerminalOpDelegate(name)¶
- Return type:
TerminalOpDelegate
- Parameters:
name (
str
) – A key used to identify theTerminalOpDelegate
.- Returns:
The
TerminalOpDelegate
that was registered withRegisterTerminalOpDelegate()
under the given name, orNone
if no Terminal Op Delegate was registered under that name.
- class Nodes3DAPI.TerminalOpDelegates.TerminalOpDelegate.TerminalOpDelegate¶
Bases:
object
Base class for a Terminal Op Delegate. A
TerminalOpDelegate
allows Terminal Ops to be appended to any Op Tree returned by nodes. The Op Args of these Ops can change arbitrarily, forcing the Op Tree to be recooked. These can be registered in theNodes3DAPI
using:Nodes3DAPI.RegisterTerminalOpDelegate( 'some name', someTerminalOpDelegate)
This base class is simply an interface, and does not provide any mechanism to store the Ops/Op Args in itself. That is the responsibility of the subclass.
- appendOp(op, txn, port, graphState)¶
Appends the Terminal Ops to the given Op Tree. The port and graph state used to generate the Op Tree are provided.
- Return type:
PyFnGeolib.GeolibRuntimeOp
- Parameters:
op (
PyFnGeolib.GeolibRuntimeOp
) – An existing Op to be appended by theTerminalOpDelegate
Ops.txn (
PyFnGeolib.GeolibRuntimeTransaction
) – The Geolib3 transaction.port (
NodegraphAPI.Port
orNoneType
) – The port from which the Op Tree was generated, orNone
.graphState (
NodegraphAPI.GraphState
) – The Graph State with which the Op Tree was generated.
- Returns:
The last appended Op or the original Op if no Ops are appended.
- Raises:
NotImplementedError – If not overridden by a subclass.
- update()¶
Updates the internal data of the Terminal Op Delegate. This can be the Op and Op Args instances themselves or some data that can be used by
appendOp()
to instantiate these Ops and Op Args.- Return type:
bool
- Returns:
True
if any Ops or Op args from thisTerminalOpDelegate
changed.- Raises:
NotImplementedError – If not overridden by a subclass.