26
26
from .utils import write_metarig , write_widget
27
27
from .utils import unique_name
28
28
from .utils import upgradeMetarigTypes , outdated_types
29
- from .utils import get_keyed_frames
29
+ from .utils import get_keyed_frames , bones_in_frame
30
30
from .utils import overwrite_prop_animation
31
31
from .rigs .utils import get_limb_generated_names
32
32
from . import rig_lists
@@ -905,7 +905,7 @@ def FktoIk(rig, window='ALL'):
905
905
906
906
if not id_store .rigify_transfer_only_selected :
907
907
pbones = rig .pose .bones
908
- bpy .ops .pose .select_all (action = 'SELECT ' )
908
+ bpy .ops .pose .select_all (action = 'DESELECT ' )
909
909
else :
910
910
pbones = bpy .context .selected_pose_bones
911
911
bpy .ops .pose .select_all (action = 'DESELECT' )
@@ -929,6 +929,8 @@ def FktoIk(rig, window='ALL'):
929
929
kwargs = {'uarm_fk' : controls [1 ], 'farm_fk' : controls [2 ], 'hand_fk' : controls [3 ],
930
930
'uarm_ik' : controls [0 ], 'farm_ik' : ik_ctrl [1 ], 'hand_ik' : controls [4 ],
931
931
'pole' : pole , 'main_parent' : parent }
932
+ args = (controls [0 ], controls [1 ], controls [2 ], controls [3 ],
933
+ ik_ctrl [1 ], controls [4 ], pole )
932
934
else :
933
935
func = leg_ik2fk
934
936
controls = names ['controls' ]
@@ -945,13 +947,18 @@ def FktoIk(rig, window='ALL'):
945
947
'mfoot_fk' : controls [7 ], 'thigh_ik' : controls [0 ], 'shin_ik' : ik_ctrl [1 ],
946
948
'foot_ik' : controls [6 ], 'pole' : pole , 'footroll' : controls [5 ], 'mfoot_ik' : ik_ctrl [2 ],
947
949
'main_parent' : parent }
950
+ args = (controls [0 ], controls [1 ], controls [2 ], controls [3 ],
951
+ ik_ctrl [1 ], controls [6 ], controls [5 ], pole )
948
952
949
953
for f in frames :
954
+ if not bones_in_frame (f , rig , * args ):
955
+ continue
950
956
scn .frame_set (f )
951
957
func (** kwargs )
952
958
bpy .ops .anim .keyframe_insert_menu (type = 'BUILTIN_KSI_VisualLocRot' )
953
959
bpy .ops .anim .keyframe_insert_menu (type = 'Scaling' )
954
960
961
+ bpy .ops .pose .select_all (action = 'DESELECT' )
955
962
limb_generated_names .pop (group )
956
963
break
957
964
@@ -973,9 +980,11 @@ def IktoFk(rig, window='ALL'):
973
980
frames = [f for f in frames if f in range (id_store .rigify_transfer_start_frame , id_store .rigify_transfer_end_frame + 1 )]
974
981
elif window == 'CURRENT' :
975
982
frames = [scn .frame_current ]
983
+ else :
984
+ frames = [scn .frame_current ]
976
985
977
986
if not id_store .rigify_transfer_only_selected :
978
- bpy .ops .pose .select_all (action = 'SELECT ' )
987
+ bpy .ops .pose .select_all (action = 'DESELECT ' )
979
988
pbones = rig .pose .bones
980
989
else :
981
990
pbones = bpy .context .selected_pose_bones
@@ -999,6 +1008,8 @@ def IktoFk(rig, window='ALL'):
999
1008
kwargs = {'uarm_fk' : controls [1 ], 'farm_fk' : controls [2 ], 'hand_fk' : controls [3 ],
1000
1009
'uarm_ik' : controls [0 ], 'farm_ik' : ik_ctrl [1 ],
1001
1010
'hand_ik' : controls [4 ]}
1011
+ args = (controls [0 ], controls [1 ], controls [2 ], controls [3 ],
1012
+ ik_ctrl [1 ], controls [4 ], pole )
1002
1013
else :
1003
1014
func = leg_fk2ik
1004
1015
controls = names ['controls' ]
@@ -1012,11 +1023,18 @@ def IktoFk(rig, window='ALL'):
1012
1023
kwargs = {'thigh_fk' : controls [1 ], 'shin_fk' : controls [2 ], 'foot_fk' : controls [3 ],
1013
1024
'mfoot_fk' : controls [7 ], 'thigh_ik' : controls [0 ], 'shin_ik' : ik_ctrl [1 ],
1014
1025
'foot_ik' : ik_ctrl [2 ], 'mfoot_ik' : ik_ctrl [2 ]}
1026
+ args = (controls [0 ], controls [1 ], controls [2 ], controls [3 ],
1027
+ ik_ctrl [1 ], controls [6 ], controls [5 ], pole )
1028
+
1015
1029
for f in frames :
1030
+ if not bones_in_frame (f , rig , * args ):
1031
+ continue
1016
1032
scn .frame_set (f )
1017
1033
func (** kwargs )
1018
1034
bpy .ops .anim .keyframe_insert_menu (type = 'BUILTIN_KSI_VisualLocRot' )
1019
1035
bpy .ops .anim .keyframe_insert_menu (type = 'Scaling' )
1036
+
1037
+ bpy .ops .pose .select_all (action = 'DESELECT' )
1020
1038
limb_generated_names .pop (group )
1021
1039
break
1022
1040
0 commit comments