From da4d8416b4cf2727063c29e090c742d7b8c5639a Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Fri, 10 Feb 2023 13:04:48 -0500 Subject: [PATCH 01/25] initial patch apply --- .gitignore | 4 +++ .../transform/transform_orientations.c | 30 ++++++++++++++++++- source/blender/makesdna/DNA_view3d_types.h | 1 + source/blender/makesrna/intern/rna_scene.c | 5 ++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 96b70c2be70..07eef745e4a 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,7 @@ waveletNoiseTile.bin # testing environment /Testing + +# CLion cmake folders +cmake-* + diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 66fee01f864..830987eebdf 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -514,6 +514,32 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, /* If not gimbal, fall through to normal. */ 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: { if (obedit || (ob && ob->mode & OB_MODE_POSE)) { ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); @@ -526,7 +552,7 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, if (ob) { if (ob->mode & OB_MODE_POSE) { /* Each bone moves on its own local axis, but to avoid confusion, - * use the active pones axis for display T33575, this works as expected on a single + * use the active bone's axis for display T33575, this works as expected on a single * bone and users who select many bones will understand what's going on and what local * means when they start transforming. */ ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); @@ -646,6 +672,8 @@ const char *transform_orientations_spacename_get(TransInfo *t, const short orien return TIP_("view"); case V3D_ORIENT_CURSOR: return TIP_("cursor"); + case V3D_ORIENT_PARENT: + return TIP_("parent"); case V3D_ORIENT_CUSTOM_MATRIX: return TIP_("custom"); case V3D_ORIENT_CUSTOM: diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 4c5ba4c43f8..0c70a11d012 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -624,6 +624,7 @@ enum { V3D_ORIENT_VIEW = 3, V3D_ORIENT_GIMBAL = 4, V3D_ORIENT_CURSOR = 5, + V3D_ORIENT_PARENT = 6, V3D_ORIENT_CUSTOM = 1024, /** Runtime only, never saved to DNA. */ V3D_ORIENT_CUSTOM_MATRIX = (V3D_ORIENT_CUSTOM - 1), diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index d8cb588319d..75525b0d383 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -639,6 +639,11 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = { ICON_ORIENTATION_CURSOR, "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"}, {0, NULL, 0, NULL, NULL}, }; -- 2.30.2 From 47932223f5e33bbf35624ae2d481c60743418934 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Mon, 13 Feb 2023 12:05:15 -0500 Subject: [PATCH 02/25] got things compiling --- .../blender/editors/transform/transform_orientations.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 830987eebdf..6894a632354 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -524,16 +524,17 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, // 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); + + ED_getTransformOrientationMatrix( + scene, 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); + ED_getTransformOrientationMatrix( + scene, view_layer, v3d, ob->parent ? ob->parent : ob, obedit, pivot_point, r_mat); break; } } -- 2.30.2 From a0ab44903486397ce98ea24d48b89fef2c942b37 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Wed, 15 Feb 2023 18:07:45 -0500 Subject: [PATCH 03/25] some ugly code to test out objects / bones that don't have parents --- .../transform/transform_orientations.c | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index e1c72faa697..92424003afd 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -517,24 +517,40 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, case V3D_ORIENT_PARENT: { if (ob) { if (ob->mode & OB_MODE_POSE) { + printf("I'm in pose mode \n"); 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; + if (active_pchan->parent) { + if (active_pchan->parent->bone->flag & BONE_NO_LOCAL_LOCATION) { + bArmature *armature = ob->data; + armature->act_bone = active_pchan->parent->bone; - ED_getTransformOrientationMatrix( - scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); - armature->act_bone = active_pchan->bone; + ED_getTransformOrientationMatrix( + scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); + armature->act_bone = active_pchan->bone; + } + } + else { + if (active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION) { + unit_m3(r_mat); + } + else { + ED_getTransformOrientationMatrix( + scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); + } break; } } else { // handle the parent check at object level - ED_getTransformOrientationMatrix( - scene, view_layer, v3d, ob->parent ? ob->parent : ob, obedit, pivot_point, r_mat); + // TODO if object doesn't have parent, we default to local coordinates + printf("I'm not in pose mode \n"); + if (ob->parent) { + ED_getTransformOrientationMatrix( + scene, view_layer, v3d, ob->parent, obedit, pivot_point, r_mat); + } + else { + unit_m3(r_mat); + } break; } } @@ -553,7 +569,7 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, if (ob) { if (ob->mode & OB_MODE_POSE) { /* 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'ss 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 * means when they start transforming. */ ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); -- 2.30.2 From 21dce79b222228867c6ae0004719cc3c0094c33c Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Thu, 16 Feb 2023 00:33:51 -0500 Subject: [PATCH 04/25] I think I got it. using object orientation if root bone, and not BONE_LOCAL_LOCATION set --- .../blender/editors/transform/transform_orientations.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 92424003afd..e5b4c06218e 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -517,7 +517,6 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, case V3D_ORIENT_PARENT: { if (ob) { if (ob->mode & OB_MODE_POSE) { - printf("I'm in pose mode \n"); bPoseChannel *active_pchan = BKE_pose_channel_active(ob, false); if (active_pchan->parent) { if (active_pchan->parent->bone->flag & BONE_NO_LOCAL_LOCATION) { @@ -531,9 +530,11 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, } else { if (active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION) { - unit_m3(r_mat); + // if root, and BONE_NO_LOCAL_LOCATION isn't set local transform of parent + transform_orientations_create_from_axis(r_mat, UNPACK3(ob->object_to_world)); } else { + // else, if root and BONE_LOCAL_LOCATION is set, use bone local ED_getTransformOrientationMatrix( scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); } @@ -542,8 +543,6 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, } else { // handle the parent check at object level - // TODO if object doesn't have parent, we default to local coordinates - printf("I'm not in pose mode \n"); if (ob->parent) { ED_getTransformOrientationMatrix( scene, view_layer, v3d, ob->parent, obedit, pivot_point, r_mat); @@ -569,7 +568,7 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, if (ob) { if (ob->mode & OB_MODE_POSE) { /* Each bone moves on its own local axis, but to avoid confusion, - * use the active bone'ss 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 * means when they start transforming. */ ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); -- 2.30.2 From 2e5da7e81f6f983b9685363cc0857a04d54f5bcb Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Fri, 10 Feb 2023 13:04:48 -0500 Subject: [PATCH 05/25] initial patch apply --- .gitignore | 4 +++ .../transform/transform_orientations.c | 29 ++++++++++++++++++- source/blender/makesdna/DNA_view3d_types.h | 1 + source/blender/makesrna/intern/rna_scene.c | 5 ++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 96b70c2be70..07eef745e4a 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,7 @@ waveletNoiseTile.bin # testing environment /Testing + +# CLion cmake folders +cmake-* + diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 0cf9d5fa309..fe699b038f3 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -514,6 +514,31 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, /* If not gimbal, fall through to normal. */ 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: { if (obedit || (ob && ob->mode & OB_MODE_POSE)) { 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->mode & OB_MODE_POSE) { /* 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 * means when they start transforming. */ 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"); case V3D_ORIENT_CURSOR: return TIP_("cursor"); + case V3D_ORIENT_PARENT: + return TIP_("parent"); case V3D_ORIENT_CUSTOM_MATRIX: return TIP_("custom"); case V3D_ORIENT_CUSTOM: diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index fb70fe982ba..bc013721090 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -629,6 +629,7 @@ enum { V3D_ORIENT_VIEW = 3, V3D_ORIENT_GIMBAL = 4, V3D_ORIENT_CURSOR = 5, + V3D_ORIENT_PARENT = 6, V3D_ORIENT_CUSTOM = 1024, /** Runtime only, never saved to DNA. */ V3D_ORIENT_CUSTOM_MATRIX = (V3D_ORIENT_CUSTOM - 1), diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index d8cb588319d..75525b0d383 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -639,6 +639,11 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = { ICON_ORIENTATION_CURSOR, "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"}, {0, NULL, 0, NULL, NULL}, }; -- 2.30.2 From 2492bb62bd0acd224ec968bb7bd2d21adcfd7307 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Mon, 13 Feb 2023 12:05:15 -0500 Subject: [PATCH 06/25] got things compiling --- source/blender/editors/transform/transform_orientations.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index fe699b038f3..958af644a77 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -524,7 +524,9 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, // 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); + + ED_getTransformOrientationMatrix( + scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); armature->act_bone = active_pchan->bone; break; } @@ -532,7 +534,7 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, else { // handle the parent check at object level ED_getTransformOrientationMatrix( - view_layer, v3d, ob->parent ? ob->parent : ob, obedit, pivot_point, r_mat); + scene, view_layer, v3d, ob->parent ? ob->parent : ob, obedit, pivot_point, r_mat); break; } } -- 2.30.2 From 016858ce738e429537bca26b9ecd17c4764a4ca0 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Wed, 15 Feb 2023 18:07:45 -0500 Subject: [PATCH 07/25] some ugly code to test out objects / bones that don't have parents --- .../transform/transform_orientations.c | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 958af644a77..87644c03aa1 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -517,24 +517,40 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, case V3D_ORIENT_PARENT: { if (ob) { if (ob->mode & OB_MODE_POSE) { + printf("I'm in pose mode \n"); 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; + if (active_pchan->parent) { + if (active_pchan->parent->bone->flag & BONE_NO_LOCAL_LOCATION) { + bArmature *armature = ob->data; + armature->act_bone = active_pchan->parent->bone; - ED_getTransformOrientationMatrix( - scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); - armature->act_bone = active_pchan->bone; + ED_getTransformOrientationMatrix( + scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); + armature->act_bone = active_pchan->bone; + } + } + else { + if (active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION) { + unit_m3(r_mat); + } + else { + ED_getTransformOrientationMatrix( + scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); + } break; } } else { // handle the parent check at object level - ED_getTransformOrientationMatrix( - scene, view_layer, v3d, ob->parent ? ob->parent : ob, obedit, pivot_point, r_mat); + // TODO if object doesn't have parent, we default to local coordinates + printf("I'm not in pose mode \n"); + if (ob->parent) { + ED_getTransformOrientationMatrix( + scene, view_layer, v3d, ob->parent, obedit, pivot_point, r_mat); + } + else { + unit_m3(r_mat); + } break; } } -- 2.30.2 From c24f726e563fe7a726b9460b2c4b82cc4f7f6dd1 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Thu, 16 Feb 2023 00:33:51 -0500 Subject: [PATCH 08/25] I think I got it. using object orientation if root bone, and not BONE_LOCAL_LOCATION set --- source/blender/editors/transform/transform_orientations.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 87644c03aa1..e5b4c06218e 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -517,7 +517,6 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, case V3D_ORIENT_PARENT: { if (ob) { if (ob->mode & OB_MODE_POSE) { - printf("I'm in pose mode \n"); bPoseChannel *active_pchan = BKE_pose_channel_active(ob, false); if (active_pchan->parent) { if (active_pchan->parent->bone->flag & BONE_NO_LOCAL_LOCATION) { @@ -531,9 +530,11 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, } else { if (active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION) { - unit_m3(r_mat); + // if root, and BONE_NO_LOCAL_LOCATION isn't set local transform of parent + transform_orientations_create_from_axis(r_mat, UNPACK3(ob->object_to_world)); } else { + // else, if root and BONE_LOCAL_LOCATION is set, use bone local ED_getTransformOrientationMatrix( scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); } @@ -542,8 +543,6 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, } else { // handle the parent check at object level - // TODO if object doesn't have parent, we default to local coordinates - printf("I'm not in pose mode \n"); if (ob->parent) { ED_getTransformOrientationMatrix( scene, view_layer, v3d, ob->parent, obedit, pivot_point, r_mat); -- 2.30.2 From 07324b754c4598da997eac534030faeb7a1fec8d Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Thu, 16 Feb 2023 16:01:47 -0500 Subject: [PATCH 09/25] we needed to grab the local space transform of the parent --- source/blender/editors/transform/transform_orientations.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index e5b4c06218e..5bbb01eb97f 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -544,8 +544,7 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, else { // handle the parent check at object level if (ob->parent) { - ED_getTransformOrientationMatrix( - scene, view_layer, v3d, ob->parent, obedit, pivot_point, r_mat); + transform_orientations_create_from_axis(r_mat, UNPACK3(ob->parent->object_to_world)); } else { unit_m3(r_mat); -- 2.30.2 From 761c27e4b752e0057f07cdb053782c7d143b25d7 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Fri, 17 Feb 2023 16:53:05 -0500 Subject: [PATCH 10/25] refactroing, and head sratching. But I think I got it all working --- .../transform/transform_orientations.c | 73 +++++++++++-------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 5bbb01eb97f..386637051f6 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -485,6 +485,45 @@ void ED_transform_calc_orientation_from_type(const bContext *C, float r_mat[3][3 scene, view_layer, v3d, rv3d, ob, obedit, orient_index, pivot_point, r_mat); } +static void handle_armature_parent_orientation(const Scene *scene, + ViewLayer *view_layer, + const View3D *v3d, + Object *ob, + Object *obedit, + const int pivot_point, + float r_mat[3][3]) +{ + bPoseChannel *active_pchan = BKE_pose_channel_active(ob, false); + + if (active_pchan->parent) { + if (active_pchan->parent->bone->flag & BONE_NO_LOCAL_LOCATION) { + transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->bone->arm_mat)); + return; + } + } + // if root, and "Local Location", isn't set local transform of armature object. + if (active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION) { + transform_orientations_create_from_axis(r_mat, UNPACK3(ob->object_to_world)); + return; + } + + // if root or child bone has "Local Location", is set, use bone local. + ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); + return; +} + +static void handle_object_parent_orientation(Object *ob, float r_mat[3][3]) +{ + // If object has parent, then orient to parent. + if (ob->parent) { + transform_orientations_create_from_axis(r_mat, UNPACK3(ob->parent->object_to_world)); + } + else { + // If object doesn't have parent, then orient to world. + unit_m3(r_mat); + } +} + short ED_transform_calc_orientation_from_type_ex(const Scene *scene, ViewLayer *view_layer, const View3D *v3d, @@ -517,38 +556,12 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, case V3D_ORIENT_PARENT: { if (ob) { if (ob->mode & OB_MODE_POSE) { - bPoseChannel *active_pchan = BKE_pose_channel_active(ob, false); - if (active_pchan->parent) { - if (active_pchan->parent->bone->flag & BONE_NO_LOCAL_LOCATION) { - bArmature *armature = ob->data; - armature->act_bone = active_pchan->parent->bone; - - ED_getTransformOrientationMatrix( - scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); - armature->act_bone = active_pchan->bone; - } - } - else { - if (active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION) { - // if root, and BONE_NO_LOCAL_LOCATION isn't set local transform of parent - transform_orientations_create_from_axis(r_mat, UNPACK3(ob->object_to_world)); - } - else { - // else, if root and BONE_LOCAL_LOCATION is set, use bone local - ED_getTransformOrientationMatrix( - scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); - } - break; - } + handle_armature_parent_orientation( + scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); + break; } else { - // handle the parent check at object level - if (ob->parent) { - transform_orientations_create_from_axis(r_mat, UNPACK3(ob->parent->object_to_world)); - } - else { - unit_m3(r_mat); - } + handle_object_parent_orientation(ob, r_mat); break; } } -- 2.30.2 From 8e6e6ab88118f58e89dda4f1fa30dc447873f645 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Thu, 23 Feb 2023 10:16:13 -0500 Subject: [PATCH 11/25] adding in parent local location option --- source/blender/editors/transform/transform_orientations.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 386637051f6..3ddcb90062b 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -500,6 +500,13 @@ static void handle_armature_parent_orientation(const Scene *scene, transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->bone->arm_mat)); return; } + else { + bArmature *armature = ob->data; + armature->act_bone = active_pchan->parent->bone; + ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); + armature->act_bone = active_pchan->bone; + return; + } } // if root, and "Local Location", isn't set local transform of armature object. if (active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION) { -- 2.30.2 From f3e4fd0ff4defd73ecd60da85324079c34e9cb8b Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Thu, 23 Feb 2023 11:39:15 -0500 Subject: [PATCH 12/25] use parent orientation regardless if parent has local location or not --- .../editors/transform/transform_orientations.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 3ddcb90062b..cd39b6004c4 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -496,17 +496,9 @@ static void handle_armature_parent_orientation(const Scene *scene, bPoseChannel *active_pchan = BKE_pose_channel_active(ob, false); if (active_pchan->parent) { - if (active_pchan->parent->bone->flag & BONE_NO_LOCAL_LOCATION) { - transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->bone->arm_mat)); - return; - } - else { - bArmature *armature = ob->data; - armature->act_bone = active_pchan->parent->bone; - ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); - armature->act_bone = active_pchan->bone; - return; - } + // For child, show parent local regardlesss if "local location" is on for parent bone. + transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->bone->arm_mat)); + return; } // if root, and "Local Location", isn't set local transform of armature object. if (active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION) { -- 2.30.2 From 845f2b2f4ad089528a595ff03669b02437e59b97 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Wed, 22 Mar 2023 10:46:40 -0400 Subject: [PATCH 13/25] using local orientation icon for parent --- source/blender/makesrna/intern/rna_scene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index d8f3c0c48be..bf68c7fcb03 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -639,7 +639,7 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = { ICON_ORIENTATION_CURSOR, "Cursor", "Align the transformation axes to the 3D cursor"}, - {V3D_ORIENT_PARENT, + {V3D_ORIENT_LOCAL, "PARENT", ICON_ORIENTATION_GLOBAL, "Parent", -- 2.30.2 From ee31fd6403d4a8aa7b3669204979fc0b35d679f1 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Wed, 22 Mar 2023 17:41:08 -0400 Subject: [PATCH 14/25] using local icon --- source/blender/makesrna/intern/rna_scene.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index b8024d165ef..fb388b12bca 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -639,9 +639,9 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = { ICON_ORIENTATION_CURSOR, "Cursor", "Align the transformation axes to the 3D cursor"}, - {V3D_ORIENT_LOCAL, + {V3D_ORIENT_PARENT, "PARENT", - ICON_ORIENTATION_GLOBAL, + ICON_ORIENTATION_LOCAL, "Parent", "Align the transformation axes to the object's parent space"}, // {V3D_ORIENT_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"}, -- 2.30.2 From 2b2738b39223566a1acf0a28fd4b9fae0801dddf Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Wed, 22 Mar 2023 18:52:39 -0400 Subject: [PATCH 15/25] comment cleanup --- source/blender/editors/transform/transform_orientations.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 64b1e60503a..21178f62d72 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -591,17 +591,17 @@ static void handle_armature_parent_orientation(const Scene *scene, bPoseChannel *active_pchan = BKE_pose_channel_active(ob, false); if (active_pchan->parent) { - // For child, show parent local regardlesss if "local location" is on for parent bone. + // For child, show parent local regardless if "local location" is set for parent bone. transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->bone->arm_mat)); return; } - // if root, and "Local Location", isn't set local transform of armature object. + // if root, and "Local Location" isn't set, use local transform of armature object. if (active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION) { transform_orientations_create_from_axis(r_mat, UNPACK3(ob->object_to_world)); return; } - // if root or child bone has "Local Location", is set, use bone local. + // if root or child bone has "Local Location" set, use bone local. ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); return; } -- 2.30.2 From 624550d7d855de7e3596cba532007da1106fcf90 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Thu, 23 Mar 2023 22:19:44 -0400 Subject: [PATCH 16/25] need to use parent pose matrix, instead of armature_mat --- source/blender/editors/transform/transform_orientations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 21178f62d72..9b91933b24f 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -592,7 +592,7 @@ static void handle_armature_parent_orientation(const Scene *scene, if (active_pchan->parent) { // For child, show parent local regardless if "local location" is set for parent bone. - transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->bone->arm_mat)); + transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->pose_mat)); return; } // if root, and "Local Location" isn't set, use local transform of armature object. -- 2.30.2 From cc12f1461d3d873c79797c9847a7e63ca67d5d05 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Mon, 3 Apr 2023 14:22:11 -0400 Subject: [PATCH 17/25] Child with local location now uses bone local. Clean up comments to reflect changes --- .../editors/transform/transform_orientations.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 9b91933b24f..9d7fee94c50 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -590,18 +590,25 @@ static void handle_armature_parent_orientation(const Scene *scene, { bPoseChannel *active_pchan = BKE_pose_channel_active(ob, false); + // If Child bone has "Local Location" on, use local location orientation. + if (!(active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) { + ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); + return; + } + if (active_pchan->parent) { - // For child, show parent local regardless if "local location" is set for parent bone. + // If Child bone doesn't have "Local Location" use parent space. transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->pose_mat)); return; } - // if root, and "Local Location" isn't set, use local transform of armature object. + + // If root, and "Local Location" isn't set, use local transform of armature object. if (active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION) { transform_orientations_create_from_axis(r_mat, UNPACK3(ob->object_to_world)); return; } - // if root or child bone has "Local Location" set, use bone local. + // If root has "Local Location" set, use bone local. ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); return; } @@ -611,6 +618,7 @@ static void handle_object_parent_orientation(Object *ob, float r_mat[3][3]) // If object has parent, then orient to parent. if (ob->parent) { transform_orientations_create_from_axis(r_mat, UNPACK3(ob->parent->object_to_world)); + 7 } else { // If object doesn't have parent, then orient to world. -- 2.30.2 From 928e06c5e1667c67b6b81a40d50cf0facdadddf2 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Mon, 3 Apr 2023 14:38:12 -0400 Subject: [PATCH 18/25] 7 was not a lucky number --- source/blender/editors/transform/transform_orientations.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 9d7fee94c50..b1162a1d595 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -618,7 +618,6 @@ static void handle_object_parent_orientation(Object *ob, float r_mat[3][3]) // If object has parent, then orient to parent. if (ob->parent) { transform_orientations_create_from_axis(r_mat, UNPACK3(ob->parent->object_to_world)); - 7 } else { // If object doesn't have parent, then orient to world. -- 2.30.2 From 574f15d1f5e0c9f1eed30e255a4005d0157772dd Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Mon, 3 Apr 2023 15:53:51 -0400 Subject: [PATCH 19/25] Cleanup: Fix spelling for 'bone' --- source/blender/editors/transform/transform_orientations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index f1e83c5090c..3853a2ae1cf 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -621,7 +621,7 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, if (ob) { if (ob->mode & OB_MODE_POSE) { /* 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 * means when they start transforming. */ ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); -- 2.30.2 From 46680d7a3355261e780b30277efa87089b2269a7 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Tue, 4 Apr 2023 16:30:34 -0400 Subject: [PATCH 20/25] Cleaning logic up a little bit --- .../editors/transform/transform_orientations.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index b1162a1d595..53d64a8e153 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -590,13 +590,14 @@ static void handle_armature_parent_orientation(const Scene *scene, { bPoseChannel *active_pchan = BKE_pose_channel_active(ob, false); - // If Child bone has "Local Location" on, use local location orientation. - if (!(active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) { - ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); - return; - } - + // Check if target bone is a child. if (active_pchan->parent) { + // If Child bone has "Local Location" on, use local location orientation. + if (!(active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) { + ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); + return; + } + // If Child bone doesn't have "Local Location" use parent space. transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->pose_mat)); return; -- 2.30.2 From 0b0c39a6463624ae75c1fe1db64a232d57744fa7 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Fri, 14 Apr 2023 09:44:34 -0700 Subject: [PATCH 21/25] reverting to child bone always using parent space, regardless of local location. Also use blenk icon 1 to preserve icon width --- source/blender/editors/transform/transform_orientations.c | 7 +------ source/blender/makesrna/intern/rna_scene.c | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 53d64a8e153..0e6c1442b9a 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -592,13 +592,8 @@ static void handle_armature_parent_orientation(const Scene *scene, // Check if target bone is a child. if (active_pchan->parent) { - // If Child bone has "Local Location" on, use local location orientation. - if (!(active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) { - ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); - return; - } - // If Child bone doesn't have "Local Location" use parent space. + // For child, show parent local regardless if "local location" is set for parent bone transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->pose_mat)); return; } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 5c7a437948b..da448570974 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -642,7 +642,7 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = { "Align the transformation axes to the 3D cursor"}, {V3D_ORIENT_PARENT, "PARENT", - ICON_ORIENTATION_LOCAL, + ICON_BLANK1, "Parent", "Align the transformation axes to the object's parent space"}, // {V3D_ORIENT_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"}, -- 2.30.2 From 0ef2fb3f074c06b4596dd476b6effb068689353b Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Fri, 14 Apr 2023 09:52:42 -0700 Subject: [PATCH 22/25] removing clion gitignore --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4d3a8976afa..68339bf29a0 100644 --- a/.gitignore +++ b/.gitignore @@ -11,9 +11,6 @@ __pycache__/ *.swo *# -# CLion cmake folders -cmake-* - # Indexes for emacs, vi & others TAGS tags -- 2.30.2 From 64486499710a80ee27a2d7a6c8a20677f1043a23 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Sun, 16 Apr 2023 18:15:50 -0400 Subject: [PATCH 23/25] space cleanup --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 68339bf29a0..19da8b9205c 100644 --- a/.gitignore +++ b/.gitignore @@ -50,7 +50,6 @@ waveletNoiseTile.bin # testing environment /Testing/ - # Translations. /locale/user-config.py -- 2.30.2 From 27306000a302bbb83bbac08980e65d90195f7942 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Mon, 17 Apr 2023 13:38:47 -0400 Subject: [PATCH 24/25] root bone doesn't account for local location. Just used parent object (armature object) --- .../transform/transform_orientations.c | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 0e6c1442b9a..3b0679054c0 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -580,13 +580,7 @@ void ED_transform_calc_orientation_from_type(const bContext *C, float r_mat[3][3 scene, view_layer, v3d, rv3d, ob, obedit, orient_index, pivot_point, r_mat); } -static void handle_armature_parent_orientation(const Scene *scene, - ViewLayer *view_layer, - const View3D *v3d, - Object *ob, - Object *obedit, - const int pivot_point, - float r_mat[3][3]) +static void handle_armature_parent_orientation(Object *ob, float r_mat[3][3]) { bPoseChannel *active_pchan = BKE_pose_channel_active(ob, false); @@ -598,15 +592,8 @@ static void handle_armature_parent_orientation(const Scene *scene, return; } - // If root, and "Local Location" isn't set, use local transform of armature object. - if (active_pchan->bone->flag & BONE_NO_LOCAL_LOCATION) { - transform_orientations_create_from_axis(r_mat, UNPACK3(ob->object_to_world)); - return; - } - - // If root has "Local Location" set, use bone local. - ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); - return; + // For root, use local transform of armature object. + transform_orientations_create_from_axis(r_mat, UNPACK3(ob->object_to_world)); } static void handle_object_parent_orientation(Object *ob, float r_mat[3][3]) @@ -653,8 +640,7 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, case V3D_ORIENT_PARENT: { if (ob) { if (ob->mode & OB_MODE_POSE) { - handle_armature_parent_orientation( - scene, view_layer, v3d, ob, obedit, pivot_point, r_mat); + handle_armature_parent_orientation(ob, r_mat); break; } else { -- 2.30.2 From c12b7e2711d0e12994d7548f4546bc03716df4a5 Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Thu, 20 Apr 2023 11:32:53 -0400 Subject: [PATCH 25/25] Cleaned up comments --- .../editors/transform/transform_orientations.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 3b0679054c0..64bd87cbf79 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -584,26 +584,25 @@ static void handle_armature_parent_orientation(Object *ob, float r_mat[3][3]) { bPoseChannel *active_pchan = BKE_pose_channel_active(ob, false); - // Check if target bone is a child. + /* Check if target bone is a child. */ if (active_pchan->parent) { - - // For child, show parent local regardless if "local location" is set for parent bone + /* For child, show parent local regardless if "local location" is set for parent bone. */ transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->pose_mat)); return; } - // For root, use local transform of armature object. + /* For root, use local transform of armature object. */ transform_orientations_create_from_axis(r_mat, UNPACK3(ob->object_to_world)); } static void handle_object_parent_orientation(Object *ob, float r_mat[3][3]) { - // If object has parent, then orient to parent. + /* If object has parent, then orient to parent. */ if (ob->parent) { transform_orientations_create_from_axis(r_mat, UNPACK3(ob->parent->object_to_world)); } else { - // If object doesn't have parent, then orient to world. + /* If object doesn't have parent, then orient to world. */ unit_m3(r_mat); } } -- 2.30.2