From 7a7eadaf7f6be4008f49a83d76c5a6d5a6294f14 Mon Sep 17 00:00:00 2001 From: OmarSquircleArt Date: Wed, 14 Aug 2019 10:53:19 +0200 Subject: Shading: Add a clamp option to the Map Range node. If the option is enabled, the output is clamped to the target range. The target range is [To Min, To Max]. The option is enabled by default. The clamp option is implemented in EEVEE by linking to the `clamp_value` GLSL function. And it is implemented in Cycles using a graph expand function. Reviewers: brecht, JacquesLucke Differential Revision: https://developer.blender.org/D5477 --- source/blender/editors/space_node/drawnode.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/editors/space_node/drawnode.c') diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index b63f0daaa0d..704d878e620 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -249,6 +249,11 @@ static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA } } +static void node_buts_map_range(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "clamp", 0, NULL, ICON_NONE); +} + static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "operation", 0, "", ICON_NONE); @@ -1209,6 +1214,9 @@ static void node_shader_set_butfunc(bNodeType *ntype) case SH_NODE_VALTORGB: ntype->draw_buttons = node_buts_colorramp; break; + case SH_NODE_MAP_RANGE: + ntype->draw_buttons = node_buts_map_range; + break; case SH_NODE_MATH: ntype->draw_buttons = node_buts_math; break; -- cgit v1.2.3