Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_orientations.c
| Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_action.h" | #include "BKE_action.h" | ||||
| #include "BKE_curve.h" | #include "BKE_curve.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "BKE_armature.h" | |||||
| #include "BKE_object.h" | |||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "ED_armature.h" | #include "ED_armature.h" | ||||
| #include "transform.h" | #include "transform.h" | ||||
| /* *********************** TransSpace ************************** */ | /* *********************** TransSpace ************************** */ | ||||
| ▲ Show 20 Lines • Show All 424 Lines • ▼ Show 20 Lines | case V3D_MANIP_VIEW: | ||||
| copy_m3_m4(mat, rv3d->viewinv); | copy_m3_m4(mat, rv3d->viewinv); | ||||
| normalize_m3(mat); | normalize_m3(mat); | ||||
| 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_MANIP_AXIAL: | |||||
| BLI_strncpy(t->spacename, IFACE_("along axis"), sizeof(t->spacename)); | |||||
| if (ob) | |||||
| { | |||||
| if (ob->mode & OB_MODE_POSE) { | |||||
| bPoseChannel *posebone = CTX_data_active_pose_bone(C); | |||||
| if (!(posebone)) { | |||||
| return; | |||||
swerner: As above, this should return a value. | |||||
| } | |||||
| // For god node (bottom of hierarchy) | |||||
| if (!posebone->parent) | |||||
| { | |||||
| // Works like local | |||||
| copy_m3_m4(t->spacemtx, ob->obmat); | |||||
| normalize_m3(t->spacemtx); | |||||
| break; | |||||
| } | |||||
| float mat[3][3]; // Final matrix that will be put in twmat for the region view | |||||
| BKE_pose_computing_pchan_rest(posebone, mat); | |||||
| copy_m3_m3(t->spacemtx, mat); | |||||
| break; | |||||
| } | |||||
| // This is for regular non-rig objects | |||||
| if (is_zero_v3(ob->rot)) | |||||
| copy_m3_m4(t->spacemtx, ob->obmat); | |||||
| else { | |||||
| float mfm[4][4]; // My final Matrix | |||||
| BKE_object_computing_obmat_rest(ob, mfm); | |||||
| copy_m3_m4(t->spacemtx, mfm); | |||||
| } | |||||
| normalize_m3(t->spacemtx); | |||||
| break; | |||||
| } | |||||
| else | |||||
| unit_m3(t->spacemtx); | |||||
| break; | |||||
| default: /* V3D_MANIP_CUSTOM */ | default: /* V3D_MANIP_CUSTOM */ | ||||
| if (applyTransformOrientation(C, t->spacemtx, t->spacename, t->current_orientation - V3D_MANIP_CUSTOM)) { | if (applyTransformOrientation(C, t->spacemtx, t->spacename, t->current_orientation - V3D_MANIP_CUSTOM)) { | ||||
| /* pass */ | /* pass */ | ||||
| } | } | ||||
| else { | else { | ||||
| unit_m3(t->spacemtx); | unit_m3(t->spacemtx); | ||||
| } | } | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 586 Lines • Show Last 20 Lines | |||||
As above, this should return a value.