diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-10-22 18:13:13 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-10-22 19:24:10 +0300 |
commit | 816407649aedfaa7836e3aca7629842db732e279 (patch) | |
tree | 201c08308821382d6847f10a0c03902faeb88870 /rigify/rig_ui_template.py | |
parent | 0e0e8de0de6022c23729e2d139b9aa47324d7122 (diff) |
Rigify: More updates for 2.8 API
With those changes the addon is working in some functional state.
Thus I'm bumping its version to 2.80.
TODOS:
* Handle collections (put all the new objects in a collection).
* We should also replace the old WGT_LAYERS with subcollections.
* Move toolshelf operators out of there (make tools or move to sidebar).
Diffstat (limited to 'rigify/rig_ui_template.py')
-rw-r--r-- | rigify/rig_ui_template.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/rigify/rig_ui_template.py b/rigify/rig_ui_template.py index bbbc06dc..8031ff3b 100644 --- a/rigify/rig_ui_template.py +++ b/rigify/rig_ui_template.py @@ -136,11 +136,11 @@ def get_pose_matrix_in_other_space(mat, pose_bone): par_rest = Matrix() # Get matrix in bone's current transform space - smat = rest_inv * (par_rest * (par_inv * mat)) + smat = rest_inv @ (par_rest @ (par_inv @ mat)) # Compensate for non-local location #if not pose_bone.bone.use_local_location: - # loc = smat.to_translation() * (par_rest.inverted() * rest).to_quaternion() + # loc = smat.to_translation() @ (par_rest.inverted() @ rest).to_quaternion() # smat.translation = loc return smat @@ -167,8 +167,8 @@ def set_pose_translation(pose_bone, mat): else: par_rest = Matrix() - q = (par_rest.inverted() * rest).to_quaternion() - pose_bone.location = q * loc + q = (par_rest.inverted() @ rest).to_quaternion() + pose_bone.location = q @ loc def set_pose_rotation(pose_bone, mat): @@ -284,11 +284,11 @@ def match_pole_target(ik_first, ik_last, pole, match_bone, length): angle = rotation_difference(ik_first.matrix, match_bone.matrix) # Try compensating for the rotation difference in both directions - pv1 = Matrix.Rotation(angle, 4, ikv) * pv + pv1 = Matrix.Rotation(angle, 4, ikv) @ pv set_pole(pv1) ang1 = rotation_difference(ik_first.matrix, match_bone.matrix) - pv2 = Matrix.Rotation(-angle, 4, ikv) * pv + pv2 = Matrix.Rotation(-angle, 4, ikv) @ pv set_pole(pv2) ang2 = rotation_difference(ik_first.matrix, match_bone.matrix) @@ -425,8 +425,8 @@ def fk2ik_leg(obj, fk, ik): match_pose_scale(shin, shini) # Foot position - mat = mfoot.bone.matrix_local.inverted() * foot.bone.matrix_local - footmat = get_pose_matrix_in_other_space(mfooti.matrix, foot) * mat + mat = mfoot.bone.matrix_local.inverted() @ foot.bone.matrix_local + footmat = get_pose_matrix_in_other_space(mfooti.matrix, foot) @ mat set_pose_rotation(foot, footmat) set_pose_scale(foot, footmat) bpy.ops.object.mode_set(mode='OBJECT') @@ -443,8 +443,8 @@ def fk2ik_leg(obj, fk, ik): match_pose_scale(shin, shini) # Foot position - mat = mfoot.bone.matrix_local.inverted() * foot.bone.matrix_local - footmat = get_pose_matrix_in_other_space(mfooti.matrix, foot) * mat + mat = mfoot.bone.matrix_local.inverted() @ foot.bone.matrix_local + footmat = get_pose_matrix_in_other_space(mfooti.matrix, foot) @ mat set_pose_rotation(foot, footmat) set_pose_scale(foot, footmat) bpy.ops.object.mode_set(mode='OBJECT') @@ -483,8 +483,8 @@ def ik2fk_leg(obj, fk, ik): set_pose_rotation(footroll, Matrix()) # Foot position - mat = mfooti.bone.matrix_local.inverted() * footi.bone.matrix_local - footmat = get_pose_matrix_in_other_space(foot.matrix, footi) * mat + mat = mfooti.bone.matrix_local.inverted() @ footi.bone.matrix_local + footmat = get_pose_matrix_in_other_space(foot.matrix, footi) @ mat set_pose_translation(footi, footmat) set_pose_rotation(footi, footmat) set_pose_scale(footi, footmat) @@ -509,8 +509,8 @@ def ik2fk_leg(obj, fk, ik): set_pose_rotation(footroll, Matrix()) # Foot position - mat = mfooti.bone.matrix_local.inverted() * footi.bone.matrix_local - footmat = get_pose_matrix_in_other_space(mfoot.matrix, footi) * mat + mat = mfooti.bone.matrix_local.inverted() @ footi.bone.matrix_local + footmat = get_pose_matrix_in_other_space(mfoot.matrix, footi) @ mat set_pose_translation(footi, footmat) set_pose_rotation(footi, footmat) set_pose_scale(footi, footmat) |