Nuke binary plugins 16.0.1
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Loading...
Searching...
No Matches
DD::Image::ScenePrimExporterOpI Class Referenceabstract

#include <ScenePrimExporterOpI.h>

Inheritance diagram for DD::Image::ScenePrimExporterOpI:
DD::Image::GeometryProviderI DD::Image::AxisOp DD::Image::CameraOp DD::Image::LightOp DD::Image::ComplexLightOp

Public Types

enum  { EXPORT_SAMPLE_ALL_SCRIPT_FRAMES , EXPORT_ADDL_TIMES , EXPORT_SAMPLE_KEYFRAMES }
 Export sampling modes. More...
 
enum  { EXPORT_PARENT_XFORM , EXPORT_PARENT_SCOPE , EXPORT_PARENT_PLACEHOLDER_OVERRIDE , EXPORT_PARENT_IGNORE }
 Modes for building additional parent prims specified in 'prim_path'.
 

Public Member Functions

 ScenePrimExporterOpI ()
 Sets parent fill type to Xform(0).
 
virtual OpgetScenePrimExporterOp ()=0
 Return the Op the interface is attached to. Should return 'this'. Must implement.
 
OpgetScenePrimExporterOp () const
 
virtual ScenePrimExporterOpIasScenePrimExporter ()
 Allow subclasses to gain access to sibling functions.
 
virtual void addExportOptionsKnobs (Knob_Callback f)
 
virtual void enableExportOptionsKnobs (bool exportEnabled)
 
std::string exportPrimPath () const
 Return the value of the 'prim_path' knob.
 
int32_t exportParentPrimMode () const
 Return the mode value of the 'parent_prim_type' knob.
 
virtual usg::Path exportBasePrimPath () const =0
 
virtual int32_t exportBasePrimType () const =0
 
void buildParentPrims (usg::LayerRef &exportLayer) const
 
usg::LayerRef exportScenePrims (int32_t exportMode, const fdk::TimeValueSet &additionalTimes=fdk::TimeValueSet(), bool force=false)
 
void exportScenePrimsToLayer (usg::LayerRef &exportLayer, int32_t exportMode, const fdk::FrameValueSet &sampleFrames)
 
void KnobDefinesExportedGeometry (const Knob_Closure &f)
 
void KnobModifiesExportedAttribValues (const Knob_Closure &f)
 
virtual void appendExporterGeomState (DD::Image::Hash &opStoreHash)
 
OpgetGeometryProviderOp () override
 GeometryProviderI: Return the Op the interface is attached to.
 
GeometryProviderIasGeometryProvider () override
 GeometryProviderI: Allow subclasses to gain access to sibling functions.
 
fdk::Hash geometryComposeState () const override
 Returns the compose state of the exportLayer.
 
fdk::Hash geometryEditState () const override
 Returns the edit state of the exportLayer.
 
bool geometryStateVaries () const override
 Returns the animating state of the exportLayer.
 
usg::LayerRef getGeometryLayer (const fdk::TimeValueSet &sampleTimes=fdk::TimeValueSet()) override
 
bool canProvideGeometryStage () const override
 Provides a fully constructed usg::Stage via buildGeometryStage().
 
void buildGeometryStage (usg::StageRef &stage, const usg::ArgSet &requestArgs, const fdk::TimeValueSet &sampleTimes=fdk::TimeValueSet()) override
 
- Public Member Functions inherited from DD::Image::GeometryProviderI
virtual GeometryProviderIasGeometryProvider ()=0
 
virtual OpgetGeometryProviderOp ()=0
 
OpgetGeometryProviderOp () const
 Same as getGeometryProviderOp() but const.
 
virtual fdk::Hash geometryComposeState () const =0
 
virtual fdk::Hash geometryEditState () const =0
 
virtual bool geometryStateVaries () const =0
 
virtual usg::LayerRef buildGeometryLayer (bool appendTo=false, const fdk::TimeValueSet &sampleTimes=fdk::TimeValueSet())=0
 
virtual usg::LayerRef getGeometryLayer (const fdk::TimeValueSet &sampleTimes=fdk::TimeValueSet())
 
virtual bool canProvideGeometryStage () const
 
virtual void buildGeometryStage (usg::StageRef &stage, const usg::ArgSet &requestArgs, const fdk::TimeValueSet &sampleTimes=fdk::TimeValueSet())
 
virtual usg::StageRef getGeometryStage (const fdk::TimeValueSet &sampleTimes=fdk::TimeValueSet())
 

Protected Member Functions

