Nuke binary plugins 15.0.5
 
Loading...
Searching...
No Matches
DD::Image::LightMaterialOpI Class Reference

#include <LightMaterialOpI.h>

Inheritance diagram for DD::Image::LightMaterialOpI:
DD::Image::MaterialOpI DD::Image::LightOp DD::Image::ComplexLightOp

Public Member Functions

std::string getShaderNodeName (const usg::Token &target_renderer=usg::Token()) override
 
void defineLightPrim (const usg::LayerRef &define_layer, const usg::Path &light_prim_path, const MaterialContext &rtx, usg::ShaderDescGroup &shaderdesc_group)
 
- Public Member Functions inherited from DD::Image::MaterialOpI
virtual OpgetOp ()
 Return the Op this interface is attached to. Should return 'this'.
 
virtual void setOverrideOp (Op *)
 
virtual void clearOverrideOp ()
 Disable any assigned override Op.
 
virtual OpgetOverrideOp () const
 Return the override Op used for shader property value updating.
 
virtual usg::TokenArray getAppliedApiSchemas () const
 Returns a list of API's this output shader must implement.
 
virtual const char * getOutputSchema () const
 
virtual int32_t getOutputType () const
 
bool isCoShader () const
 Convenience to check output type.
 
bool isSurfaceShader () const
 
bool isLightShader () const
 
bool isVolumeShader () const
 
virtual std::string getShaderNodeName (const usg::Token &target_renderer=usg::Token())
 
virtual int32_t connectionTypeForNodeInput (int32_t node_input) const
 
virtual usg::ShaderDesc * createShaderGraph (int32_t output_type, const MaterialContext &rtx, usg::ShaderDescGroup &shader_group)
 
virtual usg::ShaderDesc * createShaderGraphFromOp (Op *input_op, const MaterialContext &rtx, usg::ShaderDescGroup &shader_group)
 
virtual void updateShaderGraphOverrides (int32_t output_type, const MaterialContext &rtx, usg::ShaderDescGroup &shader_group)
 
virtual void updateShaderGraphFromOp (Op *input_op, const MaterialContext &rtx, usg::ShaderDescGroup &shader_group)
 

Static Public Member Functions

static const char * conformPropName (const char *prop_name)
 
- Static Public Member Functions inherited from DD::Image::MaterialOpI
static std::string getNodeInstanceSuffix (DD::Image::Op *op)
 
static std::string buildName (const std::string &node_name, const char *schema_name)
 Convenience function builds a standard shader name with '<node_name>_<schema_name>'.
 
static std::string buildName (const usg::Token &target_renderer, const std::string &node_name, const char *schema_name)
 Convenience function builds a standard shader name with '<target_renderer>_<node_name>_<schema_name>'.
 
static int32_t getShaderTypeFromOp (Op *op)
 
static std::string getShaderNodeNameFromOp (const usg::Token &target_renderer, Op *op)
 
static const char * inputShaderTypeName (int32_t op_type)
 
static usg::ShaderDesc * createOpInterfaceShaderDesc (int32_t op_type, Op *op)
 
static usg::ShaderDesc * createOpInterfaceShaderDesc (Op *op)
 
static std::string buildAssetPath (Op *input_op)
 
static bool parseAssetPath (const std::string &path, std::string &nodePath, OutputContext &outputContext, Hash &opHash)
 
static OpretrieveOpFromAssetPath (const std::string &path)
 

Protected Member Functions

bool overrideShaderDescInput (const char *knob_name, const MaterialContext &rtx, usg::ShaderDesc &shader_desc, const char *target_property_name, usg::Value::Type target_property_type_hint=usg::Value::Type::InvalidType) override
 
bool overrideShaderDescInput (const Channel &chan, const MaterialContext &rtx, usg::ShaderDesc &shader_desc, const char *target_property_name) override
 
bool overrideShaderDescInput (const Channel *chan_array, uint32_t num_channels, const MaterialContext &rtx, usg::ShaderDesc &shader_desc, const char *target_property_name) override
 
bool overrideShaderDescInput (const ChannelSet &channels, const MaterialContext &rtx, usg::ShaderDesc &shader_desc, const char *target_property_name) override
 
virtual bool overrideShaderDescInput (const char *knob_name, const MaterialContext &rtx, usg::ShaderDesc &shader_desc, const char *target_property_name, usg::Value::Type target_property_type_hint=usg::Value::Type::InvalidType)
 
virtual bool overrideShaderDescInput (const Channel &chan, const MaterialContext &rtx, usg::ShaderDesc &shader_desc, const char *target_property_name)
 
virtual bool overrideShaderDescInput (const Channel *chan_array, uint32_t num_channels, const MaterialContext &rtx, usg::ShaderDesc &shader_desc, const char *target_property_name)
 
virtual bool overrideShaderDescInput (const ChannelSet &channels, const MaterialContext &rtx, usg::ShaderDesc &shader_desc, const char *target_property_name)
 

Additional Inherited Members

- Public Types inherited from DD::Image::MaterialOpI
enum  {
  INPUT_TYPE_NONE , INPUT_TYPE_OP , INPUT_TYPE_MATERIALOP , INPUT_TYPE_IOP ,
  INPUT_TYPE_AXISOP , INPUT_TYPE_CAMERAOP , INPUT_TYPE_LIGHTOP
}
 
