Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_orientations.c
| Show First 20 Lines • Show All 432 Lines • ▼ Show 20 Lines | if (do_it) { | ||||
| } | } | ||||
| } | } | ||||
| total += armature_bone_transflags_update_recursive(arm, &bone->childbase, do_next); | total += armature_bone_transflags_update_recursive(arm, &bone->childbase, do_next); | ||||
| } | } | ||||
| return total; | return total; | ||||
| } | } | ||||
| void initTransformOrientation(bContext *C, TransInfo *t) | void initTransformOrientation(bContext *C, TransInfo *t, short orientation) | ||||
| { | { | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| Object *obedit = CTX_data_active_object(C); | Object *obedit = CTX_data_active_object(C); | ||||
| switch (t->orientation.user) { | switch (orientation) { | ||||
| case V3D_ORIENT_GLOBAL: | case V3D_ORIENT_GLOBAL: | ||||
| unit_m3(t->spacemtx); | unit_m3(t->spacemtx); | ||||
| BLI_strncpy(t->spacename, TIP_("global"), sizeof(t->spacename)); | BLI_strncpy(t->spacename, TIP_("global"), sizeof(t->spacename)); | ||||
| break; | break; | ||||
| case V3D_ORIENT_GIMBAL: | case V3D_ORIENT_GIMBAL: | ||||
| unit_m3(t->spacemtx); | unit_m3(t->spacemtx); | ||||
| if (ob && gimbal_axis(ob, t->spacemtx)) { | if (ob && gimbal_axis(ob, t->spacemtx)) { | ||||
| Show All 18 Lines | case V3D_ORIENT_LOCAL: | ||||
| else { | else { | ||||
| unit_m3(t->spacemtx); | unit_m3(t->spacemtx); | ||||
| } | } | ||||
| break; | break; | ||||
| case V3D_ORIENT_VIEW: | case V3D_ORIENT_VIEW: | ||||
| if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { | if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { | ||||
| RegionView3D *rv3d = t->region->regiondata; | |||||
| float mat[3][3]; | float mat[3][3]; | ||||
| BLI_strncpy(t->spacename, TIP_("view"), sizeof(t->spacename)); | BLI_strncpy(t->spacename, TIP_("view"), sizeof(t->spacename)); | ||||
| copy_m3_m4(mat, rv3d->viewinv); | copy_m3_m4(mat, t->viewinv); | ||||
| normalize_m3(mat); | normalize_m3(mat); | ||||
| negate_v3(mat[2]); | |||||
| copy_m3_m3(t->spacemtx, mat); | copy_m3_m3(t->spacemtx, mat); | ||||
| } | } | ||||
| else { | else { | ||||
| unit_m3(t->spacemtx); | unit_m3(t->spacemtx); | ||||
| } | } | ||||
| break; | break; | ||||
| case V3D_ORIENT_CURSOR: { | case V3D_ORIENT_CURSOR: { | ||||
| BLI_strncpy(t->spacename, TIP_("cursor"), sizeof(t->spacename)); | BLI_strncpy(t->spacename, TIP_("cursor"), sizeof(t->spacename)); | ||||
| BKE_scene_cursor_rot_to_mat3(&t->scene->cursor, t->spacemtx); | BKE_scene_cursor_rot_to_mat3(&t->scene->cursor, t->spacemtx); | ||||
| break; | break; | ||||
| } | } | ||||
| case V3D_ORIENT_CUSTOM_MATRIX: | case V3D_ORIENT_CUSTOM_MATRIX: | ||||
| /* Already set. */ | |||||
| BLI_strncpy(t->spacename, TIP_("custom"), sizeof(t->spacename)); | BLI_strncpy(t->spacename, TIP_("custom"), sizeof(t->spacename)); | ||||
| copy_m3_m3(t->spacemtx, t->orientation.custom_matrix); | |||||
| break; | break; | ||||
| case V3D_ORIENT_CUSTOM: | case V3D_ORIENT_CUSTOM: | ||||
| BLI_strncpy(t->spacename, t->orientation.custom->name, sizeof(t->spacename)); | BLI_strncpy(t->spacename, t->orientation.custom->name, sizeof(t->spacename)); | ||||
| if (applyTransformOrientation(t->orientation.custom, t->spacemtx, t->spacename)) { | if (applyTransformOrientation(t->orientation.custom, t->spacemtx, t->spacename)) { | ||||
| /* pass */ | /* pass */ | ||||
| } | } | ||||
| else { | else { | ||||
| unit_m3(t->spacemtx); | unit_m3(t->spacemtx); | ||||
| } | } | ||||
| break; | 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); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| * utility function - get first n, selected vert/edge/faces | * utility function - get first n, selected vert/edge/faces | ||||
| */ | */ | ||||
| static uint bm_mesh_elems_select_get_n__internal( | static uint bm_mesh_elems_select_get_n__internal( | ||||
| BMesh *bm, BMElem **elems, const uint n, const BMIterType itype, const char htype) | BMesh *bm, BMElem **elems, const uint n, const BMIterType itype, const char htype) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 657 Lines • Show Last 20 Lines | |||||