diff --git a/rigify/utils/bones.py b/rigify/utils/bones.py index 7f178481b5563b1c7a4632d2b65425ec60fa0676..83d42b23d4b53f02b26a9444d7b5988bfbb5b064 100644 --- a/rigify/utils/bones.py +++ b/rigify/utils/bones.py @@ -682,4 +682,4 @@ def set_bone_widget_transform(obj, bone_name, transform_bone, use_size=True, sca bone.custom_shape_transform = None bone.use_custom_shape_bone_size = use_size - bone.custom_shape_scale = scale + bone.custom_shape_scale_xyz = (scale, scale, scale) diff --git a/rigify/utils/widgets.py b/rigify/utils/widgets.py index 964d625702ad5b0cf7e4c66018a75c47bd742edf..970904c197e333c05afa3c603617e91d63860bad 100644 --- a/rigify/utils/widgets.py +++ b/rigify/utils/widgets.py @@ -23,7 +23,7 @@ import math import inspect import functools -from mathutils import Matrix +from mathutils import Matrix, Vector, Euler from .errors import MetarigError from .collections import ensure_widget_collection @@ -42,7 +42,10 @@ def obj_to_bone(obj, rig, bone_name, bone_transform_name=None): raise MetarigError("obj_to_bone(): does not work while in edit mode") bone = rig.pose.bones[bone_name] - scale = bone.custom_shape_scale + + loc = bone.custom_shape_translation + rot = bone.custom_shape_rotation_euler + scale = Vector(bone.custom_shape_scale_xyz) if bone.use_custom_shape_bone_size: scale *= bone.length @@ -52,8 +55,10 @@ def obj_to_bone(obj, rig, bone_name, bone_transform_name=None): elif bone.custom_shape_transform: bone = bone.custom_shape_transform + shape_mat = Matrix.Translation(loc) @ (Euler(rot).to_matrix() @ Matrix.Diagonal(scale)).to_4x4() + obj.rotation_mode = 'XYZ' - obj.matrix_basis = rig.matrix_world @ bone.bone.matrix_local @ Matrix.Scale(scale, 4) + obj.matrix_basis = rig.matrix_world @ bone.bone.matrix_local @ shape_mat def create_widget(rig, bone_name, bone_transform_name=None, *, widget_name=None, widget_force_new=False): diff --git a/space_view3d_copy_attributes.py b/space_view3d_copy_attributes.py index 93dfaa3898141f4df34c0a95e5b0932c19e9c2b0..2d1fff59da2135c1fa0f5cda5fbf7736b25429d9 100644 --- a/space_view3d_copy_attributes.py +++ b/space_view3d_copy_attributes.py @@ -177,7 +177,9 @@ def pVisScaExec(bone, active, context): def pDrwExec(bone, active, context): bone.custom_shape = active.custom_shape bone.use_custom_shape_bone_size = active.use_custom_shape_bone_size - bone.custom_shape_scale = active.custom_shape_scale + bone.custom_shape_translation = active.custom_shape_translation + bone.custom_shape_rotation_euler = active.custom_shape_rotation_euler + bone.custom_shape_scale_xyz = active.custom_shape_scale_xyz bone.bone.show_wire = active.bone.show_wire