enum  {
  OUTPUT_TYPE_NONE , OUTPUT_TYPE_COSHADER , OUTPUT_TYPE_SURFACESHADER , OUTPUT_TYPE_LIGHTSHADER ,
  OUTPUT_TYPE_VOLUMESHADER
}
 

Detailed Description

Interface for abstracting Light usg::Prims and their possible materials, usually built from LightOps.

LightMaterialOpI converts a graph network of Nuke LightOp, AxisOp, and Iop Nodes into usg::Prims with the matching Xform parenting structure. At the moment (Nuke14-2022) the material and shader graph part is ignored in favor of using the direct texture assignment attributes on the Light Prims. When light shader graphs are formally supported they will likely be handled similar to surface materials and stored under a shared 'light library' locale in the scenegraph. This is the reason why this class is a subclass of MaterialOpI.

The biggest topological difference between this and MaterialOpI is that a Light usg::Prim is created with possibly a parenting rig added above it rather than a single usg::MaterialPrim and multiple usg::ShaderPrims underneath.

Member Function Documentation

◆ getShaderNodeName()

std::string DD::Image::LightMaterialOpI::getShaderNodeName ( const usg::Token &  target_renderer = usg::Token())
overridevirtual

The 'shader node' name for LightOps is its full prim path so this method returns 'LightOp::primFullPath()'. The target_renderer arg is ignored.

Reimplemented from DD::Image::MaterialOpI.

References DD::Image::MaterialOpI::getOp(), and DD::Image::AxisOp::primFullPath().

Referenced by defineLightPrim().

◆ conformPropName()

const char * DD::Image::LightMaterialOpI::conformPropName ( const char *  prop_name)
static

Skips any leading 'inputs:' or 'outputs:' prefix in the prop name. This can commonly happen when the property names are coming from a Light Prim and not a shader. For example a Schema property named 'inputs:intensity' will be changed to 'intensity' since light prims don't use the same convention as shader prims.

Referenced by overrideShaderDescInput().

◆ defineLightPrim()

void DD::Image::LightMaterialOpI::defineLightPrim ( const usg::LayerRef &  define_layer,
const usg::Path &  light_prim_path,
const MaterialContext rtx,
usg::ShaderDescGroup &  shaderdesc_group 
)

Define a Light Prim from the wrapped LightOp in the provided GeomLayer, setting any attribute overrides.

'light_path' is the absolute path to the new Light Prim with the new prim name at the end.

Optionally initialize a ShaderDescGroup with all the ShaderDesc comprising this light's shader tree and its input connections, and assign the 'output' shader entry point for the group.

References DD::Image::MaterialOpI::getOp(), DD::Image::MaterialOpI::getOutputSchema(), getShaderNodeName(), DD::Image::Op::nodeName(), DD::Image::MaterialOpI::OUTPUT_TYPE_LIGHTSHADER, and DD::Image::MaterialOpI::updateShaderGraphOverrides().

Referenced by DD::Image::GeomOpEngine::importLightOp().

◆ overrideShaderDescInput() [1/4]

bool DD::Image::LightMaterialOpI::overrideShaderDescInput ( const char *  knob_name,
const MaterialContext rtx,
usg::ShaderDesc &  shader_desc,
const char *  target_property_name,
usg::Value::Type  target_property_type_hint = usg::Value::Type::InvalidType 
)
overrideprotectedvirtual

Copy the value from a local Op Knob to the ShaderDesc. Translates light Prim property names and trim any leading 'inputs:' or 'outputs:'.

Reimplemented from DD::Image::MaterialOpI.

References conformPropName(), and DD::Image::MaterialOpI::overrideShaderDescInput().

◆ overrideShaderDescInput() [2/4]

bool DD::Image::LightMaterialOpI::overrideShaderDescInput ( const Channel chan,
const MaterialContext rtx,
usg::ShaderDesc &  shader_desc,
const char *  target_property_name 
)
overrideprotectedvirtual

Specialization for Channel-source override. Translates light Prim property names and trim any leading 'inputs:' or 'outputs:'.

Reimplemented from DD::Image::MaterialOpI.

References conformPropName(), and DD::Image::MaterialOpI::overrideShaderDescInput().

◆ overrideShaderDescInput() [3/4]

bool DD::Image::LightMaterialOpI::overrideShaderDescInput ( const Channel chan_array,
uint32_t  num_channels,
const MaterialContext rtx,
usg::ShaderDesc &  shader_desc,
const char *  target_property_name 
)
overrideprotectedvirtual

Specialization for ChannelArray-source override. Translates light Prim property names and trim any leading 'inputs:' or 'outputs:'.

Reimplemented from DD::Image::MaterialOpI.

References conformPropName(), and DD::Image::MaterialOpI::overrideShaderDescInput().

◆ overrideShaderDescInput() [4/4]

bool DD::Image::LightMaterialOpI::overrideShaderDescInput ( const ChannelSet channels,
const MaterialContext rtx,
usg::ShaderDesc &  shader_desc,
const char *  target_property_name 
)
overrideprotectedvirtual

Specialization for ChannelSet-source override. Translates light Prim property names and trim any leading 'inputs:' or 'outputs:'.

Reimplemented from DD::Image::MaterialOpI.

References conformPropName(), and DD::Image::MaterialOpI::overrideShaderDescInput().



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