Animation: Add in Parent space alignment option to the Transform Orientation gizmo #104724
4
.gitignore
vendored
4
.gitignore
vendored
@ -49,3 +49,7 @@ waveletNoiseTile.bin
|
|||||||
|
|
||||||
# testing environment
|
# testing environment
|
||||||
/Testing
|
/Testing
|
||||||
|
|
||||||
|
# CLion cmake folders
|
||||||
|
cmake-*
|
||||||
|
|
||||||
|
@ -514,6 +514,31 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene,
|
|||||||
/* If not gimbal, fall through to normal. */
|
/* If not gimbal, fall through to normal. */
|
||||||
ATTR_FALLTHROUGH;
|
ATTR_FALLTHROUGH;
|
||||||
}
|
}
|
||||||
|
case V3D_ORIENT_PARENT: {
|
||||||
|
if (ob) {
|
||||||
|
if (ob->mode & OB_MODE_POSE) {
|
||||||
|
bPoseChannel *active_pchan = BKE_pose_channel_active(ob, false);
|
||||||
|
// switch for parent if it exists
|
||||||
|
bPoseChannel *space_pchan = active_pchan->parent ? active_pchan->parent : active_pchan;
|
||||||
|
if (space_pchan) {
|
||||||
|
// store off the original active bone for a moment, run this, then restore
|
||||||
|
bArmature *armature = ob->data;
|
||||||
|
armature->act_bone = space_pchan->bone;
|
||||||
|
ED_getTransformOrientationMatrix(view_layer, v3d, ob, obedit, pivot_point, r_mat);
|
||||||
|
armature->act_bone = active_pchan->bone;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// handle the parent check at object level
|
||||||
|
ED_getTransformOrientationMatrix(
|
||||||
|
view_layer, v3d, ob->parent ? ob->parent : ob, obedit, pivot_point, r_mat);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* No break; we define 'parent' as 'normal' otherwise. */
|
||||||
|
ATTR_FALLTHROUGH;
|
||||||
|
}
|
||||||
case V3D_ORIENT_NORMAL: {
|
case V3D_ORIENT_NORMAL: {
|
||||||
if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
|
if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
|
||||||
ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat);
|
ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat);
|
||||||
@ -526,7 +551,7 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene,
|
|||||||
if (ob) {
|
if (ob) {
|
||||||
if (ob->mode & OB_MODE_POSE) {
|
if (ob->mode & OB_MODE_POSE) {
|
||||||
/* Each bone moves on its own local axis, but to avoid confusion,
|
/* Each bone moves on its own local axis, but to avoid confusion,
|
||||||
* use the active pones axis for display #33575, this works as expected on a single
|
* use the active bone's axis for display #33575, this works as expected on a single
|
||||||
* bone and users who select many bones will understand what's going on and what local
|
* bone and users who select many bones will understand what's going on and what local
|
||||||
* means when they start transforming. */
|
* means when they start transforming. */
|
||||||
ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat);
|
ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat);
|
||||||
@ -646,6 +671,8 @@ const char *transform_orientations_spacename_get(TransInfo *t, const short orien
|
|||||||
return TIP_("view");
|
return TIP_("view");
|
||||||
case V3D_ORIENT_CURSOR:
|
case V3D_ORIENT_CURSOR:
|
||||||
return TIP_("cursor");
|
return TIP_("cursor");
|
||||||
|
case V3D_ORIENT_PARENT:
|
||||||
|
return TIP_("parent");
|
||||||
case V3D_ORIENT_CUSTOM_MATRIX:
|
case V3D_ORIENT_CUSTOM_MATRIX:
|
||||||
return TIP_("custom");
|
return TIP_("custom");
|
||||||
|
|||||||
case V3D_ORIENT_CUSTOM:
|
case V3D_ORIENT_CUSTOM:
|
||||||
|
@ -629,6 +629,7 @@ enum {
|
|||||||
V3D_ORIENT_VIEW = 3,
|
V3D_ORIENT_VIEW = 3,
|
||||||
V3D_ORIENT_GIMBAL = 4,
|
V3D_ORIENT_GIMBAL = 4,
|
||||||
V3D_ORIENT_CURSOR = 5,
|
V3D_ORIENT_CURSOR = 5,
|
||||||
|
V3D_ORIENT_PARENT = 6,
|
||||||
V3D_ORIENT_CUSTOM = 1024,
|
V3D_ORIENT_CUSTOM = 1024,
|
||||||
/** Runtime only, never saved to DNA. */
|
/** Runtime only, never saved to DNA. */
|
||||||
V3D_ORIENT_CUSTOM_MATRIX = (V3D_ORIENT_CUSTOM - 1),
|
V3D_ORIENT_CUSTOM_MATRIX = (V3D_ORIENT_CUSTOM - 1),
|
||||||
|
@ -639,6 +639,11 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = {
|
|||||||
ICON_ORIENTATION_CURSOR,
|
ICON_ORIENTATION_CURSOR,
|
||||||
"Cursor",
|
"Cursor",
|
||||||
"Align the transformation axes to the 3D cursor"},
|
"Align the transformation axes to the 3D cursor"},
|
||||||
|
{V3D_ORIENT_PARENT,
|
||||||
|
"PARENT",
|
||||||
|
ICON_ORIENTATION_GLOBAL,
|
||||||
|
"Parent",
|
||||||
|
"Align the transformation axes to the object's parent space"},
|
||||||
// {V3D_ORIENT_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
|
// {V3D_ORIENT_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
|
||||||
{0, NULL, 0, NULL, NULL},
|
{0, NULL, 0, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user
No need to put this fix into this PR, if you want, please commit that directly to
main
.I tried to, but it kept asking for my credentials, and I'd get a 403...