[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53106] tags/blender-2.65a-release/blender : svn merge ^/trunk/blender -c53102 -c53103 -c53104 -c53105

Campbell Barton ideasman42 at gmail.com
Tue Dec 18 08:49:11 CET 2012


Revision: 53106
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53106
Author:   campbellbarton
Date:     2012-12-18 07:49:09 +0000 (Tue, 18 Dec 2012)
Log Message:
-----------
svn merge ^/trunk/blender -c53102 -c53103 -c53104 -c53105

Modified Paths:
--------------
    tags/blender-2.65a-release/blender/source/blender/editors/transform/transform_manipulator.c
    tags/blender-2.65a-release/blender/source/blender/editors/transform/transform_orientations.c

Property Changed:
----------------
    tags/blender-2.65a-release/blender/


Property changes on: tags/blender-2.65a-release/blender
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45623-45625,46037,48089,48092,48551-48552,48679,48790,48792-48793,49076,49087,49292,49294,49466,49894,50052,50126
/trunk/blender:52842-52858,52867,52870-52871,52883,52891,52910,52915,52919,52928,52930,52945,52958,52966,52977,52981,52994-52998,53005,53015,53037-53039,53056,53061,53063,53065-53067,53077,53086-53087,53090,53095
   + /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45623-45625,46037,48089,48092,48551-48552,48679,48790,48792-48793,49076,49087,49292,49294,49466,49894,50052,50126
/trunk/blender:52842-52858,52867,52870-52871,52883,52891,52910,52915,52919,52928,52930,52945,52958,52966,52977,52981,52994-52998,53005,53015,53037-53039,53056,53061,53063,53065-53067,53077,53086-53087,53090,53095,53102-53105

Modified: tags/blender-2.65a-release/blender/source/blender/editors/transform/transform_manipulator.c
===================================================================
--- tags/blender-2.65a-release/blender/source/blender/editors/transform/transform_manipulator.c	2012-12-18 07:38:02 UTC (rev 53105)
+++ tags/blender-2.65a-release/blender/source/blender/editors/transform/transform_manipulator.c	2012-12-18 07:49:09 UTC (rev 53106)
@@ -148,10 +148,8 @@
 	Bone *bone = pchan->bone;
 
 	if (bone) {
-		if (bone->flag & BONE_TRANSFORM) {
-			calc_tw_center(scene, pchan->pose_head);
-			protectflag_to_drawflags(pchan->protectflag, &rv3d->twdrawflag);
-		}
+		calc_tw_center(scene, pchan->pose_head);
+		protectflag_to_drawflags(pchan->protectflag, &rv3d->twdrawflag);
 	}
 }
 
