[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14921] branches/apricot/source/blender/ src/transform_orientations.c: merge from trunk for venomgfx

Campbell Barton ideasman42 at gmail.com
Thu May 22 11:29:50 CEST 2008


Revision: 14921
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14921
Author:   campbellbarton
Date:     2008-05-22 11:29:42 +0200 (Thu, 22 May 2008)

Log Message:
-----------
merge from trunk for venomgfx

Modified Paths:
--------------
    branches/apricot/source/blender/src/transform_orientations.c

Modified: branches/apricot/source/blender/src/transform_orientations.c
===================================================================
--- branches/apricot/source/blender/src/transform_orientations.c	2008-05-22 09:22:00 UTC (rev 14920)
+++ branches/apricot/source/blender/src/transform_orientations.c	2008-05-22 09:29:42 UTC (rev 14921)
@@ -26,6 +26,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_armature_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_listBase.h"
 #include "DNA_object_types.h"
@@ -44,6 +45,7 @@
 #include "BLI_editVert.h"
 
 #include "BIF_editmesh.h"
+#include "BIF_editarmature.h"
 #include "BIF_interface.h"
 #include "BIF_space.h"
 #include "BIF_toolbox.h"
@@ -605,6 +607,38 @@
 				result = ORIENTATION_NORMAL;
 			}
 		}
+		else if (G.obedit->type == OB_ARMATURE)
+		{
+			bArmature *arm = G.obedit->data;
+			EditBone *ebone;
+			
+			for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
+				if (arm->layer & ebone->layer)
+				{
+					if (ebone->flag & BONE_SELECTED)
+					{
+						float vec[3];
+						VecSubf(vec, ebone->tail, ebone->head);
+						Normalize(vec);
+						VecAddf(normal, normal, vec);
+					}
+				}
+			}
+			
+			Normalize(normal);
+			Crossf(plane, G.obedit->obmat[0], normal);
+			
+			if (Inpf(plane, plane) < FLT_EPSILON)
+			{
+				Crossf(plane, G.obedit->obmat[1], normal);
+			} 
+
+			if (plane[0] != 0 || plane[1] != 0 || plane[2] != 0)
+			{
+				result = ORIENTATION_EDGE;
+			}
+
+		}
 		
 		Mat4Mul3Vecfl(G.obedit->obmat, plane);
 		Mat4Mul3Vecfl(G.obedit->obmat, normal);





More information about the Bf-blender-cvs mailing list