Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_constraints.c
| Show First 20 Lines • Show All 707 Lines • ▼ Show 20 Lines | case V3D_ORIENT_NORMAL: | ||||
| setAxisMatrixConstraint(t, mode, text); | setAxisMatrixConstraint(t, mode, text); | ||||
| } | } | ||||
| else { | else { | ||||
| setConstraint(t, t->spacemtx, mode, text); | setConstraint(t, t->spacemtx, mode, text); | ||||
| } | } | ||||
| break; | break; | ||||
| case V3D_ORIENT_VIEW: | case V3D_ORIENT_VIEW: | ||||
| BLI_snprintf(text, sizeof(text), ftext, TIP_("view")); | BLI_snprintf(text, sizeof(text), ftext, TIP_("view")); | ||||
| setConstraint(t, t->spacemtx, mode, text); | float mtx[3][3]; | ||||
| copy_m3_m3(mtx, t->spacemtx); | |||||
| negate_v3(mtx[2]); | |||||
| setConstraint(t, mtx, mode, text); | |||||
| break; | break; | ||||
| case V3D_ORIENT_CURSOR: | case V3D_ORIENT_CURSOR: | ||||
| BLI_snprintf(text, sizeof(text), ftext, TIP_("cursor")); | BLI_snprintf(text, sizeof(text), ftext, TIP_("cursor")); | ||||
| setConstraint(t, t->spacemtx, mode, text); | setConstraint(t, t->spacemtx, mode, text); | ||||
| break; | break; | ||||
| case V3D_ORIENT_GIMBAL: | case V3D_ORIENT_GIMBAL: | ||||
| BLI_snprintf(text, sizeof(text), ftext, TIP_("gimbal")); | BLI_snprintf(text, sizeof(text), ftext, TIP_("gimbal")); | ||||
| setConstraint(t, t->spacemtx, mode, text); | setConstraint(t, t->spacemtx, mode, text); | ||||
| ▲ Show 20 Lines • Show All 254 Lines • ▼ Show 20 Lines | void getConstraintMatrix(TransInfo *t) | ||||
| } | } | ||||
| mul_m3_m3m3(mat, t->con.pmtx, t->con.imtx); | mul_m3_m3m3(mat, t->con.pmtx, t->con.imtx); | ||||
| mul_m3_m3m3(t->con.pmtx, t->con.mtx, mat); | mul_m3_m3m3(t->con.pmtx, t->con.mtx, mat); | ||||
| } | } | ||||
| /*------------------------- MMB Select -------------------------------*/ | /*------------------------- MMB Select -------------------------------*/ | ||||
| void initSelectConstraint(TransInfo *t, float mtx[3][3]) | void initSelectConstraint(TransInfo *t, bool force_global) | ||||
| { | { | ||||
| copy_m3_m3(t->con.mtx, mtx); | short orientation; | ||||
| t->con.mode |= CON_APPLY; | if (force_global) { | ||||
| t->con.mode |= CON_SELECT; | orientation = V3D_ORIENT_GLOBAL; | ||||
| } | |||||
| else { | |||||
| if (t->orientation.index == 0) { | |||||
| t->orientation.index = 1; | |||||
| BLI_assert(t->orientation.types[0] != V3D_ORIENT_CUSTOM_MATRIX); | |||||
| initTransformOrientation(t->context, t, t->orientation.types[t->orientation.index]); | |||||
| } | |||||
| orientation = t->orientation.types[t->orientation.index]; | |||||
| } | |||||
| setUserConstraint(t, orientation, CON_APPLY | CON_SELECT, ""); | |||||
| setNearestAxis(t); | setNearestAxis(t); | ||||
| t->con.drawExtra = NULL; | |||||
| t->con.applyVec = applyAxisConstraintVec; | |||||
| t->con.applySize = applyAxisConstraintSize; | |||||
| t->con.applyRot = applyAxisConstraintRot; | |||||
| } | } | ||||
| void selectConstraint(TransInfo *t) | void selectConstraint(TransInfo *t) | ||||
| { | { | ||||
| if (t->con.mode & CON_SELECT) { | if (t->con.mode & CON_SELECT) { | ||||
| setNearestAxis(t); | setNearestAxis(t); | ||||
| startConstraint(t); | startConstraint(t); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines | |||||