Blender  V2.93
Typedefs | Functions | Variables
blender_shader.cpp File Reference
#include "render/background.h"
#include "render/colorspace.h"
#include "render/graph.h"
#include "render/light.h"
#include "render/nodes.h"
#include "render/osl.h"
#include "render/scene.h"
#include "render/shader.h"
#include "blender/blender_image.h"
#include "blender/blender_sync.h"
#include "blender/blender_texture.h"
#include "blender/blender_util.h"
#include "util/util_debug.h"
#include "util/util_foreach.h"
#include "util/util_set.h"
#include "util/util_string.h"
#include "util/util_task.h"

Go to the source code of this file.

Typedefs

typedef map< void *, ShaderOutput * > PtrOutputMap
 
typedef map< string, ConvertNode * > ProxyMap
 

Functions

static VolumeSampling get_volume_sampling (PointerRNA &ptr)
 
static VolumeInterpolation get_volume_interpolation (PointerRNA &ptr)
 
static DisplacementMethod get_displacement_method (PointerRNA &ptr)
 
static int validate_enum_value (int value, int num_values, int default_value)
 
template<typename NodeType >
static InterpolationType get_image_interpolation (NodeType &b_node)
 
template<typename NodeType >
static ExtensionType get_image_extension (NodeType &b_node)
 
static ImageAlphaType get_image_alpha_type (BL::Image &b_image)
 
static const string_view object_attr_prefix ("\x01object:")
 
static const string_view instancer_attr_prefix ("\x01instancer:")
 
static ustring blender_attribute_name_add_type (const string &name, BlenderAttributeType type)
 
BlenderAttributeType blender_attribute_name_split_type (ustring name, string *r_real_name)
 
static BL::NodeSocket get_node_output (BL::Node &b_node, const string &name)
 
static float3 get_node_output_rgba (BL::Node &b_node, const string &name)
 
static float get_node_output_value (BL::Node &b_node, const string &name)
 
static float3 get_node_output_vector (BL::Node &b_node, const string &name)
 
static SocketType::Type convert_socket_type (BL::NodeSocket &b_socket)
 
static void set_default_value (ShaderInput *input, BL::NodeSocket &b_sock, BL::BlendData &b_data, BL::ID &b_id)
 
static void get_tex_mapping (TextureNode *mapping, BL::TexMapping &b_mapping)
 
static ShaderNodeadd_node (Scene *scene, BL::RenderEngine &b_engine, BL::BlendData &b_data, BL::Depsgraph &b_depsgraph, BL::Scene &b_scene, ShaderGraph *graph, BL::ShaderNodeTree &b_ntree, BL::ShaderNode &b_node)
 
static bool node_use_modified_socket_name (ShaderNode *node)
 
static ShaderInputnode_find_input_by_name (ShaderNode *node, BL::Node &b_node, BL::NodeSocket &b_socket)
 
static ShaderOutputnode_find_output_by_name (ShaderNode *node, BL::Node &b_node, BL::NodeSocket &b_socket)
 
static void add_nodes (Scene *scene, BL::RenderEngine &b_engine, BL::BlendData &b_data, BL::Depsgraph &b_depsgraph, BL::Scene &b_scene, ShaderGraph *graph, BL::ShaderNodeTree &b_ntree, const ProxyMap &proxy_input_map, const ProxyMap &proxy_output_map)
 
static void add_nodes (Scene *scene, BL::RenderEngine &b_engine, BL::BlendData &b_data, BL::Depsgraph &b_depsgraph, BL::Scene &b_scene, ShaderGraph *graph, BL::ShaderNodeTree &b_ntree)
 

Variables

CCL_NAMESPACE_BEGIN typedef map< void *, ShaderInput * > PtrInputMap
 

Typedef Documentation

◆ ProxyMap

typedef map<string, ConvertNode *> ProxyMap

Definition at line 41 of file blender_shader.cpp.

◆ PtrOutputMap

typedef map<void *, ShaderOutput *> PtrOutputMap

Definition at line 40 of file blender_shader.cpp.

Function Documentation

◆ add_node()

static ShaderNode* add_node ( Scene scene,
BL::RenderEngine b_engine,
BL::BlendData &  b_data,
BL::Depsgraph b_depsgraph,
BL::Scene b_scene,
ShaderGraph graph,
BL::ShaderNodeTree &  b_ntree,
BL::ShaderNode &  b_node 
)
static

Definition at line 257 of file blender_shader.cpp.

