[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52216] trunk/blender/source/blender/ compositor/operations/COM_MapRangeOperation.cpp: fix range map node clipping when max < min

Dalai Felinto dfelinto at gmail.com
Wed Nov 14 23:15:46 CET 2012


Revision: 52216
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52216
Author:   dfelinto
Date:     2012-11-14 22:15:45 +0000 (Wed, 14 Nov 2012)
Log Message:
-----------
fix range map node clipping when max < min
(useful for flipping the values inside the node)

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/operations/COM_MapRangeOperation.cpp

Modified: trunk/blender/source/blender/compositor/operations/COM_MapRangeOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_MapRangeOperation.cpp	2012-11-14 21:57:47 UTC (rev 52215)
+++ trunk/blender/source/blender/compositor/operations/COM_MapRangeOperation.cpp	2012-11-14 22:15:45 UTC (rev 52216)
@@ -65,8 +65,14 @@
 	value = (value - source_min) / (source_max - source_min);
 	value = dest_min + value * (dest_max - dest_min);
 
-	if (this->m_useClamp)
-		CLAMP(value, dest_min, dest_max);
+	if (this->m_useClamp) {
+		if (dest_max > dest_min) {
+			CLAMP(value, dest_min, dest_max);
+		}
+		else {
+			CLAMP(value, dest_max, dest_min);
+		}
+	}
 
 	output[0] = value;
 }




More information about the Bf-blender-cvs mailing list