Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_mirror.c
| Show All 29 Lines | |||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "transform.h" | #include "transform.h" | ||||
| #include "transform_data.h" | |||||
| #include "transform_mode.h" | #include "transform_mode.h" | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /* Transform (Mirror) */ | /* Transform (Mirror) */ | ||||
| /** \name Transform Mirror | /** \name Transform Mirror | ||||
| * \{ */ | * \{ */ | ||||
| static void applyMirror(TransInfo *t, const int UNUSED(mval[2])) | static void applyMirror(TransInfo *t, const int UNUSED(mval[2])) | ||||
| { | { | ||||
| float size[3], mat[3][3]; | float size[3], mat[3][3]; | ||||
| int i; | |||||
| char str[UI_MAX_DRAW_STR]; | char str[UI_MAX_DRAW_STR]; | ||||
| copy_v3_v3(t->values_final, t->values); | copy_v3_v3(t->values_final, t->values); | ||||
| /* OPTIMIZATION: | /* OPTIMIZATION: | ||||
| * This still recalculates transformation on mouse move | * This still recalculates transformation on mouse move | ||||
| * while it should only recalculate on constraint change. */ | * while it should only recalculate on constraint change. */ | ||||
| /* if an axis has been selected */ | /* if an axis has been selected */ | ||||
| if (t->con.mode & CON_APPLY) { | if (t->con.mode & CON_APPLY) { | ||||
| size[0] = size[1] = size[2] = -1; | size[0] = size[1] = size[2] = -1; | ||||
| size_to_mat3(mat, size); | size_to_mat3(mat, size); | ||||
| if (t->con.applySize) { | if (t->con.applySize) { | ||||
| t->con.applySize(t, NULL, NULL, mat); | t->con.applySize(t, NULL, 0, mat); | ||||
| } | } | ||||
| BLI_snprintf(str, sizeof(str), TIP_("Mirror%s"), t->con.text); | BLI_snprintf(str, sizeof(str), TIP_("Mirror%s"), t->con.text); | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| TransData *td = tc->data; | TransData *td = tc->data; | ||||
| for (i = 0; i < tc->data_len; i++, td++) { | for (int tdi = 0; tdi < tc->data_len; tdi++) { | ||||
| if (td->flag & TD_SKIP) { | if (td->basic[tdi].flag & TD_SKIP) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ElementResize(t, tc, td, mat); | ElementResize(t, tc, tdi, mat); | ||||
| } | } | ||||
| } | } | ||||
| recalcData(t); | recalcData(t); | ||||
| ED_area_status_text(t->area, str); | ED_area_status_text(t->area, str); | ||||
| } | } | ||||
| else { | else { | ||||
| size[0] = size[1] = size[2] = 1; | size[0] = size[1] = size[2] = 1; | ||||
| size_to_mat3(mat, size); | size_to_mat3(mat, size); | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| TransData *td = tc->data; | TransData *td = tc->data; | ||||
| for (i = 0; i < tc->data_len; i++, td++) { | for (int tdi = 0; tdi < tc->data_len; tdi++) { | ||||
| if (td->flag & TD_SKIP) { | if (td->basic[tdi].flag & TD_SKIP) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ElementResize(t, tc, td, mat); | ElementResize(t, tc, tdi, mat); | ||||
| } | } | ||||
| } | } | ||||
| recalcData(t); | recalcData(t); | ||||
| if (t->flag & T_2D_EDIT) { | if (t->flag & T_2D_EDIT) { | ||||
| ED_area_status_text(t->area, TIP_("Select a mirror axis (X, Y)")); | ED_area_status_text(t->area, TIP_("Select a mirror axis (X, Y)")); | ||||
| } | } | ||||
| Show All 17 Lines | |||||