Skip to content

Commit 1b5177c

Browse files
committed
fix: partial(?) fk2ik snap in 2.78 ver
1 parent 8240e8a commit 1b5177c

File tree

1 file changed

+43
-16
lines changed

1 file changed

+43
-16
lines changed

rig_ui_template.py

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -331,19 +331,38 @@ def fk2ik_arm(obj, fk, ik):
331331
match_pose_scale(hand, handi)
332332
else:
333333
# Upper arm position
334-
match_pose_translation(uarm, uarmi)
335-
match_pose_rotation(uarm, uarmi)
336-
match_pose_scale(uarm, uarmi)
334+
mat = get_pose_matrix_in_other_space(uarmi.matrix, uarm)
335+
set_pose_translation(uarm, mat.copy())
336+
set_pose_rotation(uarm, mat.copy())
337+
set_pose_scale(uarm, mat.copy())
338+
bpy.ops.object.mode_set(mode='OBJECT')
339+
bpy.ops.object.mode_set(mode='POSE')
340+
# match_pose_translation(uarm, uarmi)
341+
# match_pose_rotation(uarm, uarmi)
342+
# match_pose_scale(uarm, uarmi)
337343
338344
# Forearm position
339-
#match_pose_translation(hand, handi)
340-
match_pose_rotation(farm, farmi)
341-
match_pose_scale(farm, farmi)
345+
mat = get_pose_matrix_in_other_space(farmi.matrix, farm)
346+
set_pose_translation(farm, mat.copy())
347+
set_pose_rotation(farm, mat.copy())
348+
set_pose_scale(farm, mat.copy())
349+
bpy.ops.object.mode_set(mode='OBJECT')
350+
bpy.ops.object.mode_set(mode='POSE')
351+
#match_pose_translation(farm, farmi)
352+
# match_pose_rotation(farm, farmi)
353+
# match_pose_scale(farm, farmi)
342354
343355
# Hand position
344-
match_pose_translation(hand, handi)
345-
match_pose_rotation(hand, handi)
346-
match_pose_scale(hand, handi)
356+
mat = get_pose_matrix_in_other_space(handi.matrix, hand)
357+
set_pose_translation(hand, mat.copy())
358+
set_pose_rotation(hand, mat.copy())
359+
set_pose_scale(hand, mat.copy())
360+
bpy.ops.object.mode_set(mode='OBJECT')
361+
bpy.ops.object.mode_set(mode='POSE')
362+
363+
# match_pose_translation(hand, handi)
364+
# match_pose_rotation(hand, handi)
365+
# match_pose_scale(hand, handi)
347366
348367
349368
def ik2fk_arm(obj, fk, ik):
@@ -380,16 +399,24 @@ def ik2fk_arm(obj, fk, ik):
380399
381400
else:
382401
# Hand position
383-
match_pose_translation(handi, hand)
384-
match_pose_rotation(handi, hand)
385-
match_pose_scale(handi, hand)
402+
mat = get_pose_matrix_in_other_space(hand.matrix, handi)
403+
set_pose_translation(handi, mat.copy())
404+
set_pose_rotation(handi, mat.copy())
405+
set_pose_scale(handi, mat.copy())
406+
# match_pose_translation(handi, hand)
407+
# match_pose_rotation(handi, hand)
408+
# match_pose_scale(handi, hand)
386409
387410
# Upper Arm position
388-
match_pose_translation(uarmi, uarm)
389-
match_pose_rotation(uarmi, uarm)
390-
match_pose_scale(uarmi, uarm)
411+
mat = get_pose_matrix_in_other_space(farm.matrix, farmi)
412+
set_pose_translation(farmi, mat.copy())
413+
set_pose_rotation(farmi, mat.copy())
414+
set_pose_scale(farmi, mat.copy())
415+
# match_pose_translation(uarmi, uarm)
416+
# match_pose_rotation(uarmi, uarm)
417+
# match_pose_scale(uarmi, uarm)
391418
# Rotation Correction
392-
correct_rotation(uarmi, uarm)
419+
# correct_rotation(uarmi, uarm)
393420
394421
def fk2ik_leg(obj, fk, ik):
395422
""" Matches the fk bones in a leg rig to the ik bones.

0 commit comments

Comments
 (0)