References ImageManager::add_image(), blender_absolute_path(), blender_attribute_name_add_type(), CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID, CLOSURE_BSDF_DIFFUSE_TOON_ID, CLOSURE_BSDF_GLOSSY_TOON_ID, CLOSURE_BSDF_HAIR_REFLECTION_ID, CLOSURE_BSDF_HAIR_TRANSMISSION_ID, CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID, CLOSURE_BSDF_MICROFACET_BECKMANN_ID, CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID, CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID, CLOSURE_BSDF_MICROFACET_GGX_ID, CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID, CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID, CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID, CLOSURE_BSDF_REFLECTION_ID, CLOSURE_BSDF_REFRACTION_ID, CLOSURE_BSDF_SHARP_GLASS_ID, CLOSURE_BSSRDF_BURLEY_ID, CLOSURE_BSSRDF_CUBIC_ID, CLOSURE_BSSRDF_GAUSSIAN_ID, CLOSURE_BSSRDF_PRINCIPLED_ID, CLOSURE_BSSRDF_PRINCIPLED_RANDOM_WALK_ID, CLOSURE_BSSRDF_RANDOM_WALK_ID, ColorRamp, colorramp_to_array(), curvemapping_color_to_array(), curvemapping_minmax(), get_enum(), get_enum_identifier(), get_float3(), get_image_alpha_type(), get_image_extension(), get_image_interpolation(), get_node_output_rgba(), get_node_output_value(), get_node_output_vector(), get_tex_mapping(), get_text_datablock_content(), get_transform(), graph, ImageSlotTextureNode::handle, PointDensityTextureNode::handle, Scene::image_manager, ImageTextureNode::image_params(), EnvironmentTextureNode::image_params(), PointDensityTextureNode::image_params(), image_user_file_path(), image_user_frame_number(), magic(), mix, node, NODE_PRINCIPLED_HAIR_NUM, NODE_PRINCIPLED_HAIR_REFLECTANCE, noise(), norm(), normalize(), NULL, ShaderNode::outputs, point_density_texture_space(), principled_hair(), array< T, alignment >::push_back_slow(), RAMP_TABLE_SIZE, RNA_ShaderNodeCameraData, RNA_ShaderNodeCombineRGB, RNA_ShaderNodeGamma, RNA_ShaderNodeHueSaturation, RNA_ShaderNodeInvert, RNA_ShaderNodeMapping, RNA_ShaderNodeMath, RNA_ShaderNodeMixRGB, RNA_ShaderNodeNormal, RNA_ShaderNodeOutputAOV, RNA_ShaderNodeRGB, RNA_ShaderNodeRGBCurve, RNA_ShaderNodeRGBToBW, RNA_ShaderNodeScript, RNA_ShaderNodeSeparateRGB, RNA_ShaderNodeValToRGB, RNA_ShaderNodeValue, RNA_ShaderNodeVectorCurve, RNA_ShaderNodeVectorMath, scene, Node::set_value(), Scene::shader_manager, size(), tex_coord, transform_inverse(), transform_scale(), transform_translate(), and ShaderManager::use_osl().

Referenced by add_nodes(), and do_versions_material_convert_legacy_blend_mode().

◆ add_nodes() [1/2]

static void add_nodes ( Scene scene,
BL::RenderEngine b_engine,
BL::BlendData &  b_data,
BL::Depsgraph b_depsgraph,
BL::Scene b_scene,
ShaderGraph graph,
BL::ShaderNodeTree &  b_ntree 
)
static

Definition at line 1262 of file blender_shader.cpp.

References add_nodes(), graph, and scene.

◆ add_nodes() [2/2]

static void add_nodes ( Scene scene,
BL::RenderEngine b_engine,
BL::BlendData &  b_data,
BL::Depsgraph b_depsgraph,
BL::Scene b_scene,
ShaderGraph graph,
BL::ShaderNodeTree &  b_ntree,
const ProxyMap proxy_input_map,
const ProxyMap proxy_output_map 
)
static

◆ blender_attribute_name_add_type()

static ustring blender_attribute_name_add_type ( const string &  name,
BlenderAttributeType  type 
)
static

Definition at line 118 of file blender_shader.cpp.

References instancer_attr_prefix(), object_attr_prefix(), and type.

Referenced by add_node().

◆ blender_attribute_name_split_type()

BlenderAttributeType blender_attribute_name_split_type ( ustring  name,
string *  r_real_name 
)

Definition at line 130 of file blender_shader.cpp.

References instancer_attr_prefix(), and object_attr_prefix().

◆ convert_socket_type()

static SocketType::Type convert_socket_type ( BL::NodeSocket &  b_socket)
static

