diff options
Diffstat (limited to 'rigify')
-rw-r--r-- | rigify/utils/bones.py | 2 | ||||
-rw-r--r-- | rigify/utils/widgets.py | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/rigify/utils/bones.py b/rigify/utils/bones.py index 7f178481..83d42b23 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 964d6257..970904c1 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): |