Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_trackball.c
| Show All 30 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" | ||||
| #include "transform_snap.h" | #include "transform_snap.h" | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /* Transform (Rotation - Trackball) */ | /* Transform (Rotation - Trackball) */ | ||||
| /** \name Transform Rotation - Trackball | /** \name Transform Rotation - Trackball | ||||
| * \{ */ | * \{ */ | ||||
| static void applyTrackballValue(TransInfo *t, | static void applyTrackballValue(TransInfo *t, | ||||
| const float axis1[3], | const float axis1[3], | ||||
| const float axis2[3], | const float axis2[3], | ||||
| const float angles[2]) | const float angles[2]) | ||||
| { | { | ||||
| float mat[3][3]; | float mat[3][3]; | ||||
| float axis[3]; | float axis[3]; | ||||
| float angle; | float angle; | ||||
| int i; | |||||
| mul_v3_v3fl(axis, axis1, angles[0]); | mul_v3_v3fl(axis, axis1, angles[0]); | ||||
| madd_v3_v3fl(axis, axis2, angles[1]); | madd_v3_v3fl(axis, axis2, angles[1]); | ||||
| angle = normalize_v3(axis); | angle = normalize_v3(axis); | ||||
| axis_angle_normalized_to_mat3(mat, axis, angle); | axis_angle_normalized_to_mat3(mat, axis, angle); | ||||
| 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; | ||||
| } | } | ||||
| if (t->flag & T_PROP_EDIT) { | if (t->flag & T_PROP_EDIT) { | ||||
| axis_angle_normalized_to_mat3(mat, axis, td->factor * angle); | axis_angle_normalized_to_mat3(mat, axis, td->prop[tdi].factor * angle); | ||||
| } | } | ||||
| ElementRotation(t, tc, td, mat, t->around); | ElementRotation(t, tc, tdi, mat, t->around); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void applyTrackball(TransInfo *t, const int UNUSED(mval[2])) | static void applyTrackball(TransInfo *t, const int UNUSED(mval[2])) | ||||
| { | { | ||||
| char str[UI_MAX_DRAW_STR]; | char str[UI_MAX_DRAW_STR]; | ||||
| size_t ofs = 0; | size_t ofs = 0; | ||||
| ▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines | |||||