Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_align.c
| Show All 26 Lines | |||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.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 (Align) */ | /* Transform (Align) */ | ||||
| /** \name Transform Align | /** \name Transform Align | ||||
| * \{ */ | * \{ */ | ||||
| static void applyAlign(TransInfo *t, const int UNUSED(mval[2])) | static void applyAlign(TransInfo *t, const int UNUSED(mval[2])) | ||||
| { | { | ||||
| float center[3]; | float center[3]; | ||||
| int i; | |||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| /* saving original center */ | /* saving original center */ | ||||
| copy_v3_v3(center, tc->center_local); | copy_v3_v3(center, tc->center_local); | ||||
| 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++) { | ||||
| float mat[3][3], invmat[3][3]; | float mat[3][3], invmat[3][3]; | ||||
| if (td->flag & TD_SKIP) { | if (td->basic[tdi].flag & TD_SKIP) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* around local centers */ | /* around local centers */ | ||||
| if (t->flag & (T_OBJECT | T_POSE)) { | if (t->flag & (T_OBJECT | T_POSE)) { | ||||
| copy_v3_v3(tc->center_local, td->center); | copy_v3_v3(tc->center_local, td->center[tdi]); | ||||
| } | } | ||||
| else { | else { | ||||
| if (t->settings->selectmode & SCE_SELECT_FACE) { | if (t->settings->selectmode & SCE_SELECT_FACE) { | ||||
| copy_v3_v3(tc->center_local, td->center); | copy_v3_v3(tc->center_local, td->center[tdi]); | ||||
| } | } | ||||
| } | } | ||||
| invert_m3_m3(invmat, td->axismtx); | invert_m3_m3(invmat, td->space[tdi].axismtx); | ||||
| mul_m3_m3m3(mat, t->spacemtx, invmat); | mul_m3_m3m3(mat, t->spacemtx, invmat); | ||||
| ElementRotation(t, tc, td, mat, t->around); | ElementRotation(t, tc, tdi, mat, t->around); | ||||
| } | } | ||||
| /* restoring original center */ | /* restoring original center */ | ||||
| copy_v3_v3(tc->center_local, center); | copy_v3_v3(tc->center_local, center); | ||||
| } | } | ||||
| recalcData(t); | recalcData(t); | ||||
| ED_area_status_text(t->area, TIP_("Align")); | ED_area_status_text(t->area, TIP_("Align")); | ||||
| Show All 11 Lines | |||||