Monitoring Ops generated by the Node Graph

The PortOpClient API enables monitoring of Ops for a given Port and Graph State specification.

API Reference

Nodes3DAPI.RegisterPortOpClient(portOpClient)

Register the given Port Op Client for evaluation on changes to Node Graph, according to the current 3D Update Mode.

Note:The registry does not store strong references to registered Port Op Clients.
Parameters:portOpClient (PortOpClient) – Port Op Client to register.
Nodes3DAPI.UnregisterPortOpClient(portOpClient)

Unregister the given Port Op Client for evaluation on changes to Node Graph.

Parameters:portOpClient (PortOpClient) – Port Op Client to unregister.
Nodes3DAPI.MarkPortOpClientDirty(portOpClient)

Mark the given Port Op Client as requiring re-evaluation. This should be called whenever a Port Op Client’s dependencies change, other than implicit dependencies such as the Node Graph and current Viewed Node).

Parameters:portOpClient (PortOpClient) – Port Op Client to mark as requiring re-evaluation.
Nodes3DAPI.UpdatePortOpClients(portOpClients=None)

Force registered Port Op Clients to be [synchronously] re-evaluated.

Note:Non-continuous 3D Update Modes do not prevent this function from committing changes to the Geolib runtime.
Return type:int
Parameters:portOpClients (Iterable of PortOpClient, or NoneType.) – Registered Port Op Clients to update, or None to update all registered Port Op Clients.
Returns:The resulting commit ID.

Port Op Client interface

class Nodes3DAPI.PortOpClient.GraphStateId

Bases: str

Graph State identifier.

__dict__ = dict_proxy({'__dict__': <attribute '__dict__' of 'GraphStateId' objects>, '__module__': 'Nodes3DAPI.PortOpClient', '__new__': <staticmethod object at 0x7f60c0c21050>, 'kNone': 'No Graph State', 'kValues': ('Current Graph State', 'No Graph State'), 'kCurrent': 'Current Graph State', '__doc__': '\n Graph State identifier.\n '})
__module__ = 'Nodes3DAPI.PortOpClient'
static __new__(value='Current Graph State')
kCurrent = 'Current Graph State'
kNone = 'No Graph State'
kValues = ('Current Graph State', 'No Graph State')
class Nodes3DAPI.PortOpClient.PortId

Bases: str

Port identifier.

__dict__ = dict_proxy({'__module__': 'Nodes3DAPI.PortOpClient', '__new__': <staticmethod object at 0x7f60c0c21088>, 'kViewed': 'Viewed Port', '__dict__': <attribute '__dict__' of 'PortId' objects>, 'kValues': ('Viewed Port',), '__doc__': '\n Port identifier.\n '})
__module__ = 'Nodes3DAPI.PortOpClient'
static __new__(value='Viewed Port')
kValues = ('Viewed Port',)
kViewed = 'Viewed Port'
class Nodes3DAPI.PortOpClient.NodeId

Bases: str

Node identifier.

__dict__ = dict_proxy({'__module__': 'Nodes3DAPI.PortOpClient', '__new__': <staticmethod object at 0x7f60c0c210c0>, 'kViewed': 'Viewed Node', '__dict__': <attribute '__dict__' of 'NodeId' objects>, 'kValues': ('Viewed Node',), '__doc__': '\n Node identifier.\n '})
__module__ = 'Nodes3DAPI.PortOpClient'
static __new__(value='Viewed Node')
kValues = ('Viewed Node',)
kViewed = 'Viewed Node'
class Nodes3DAPI.PortOpClient.GraphStateSpec

Bases: Nodes3DAPI.PortOpClient.GraphStateSpec

Graph State specification. This may take the value of a Graph State, or of a Graph State identifier for subsequent resolution.

