Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2008-05-22 13:22:00 +0400
committerMartin Poirier <theeth@yahoo.com>2008-05-22 13:22:00 +0400
commita4688b24dcd66b8473015950b968087ad4b1cf9f (patch)
tree60406d9bf7bda509a541322b912610156be9bc80 /source/blender/src/transform_orientations.c
parent61fa5f9126033e8e4d013005a10b815b79765d54 (diff)
Transform Orientations
Normal orientation for editbones (was previously missing)
Diffstat (limited to 'source/blender/src/transform_orientations.c')
-rw-r--r--source/blender/src/transform_orientations.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/src/transform_orientations.c b/source/blender/src/transform_orientations.c
index 301ac8aa248..6696fcf95d6 100644
--- a/source/blender/src/transform_orientations.c
+++ b/source/blender/src/transform_orientations.c
@@ -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 @@ int getTransformOrientation(float normal[3], float plane[3], int activeOnly)
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);