Fix 3D view axis align flag

Missed from recent pivot-point move to scene.
This commit is contained in:
Campbell Barton
2018-05-13 06:37:36 +02:00
parent 6c6a394373
commit 7a56d31af3
4 changed files with 38 additions and 26 deletions

View 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 *****************************/

View 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 */

View 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;

View 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