◆ get_displacement_method()

static DisplacementMethod get_displacement_method ( PointerRNA ptr)
static

Definition at line 67 of file blender_shader.cpp.

References DISPLACE_BUMP, DISPLACE_NUM_METHODS, get_enum(), and ptr.

◆ get_image_alpha_type()

static ImageAlphaType get_image_alpha_type ( BL::Image b_image)
static

Definition at line 94 of file blender_shader.cpp.

References IMAGE_ALPHA_AUTO, IMAGE_ALPHA_NUM_TYPES, and validate_enum_value().

Referenced by add_node().

◆ get_image_extension()

template<typename NodeType >
static ExtensionType get_image_extension ( NodeType b_node)
static

Definition at line 88 of file blender_shader.cpp.

References EXTENSION_NUM_TYPES, EXTENSION_REPEAT, and validate_enum_value().

Referenced by add_node().

◆ get_image_interpolation()

template<typename NodeType >
static InterpolationType get_image_interpolation ( NodeType b_node)
static

Definition at line 81 of file blender_shader.cpp.

References INTERPOLATION_LINEAR, INTERPOLATION_NUM_TYPES, and validate_enum_value().

Referenced by add_node().

◆ get_node_output()

static BL::NodeSocket get_node_output ( BL::Node &  b_node,
const string &  name 
)
static

◆ get_node_output_rgba()

static float3 get_node_output_rgba ( BL::Node &  b_node,
const string &  name 
)
static

Definition at line 160 of file blender_shader.cpp.

References get_node_output(), make_float3, and RNA_float_get_array().

Referenced by add_node().

◆ get_node_output_value()

static float get_node_output_value ( BL::Node &  b_node,
const string &  name 
)
static

Definition at line 168 of file blender_shader.cpp.

References get_node_output(), and RNA_float_get().

Referenced by add_node().

◆ get_node_output_vector()

static float3 get_node_output_vector ( BL::Node &  b_node,
const string &  name 
)
static

Definition at line 174 of file blender_shader.cpp.

References get_node_output(), make_float3, and RNA_float_get_array().

Referenced by add_node().

◆ get_tex_mapping()

static void get_tex_mapping ( TextureNode mapping,
BL::TexMapping b_mapping 
)
static

Definition at line 242 of file blender_shader.cpp.

References get_float3().

Referenced by add_node().

◆ get_volume_interpolation()

static VolumeInterpolation get_volume_interpolation ( PointerRNA ptr)
static

◆ get_volume_sampling()

static VolumeSampling get_volume_sampling ( PointerRNA ptr)
static

Definition at line 55 of file blender_shader.cpp.

References get_enum(), ptr, VOLUME_NUM_SAMPLING, and VOLUME_SAMPLING_DISTANCE.

◆ instancer_attr_prefix()

static const string_view instancer_attr_prefix ( "\x01instancer:"  )
static

◆ node_find_input_by_name()

static ShaderInput* node_find_input_by_name ( ShaderNode node,
BL::Node &  b_node,
BL::NodeSocket &  b_socket 
)
static

Definition at line 1005 of file blender_shader.cpp.

References ShaderInput::name(), node, node_use_modified_socket_name(), and string_printf().

Referenced by add_nodes().

◆ node_find_output_by_name()

static ShaderOutput* node_find_output_by_name ( ShaderNode node,
BL::Node &  b_node,
BL::NodeSocket &  b_socket 
)
static

Definition at line 1038 of file blender_shader.cpp.

References ShaderOutput::name(), node, node_use_modified_socket_name(), and string_printf().

Referenced by add_nodes().

◆ node_use_modified_socket_name()

static bool node_use_modified_socket_name ( ShaderNode node)
static

Definition at line 997 of file blender_shader.cpp.

References node, and SHADER_SPECIAL_TYPE_OSL.

Referenced by node_find_input_by_name(), and node_find_output_by_name().

◆ object_attr_prefix()

static const string_view object_attr_prefix ( "\x01object:"  )
static

◆ set_default_value()

static void set_default_value ( ShaderInput input,
BL::NodeSocket &  b_sock,
BL::BlendData &  b_data,
BL::ID b_id 
)
static

◆ validate_enum_value()

static int validate_enum_value ( int  value,
int  num_values,
int  default_value 
)
static

Variable Documentation

◆ PtrInputMap

CCL_NAMESPACE_BEGIN typedef map<void *, ShaderInput *> PtrInputMap

Definition at line 39 of file blender_shader.cpp.

Referenced by add_nodes().