diff options
author | Charlie Jolly <charlie> | 2019-12-07 15:35:07 +0300 |
---|---|---|
committer | Charlie Jolly <mistajolly@gmail.com> | 2019-12-07 15:52:42 +0300 |
commit | 958d0d4236b1cfa600a7f36f6bdc51fdd0d98a97 (patch) | |
tree | 567a1e3209e6302dd784c054b858a8b5fb92bc9f /source/blender/editors/space_node | |
parent | 0406eb110332a863811d7fb6228f9a7ca514e022 (diff) |
Shader Nodes: Add Interpolation modes to Map Range node
Modes: Linear interpolation (default), stepped linear, smoothstep and smootherstep.
This also includes an additional option for the **Clamp node** to switch between **Min Max** (default) and **Range** mode.
This was needed to allow clamping when **To Max** is less than **To Min**.
Reviewed By: JacquesLucke, brecht
Differential Revision: https://developer.blender.org/D5827
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index b60764c410d..a02eeaa1502 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -250,9 +250,19 @@ static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA } } -static void node_buts_map_range(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_shader_buts_clamp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "clamp", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "clamp_type", 0, "", ICON_NONE); +} + +static void node_shader_buts_map_range(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "interpolation_type", 0, "", ICON_NONE); + if (!ELEM(RNA_enum_get(ptr, "interpolation_type"), + NODE_MAP_RANGE_SMOOTHSTEP, + NODE_MAP_RANGE_SMOOTHERSTEP)) { + uiItemR(layout, ptr, "clamp", 0, NULL, ICON_NONE); + } } static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1172,8 +1182,11 @@ static void node_shader_set_butfunc(bNodeType *ntype) case SH_NODE_VALTORGB: ntype->draw_buttons = node_buts_colorramp; break; + case SH_NODE_CLAMP: + ntype->draw_buttons = node_shader_buts_clamp; + break; case SH_NODE_MAP_RANGE: - ntype->draw_buttons = node_buts_map_range; + ntype->draw_buttons = node_shader_buts_map_range; break; case SH_NODE_MATH: ntype->draw_buttons = node_buts_math; |