diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-04-29 14:07:25 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-04-29 14:07:25 +0300 |
commit | c57e4418bb85aec8bd3615fd775b990badb43d30 (patch) | |
tree | 0485c9c5d853ec7e22113925463302808b052f72 /source/blender/editors/transform/transform_orientations.c | |
parent | 980cebc459fb1990b216b5c5c0935b30f10fedf7 (diff) |
Transform Orientation Refactor
- Use `t->spacemtx` as the orientation matrix instead `t->orient_matrix`.
- Unify constraint behavior between modal and non-modal.
- Simplify code to remove old workarounds and rearrange struct members.
This fix T66142 since the actual `orient_type` (in the case
`V3D_ORIENT_NORMAL`) is used during Redo instead of always using
`V3D_ORIENT_CUSTOM_MATRIX`).
Differential Revision: https://developer.blender.org/D7469
Diffstat (limited to 'source/blender/editors/transform/transform_orientations.c')
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 82b3393fc1f..4e34c469258 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -438,12 +438,12 @@ static int armature_bone_transflags_update_recursive(bArmature *arm, return total; } -void initTransformOrientation(bContext *C, TransInfo *t) +void initTransformOrientation(bContext *C, TransInfo *t, short orientation) { Object *ob = CTX_data_active_object(C); Object *obedit = CTX_data_active_object(C); - switch (t->orientation.user) { + switch (orientation) { case V3D_ORIENT_GLOBAL: unit_m3(t->spacemtx); BLI_strncpy(t->spacename, TIP_("global"), sizeof(t->spacename)); @@ -478,12 +478,12 @@ void initTransformOrientation(bContext *C, TransInfo *t) case V3D_ORIENT_VIEW: if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { - RegionView3D *rv3d = t->region->regiondata; float mat[3][3]; BLI_strncpy(t->spacename, TIP_("view"), sizeof(t->spacename)); - copy_m3_m4(mat, rv3d->viewinv); + copy_m3_m4(mat, t->viewinv); normalize_m3(mat); + negate_v3(mat[2]); copy_m3_m3(t->spacemtx, mat); } else { @@ -496,8 +496,8 @@ void initTransformOrientation(bContext *C, TransInfo *t) break; } case V3D_ORIENT_CUSTOM_MATRIX: - /* Already set. */ BLI_strncpy(t->spacename, TIP_("custom"), sizeof(t->spacename)); + copy_m3_m3(t->spacemtx, t->orientation.custom_matrix); break; case V3D_ORIENT_CUSTOM: BLI_strncpy(t->spacename, t->orientation.custom->name, sizeof(t->spacename)); @@ -510,20 +510,6 @@ void initTransformOrientation(bContext *C, TransInfo *t) } break; } - - if (t->orient_matrix_is_set == false) { - t->orient_matrix_is_set = true; - if (t->flag & T_MODAL) { - /* Rotate for example defaults to operating on the view plane. */ - t->orientation.unset = V3D_ORIENT_VIEW; - copy_m3_m4(t->orient_matrix, t->viewinv); - normalize_m3(t->orient_matrix); - negate_m3(t->orient_matrix); - } - else { - copy_m3_m3(t->orient_matrix, t->spacemtx); - } - } } /** |