Look-File-Baking Nodes

New in Katana 4

The Nodes3DAPI.LookFileBaking module may be used in combination with LookFileBakeAPI (specifically, LookFileBakeAPI.LookFileBaker) to create custom Look-File-baking nodes.

LookFileBaking

Module containing utility functions for, and global state associated with baking Look Files.

This module defines the isLookFileBaking() function in the context of Python-based parameter expressions as an alias of GetGlobalBakeState(), and declares the preLookFileBake and postLookFileBake Callback types. The preLookFileMaterialsOut and postLookFileMaterialsOut Callback types are also declared.

since:

Katana 4.0v1

Nodes3DAPI.LookFileBaking.BakingContext()

Context manager for a Look File Baking node graph evaluation.

Enables baking state and parameter expression caching (implying a guarantee that no node graph changes will take place within this context).

Nodes3DAPI.LookFileBaking.GetBakeState()

Gets the current Look File Bake state, enabled by BakingContext().

Return type:

bool

Returns:

The current Look File Bake state.

Nodes3DAPI.LookFileBaking.GetGlobalBakeState()

Gets the current global Look File Bake state, enabled by either BakingContext() or the legacy GeoAPI.Util.LookFileUtil bake state.

Return type:

bool

Returns:

The current global Look File Bake state.

Note:

This function is available in the context of Python-based parameter expressions under the name isLookFileBaking().

Nodes3DAPI.LookFileBaking.PreLookFileBake(node, assetId, rootLocationProducers, progressCallback, abortCallback)

Executes callbacks of type preLookFileBake for the given node with the given arguments.

Parameters:
  • node (NodegraphAPI.Node or None) – The node that is being baked.

  • assetId (str) – Look File Asset ID

  • rootLocationProducers (dict of str to FnGeolibProducers.GeometryProducer) – Dictionary of Geometry Producers keyed on root location path.

  • progressCallback (callable or None) – Optional callback that may be called with a single string argument providing the current baking status.

  • abortCallback (callable or None) – Optional callback that may be called to abort the bake, with a single string argument providing a reason.

Nodes3DAPI.LookFileBaking.PostLookFileBake(node, assetId, rootLocationProducers, progressCallback, abortCallback)

Executes callbacks of type postLookFileBake for the given node with the given arguments.

Parameters:
  • node (NodegraphAPI.Node or None) – The node that is being baked.

  • assetId (str) – Look File Asset ID

  • rootLocationProducers (dict of str to FnGeolibProducers.GeometryProducer) – Dictionary of Geometry Producers keyed on root location path.

  • progressCallback (callable or None) – Optional callback that may be called with a single string argument providing the current baking status.

  • abortCallback (callable or None) – Optional callback that may be called to abort the bake, with a single string argument providing a reason.

class Nodes3DAPI.LookFileBaking.PreLookFileBakeHandler(node=None)

Bases: _PrePostLookFileBakeCallbackForwarder

Pre-Look File Bake handler that executes registered preLookFileBake callbacks with the given node.

__init__(node=None)

Initializes with the given node.

Parameters:

node (NodegraphAPI.Node or None) – The node whose baking will trigger the callback.

class Nodes3DAPI.LookFileBaking.PostLookFileBakeHandler(node=None)

Bases: _PrePostLookFileBakeCallbackForwarder

Post-Look File Bake handler that executes registered postLookFileBake callbacks with the given node.

__init__(node=None)

Initializes with the given node.

Parameters:

node (NodegraphAPI.Node or None) – The node whose baking will trigger the callback.

Nodes3DAPI.LookFileBaking.PreLookFileMaterialsOut(node, assetId, progressCallback, abortCallback)

Executes callbacks of type preLookFileMaterialsOut for the given node with the given arguments.

Parameters:
  • node (NodegraphAPI.Node or None) – The node that is writing a materials Look File.

  • assetId (str) – Look File Asset ID

  • progressCallback (callable or None) – Optional callback that may be called with a single string argument providing the current baking status.

  • abortCallback (callable or None) – Optional callback that may be called to abort the bake, with a single string argument providing a reason.

Nodes3DAPI.LookFileBaking.PostLookFileMaterialsOut(node, assetId, progressCallback, abortCallback)

Executes callbacks of type postLookFileMaterialsOut for the given node with the given arguments.

Parameters:
  • node (NodegraphAPI.Node or None) – The node that is writing a materials Look File.

  • assetId (str) – Look File Asset ID

  • progressCallback (callable or None) – Optional callback that may be called with a single string argument providing the current baking status.

  • abortCallback (callable or None) – Optional callback that may be called to abort the bake, with a single string argument providing a reason.