void _exporterResetScenePrimState (const OutputContext &opStoreContext)
 
void _exporterUpdateScenePrimState (const OutputContext &opStoreContext, const DD::Image::Hash &opStoreHash)
 
virtual fdk::Hash _buildScenePrimExporterState (const fdk::Hash &hash)
 
int32_t _exportScenePrimsKnobChanged (Knob *k, int32_t callAgain)
 
virtual void _validateScenePrimExporter (bool for_real)
 
virtual void _exportScenePrims (usg::LayerRef &exportLayer, int32_t exportMode, const fdk::FrameValueSet &sampleFrames=fdk::FrameValueSet()) const =0
 
bool exportKnob (const char *knobName, int32_t exportMode, const fdk::FrameValueSet &sampleFrames, usg::Prim &outputPrim, const char *targetPropertyName, usg::Value::Type targetPropertyTypeHint=usg::Value::Type::InvalidType) const
 
bool exportKnob (const char *knobName, bool ignoreDefaultTest, int32_t exportMode, const fdk::FrameValueSet &sampleFrames, usg::Prim &outputPrim, const char *targetPropertyName, usg::Value::Type targetPropertyTypeHint=usg::Value::Type::InvalidType) const
 
bool exportInputOpAsAssetPath (int32_t input, int32_t exportMode, const fdk::FrameValueSet &sampleFrames, usg::Prim &outputPrim, const char *targetPropertyName) const
 Export an input Op connection as an asset path, usually for textures.
 
Impl & _nodeExporterData () const
 For internal use only - returns the _pImpl from the firstOp which is unique per Node.
 
usg::ShaderDescGroupPtrMap & _shaderDescGroups ()
 Groups of locally-created ShaderDescs.
 
usg::LayerRef buildGeometryLayer (bool appendTo, const fdk::TimeValueSet &sampleTimes) override
 Calls exportScenePrims() with the appropriate mode.
 

Protected Attributes

std::unique_ptr< Impl > _pImpl
 

Additional Inherited Members

- Static Public Member Functions inherited from DD::Image::GeometryProviderI
static void buildStage (usg::StageRef &stage, const usg::ArgSet &requestArgs, const OpSet &ops, const fdk::TimeValueSet *additionalTimes=nullptr)
 
static void buildStage (usg::StageRef &stage, const usg::ArgSet &requestArgs, Op *geometryProviderOp, const fdk::TimeValueSet *additionalTimes=nullptr)
 

Detailed Description

Helper interface class for non GeomOp based classes to produce scene geometry prims like GeomOps can output.

IMPORTANT: In the owner Op's implementation (the Op subclass that's inheriting this interface) you MUST implement the Op::_knobStorePrep() and Op::_knobStorePost() methods and within those methods call _exporterResetScenePrimState() and _exporterUpdateScenePrimState() respectively. Otherwise the exporter will not update properly. This is due to the exporter needing to determine its export changes due to Knob value changes, so the exporter needs to know the state prior to any Knob changes, and the state after any Knob changes.

For example AxisOp::_knobStorePrep() and AxisOp::_knobStorePost() are both implemented and call this interface, and this allows all AxisOp subclasses like CameraOp and LightOp to properly determine their export state.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Export sampling modes.

Enumerator
EXPORT_SAMPLE_ALL_SCRIPT_FRAMES 

Sample root frame range at integer frame increments.

EXPORT_ADDL_TIMES 

Sample at additional times but do -NOT- clear the Layer.

EXPORT_SAMPLE_KEYFRAMES 

Only sample at knob keyframes.

Member Function Documentation

◆ getScenePrimExporterOp()

virtual Op * DD::Image::ScenePrimExporterOpI::getScenePrimExporterOp ( )
pure virtual

◆ asScenePrimExporter()

virtual ScenePrimExporterOpI * DD::Image::ScenePrimExporterOpI::asScenePrimExporter ( )
inlinevirtual

Allow subclasses to gain access to sibling functions.

Reimplemented in DD::Image::AxisOp.

◆ addExportOptionsKnobs()

void ScenePrimExporterOpI::addExportOptionsKnobs ( Knob_Callback  f)
virtual

◆ enableExportOptionsKnobs()

void ScenePrimExporterOpI::enableExportOptionsKnobs ( bool  exportEnabled)
virtual

Called from owner Op, typically, to enable/disable the export knobs with some custom logic. Base class does nothing.

Reimplemented in DD::Image::AxisOp.

References getScenePrimExporterOp().

