[Bf-blender-cvs] [20b4477] master: Cleanup: use defines for handles

Campbell Barton noreply at git.blender.org
Thu Feb 25 00:52:47 CET 2016


Commit: 20b4477cff689e0218398d5d6556ca25021ed1fa
Author: Campbell Barton
Date:   Thu Feb 25 10:44:34 2016 +1100
Branches: master
https://developer.blender.org/rB20b4477cff689e0218398d5d6556ca25021ed1fa

Cleanup: use defines for handles

Copied from original function.

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

M	source/blender/blenkernel/intern/colortools.c

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

diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 4a9d384..32fb6af 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -414,6 +414,10 @@ void curvemap_sethandle(CurveMap *cuma, int type)
  */
 static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *next, int UNUSED(mode))
 {
+	/* defines to avoid confusion */
+#define p2_h1 ((p2) - 3)
+#define p2_h2 ((p2) + 3)
+
 	float *p1, *p2, *p3, pt[3];
 	float len, len_a, len_b;
 	float dvec_a[2], dvec_b[2];
@@ -463,21 +467,24 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex
 			
 			if (bezt->h1 == HD_AUTO) {
 				len_a /= len;
-				madd_v2_v2v2fl(p2 - 3, p2, tvec, -len_a);
+				madd_v2_v2v2fl(p2_h1, p2, tvec, -len_a);
 			}
 			if (bezt->h2 == HD_AUTO) {
 				len_b /= len;
-				madd_v2_v2v2fl(p2 + 3, p2, tvec,  len_b);
+				madd_v2_v2v2fl(p2_h2, p2, tvec,  len_b);
 			}
 		}
 	}
 
 	if (bezt->h1 == HD_VECT) {    /* vector */
-		madd_v2_v2v2fl(p2 - 3, p2, dvec_a, -1.0f / 3.0f);
+		madd_v2_v2v2fl(p2_h1, p2, dvec_a, -1.0f / 3.0f);
 	}
 	if (bezt->h2 == HD_VECT) {
-		madd_v2_v2v2fl(p2 + 3, p2, dvec_b,  1.0f / 3.0f);
+		madd_v2_v2v2fl(p2_h2, p2, dvec_b,  1.0f / 3.0f);
 	}
+
+#undef p2_h1
+#undef p2_h2
 }
 
 /* in X, out Y.




More information about the Bf-blender-cvs mailing list