diff options
Diffstat (limited to 'source/blender/nodes/shader/nodes')
3 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.cc b/source/blender/nodes/shader/nodes/node_shader_bump.cc index 252abd02ad7..690eacf30ff 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bump.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bump.cc @@ -60,6 +60,17 @@ static int gpu_shader_bump(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { + /* If there is no Height input, the node becomes a no-op. */ + if (!in[2].link) { + if (!in[5].link) { + return GPU_link(mat, "world_normals_get", &out[0].link); + } + else { + /* Actually running the bump code would normalize, but Cycles handles it as total no-op. */ + return GPU_link(mat, "vector_copy", in[5].link, &out[0].link); + } + } + if (!in[5].link) { GPU_link(mat, "world_normals_get", &in[5].link); } diff --git a/source/blender/nodes/shader/nodes/node_shader_common.cc b/source/blender/nodes/shader/nodes/node_shader_common.cc index 3f0fff34533..f7a17f0722c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_common.cc +++ b/source/blender/nodes/shader/nodes/node_shader_common.cc @@ -15,7 +15,6 @@ * * The Original Code is Copyright (C) 2006 Blender Foundation. * All rights reserved. - * Juho Vepsäläinen */ /** \file diff --git a/source/blender/nodes/shader/nodes/node_shader_map_range.cc b/source/blender/nodes/shader/nodes/node_shader_map_range.cc index bc7ca661a77..254ab9f866d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_map_range.cc +++ b/source/blender/nodes/shader/nodes/node_shader_map_range.cc @@ -66,6 +66,16 @@ static void node_shader_buts_map_range(uiLayout *layout, bContext *UNUSED(C), Po } } +static int node_shader_map_range_ui_class(const bNode *node) +{ + const NodeMapRange &storage = node_storage(*node); + const CustomDataType data_type = static_cast<CustomDataType>(storage.data_type); + if (data_type == CD_PROP_FLOAT3) { + return NODE_CLASS_OP_VECTOR; + } + return NODE_CLASS_CONVERTER; +} + static void node_shader_update_map_range(bNodeTree *ntree, bNode *node) { const NodeMapRange &storage = node_storage(*node); @@ -665,6 +675,7 @@ void register_node_type_sh_map_range() sh_fn_node_type_base(&ntype, SH_NODE_MAP_RANGE, "Map Range", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_map_range_declare; ntype.draw_buttons = file_ns::node_shader_buts_map_range; + ntype.ui_class = file_ns::node_shader_map_range_ui_class; node_type_init(&ntype, file_ns::node_shader_init_map_range); node_type_storage( &ntype, "NodeMapRange", node_free_standard_storage, node_copy_standard_storage); |