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

Log Message:
-----------
Transform Orientations

Normal orientation for editbones (was previously missing)

Modified Paths:
--------------
    trunk/blender/source/blender/src/transform_orientations.c

Modified: trunk/blender/source/blender/src/transform_orientations.c
===================================================================
--- trunk/blender/source/blender/src/transform_orientations.c   2008-05-22 
09:11:52 UTC (rev 14919)
+++ trunk/blender/source/blender/src/transform_orientations.c   2008-05-22 
09:22:00 UTC (rev 14920)
@@ -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);


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to