@@ -361,19 +359,36 @@
 		else if (obedit->type == OB_ARMATURE) {
 			bArmature *arm = obedit->data;
 			EditBone *ebo;
-			for (ebo = arm->edbo->first; ebo; ebo = ebo->next) {
-				if (EBONE_VISIBLE(arm, ebo)) {
-					if (ebo->flag & BONE_TIPSEL) {
-						calc_tw_center(scene, ebo->tail);
-						totsel++;
+
+			if ((v3d->around == V3D_ACTIVE) && (ebo = arm->act_edbone)) {
+				/* doesn't check selection or visibility intentionally */
+				if (ebo->flag & BONE_TIPSEL) {
+					calc_tw_center(scene, ebo->tail);
+					totsel++;
+				}
+				if ((ebo->flag & BONE_ROOTSEL) ||
+				    ((ebo->flag & BONE_TIPSEL) == FALSE))  /* ensure we get at least one point */
+				{
+					calc_tw_center(scene, ebo->head);
+					totsel++;
+				}
+				stats_editbone(rv3d, ebo);
+			}
+			else {
+				for (ebo = arm->edbo->first; ebo; ebo = ebo->next) {
+					if (EBONE_VISIBLE(arm, ebo)) {
+						if (ebo->flag & BONE_TIPSEL) {
+							calc_tw_center(scene, ebo->tail);
+							totsel++;
+						}
+						if (ebo->flag & BONE_ROOTSEL) {
+							calc_tw_center(scene, ebo->head);
+							totsel++;
+						}
+						if (ebo->flag & BONE_SELECTED) {
+							stats_editbone(rv3d, ebo);
+						}
 					}
-					if (ebo->flag & BONE_ROOTSEL) {
-						calc_tw_center(scene, ebo->head);
-						totsel++;
-					}
-					if (ebo->flag & BONE_SELECTED) {
-						stats_editbone(rv3d, ebo);
-					}
 				}
 			}
 		}
@@ -480,17 +495,35 @@
 	else if (ob && (ob->mode & OB_MODE_POSE)) {
 		bPoseChannel *pchan;
 		int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed
+		int ok = FALSE;
 
 		if ((ob->lay & v3d->lay) == 0) return 0;
 
-		totsel = count_set_pose_transflags(&mode, 0, ob);
-
-		if (totsel) {
-			/* use channels to get stats */
-			for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+		if ((v3d->around == V3D_ACTIVE) && (pchan = BKE_pose_channel_active(ob))) {
+			/* doesn't check selection or visibility intentionally */
+			Bone *bone = pchan->bone;
+			if (bone) {
 				stats_pose(scene, rv3d, pchan);
+				totsel = 1;
+				ok = TRUE;
 			}
+		}
+		else {
+			totsel = count_set_pose_transflags(&mode, 0, ob);
 
+			if (totsel) {
+				/* use channels to get stats */
+				for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+					Bone *bone = pchan->bone;
+					if (bone && (bone->flag & BONE_TRANSFORM)) {
+						stats_pose(scene, rv3d, pchan);
+					}
+				}
+				ok = TRUE;
+			}
+		}
+
+		if (ok) {
 			mul_v3_fl(scene->twcent, 1.0f / (float)totsel);   // centroid!
 			mul_m4_v3(ob->obmat, scene->twcent);
 			mul_m4_v3(ob->obmat, scene->twmin);
@@ -552,8 +585,9 @@
 		switch (v3d->twmode) {
 		
 			case V3D_MANIP_GLOBAL:
+			{
 				break; /* nothing to do */
-
+			}
 			case V3D_MANIP_GIMBAL:
 			{
 				float mat[3][3];
@@ -562,28 +596,43 @@
 					break;
 				}
 				/* if not gimbal, fall through to normal */
+				/* pass through */
 			}
 			case V3D_MANIP_NORMAL:
+			{
 				if (obedit || ob->mode & OB_MODE_POSE) {
 					float mat[3][3];
 					ED_getTransformOrientationMatrix(C, mat, (v3d->around == V3D_ACTIVE));
 					copy_m4_m3(rv3d->twmat, mat);
 					break;
 				}
-			/* no break we define 'normal' as 'local' in Object mode */
+				/* no break we define 'normal' as 'local' in Object mode */
+				/* pass through */
+			}
 			case V3D_MANIP_LOCAL:
+			{
+				if (ob->mode & OB_MODE_POSE) {
+					/* each bone moves on its own local axis, but  to avoid confusion,
+					 * use the active pones axis for display [#33575], this works as expected on a single bone
+					 * and users who select many bones will understand whats going on and what local means
+					 * when they start transforming */
+					float mat[3][3];
+					ED_getTransformOrientationMatrix(C, mat, (v3d->around == V3D_ACTIVE));
+					copy_m4_m3(rv3d->twmat, mat);
+					break;
+				}
 				copy_m4_m4(rv3d->twmat, ob->obmat);
 				normalize_m4(rv3d->twmat);
 				break;
-
+			}
 			case V3D_MANIP_VIEW:
 			{
 				float mat[3][3];
 				copy_m3_m4(mat, rv3d->viewinv);
 				normalize_m3(mat);
 				copy_m4_m3(rv3d->twmat, mat);
+				break;
 			}
-			break;
 			default: /* V3D_MANIP_CUSTOM */
 			{
 				float mat[3][3];

Modified: tags/blender-2.65a-release/blender/source/blender/editors/transform/transform_orientations.c
===================================================================
--- tags/blender-2.65a-release/blender/source/blender/editors/transform/transform_orientations.c	2012-12-18 07:38:02 UTC (rev 53105)
+++ tags/blender-2.65a-release/blender/source/blender/editors/transform/transform_orientations.c	2012-12-18 07:49:09 UTC (rev 53106)
@@ -43,6 +43,7 @@
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
+#include "BKE_action.h"
 #include "BKE_armature.h"
 #include "BKE_curve.h"
 #include "BKE_context.h"
@@ -737,7 +738,7 @@
 				}
 			}
 			
-			if (normal[0] != 0 || normal[1] != 0 || normal[2] != 0) {
+			if (!is_zero_v3(normal)) {
 				result = ORIENTATION_NORMAL;
 			}
 		}
@@ -760,29 +761,45 @@
 		else if (obedit->type == OB_ARMATURE) {
 			bArmature *arm = obedit->data;
 			EditBone *ebone;
+			int ok = FALSE;
 			
-			for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
-				if (arm->layer & ebone->layer) {
-					if (ebone->flag & BONE_SELECTED) {
-						float tmat[3][3];
-						float vec[3];
-						sub_v3_v3v3(vec, ebone->tail, ebone->head);
-						normalize_v3(vec);
-						add_v3_v3(normal, vec);
-						
-						vec_roll_to_mat3(vec, ebone->roll, tmat);
-						add_v3_v3(plane, tmat[2]);
+			/* grr,.but better then duplicate code */
+#define EBONE_CALC_NORMAL_PLANE  { \
+			float tmat[3][3]; \
+			float vec[3]; \
+			sub_v3_v3v3(vec, ebone->tail, ebone->head); \
+			normalize_v3(vec); \
+			add_v3_v3(normal, vec); \
+			\
+			vec_roll_to_mat3(vec, ebone->roll, tmat); \
+			add_v3_v3(plane, tmat[2]); \
+		} (void)0
+
+
+			if (activeOnly && (ebone = arm->act_edbone)) {
+				EBONE_CALC_NORMAL_PLANE;
+				ok = TRUE;
+			}
+			else {
+				for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+					if (arm->layer & ebone->layer) {
+						if (ebone->flag & BONE_SELECTED) {
+							EBONE_CALC_NORMAL_PLANE;
+							ok = TRUE;
+						}
 					}
 				}
 			}
 			
-			normalize_v3(normal);
-			normalize_v3(plane);
+			if (ok) {
+				normalize_v3(normal);
+				normalize_v3(plane);
 
-			if (plane[0] != 0 || plane[1] != 0 || plane[2] != 0) {
-				result = ORIENTATION_EDGE;
+				if (!is_zero_v3(plane)) {
+					result = ORIENTATION_EDGE;
+				}
 			}
-
+#undef EBONE_CALC_NORMAL_PLANE
 		}
 
 		/* Vectors from edges don't need the special transpose inverse multiplication */
@@ -798,19 +815,32 @@
 	else if (ob && (ob->mode & OB_MODE_POSE)) {
 		bArmature *arm = ob->data;
 		bPoseChannel *pchan;
-		int totsel;
-		
-		totsel = count_bone_select(arm, &arm->bonebase, 1);
-		if (totsel) {
-			float imat[3][3], mat[3][3];
+		float imat[3][3], mat[3][3];
+		int ok = FALSE;
 
-			/* use channels to get stats */
-			for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
-				if (pchan->bone && pchan->bone->flag & BONE_TRANSFORM) {
-					add_v3_v3(normal, pchan->pose_mat[2]);
-					add_v3_v3(plane, pchan->pose_mat[1]);
+		if (activeOnly && (pchan = BKE_pose_channel_active(ob))) {
+			add_v3_v3(normal, pchan->pose_mat[2]);
+			add_v3_v3(plane, pchan->pose_mat[1]);
+			ok = TRUE;
+		}
+		else {
+			int totsel;
+
+			totsel = count_bone_select(arm, &arm->bonebase, 1);
+			if (totsel) {
+				/* use channels to get stats */
+				for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+					if (pchan->bone && pchan->bone->flag & BONE_TRANSFORM) {
+						add_v3_v3(normal, pchan->pose_mat[2]);
+						add_v3_v3(plane, pchan->pose_mat[1]);
+					}
 				}
+				ok = TRUE;
 			}
+		}
+
+		/* use for both active & all */
+		if (ok) {
 			negate_v3(plane);
 			

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list