__dict__ = dict_proxy({'__dict__': <attribute '__dict__' of 'GraphStateSpec' objects>, '__module__': 'Nodes3DAPI.PortOpClient', '__doc__': '\n Graph State specification. This may take the value of a Graph State, or of\n a Graph State identifier for subsequent resolution.\n ', '__new__': <staticmethod object at 0x7f60c0c21210>})
__module__ = 'Nodes3DAPI.PortOpClient'
static __new__(value='Current Graph State')
Parameters:value (NodegraphAPI.GraphState or {GraphStateId}) – Value
class Nodes3DAPI.PortOpClient.NodeTraversalEndpoints

Bases: Nodes3DAPI.PortOpClient.NodeTraversalEndpointsBase

Start and end points for a Node Graph traversal.

The end or ‘search’ point, is a NodegraphAPI.Port. The start point may be either a NodegraphAPI.Port or a NodegraphAPI.Node. A start Node is traversed each of its output Ports in order.

__dict__ = dict_proxy({'startPortOrNode': <property object at 0x7f60c0c27520>, '__module__': 'Nodes3DAPI.PortOpClient', '__new__': <staticmethod object at 0x7f60c0c21360>, 'searchPort': <property object at 0x7f60c0c274c8>, '__dict__': <attribute '__dict__' of 'NodeTraversalEndpoints' objects>, '__doc__': "\n Start and end points for a Node Graph traversal.\n\n The end or 'search' point, is a C{NodegraphAPI.Port}. The start point may\n be either a C{NodegraphAPI.Port} or a C{NodegraphAPI.Node}. A start Node\n is traversed each of its output Ports in order.\n "})
__module__ = 'Nodes3DAPI.PortOpClient'
static __new__(searchPort, startPortOrNode)
Parameters:
  • searchPort (NodegraphAPI.Port) – Port at which Node Graph traversal returns a resulting modified Graph State.
  • startPortOrNode (NodegraphAPI.Port or NodegraphAPI.Node) – Port or Node from which Node Graph traversal commences.
searchPort
startPortOrNode
class Nodes3DAPI.PortOpClient.NodeTraversalEndpointsSpec

Bases: Nodes3DAPI.PortOpClient.NodeTraversalEndpointsBase

Undocumented.

__dict__ = dict_proxy({'__module__': 'Nodes3DAPI.PortOpClient', 'getNodeTraversalEndpoints': <function getNodeTraversalEndpoints at 0x7f60c0c13ed8>, '__dict__': <attribute '__dict__' of 'NodeTraversalEndpointsSpec' objects>, 'startPortOrNodeSpec': <property object at 0x7f60c0c27628>, '__doc__': '\n Specification for start and end points for a Node Graph traversal (Node\n traversal endpoints). This may hold values of Ports/Nodes or Port/Node IDs\n for subsequent resolution.\n\n @see NodeTraversalEndpoints\n ', 'searchPortSpec': <property object at 0x7f60c0c275d0>, '__new__': <staticmethod object at 0x7f60c0c21398>})
__module__ = 'Nodes3DAPI.PortOpClient'
static __new__(searchPortSpec, startPortOrNodeSpec='Viewed Node')
Parameters:
  • searchPortSpec (NodegraphAPI.Port or PortId) – Port specification for the Port at which Node Graph traversal returns a resulting modified Graph State.
  • startPortOrNodeSpec (NodegraphAPI.Port or PortId or NodegraphAPI.Node or NodeId) – Port-or-Node specification for the Port or Node from which Node Graph traversal commences.
getNodeTraversalEndpoints()
Return type:NodeTraversalEndpoints or NoneType
Returns:Resolved Node traversal endpoints, or None.
searchPortSpec
startPortOrNodeSpec
class Nodes3DAPI.PortOpClient.PortOpClient(port='Viewed Port', initialGraphStateSpec='Current Graph State', nodeTraversalEndpointsSpec='Default Node Traversal Endpoints', applyTerminalOpDelegates=True)

Bases: object

An abstract base class for a client that can be registered to listen to changes to the Op that is produced for a given Port and Graph State specification.

The Port and Graph State specification is provided by a combination of component specifications:

  • Initial Graph State
  • Initial Graph State modification function
  • Node traversal
  • Post-traversal Graph State modification function

