Fix 3D view axis align flag
authorCampbell Barton <ideasman42@gmail.com>
Sun, 13 May 2018 04:37:36 +0000 (06:37 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 13 May 2018 04:38:43 +0000 (06:38 +0200)
Missed from recent pivot-point move to scene.

source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/makesdna/DNA_view3d_types.h

index 7686431d808e61fdb331f5db11a78473ee7f4702..44c8f581755eb5818bfadc20113f491a599fd92e 100644 (file)
@@ -720,8 +720,10 @@ bool transdata_check_local_islands(TransInfo *t, short around);
 int count_set_pose_transflags(int *out_mode, short around, struct Object *ob);
 
 /* auto-keying stuff used by special_aftertrans_update */
-void autokeyframe_ob_cb_func(struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, struct View3D *v3d, struct Object *ob, int tmode);
-void autokeyframe_pose_cb_func(struct bContext *C, struct Scene *scene, struct View3D *v3d, struct Object *ob, int tmode, short targetless_ik);
+void autokeyframe_ob_cb_func(
+        struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, struct Object *ob, int tmode);
+void autokeyframe_pose_cb_func(
+        struct bContext *C, struct Scene *scene, struct Object *ob, int tmode, short targetless_ik);
 
 /*********************** Constraints *****************************/
 
index dbbdf07ded298336739709ea722e8a632ac61d89..bdcb42e74ef3ea44b3c46af8dccab2c81b8a3e56 100644 (file)
@@ -5881,7 +5881,7 @@ static void clear_trans_object_base_flags(TransInfo *t)
  *  tmode: should be a transform mode
  */
 // NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases
-void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, View3D *v3d, Object *ob, int tmode)
+void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, Object *ob, int tmode)
 {
        ID *id = &ob->id;
        FCurve *fcu;
@@ -5933,24 +5933,28 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, V
                                        if (ob != OBACT(view_layer))
                                                do_loc = true;
                                }
-                               else if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CURSOR)
+                               else if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CURSOR) {
                                        do_loc = true;
+                               }
                                
-                               if ((v3d->flag & V3D_ALIGN) == 0)
+                               if ((scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) == 0) {
                                        do_rot = true;
+                               }
                        }
                        else if (tmode == TFM_RESIZE) {
                                if (scene->toolsettings->transform_pivot_point == V3D_AROUND_ACTIVE) {
                                        if (ob != OBACT(view_layer))
                                                do_loc = true;
                                }
-                               else if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CURSOR)
+                               else if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CURSOR) {
                                        do_loc = true;
-                               
-                               if ((v3d->flag & V3D_ALIGN) == 0)
+                               }
+
+                               if ((scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) == 0) {
                                        do_scale = true;
+                               }
                        }
-                       
+
                        /* insert keyframes for the affected sets of channels using the builtin KeyingSets found */
                        if (do_loc) {
                                KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
@@ -5997,7 +6001,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, V
  *     targetless_ik: has targetless ik been done on any channels?
  */
 // NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases
-void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, int tmode, short targetless_ik)
+void autokeyframe_pose_cb_func(bContext *C, Scene *scene, Object *ob, int tmode, short targetless_ik)
 {
        ID *id = &ob->id;
        AnimData *adt = ob->adt;
@@ -6074,20 +6078,24 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
                                                        do_loc = true;
                                        }
                                        else if (ELEM(tmode, TFM_ROTATION, TFM_TRACKBALL)) {
-                                               if (ELEM(scene->toolsettings->transform_pivot_point, V3D_AROUND_CURSOR, V3D_AROUND_ACTIVE))
+                                               if (ELEM(scene->toolsettings->transform_pivot_point, V3D_AROUND_CURSOR, V3D_AROUND_ACTIVE)) {
                                                        do_loc = true;
-                                                       
-                                               if ((v3d->flag & V3D_ALIGN) == 0)
+                                               }
+
+                                               if ((scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) == 0) {
                                                        do_rot = true;
+                                               }
                                        }
                                        else if (tmode == TFM_RESIZE) {
-                                               if (ELEM(scene->toolsettings->transform_pivot_point, V3D_AROUND_CURSOR, V3D_AROUND_ACTIVE))
+                                               if (ELEM(scene->toolsettings->transform_pivot_point, V3D_AROUND_CURSOR, V3D_AROUND_ACTIVE)) {
                                                        do_loc = true;
-                                                       
-                                               if ((v3d->flag & V3D_ALIGN) == 0)
+                                               }
+
+                                               if ((scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) == 0) {
                                                        do_scale = true;
+                                               }
                                        }
-                                       
+
                                        if (do_loc) {
                                                KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
                                                ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
@@ -6653,7 +6661,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 
                        /* automatic inserting of keys and unkeyed tagging - only if transform wasn't canceled (or TFM_DUMMY) */
                        if (!canceled && (t->mode != TFM_DUMMY)) {
-                               autokeyframe_pose_cb_func(C, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
+                               autokeyframe_pose_cb_func(C, t->scene, ob, t->mode, targetless_ik);
                                DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
                        }
                        else if (arm->flag & ARM_DELAYDEFORM) {
@@ -6718,7 +6726,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 
                        /* Set autokey if necessary */
                        if (!canceled) {
-                               autokeyframe_ob_cb_func(C, t->scene, t->view_layer, (View3D *)t->view, ob, t->mode);
+                               autokeyframe_ob_cb_func(C, t->scene, t->view_layer, ob, t->mode);
                        }
                        
                        /* restore rigid body transform */
index 237eb7651fdc578b23d30664c91ce7f3430f0de8..133cf445072dbb9b2ca7c2f497e5eb7de349ac60 100644 (file)
@@ -944,7 +944,7 @@ static void recalcData_objects(TransInfo *t)
                                int targetless_ik = (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet!
 
                                animrecord_check_state(t->scene, &ob->id, t->animtimer);
-                               autokeyframe_pose_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
+                               autokeyframe_pose_cb_func(t->context, t->scene, ob, t->mode, targetless_ik);
                        }
 
                        /* old optimize trick... this enforces to bypass the depgraph */
@@ -992,7 +992,7 @@ static void recalcData_objects(TransInfo *t)
                                // TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
                                if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
                                        animrecord_check_state(t->scene, &ob->id, t->animtimer);
-                                       autokeyframe_ob_cb_func(t->context, t->scene, t->view_layer, (View3D *)t->view, ob, t->mode);
+                                       autokeyframe_ob_cb_func(t->context, t->scene, t->view_layer, ob, t->mode);
                                }
 
                                /* sets recalc flags fully, instead of flushing existing ones
@@ -1343,9 +1343,11 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
                        v3d->twflag = 0;
                }
 
-               if (v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
+               if (t->scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) {
+                       t->flag |= T_V3D_ALIGN;
+               }
                t->around = t->scene->toolsettings->transform_pivot_point;
-               
+
                /* bend always uses the cursor */
                if (t->mode == TFM_BEND) {
                        t->around = V3D_AROUND_CURSOR;
index 5a13f625905fd9524cac4b9ec01bf81662c32a21..5758b18c364ab19c9743b03d5996408ebfe8e1b2 100644 (file)
@@ -255,12 +255,12 @@ typedef struct View3D {
 #define V3D_S3D_DISPVOLUME             (1 << 2)
 
 /* View3D->flag (short) */
-/*#define V3D_DISPIMAGE                1*/ /*UNUSED*/
-/*#define V3D_DISPBGPICS               2*/ /* UNUSED */
+/*#define V3D_FLAG_DEPRECATED_1 (1 << 0) */ /*UNUSED */
+/*#define V3D_FLAG_DEPRECATED_2 (1 << 1) */ /* UNUSED */
 #define V3D_HIDE_HELPLINES     4
 #define V3D_INVALID_BACKBUF    8
 
-#define V3D_ALIGN                      1024
+/* #define V3D_FLAG_DEPRECATED_10 (1 << 10) */ /* UNUSED */
 #define V3D_SELECT_OUTLINE     2048
 #define V3D_ZBUF_SELECT                4096
 #define V3D_GLOBAL_STATS       8192