class Nodes3DAPI.LookFileBaking.PreLookFileMaterialsOutHandler(node=None)

Bases: _PrePostLookFileMaterialsOutCallbackForwarder

Pre-Look File Materials Out handler that executes registered preLookFileMaterialsOut callbacks with the given node.

__init__(node=None)

Initializes with the given node.

Parameters:

node (NodegraphAPI.Node or None) – The node whose writing of a materials Look File will trigger the callback.

class Nodes3DAPI.LookFileBaking.PostLookFileMaterialsOutHandler(node=None)

Bases: _PrePostLookFileMaterialsOutCallbackForwarder

Post-Look File Materials Out handler that executes registered postLookFileMaterialsOut callbacks with the given node.

__init__(node=None)

Initializes with the given node.

Parameters:

node (NodegraphAPI.Node or None) – The node whose writing of a materials Look File will trigger the callback.

Nodes3DAPI.LookFileBaking.ValidateGraphState(graphStateOrTime)

Obtains a valid Graph State from the given argument.

Parameters:

graphStateOrTime (NodegraphAPI.GraphState, object convertible to a float, or None.) – The Graph State to validate.

Return type:

NodegraphAPI.GraphState

Returns:

The given Graph State, default Graph State for the given time, or the ‘current’ Graph State if the argument is None.

Raises:

TypeError – raised for invalid argument.

Nodes3DAPI.LookFileBaking.GetLookFileBakeOp(node, inputPortName, graphState, txn)

Gets an Op for the specified node input, using the given Graph State (or time), that can be used to bake Look Files.

Return type:

PyFnGeolib.GeolibRuntime.Op or None

Parameters:
  • node (NodegraphAPI.Node) – The node for which to obtain the Op.

  • inputPortName (str) – The name of the input port for which to obtain the Op.

  • graphState (NodegraphAPI.GraphState, object convertible to a float, or None.) – The Graph State with which to evaluate the Node Graph. Also accepts an object representing ‘time’ to use a default Graph State at that time, or None to use the ‘current’ Graph State.

  • txn (PyFnGeolib.GeolibRuntime.Transaction or None) – An optional Geolib transaction to use.

Returns:

An Op from the specified input, or None if no Op could be obtained.

See:

GetLookFileBakeOps()

Note:

It can be much more efficient to call GetLookFileOps() than to make multiple calls to this function [due to Parameter Expression caching].

Nodes3DAPI.LookFileBaking.GetLookFileBakeOps(node, inputPortNames, graphState, txn=None)

Gets Geometry Producers for the specified node inputs, using the given Graph State (or time), that can be used to bake Look Files.

The Graph State is modified to add a 'lookfileBake' variable to enable node behaviours specific to Look File Baking, and I{Bake State} is enabled while generating Geometry Producers for the scenes on the specified node inputs.

Return type:

list of (PyFnGeolib.GeolibRuntime.Op or None)

Parameters:
  • node (NodegraphAPI.Node) – The node for which to obtain the Geometry Producer.

  • inputPortNames (Sequence of str) – The names of the input ports for which to obtain Geometry Producers.

  • graphState (NodegraphAPI.GraphState, object convertible to a float, or None.) – The Graph State with which to evaluate the Node Graph. Also accepts an object representing ‘time’ to use a default Graph State at that time, or None to use the ‘current’ Graph State.

  • txn (PyFnGeolib.GeolibRuntime.Transaction or None) – An optional Geolib transaction to use.

Returns:

Ops from the specified inputs (at corresponding indices). A None value indicates that an Op could not be obtained for the corresponding input.

Nodes3DAPI.LookFileBaking.GetLocationIntervalEvictor(node=None, intervalParameterName='options.evictionLocationInterval', configVarName='KATANA_LOOKFILEBAKE_EVICTION_LOCATION_INTERVAL')

Gets a LocationIntervalEvictor configured according to the specified node parameter, and/or Configuration variable.

Return type:

LocationIntervalEvictor or None

Parameters:
  • node (NodegraphAPI.Node or None) – The node that is queried for an interval parameter.

  • intervalParameterName (str or None) – The name used to query {node} for an interval parameter.

  • configVarName (str or None) – The name of a Configuration variable to query.

Returns:

A configured LocationIntervalEvictor if the eviction interval is specified and is non-zero.

Note:

A node-specified value takes precedence over Configuration.

Note:

Negative values are ignored.