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
TerminalOpDelegateunder the given name.A
TerminalOpDelegateallows 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) – TheTerminalOpDelegateto register.
- Nodes3DAPI.UnregisterTerminalOpDelegate(name)
Unregisters a
TerminalOpDelegatepreviously registered withRegisterTerminalOpDelegate().- Parameters:
name (
str) – A key used to identify theTerminalOpDelegateto unregister.
- Nodes3DAPI.GetRegisteredTerminalOpDelegateNames()
- Return type:
listofstr- Returns:
A list of names of every
TerminalOpDelegatepreviously registered withRegisterTerminalOpDelegate().
- Nodes3DAPI.GetRegisteredTerminalOpDelegate(name)
- Return type:
TerminalOpDelegate- Parameters:
name (
str) – A key used to identify theTerminalOpDelegate.- Returns:
The
TerminalOpDelegatethat was registered withRegisterTerminalOpDelegate()under the given name, orNoneif no Terminal Op Delegate was registered under that name.
- class Nodes3DAPI.TerminalOpDelegates.TerminalOpDelegate.TerminalOpDelegate
Bases:
objectBase class for a Terminal Op Delegate. A
TerminalOpDelegateallows 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 theNodes3DAPIusing: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 theTerminalOpDelegateOps.txn (
PyFnGeolib.GeolibRuntimeTransaction) – The Geolib3 transaction.port (
NodegraphAPI.PortorNoneType) – 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:
Trueif any Ops or Op args from thisTerminalOpDelegatechanged.- Raises:
NotImplementedError – If not overridden by a subclass.