[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33967] trunk/blender/source/blender/ editors/armature/editarmature.c: armature recalc roll now works properly with mirror enabled.

Campbell Barton ideasman42 at gmail.com
Fri Dec 31 11:42:31 CET 2010


Revision: 33967
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33967
Author:   campbellbarton
Date:     2010-12-31 11:42:31 +0100 (Fri, 31 Dec 2010)

Log Message:
-----------
armature recalc roll now works properly with mirror enabled.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/editarmature.c

Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c	2010-12-31 10:24:40 UTC (rev 33966)
+++ trunk/blender/source/blender/editors/armature/editarmature.c	2010-12-31 10:42:31 UTC (rev 33967)
@@ -2180,6 +2180,9 @@
 
 	float imat[3][3];
 
+	bArmature *arm= ob->data;
+	EditBone *ebone;
+
 	copy_m3_m4(imat, ob->obmat);
 	invert_m3(imat);
 
@@ -2194,13 +2197,14 @@
 		mul_m3_v3(imat, cursor_local);
 
 		/* cursor */
-		CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
-			float cursor_rel[3];
-			sub_v3_v3v3(cursor_rel, cursor_local, ebone->head);
-			if(axis_flip) negate_v3(cursor_rel);
-			ebone->roll= ED_rollBoneToVector(ebone, cursor_rel, axis_only);
+		for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+			if(EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
+				float cursor_rel[3];
+				sub_v3_v3v3(cursor_rel, cursor_local, ebone->head);
+				if(axis_flip) negate_v3(cursor_rel);
+				ebone->roll= ED_rollBoneToVector(ebone, cursor_rel, axis_only);
+			}
 		}
-		CTX_DATA_END;
 	}
 	else {
 		float vec[3]= {0.0f, 0.0f, 0.0f};
@@ -2237,13 +2241,25 @@
 
 		if(axis_flip) negate_v3(vec);
 
-		CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
-			/* roll func is a callback which assumes that all is well */
-			ebone->roll= ED_rollBoneToVector(ebone, vec, axis_only);
+		for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+			if(EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
+				/* roll func is a callback which assumes that all is well */
+				ebone->roll= ED_rollBoneToVector(ebone, vec, axis_only);
+			}
 		}
-		CTX_DATA_END;
 	}
 
+	if (arm->flag & ARM_MIRROR_EDIT) {
+		for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+			if((EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) {
+				EditBone *ebone_mirr= ED_armature_bone_get_mirrored(arm->edbo, ebone);
+				if (ebone_mirr && (EBONE_VISIBLE(arm, ebone_mirr) && EBONE_EDITABLE(ebone_mirr))) {
+					ebone->roll= -ebone_mirr->roll;
+				}
+			}
+		}
+	}
+
 	/* note, notifier might evolve */
 	WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
 	





More information about the Bf-blender-cvs mailing list