diff options
author | OmarSquircleArt <omar.squircleart@gmail.com> | 2019-08-14 11:53:19 +0300 |
---|---|---|
committer | OmarSquircleArt <omar.squircleart@gmail.com> | 2019-08-14 11:53:19 +0300 |
commit | 7a7eadaf7f6be4008f49a83d76c5a6d5a6294f14 (patch) | |
tree | 8a064999db636d7c8c49f41156fd526193cee658 /source/blender/editors/space_node | |
parent | c9acc5faad08422e07be59fc160a028a45b7440c (diff) |
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
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |