diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-13 07:37:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-13 07:38:43 +0300 |
commit | 7a56d31af3523081e33a67d7aea11314c37c7104 (patch) | |
tree | 5a458cb53398fa0fb283f40c75fdc08e6d353d7c /source/blender/editors/transform | |
parent | 6c6a394373999562d4c29ac17f7f98fe3f2b3364 (diff) |
Fix 3D view axis align flag
Missed from recent pivot-point move to scene.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform.h | 6 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 42 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 10 |
3 files changed, 35 insertions, 23 deletions
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 7686431d808..44c8f581755 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -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 *****************************/ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index dbbdf07ded2..bdcb42e74ef 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -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 */ diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 237eb7651fd..133cf445072 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -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; |