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 legacyGeoAPI.Util.LookFileUtilbake 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
preLookFileBakefor the given node with the given arguments.- Parameters:
node (
NodegraphAPI.NodeorNone) – The node that is being baked.assetId (
str) – Look File Asset IDrootLocationProducers (
dictofstrtoFnGeolibProducers.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
postLookFileBakefor the given node with the given arguments.- Parameters:
node (
NodegraphAPI.NodeorNone) – The node that is being baked.assetId (
str) – Look File Asset IDrootLocationProducers (
dictofstrtoFnGeolibProducers.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:
_PrePostLookFileBakeCallbackForwarderPre-Look File Bake handler that executes registered
preLookFileBakecallbacks with the given node.- __init__(node=None)¶
Initializes with the given node.
- Parameters:
node (
NodegraphAPI.NodeorNone) – The node whose baking will trigger the callback.
- class Nodes3DAPI.LookFileBaking.PostLookFileBakeHandler(node=None)¶
Bases:
_PrePostLookFileBakeCallbackForwarderPost-Look File Bake handler that executes registered
postLookFileBakecallbacks with the given node.- __init__(node=None)¶
Initializes with the given node.
- Parameters:
node (
NodegraphAPI.NodeorNone) – The node whose baking will trigger the callback.
- Nodes3DAPI.LookFileBaking.PreLookFileMaterialsOut(node, assetId, progressCallback, abortCallback)¶
Executes callbacks of type
preLookFileMaterialsOutfor the given node with the given arguments.- Parameters:
node (
NodegraphAPI.NodeorNone) – The node that is writing a materials Look File.assetId (
str) – Look File Asset IDprogressCallback (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
postLookFileMaterialsOutfor the given node with the given arguments.- Parameters:
node (
NodegraphAPI.NodeorNone) – The node that is writing a materials Look File.assetId (
str) – Look File Asset IDprogressCallback (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:
_PrePostLookFileMaterialsOutCallbackForwarderPre-Look File Materials Out handler that executes registered
preLookFileMaterialsOutcallbacks with the given node.- __init__(node=None)¶
Initializes with the given node.
- Parameters:
node (
NodegraphAPI.NodeorNone) – The node whose writing of a materials Look File will trigger the callback.
- class Nodes3DAPI.LookFileBaking.PostLookFileMaterialsOutHandler(node=None)¶
Bases:
_PrePostLookFileMaterialsOutCallbackForwarderPost-Look File Materials Out handler that executes registered
postLookFileMaterialsOutcallbacks with the given node.- __init__(node=None)¶
Initializes with the given node.
- Parameters:
node (
NodegraphAPI.NodeorNone) – 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 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.OporNone- 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, orNoneto use the ‘current’ Graph State.txn (
PyFnGeolib.GeolibRuntime.TransactionorNone) – An optional Geolib transaction to use.
- Returns:
An Op from the specified input, or
Noneif 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 Bake State is enabled while generating Geometry Producers for the scenes on the specified node inputs.- Return type:
listof (PyFnGeolib.GeolibRuntime.OporNone)- Parameters:
node (
NodegraphAPI.Node) – The node for which to obtain the Geometry Producer.inputPortNames (
Sequenceofstr) – 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, orNoneto use the ‘current’ Graph State.txn (
PyFnGeolib.GeolibRuntime.TransactionorNone) – An optional Geolib transaction to use.
- Returns:
Ops from the specified inputs (at corresponding indices). A
Nonevalue 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
LocationIntervalEvictorconfigured according to the specified node parameter, and/or Configuration variable.- Return type:
LocationIntervalEvictororNone- Parameters:
node (
NodegraphAPI.NodeorNone) – The node that is queried for an interval parameter.intervalParameterName (
strorNone) – The name used to query {node} for an interval parameter.configVarName (
strorNone) – The name of a Configuration variable to query.
- Returns:
A configured
LocationIntervalEvictorif the eviction interval is specified and is non-zero.- Note:
A node-specified value takes precedence over Configuration.
- Note:
Negative values are ignored.