Referenced by DD::Image::AxisOp::enableExportOptionsKnobs().

◆ exportBasePrimPath()

virtual usg::Path DD::Image::ScenePrimExporterOpI::exportBasePrimPath ( ) const
pure virtual

Return the full path of the -primary- prim and all its parents created by this node. This is the 'top' prim where any child prims are rooted under.

For example if this is an AxisOp it's typically a single Xform prim, but a CameraOp or LightOp may have additional prims after the main Xform (ie for a stereo camera rig) so this connection point needs to be explicitly identified.

Retrieve the base prim name by calling name() on the returned path.

Must implement.

Implemented in DD::Image::AxisOp.

Referenced by buildParentPrims().

◆ exportBasePrimType()

virtual int32_t DD::Image::ScenePrimExporterOpI::exportBasePrimType ( ) const
pure virtual

The type of the exportBasePrimPath() base prim (ie the end prim returned by exportBasePrimPath().name().) EXPORT_PARENT_XFORM or EXPORT_PARENT_SCOPE are supported.

◆ buildParentPrims()

void ScenePrimExporterOpI::buildParentPrims ( usg::LayerRef &  exportLayer) const

Create (define) any parent prims in the exportBasePrimPath(). These are prims in the path -before- the base prim. Uses the values from exportPrimPath() and exportParentPrimMode().

References exportBasePrimPath(), and exportParentPrimMode().

Referenced by DD::Image::AxisOp::_exportScenePrims(), DD::Image::CameraOp::_exportScenePrims(), and DD::Image::LightOp::_exportScenePrims().

◆ exportScenePrims()

usg::LayerRef ScenePrimExporterOpI::exportScenePrims ( int32_t  exportMode,
const fdk::TimeValueSet &  additionalTimes = fdk::TimeValueSet(),
bool  force = false 
)

Export prims into a scene layer. This returns fast if there's no change to the export data since last _validateScenePrimExporter() cycle. If exportMode is EXPORT_ADDL_TIMES then sample at the additionalTimes times but do -NOT- clear the Layer. If force is true then the export data is always regenerated and the Layer rebuilt.

References _exportScenePrims(), _nodeExporterData(), EXPORT_ADDL_TIMES, EXPORT_SAMPLE_ALL_SCRIPT_FRAMES, EXPORT_SAMPLE_KEYFRAMES, DD::Image::Knob::get(), getScenePrimExporterOp(), DD::Image::Op::knob(), DD::Image::Op::nodeName(), and DD::Image::Op::rootOp().

Referenced by buildGeometryLayer(), buildGeometryStage(), and getGeometryLayer().

◆ exportScenePrimsToLayer()

void ScenePrimExporterOpI::exportScenePrimsToLayer ( usg::LayerRef &  exportLayer,
int32_t  exportMode,
const fdk::FrameValueSet &  sampleFrames 
)

Export prims to a layer, ignoring any current state of the exporter controls.

This assumes exportLayer has been created, configured and valid. The list of sample frame times is a request to the exporting object and is not guaranteed to result in those exact time samples in the export layer. For example a Knob may not be animated and will only set the default sample, or the keyframes being output are sparse.

Calls the virtual _exportScenePrims() method that subclasses implement.

References _exportScenePrims().

◆ KnobDefinesExportedGeometry()

void ScenePrimExporterOpI::KnobDefinesExportedGeometry ( const Knob_Closure &  f)

Use this method if the Knob's value will affect the exported scenegraph topology by adding/removing Prims or Attributes, or by changing their names or paths in the output scenegraph.

If the knob is just changing the contents of an existing attribute rather than explicitly creating that attribute, use KnobModifiesExportedAttribValues() instead.

References _nodeExporterData().

Referenced by addExportOptionsKnobs().

◆ KnobModifiesExportedAttribValues()

void ScenePrimExporterOpI::KnobModifiesExportedAttribValues ( const Knob_Closure &  f)

Use this method if the Knob's value is changing the contents of an existing attribute in an exported prim. This only applies if the exporter can support being called in EXPORT_ADDL_TIMES mode allowing attribute changes to be applied to an already defined prim.

References _nodeExporterData().

◆ appendExporterGeomState()

void ScenePrimExporterOpI::appendExporterGeomState ( DD::Image::Hash opStoreHash)
virtual

Append arbitrary hash contributions to this exporter's local GeomState. These hash contribution sources are normally from non-Knob sources like inputs or some other Op value like frame or view. op_hash is provided as a convenience to allow the exporter to affect the Op's output hash at the same time without needing to reimplement the hash calcs in Op::append(), which will be called soon afterwards.

