[Bf-blender-cvs] [bb0b250cbde] blender-v2.92-release: Fix T85368: map range node clamps incorrectly in geometry nodes

Sam Miller noreply at git.blender.org
Mon Feb 8 13:34:12 CET 2021


Commit: bb0b250cbded8bb89d89e67cc2b39826bf3f7fa6
Author: Sam Miller
Date:   Mon Feb 8 13:32:57 2021 +0100
Branches: blender-v2.92-release
https://developer.blender.org/rBbb0b250cbded8bb89d89e67cc2b39826bf3f7fa6

Fix T85368: map range node clamps incorrectly in geometry nodes

When clamp is enabled, it should clamp between the output min and max
and not between 0 and 1.

Differential Revision: https://developer.blender.org/D10324

===================================================================

M	source/blender/nodes/shader/nodes/node_shader_map_range.cc

===================================================================

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 4a6c9ec9a4d..c01e390c513 100644
--- a/source/blender/nodes/shader/nodes/node_shader_map_range.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_map_range.cc
@@ -122,7 +122,8 @@ class MapRangeFunction : public blender::fn::MultiFunction {
 
     if (clamp_) {
       for (int64_t i : mask) {
-        CLAMP(results[i], 0.0f, 1.0f);
+        results[i] = (to_min[i] > to_max[i]) ? clamp_f(results[i], to_max[i], to_min[i]) :
+                                               clamp_f(results[i], to_min[i], to_max[i]);
       }
     }
   }



More information about the Bf-blender-cvs mailing list