fix [#36900] single spline handle can't be "scaled"
authorCampbell Barton <ideasman42@gmail.com>
Tue, 1 Oct 2013 07:02:18 +0000 (07:02 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 1 Oct 2013 07:02:18 +0000 (07:02 +0000)
this works in the graph editor but didn't for curves, useful functionality to have.

source/blender/editors/transform/transform_conversions.c

index ad31287fa939d0034f8a01595b62f4cde70f63cf..7110e7a66c51ddab11a5a01105e1c30987599188 100644 (file)
 #include "transform.h"
 #include "bmesh.h"
 
+/**
+ * Transforming around ourselves is no use, fallback to individual origins,
+ * useful for curve/armatures.
+ */
+static void transform_around_single_fallback(TransInfo *t)
+{
+       if (t->total == 1 && ELEM3(t->around, V3D_CENTER, V3D_CENTROID, V3D_ACTIVE)) {
+               t->around = V3D_LOCAL;
+       }
+}
+
 /* when transforming islands */
 struct TransIslandData {
        float co[3];
@@ -1084,6 +1095,8 @@ static void createTransArmatureVerts(TransInfo *t)
 
        if (!t->total) return;
 
+       transform_around_single_fallback(t);
+
        copy_m3_m4(mtx, t->obedit->obmat);
        pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
 
@@ -1408,6 +1421,8 @@ static void createTransCurveVerts(TransInfo *t)
        else t->total = countsel;
        t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Curve EditMode)");
 
+       transform_around_single_fallback(t);
+
        copy_m3_m4(mtx, t->obedit->obmat);
        pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);