This is commonly called from a GeomOp importing prims from this Op from its appendGeomState() method.

Base class implementation does nothing.

◆ getGeometryProviderOp()

Op * DD::Image::ScenePrimExporterOpI::getGeometryProviderOp ( )
inlineoverridevirtual

GeometryProviderI: Return the Op the interface is attached to.

Implements DD::Image::GeometryProviderI.

◆ asGeometryProvider()

GeometryProviderI * DD::Image::ScenePrimExporterOpI::asGeometryProvider ( )
inlineoverridevirtual

GeometryProviderI: Allow subclasses to gain access to sibling functions.

Implements DD::Image::GeometryProviderI.

◆ geometryComposeState()

fdk::Hash ScenePrimExporterOpI::geometryComposeState ( ) const
overridevirtual

Returns the compose state of the exportLayer.

Implements DD::Image::GeometryProviderI.

References _nodeExporterData().

◆ geometryEditState()

fdk::Hash ScenePrimExporterOpI::geometryEditState ( ) const
overridevirtual

Returns the edit state of the exportLayer.

Implements DD::Image::GeometryProviderI.

References _nodeExporterData().

◆ geometryStateVaries()

bool ScenePrimExporterOpI::geometryStateVaries ( ) const
overridevirtual

Returns the animating state of the exportLayer.

Implements DD::Image::GeometryProviderI.

◆ getGeometryLayer()

usg::LayerRef ScenePrimExporterOpI::getGeometryLayer ( const fdk::TimeValueSet &  sampleTimes = fdk::TimeValueSet())
overridevirtual

Provide the export usg::Layer. If sampleTimes is not empty the the exporter may possibly be run for those additional times.

Reimplemented from DD::Image::GeometryProviderI.

References EXPORT_SAMPLE_ALL_SCRIPT_FRAMES, and exportScenePrims().

◆ canProvideGeometryStage()

bool DD::Image::ScenePrimExporterOpI::canProvideGeometryStage ( ) const
inlineoverridevirtual

Provides a fully constructed usg::Stage via buildGeometryStage().

Reimplemented from DD::Image::GeometryProviderI.

◆ buildGeometryStage()

void ScenePrimExporterOpI::buildGeometryStage ( usg::StageRef &  stage,
const usg::ArgSet &  requestArgs,
const fdk::TimeValueSet &  sampleTimes = fdk::TimeValueSet() 
)
overridevirtual

Provide the cached exported stage. The cached stage is only created when this method is called. If the cached stage has the same composeState as the exporter then buildGeometryLayer() is called with any additional sample times but the cached stage itself is left untouched. stage is then set to the exporter's cached stage.

Reimplemented from DD::Image::GeometryProviderI.

References _nodeExporterData(), EXPORT_ADDL_TIMES, EXPORT_SAMPLE_ALL_SCRIPT_FRAMES, exportScenePrims(), getScenePrimExporterOp(), and DD::Image::Op::nodeName().

◆ _exporterResetScenePrimState()

void ScenePrimExporterOpI::_exporterResetScenePrimState ( const OutputContext opStoreContext)
protected

Call this from the owner Op's implementation of Op::_knobStorePrep(), otherwise the exporter will not update properly. This resets the local GeomStateTargets which are built from knobs during the knobs() store pass when ExporterKnobDefinesGeometry() and ExporterKnobModifiesAttribValues() are used.

References _nodeExporterData(), getScenePrimExporterOp(), and DD::Image::Op::nodeName().

Referenced by DD::Image::AxisOp::_knobStorePrep().

◆ _exporterUpdateScenePrimState()

void ScenePrimExporterOpI::_exporterUpdateScenePrimState ( const OutputContext opStoreContext,
const DD::Image::Hash opStoreHash 
)
protected

Call this from the owner Op's implementation of Op::_knobStorePost(), otherwise the exporter will not update properly. This method builds the exporter state hash by appending the exporter knob values and the owner Op's editState(), then calls _buildScenePrimExporterState() to allow subclasses to affect the state, then stores the result. On the next exportScenePrims() cycle if the state has changed the prim exporter will be run.

References _buildScenePrimExporterState(), _nodeExporterData(), DD::Image::Op::editState(), exportParentPrimMode(), exportPrimPath(), getScenePrimExporterOp(), DD::Image::Op::nodeName(), and DD::Image::Op::nodeTopologyHash().

Referenced by DD::Image::AxisOp::_knobStorePost().

