[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45410] trunk/blender/source/blender: - fix error with conflusing key/ keyblock in the shape template UI - absolute keyblocks would always be greyed out .

Campbell Barton ideasman42 at gmail.com
Thu Apr 5 07:25:20 CEST 2012


Revision: 45410
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45410
Author:   campbellbarton
Date:     2012-04-05 05:25:20 +0000 (Thu, 05 Apr 2012)
Log Message:
-----------
- fix error with conflusing key/keyblock in the shape template UI - absolute keyblocks would always be greyed out.
- fix mistake setting wrong variable in unlikely case of curve having no bezier or point array set.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/key.c
    trunk/blender/source/blender/editors/interface/interface_templates.c

Modified: trunk/blender/source/blender/blenkernel/intern/key.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/key.c	2012-04-05 05:05:18 UTC (rev 45409)
+++ trunk/blender/source/blender/blenkernel/intern/key.c	2012-04-05 05:25:20 UTC (rev 45410)
@@ -1106,15 +1106,15 @@
 static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
 {
 	KeyBlock *k[4], *actkb= ob_get_keyblock(ob);
-	float cfra, t[4], delta;
-	int a, flag = 0;
+	float t[4];
+	int flag = 0;
 
 	if (key->slurph && key->type != KEY_RELATIVE) {
 		const float ctime_scaled = key->ctime / 100.0f;
-		int step;
+		float delta = (float)key->slurph / tot;
+		float cfra = (float)scene->r.cfra;
+		int step, a;
 
-		delta = (float)key->slurph / tot;
-
 		if (tot > 100 && slurph_opt) {
 			step = tot / 50;
 			delta *= step;
@@ -1124,8 +1124,6 @@
 			step = 1;
 		}
 
-		cfra= (float)scene->r.cfra;
-		
 		for (a=0; a<tot; a+=step, cfra+= delta) {
 			flag = setkeys(ctime_scaled, &key->block, k, t, 0);
 
@@ -1204,16 +1202,17 @@
 {
 	Curve *cu= ob->data;
 	KeyBlock *k[4], *actkb= ob_get_keyblock(ob);
-	float cfra, t[4], delta;
-	int a, flag = 0;
+	float t[4];
+	int flag = 0;
 
 	if (key->slurph && key->type != KEY_RELATIVE) {
 		const float ctime_scaled = key->ctime / 100.0f;
+		float delta = (float)key->slurph / tot;
+		float cfra = (float)scene->r.cfra;
 		Nurb *nu;
-		int mode = 0, i = 0, remain = 0, step, estep = 0, count = 0;
+		int i = 0, remain = 0;
+		int step, a;
 
-		delta = (float)key->slurph / tot;
-
 		if (tot > 100 && slurph_opt) {
 			step = tot / 50;
 			delta *= step;
@@ -1223,22 +1222,26 @@
 			step = 1;
 		}
 
-		cfra= (float)scene->r.cfra;
+		for (nu=cu->nurb.first; nu; nu=nu->next) {
+			int estep, mode;
 
-		for (nu=cu->nurb.first; nu; nu=nu->next) {
 			if (nu->bp) {
-				mode= KEY_MODE_BPOINT;
-				estep= nu->pntsu*nu->pntsv;
+				mode = KEY_MODE_BPOINT;
+				estep = nu->pntsu * nu->pntsv;
 			}
 			else if (nu->bezt) {
-				mode= KEY_MODE_BEZTRIPLE;
-				estep= 3*nu->pntsu;
+				mode = KEY_MODE_BEZTRIPLE;
+				estep = 3 * nu->pntsu;
 			}
-			else
-				step= 0; /* XXX - is this some mistake??? - the estep from last iter could be used - campbell */
+			else {
+				mode = 0;
+				estep = 0;
+			}
 
-			a= 0;
+			a = 0;
 			while (a < estep) {
+				int count;
+
 				if (remain <= 0) {
 					cfra+= delta;
 					flag = setkeys(ctime_scaled, &key->block, k, t, 0);
@@ -1246,7 +1249,7 @@
 					remain= step;
 				}
 
-				count= MIN2(remain, estep);
+				count = MIN2(remain, estep);
 				if (mode == KEY_MODE_BEZTRIPLE) {
 					count += 3 - count % 3;
 				}
@@ -1281,16 +1284,15 @@
 {
 	Lattice *lt= ob->data;
 	KeyBlock *k[4], *actkb= ob_get_keyblock(ob);
-	float delta, cfra, t[4];
-	int a, flag;
+	float t[4];
+	int flag;
 	
 	if (key->slurph  && key->type != KEY_RELATIVE) {
 		const float ctime_scaled = key->ctime / 100.0f;
+		float delta = (float)key->slurph / tot;
+		float cfra = (float)scene->r.cfra;
+		int a;
 
-		delta = (float)key->slurph / tot;
-		
-		cfra = (float)scene->r.cfra;
-		
 		for (a=0; a<tot; a++, cfra+= delta) {
 			flag = setkeys(ctime_scaled, &key->block, k, t, 0);
 

Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c	2012-04-05 05:05:18 UTC (rev 45409)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c	2012-04-05 05:25:20 UTC (rev 45410)
@@ -2165,6 +2165,7 @@
 	else if (itemptr->type == &RNA_ShapeKey) {
 		Object *ob = (Object *)activeptr->data;
 		Key *key = (Key *)itemptr->id.data;
+		KeyBlock *kb = (KeyBlock *)itemptr->data;
 
 		split = uiLayoutSplit(sub, 0.66f, 0);
 
@@ -2176,8 +2177,8 @@
 		else uiItemR(row, itemptr, "value", 0, "", ICON_NONE);
 		uiItemR(row, itemptr, "mute", 0, "", 0);
 
-		if ( (key->flag & KEYBLOCK_MUTE) ||
-		     (ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)) )
+		if ((kb->flag & KEYBLOCK_MUTE) ||
+		    (ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)))
 		{
 			uiLayoutSetActive(row, 0);
 		}




More information about the Bf-blender-cvs mailing list