When any dependency is invalidated, including the Node Graph (and Global Graph State), the Viewed Node (where applicable), and any explicit invalidations, Port Op Clients registered with Nodes3DAPI are [re-]evaluated using the Port and Graph State specification, and are notified if the resulting Op changes.

Graph State modification functions are implemented as overridden methods of this class. Instantiable derived classes must implement opChanged.

__abstractmethods__ = frozenset(['opChanged'])
__dict__ = dict_proxy({'_abc_cache': <_weakrefset.WeakSet object at 0x7f60c0c1fd50>, '__module__': 'Nodes3DAPI.PortOpClient', 'getResolvedPort': <function getResolvedPort at 0x7f60c0c28140>, '__metaclass__': <class 'abc.ABCMeta'>, 'kDefaultNodeTraversalEndpointsSpec': 'Default Node Traversal Endpoints', 'initialGraphStateSpec': <property object at 0x7f60c0c27890>, 'kDefaultInitialGraphStateSpec': 'Current Graph State', 'nodeTraversalEndpointsSpec': <property object at 0x7f60c0c278e8>, 'opChanged': <function opChanged at 0x7f60c0c28500>, '__doc__': '\n An abstract base class for a client that can be registered to listen to\n changes to the Op that is produced for a given Port and Graph State\n specification.\n\n The Port and Graph State specification is provided by a combination of\n component specifications:\n\n - Initial Graph State\n - Initial Graph State modification function\n - Node traversal\n - Post-traversal Graph State modification function\n\n When any dependency is invalidated, including the Node Graph (and Global\n Graph State), the Viewed Node (where applicable), and any explicit\n invalidations, Port Op Clients registered with Nodes3DAPI are\n [re-]evaluated using the Port and Graph State specification, and are\n notified if the resulting Op changes.\n\n Graph State modification functions are implemented as overridden methods of\n this class. Instantiable derived classes must implement L{opChanged()}.\n ', '__dict__': <attribute '__dict__' of 'PortOpClient' objects>, '__abstractmethods__': frozenset(['opChanged']), '_abc_negative_cache_version': 22, '_abc_registry': <_weakrefset.WeakSet object at 0x7f60c0c1fcd0>, '_abc_negative_cache': <_weakrefset.WeakSet object at 0x7f60c0c1fdd0>, 'modifyPostTraversalGraphState': <function modifyPostTraversalGraphState at 0x7f60c0c28488>, 'modifyInitialGraphState': <function modifyInitialGraphState at 0x7f60c0c28410>, '__weakref__': <attribute '__weakref__' of 'PortOpClient' objects>, 'port': <property object at 0x7f60c0c27838>, '__init__': <function __init__ at 0x7f60c0c13f50>, 'getNodeTraversalEndpoints': <function getNodeTraversalEndpoints at 0x7f60c0c28398>})
__init__(port='Viewed Port', initialGraphStateSpec='Current Graph State', nodeTraversalEndpointsSpec='Default Node Traversal Endpoints', applyTerminalOpDelegates=True)
Parameters:
  • port (NodegraphAPI.Port or PortId) – Port or Port ID to track for Op changes.
  • initialGraphStateSpec (GraphStateSpec) – Initial Graph State for the Port and Graph State specification.
  • nodeTraversalEndpointsSpec (NodeTraversalEndpointsSpec or NoneType or str) – Node traversal endpoints for the Port and Graph State specification. This may be a NodeTraversalEndpointsSpec object, None (indicating no traversal), or kDefaultNodeTraversalEndpointsSpec (which is equivalent to NodeTraversalEndPointsSpec(port)).
  • applyTerminalOpDelegates (bool) – Option to applying Terminal Op Delegates to the Op result.
__metaclass__

alias of ABCMeta

__module__ = 'Nodes3DAPI.PortOpClient'
__weakref__

list of weak references to the object (if defined)

