[Bf-blender-cvs] [c0615ac] BendyBones: Bendy Bones: Code Cleanup - Use const for all these intermediate values too

Joshua Leung noreply at git.blender.org
Tue May 17 16:40:56 CEST 2016


Commit: c0615ac68783b86afb518b53cd5940e4fa0d9ea5
Author: Joshua Leung
Date:   Wed May 18 01:50:39 2016 +1200
Branches: BendyBones
https://developer.blender.org/rBc0615ac68783b86afb518b53cd5940e4fa0d9ea5

Bendy Bones: Code Cleanup - Use const for all these intermediate values too

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

M	source/blender/blenkernel/intern/armature.c
M	source/blender/editors/space_view3d/drawarmature.c

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

diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 0cd63cd..5c95cde 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -715,13 +715,13 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB
 		{
 			const int num_segments = bone->segments;
 			
-			float scaleIn = bone->scaleIn * (!rest ? pchan->scaleIn : 1.0f);
-			float scaleFactorIn  = 1.0f + (scaleIn  - 1.0f) * ((float)(num_segments - a) / (float)num_segments);
-		
-			float scaleOut = bone->scaleOut * (!rest ? pchan->scaleOut : 1.0f);
-			float scaleFactorOut = 1.0f + (scaleOut - 1.0f) * ((float)(a + 1)            / (float)num_segments);
+			const float scaleIn = bone->scaleIn * (!rest ? pchan->scaleIn : 1.0f);
+			const float scaleFactorIn  = 1.0f + (scaleIn  - 1.0f) * ((float)(num_segments - a) / (float)num_segments);
+			
+			const float scaleOut = bone->scaleOut * (!rest ? pchan->scaleOut : 1.0f);
+			const float scaleFactorOut = 1.0f + (scaleOut - 1.0f) * ((float)(a + 1)            / (float)num_segments);
 			
-			float scalefac = scaleFactorIn * scaleFactorOut;
+			const float scalefac = scaleFactorIn * scaleFactorOut;
 			float bscalemat[4][4], bscale[3];
 			
 			bscale[0] = scalefac;
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 16425c0..f7c1e2e 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1094,10 +1094,6 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
 	glPopMatrix();
 }
 
-/* XXX Hack - Refactor/Move/Reconsider how this can be best implemented... */
-#define BENDY_BONES_EDITMODE_PREVIEW
-
-#ifdef BENDY_BONES_EDITMODE_PREVIEW
 /* A partial copy of b_bone_spline_setup(), with just the parts for previewing editmode curve settings 
  *
  * This assumes that prev/next bones don't have any impact (since they should all still be in the "straight"
@@ -1154,10 +1150,10 @@ static void ebone_spline_preview(EditBone *ebone, Mat4 result_array[MAX_BBONE_SU
 		{
 			const int num_segments = ebone->segments;
 			
-			float scaleFactorIn  = 1.0f + (ebone->scaleIn  - 1.0f) * ((float)(num_segments - a) / (float)num_segments);
-			float scaleFactorOut = 1.0f + (ebone->scaleOut - 1.0f) * ((float)(a + 1)            / (float)num_segments);
+			const float scaleFactorIn  = 1.0f + (ebone->scaleIn  - 1.0f) * ((float)(num_segments - a) / (float)num_segments);
+			const float scaleFactorOut = 1.0f + (ebone->scaleOut - 1.0f) * ((float)(a + 1)            / (float)num_segments);
 			
-			float scalefac = scaleFactorIn * scaleFactorOut;
+			const float scalefac = scaleFactorIn * scaleFactorOut;
 			float bscalemat[4][4], bscale[3];
 			
 			bscale[0] = scalefac;
@@ -1172,8 +1168,6 @@ static void ebone_spline_preview(EditBone *ebone, Mat4 result_array[MAX_BBONE_SU
 	}
 }
 
-#endif
-
 static void draw_b_bone_boxes(const short dt, bPoseChannel *pchan, EditBone *ebone, float xwidth, float length, float zwidth)
 {
 	int segments = 0;
@@ -1191,12 +1185,10 @@ static void draw_b_bone_boxes(const short dt, bPoseChannel *pchan, EditBone *ebo
 		if (pchan) {
 			b_bone_spline_setup(pchan, 0, bbone);
 		}
-#ifdef BENDY_BONES_EDITMODE_PREVIEW
 		else if (ebone) {
 			ebone_spline_preview(ebone, bbone);
 		}
-#endif
-
+		
 		for (a = 0; a < segments; a++) {
 			glPushMatrix();
 			glMultMatrixf(bbone[a].mat);




More information about the Bf-blender-cvs mailing list