[Bf-blender-cvs] [04d40de354e] soc-2018-hair-shader: Rename possible hair parametrizations
L. E. Segovia
noreply at git.blender.org
Sat May 19 02:47:55 CEST 2018
Commit: 04d40de354eb8a07f840fa168bbb3d375adcf40d
Author: L. E. Segovia
Date: Sat May 19 00:45:20 2018 +0000
Branches: soc-2018-hair-shader
https://developer.blender.org/rB04d40de354eb8a07f840fa168bbb3d375adcf40d
Rename possible hair parametrizations
With this change, I think they're clearer and better follow Pharr's book.
Also change default to direct coloring.
Ref T54796
===================================================================
M intern/cycles/blender/blender_shader.cpp
M intern/cycles/kernel/svm/svm_closure.h
M intern/cycles/kernel/svm/svm_types.h
M intern/cycles/render/nodes.cpp
M source/blender/makesdna/DNA_node_types.h
M source/blender/makesrna/intern/rna_nodetree.c
===================================================================
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index 5bf4a4c406b..fc8a2159991 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -41,8 +41,8 @@ typedef map<string, ConvertNode*> ProxyMap;
/* Find */
void BlenderSync::find_shader(BL::ID& id,
- vector<Shader*>& used_shaders,
- Shader *default_shader)
+ vector<Shader*>& used_shaders,
+ Shader *default_shader)
{
Shader *shader = (id)? shader_map.find(id): default_shader;
@@ -55,25 +55,25 @@ void BlenderSync::find_shader(BL::ID& id,
static VolumeSampling get_volume_sampling(PointerRNA& ptr)
{
return (VolumeSampling)get_enum(ptr,
- "volume_sampling",
- VOLUME_NUM_SAMPLING,
- VOLUME_SAMPLING_DISTANCE);
+ "volume_sampling",
+ VOLUME_NUM_SAMPLING,
+ VOLUME_SAMPLING_DISTANCE);
}
static VolumeInterpolation get_volume_interpolation(PointerRNA& ptr)
{
return (VolumeInterpolation)get_enum(ptr,
- "volume_interpolation",
- VOLUME_NUM_INTERPOLATION,
- VOLUME_INTERPOLATION_LINEAR);
+ "volume_interpolation",
+ VOLUME_NUM_INTERPOLATION,
+ VOLUME_INTERPOLATION_LINEAR);
}
static DisplacementMethod get_displacement_method(PointerRNA& ptr)
{
return (DisplacementMethod)get_enum(ptr,
- "displacement_method",
- DISPLACE_NUM_METHODS,
- DISPLACE_BUMP);
+ "displacement_method",
+ DISPLACE_NUM_METHODS,
+ DISPLACE_BUMP);
}
static int validate_enum_value(int value, int num_values, int default_value)
@@ -89,8 +89,8 @@ static InterpolationType get_image_interpolation(NodeType& b_node)
{
int value = b_node.interpolation();
return (InterpolationType)validate_enum_value(value,
- INTERPOLATION_NUM_TYPES,
- INTERPOLATION_LINEAR);
+ INTERPOLATION_NUM_TYPES,
+ INTERPOLATION_LINEAR);
}
template<typename NodeType>
@@ -98,8 +98,8 @@ static ExtensionType get_image_extension(NodeType& b_node)
{
int value = b_node.extension();
return (ExtensionType)validate_enum_value(value,
- EXTENSION_NUM_TYPES,
- EXTENSION_REPEAT);
+ EXTENSION_NUM_TYPES,
+ EXTENSION_REPEAT);
}
/* Graph */
@@ -161,9 +161,9 @@ 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)
+ BL::NodeSocket& b_sock,
+ BL::BlendData& b_data,
+ BL::ID& b_id)
{
Node *node = input->parent;
const SocketType& socket = input->socket_type;
@@ -213,7 +213,7 @@ static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping& b_mapping)
}
static void get_tex_mapping(TextureMapping *mapping,
- BL::ShaderNodeMapping& b_mapping)
+ BL::ShaderNodeMapping& b_mapping)
{
if(!b_mapping)
return;
@@ -234,18 +234,18 @@ static void get_tex_mapping(TextureMapping *mapping,
static bool is_output_node(BL::Node& b_node)
{
return (b_node.is_a(&RNA_ShaderNodeOutputMaterial)
- || b_node.is_a(&RNA_ShaderNodeOutputWorld)
- || b_node.is_a(&RNA_ShaderNodeOutputLamp));
+ || b_node.is_a(&RNA_ShaderNodeOutputWorld)
+ || b_node.is_a(&RNA_ShaderNodeOutputLamp));
}
static ShaderNode *add_node(Scene *scene,
- BL::RenderEngine& b_engine,
- BL::BlendData& b_data,
- BL::Scene& b_scene,
- const bool background,
- ShaderGraph *graph,
- BL::ShaderNodeTree& b_ntree,
- BL::ShaderNode& b_node)
+ BL::RenderEngine& b_engine,
+ BL::BlendData& b_data,
+ BL::Scene& b_scene,
+ const bool background,
+ ShaderGraph *graph,
+ BL::ShaderNodeTree& b_ntree,
+ BL::ShaderNode& b_node)
{
ShaderNode *node = NULL;
@@ -255,9 +255,9 @@ static ShaderNode *add_node(Scene *scene,
BL::CurveMapping mapping(b_curve_node.mapping());
RGBCurvesNode *curves = new RGBCurvesNode();
curvemapping_color_to_array(mapping,
- curves->curves,
- RAMP_TABLE_SIZE,
- true);
+ curves->curves,
+ RAMP_TABLE_SIZE,
+ true);
curvemapping_minmax(mapping, true, &curves->min_x, &curves->max_x);
node = curves;
}
@@ -266,9 +266,9 @@ static ShaderNode *add_node(Scene *scene,
BL::CurveMapping mapping(b_curve_node.mapping());
VectorCurvesNode *curves = new VectorCurvesNode();
curvemapping_color_to_array(mapping,
- curves->curves,
- RAMP_TABLE_SIZE,
- false);
+ curves->curves,
+ RAMP_TABLE_SIZE,
+ false);
curvemapping_minmax(mapping, false, &curves->min_x, &curves->max_x);
node = curves;
}
@@ -524,12 +524,12 @@ static ShaderNode *add_node(Scene *scene,
}
node = hair;
}
- else if(b_node.is_a(&RNA_ShaderNodeBsdfHairPrincipled)) {
- BL::ShaderNodeBsdfHairPrincipled b_principled_hair_node(b_node);
- PrincipledHairBsdfNode *principled_hair = new PrincipledHairBsdfNode();
- principled_hair->parametrization = (NodePrincipledHairParametrization) get_enum(b_principled_hair_node.ptr, "parametrization", NODE_PRINCIPLED_HAIR_NUM, NODE_PRINCIPLED_HAIR_COLOR);
- node = principled_hair;
- }
+ else if(b_node.is_a(&RNA_ShaderNodeBsdfHairPrincipled)) {
+ BL::ShaderNodeBsdfHairPrincipled b_principled_hair_node(b_node);
+ PrincipledHairBsdfNode *principled_hair = new PrincipledHairBsdfNode();
+ principled_hair->parametrization = (NodePrincipledHairParametrization) get_enum(b_principled_hair_node.ptr, "parametrization", NODE_PRINCIPLED_HAIR_NUM, NODE_PRINCIPLED_HAIR_REFLECTANCE);
+ node = principled_hair;
+ }
else if(b_node.is_a(&RNA_ShaderNodeBsdfPrincipled)) {
BL::ShaderNodeBsdfPrincipled b_principled_node(b_node);
PrincipledBsdfNode *principled = new PrincipledBsdfNode();
@@ -644,10 +644,10 @@ static ShaderNode *add_node(Scene *scene,
* they could only be loaded correct from blender side
*/
bool is_builtin = b_image.packed_file() ||
- b_image.source() == BL::Image::source_GENERATED ||
- b_image.source() == BL::Image::source_MOVIE ||
- (b_engine.is_preview() &&
- b_image.source() != BL::Image::source_SEQUENCE);
+ b_image.source() == BL::Image::source_GENERATED ||
+ b_image.source() == BL::Image::source_MOVIE ||
+ (b_engine.is_preview() &&
+ b_image.source() != BL::Image::source_SEQUENCE);
if(is_builtin) {
/* for builtin images we're using image datablock name to find an image to
@@ -658,14 +658,14 @@ static ShaderNode *add_node(Scene *scene,
*/
int scene_frame = b_scene.frame_current();
int image_frame = image_user_frame_number(b_image_user,
- scene_frame);
+ scene_frame);
image->filename = b_image.name() + "@" + string_printf("%d", image_frame);
image->builtin_data = b_image.ptr.data;
}
else {
image->filename = image_user_file_path(b_image_user,
- b_image,
- b_scene.frame_current());
+ b_image,
+ b_scene.frame_current());
image->builtin_data = NULL;
}
@@ -675,11 +675,11 @@ static ShaderNode *add_node(Scene *scene,
/* TODO(sergey): Does not work properly when we change builtin type. */
if(b_image.is_updated()) {
scene->image_manager->tag_reload_image(
- image->filename.string(),
- image->builtin_data,
- get_image_interpolation(b_image_node),
- get_image_extension(b_image_node),
- image->use_alpha);
+ image->filename.string(),
+ image->builtin_data,
+ get_image_interpolation(b_image_node),
+ get_image_extension(b_image_node),
+ image->use_alpha);
}
}
image->color_space = (NodeImageColorSpace)b_image_node.color_space();
@@ -698,22 +698,22 @@ static ShaderNode *add_node(Scene *scene,
EnvironmentTextureNode *env = new EnvironmentTextureNode();
if(b_image) {
bool is_builtin = b_image.packed_file() ||
- b_image.source() == BL::Image::source_GENERATED ||
- b_image.source() == BL::Image::source_MOVIE ||
- (b_engine.is_preview() &&
- b_image.source() != BL::Image::source_SEQUENCE);
+ b_image.source() == BL::Image::source_GENERATED ||
+ b_image.source() == BL::Image::source_MOVIE ||
+ (b_engine.is_preview() &&
+ b_image.source() != BL::Image::source_SEQUENCE);
if(is_builtin) {
int scene_frame = b_scene.frame_current();
int image_frame = image_user_frame_number(b_image_user,
- scene_frame);
+ scene_frame);
env->filename = b_image.name() + "@" + string_printf("%d", image_frame);
env->builtin_data = b_image.ptr.data;
}
else {
env->filename = image_user_file_path(b_image_user,
- b_image,
- b_scene.frame_current());
+ b_image,
+ b_scene.frame_current());
env->builtin_data = NULL;
}
@@ -723,11 +723,11 @@ static ShaderNode *add_node(Scene *scene,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list