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.
- 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 legacyGeoAPI.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
orNone
) – The node that is being baked.assetId (
str
) – Look File Asset IDrootLocationProducers (
dict
ofstr
toFnGeolibProducers.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
orNone
) – The node that is being baked.assetId (
str
) – Look File Asset IDrootLocationProducers (
dict
ofstr
toFnGeolibProducers.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:
Nodes3DAPI.LookFileBaking._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
orNone
) – The node whose baking will trigger the callback.
- class Nodes3DAPI.LookFileBaking.PostLookFileBakeHandler(node=None)¶
Bases:
Nodes3DAPI.LookFileBaking._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
orNone
) – The node whose baking will trigger the callback.
- Nodes3DAPI.LookFileBaking.ValidateGraphState(graphStateOrTime)¶
Obtains a valid Graph State from the given argument.
- Parameters
graphStateOrTime (
NodegraphAPI.GraphState
, object convertible to afloat
, orNone
.) – The Graph State to validate.- Return type
- 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
orNone
- 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 afloat
, orNone
.) – 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, orNone
to use the ‘current’ Graph State.txn (
PyFnGeolib.GeolibRuntime.Transaction
orNone
) – An optional Geolib transaction to use.
- Returns
An Op from the specified input, or
None
if no Op could be obtained.- See
- 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
orNone
)- Parameters
node (
NodegraphAPI.Node
) – The node for which to obtain the Geometry Producer.inputPortNames (
Sequence
ofstr
) – The names of the input ports for which to obtain Geometry Producers.graphState (
NodegraphAPI.GraphState
, object convertible to afloat
, orNone
.) – 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, orNone
to use the ‘current’ Graph State.txn (
PyFnGeolib.GeolibRuntime.Transaction
orNone
) – 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
orNone
- Parameters
node (
NodegraphAPI.Node
orNone
) – The node that is queried for an interval parameter.intervalParameterName (
str
orNone
) – The name used to query {node} for an interval parameter.configVarName (
str
orNone
) – 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.