getNodeTraversalEndpoints()
Return type:NodeTraversalEndpoints or NoneType
Returns:Resolved Node traversal endpoints, or None.
getResolvedPort()
Return type:NodegraphAPI.Port
Returns:Resolved Port
initialGraphStateSpec
kDefaultInitialGraphStateSpec = 'Current Graph State'
kDefaultNodeTraversalEndpointsSpec = 'Default Node Traversal Endpoints'
modifyInitialGraphState(graphState)

Override this method to modify the initial Graph State prior to any Node Graph traversal.

Parameters:graphState (NodegraphAPI.GraphState or NoneType) – Resolved initial Graph State, or None.
Return type:NodegraphAPI.GraphState
Returns:Modified (or unmodified) Graph State
modifyPostTraversalGraphState(graphState)

Override this method to modify the post-traversal Graph State.

Parameters:graphState (NodegraphAPI.GraphState) – Post-traversal Graph State
Return type:NodegraphAPI.GraphState
Returns:Modified (or unmodified) Graph State
nodeTraversalEndpointsSpec
opChanged(op, graphState, txn)

Implement this abstract method to receive notifications of Op changes.

Parameters:
  • op (PyFnGeolib.GeolibRuntime.Op) – Op produced by the Port and Graph State specification
  • graphState (NodegraphAPI.GraphState) – Final Graph State used to produce the resultant Op.
  • txn (PyFnGeolib.GeolibRuntime.Transaction) – Geolib runtime transaction that may be used to perform further configuration that will be committed as part of the operating batch.
port
class Nodes3DAPI.PortOpClient.CallbackPortOpClient(port='Viewed Port', opChangeCallback=None, initialGraphStateSpec='Current Graph State', nodeTraversalEndpointsSpec='Default Node Traversal Endpoints', initialGraphStateModifier=None, postTraversalGraphStateModifier=None, applyTerminalOpDelegates=True)

Bases: Nodes3DAPI.PortOpClient.PortOpClient

Implementation of PortOpClient that forwards overridden functions to configurable weakly-referenced callables:

__abstractmethods__ = frozenset([])
__init__(port='Viewed Port', opChangeCallback=None, initialGraphStateSpec='Current Graph State', nodeTraversalEndpointsSpec='Default Node Traversal Endpoints', initialGraphStateModifier=None, postTraversalGraphStateModifier=None, applyTerminalOpDelegates=True)
Parameters:
  • port (NodegraphAPI.Port or PortId) – Port or Port ID to track for Op changes.
  • opChangeCallback (Callable or NoneType) – Callable acting as a destination for forwarded calls to opChanged, with positional parameters starting with the PortOpClient instance.
  • initialGraphStateSpec (GraphStateSpec) – Initial Graph State for the Port and Graph State specification.
  • nodeTraversalEndpointsSpec (NodeTraversalEndpointsSpec or NoneType or str) – Node traversal endpoints for the Port and Graph State specification. This may be a NodeTraversalEndpointsSpec object, None (indicating no traversal), or kDefaultNodeTraversalEndpointsSpec (which is equivalent to NodeTraversalEndPointsSpec(port)).
  • initialGraphStateModifier (Callable or NoneType) – Callable acting as a destination for forwarded calls to modifyInitialGraphState, with positional parameters starting with the PortOpClient instance.
  • postTraversalGraphStateModifier (Callable or NoneType) – Callable acting as a destination for forwarded calls to modifyPostTraversalGraphState, with positional parameters starting with the PortOpClient instance.
  • applyTerminalOpDelegates (bool) – Option to applying Terminal Op Delegates to the Op result.
__module__ = 'Nodes3DAPI.PortOpClient'
initialGraphStateModifier
modifyInitialGraphState(graphState)

Forwards to self.initialGraphStateModifier.

See:PortOpClient.modifyInitialGraphState
modifyPostTraversalGraphState(graphState)

Forwards to self.postTraversalGraphStateModifier.

See:PortOpClient.modifyPostTraversalGraphState
opChangeCallback
opChanged(op, graphState, txn)

Forwards to self.opChangeCallback.

See:PortOpClient.opChanged
postTraversalGraphStateModifier