◆ _buildScenePrimExporterState()

virtual fdk::Hash DD::Image::ScenePrimExporterOpI::_buildScenePrimExporterState ( const fdk::Hash &  hash)
inlineprotectedvirtual

Called by _exporterUpdateScenePrimState() when determining the exporter state hash. Subclasses can implement this to take any additional values into consideration when determining export state, like input hashes. Base class does nothing.

Reimplemented in DD::Image::AxisOp.

Referenced by DD::Image::AxisOp::_buildScenePrimExporterState(), and _exporterUpdateScenePrimState().

◆ _exportScenePrimsKnobChanged()

int32_t ScenePrimExporterOpI::_exportScenePrimsKnobChanged ( Knob k,
int32_t  callAgain 
)
protected

Call this from owner Op::knob_changed(). Updates exporter knobs and calls enableExportOptionsKnobs() to allow a subclass to perform some custom logic for enabling/disabling the knobs.

References getScenePrimExporterOp(), DD::Image::Knob::inputChange, and DD::Image::Knob::showPanel.

◆ _validateScenePrimExporter()

void ScenePrimExporterOpI::_validateScenePrimExporter ( bool  for_real)
protectedvirtual

Call this from owner Op::_validate(). Subclasses can implement this to do any additional work in preparation for prim exporting. Base class does nothing.

Referenced by DD::Image::AxisOp::_validate().

◆ _exportScenePrims()

virtual void DD::Image::ScenePrimExporterOpI::_exportScenePrims ( usg::LayerRef &  exportLayer,
int32_t  exportMode,
const fdk::FrameValueSet &  sampleFrames = fdk::FrameValueSet() 
) const
protectedpure virtual

Subclass portion of exportScenePrims(). Subclass should handle the creation of the actual scene prims containing data.

Must implement.

Implemented in DD::Image::AxisOp, DD::Image::CameraOp, and DD::Image::LightOp.

Referenced by exportScenePrims(), and exportScenePrimsToLayer().

◆ exportKnob() [1/2]

bool ScenePrimExporterOpI::exportKnob ( const char *  knobName,
int32_t  exportMode,
const fdk::FrameValueSet &  sampleFrames,
usg::Prim &  outputPrim,
const char *  targetPropertyName,
usg::Value::Type  targetPropertyTypeHint = usg::Value::Type::InvalidType 
) const
protected

Note - opContext frame number is ignored if exportAllKeys is true. Returns true if value was exported / set, false if not exported due to error or knob value is at the default.

References exportKnob().

Referenced by DD::Image::CameraOp::_exportScenePrims(), DD::Image::LightOp::_exportScenePrims(), and exportKnob().

◆ exportKnob() [2/2]

bool ScenePrimExporterOpI::exportKnob ( const char *  knobName,
bool  ignoreDefaultTest,
int32_t  exportMode,
const fdk::FrameValueSet &  sampleFrames,
usg::Prim &  outputPrim,
const char *  targetPropertyName,
usg::Value::Type  targetPropertyTypeHint = usg::Value::Type::InvalidType 
) const
protected

Same but controls the default value testing via the ignoreDefaultTest arg. This is needed when a Knob's default value does not match the default of the exported Prim attribute and must always be written. For example if a destination float prim attribute called 'foo' has a default of 2.0f but the source Op Knob 'foo' has a default of 0.0f, then this method can force always exporting the Knob's value even at the destination default.

References DD::Image::Knob::animationTimes(), DD::Image::Knob::get(), DD::Image::Knob::getAuthoring(), DD::Image::Authoring::getMode(), getScenePrimExporterOp(), DD::Image::Knob::hasExpression(), DD::Image::Knob::isAnimated(), DD::Image::Op::knob(), DD::Image::Authoring::NoChange, DD::Image::Op::nodeName(), DD::Image::Knob::not_default(), DD::Image::Authoring::RestoreDefault, DD::Image::root_real_fps, DD::Image::Op::rootOp(), DD::Image::Authoring::Set, DD::Image::OutputContext::setView(), and DD::Image::Knob::valueType().

◆ buildGeometryLayer()

usg::LayerRef ScenePrimExporterOpI::buildGeometryLayer ( bool  appendTo,
const fdk::TimeValueSet &  sampleTimes 
)
overrideprotectedvirtual

Member Data Documentation

◆ _pImpl

std::unique_ptr<Impl> DD::Image::ScenePrimExporterOpI::_pImpl
protected

Exporter instance is owned by firstOp

Referenced by _nodeExporterData().



©2025 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com