Skip to content

Commit

Permalink
fix wrong changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SAM-tak committed Sep 8, 2023
1 parent c478246 commit 84208b4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion gamerig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

bl_info = {
"name": "GameRig",
"version": (1, 6, 1),
"version": (1, 6, 2),
"author": "Osamu Takasugi, (Rigify : Nathan Vegdahl, Lucio Rossi, Ivan Cappiello)",
"blender": (3, 1, 0),
"description": "Character Rigging framework for Game / Realtime content",
Expand Down
18 changes: 9 additions & 9 deletions gamerig/rigs/limbs/leg.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,17 +313,10 @@ def postprocess(self, context):
'target_space' : 'POSE'
})

self.make_constraint(mch_ctrl_parent, {
'constraint' : 'LIMIT_ROTATION',
'use_limit_x' : True,
'use_limit_y' : True,
'owner_space' : 'LOCAL'
})

# Find IK toe follow property
ik_dir_ctrl = bones['ik']['ctrl']['limb'][1]
pb[ik_dir_ctrl]['IK Toe Follow'] = 1.0
rna_idprop_ui_create( pb[ik_dir_ctrl], 'IK Toe Follow', default=1.0, description='Rate of facing knee to toe forward', overridable=True )
pb[ik_dir_ctrl]['IK Toe Follow'] = 0.0
rna_idprop_ui_create( pb[ik_dir_ctrl], 'IK Toe Follow', default=0.0, description='Rate of facing knee to toe forward', overridable=True )
# Add driver to limit scale constraint influence
drv = pb[mch_ctrl_parent].constraints[-1].driver_add("influence").driver
drv.type = 'SUM'
Expand All @@ -341,6 +334,13 @@ def postprocess(self, context):
drv_modifier.coefficients[0] = 0.0
drv_modifier.coefficients[1] = 1.0

self.make_constraint(mch_ctrl_parent, {
'constraint' : 'LIMIT_ROTATION',
'use_limit_x' : True,
'use_limit_y' : True,
'owner_space' : 'LOCAL'
})

self.make_constraint(bones['ik']['mch_ctrl_parent_target'], {
'constraint' : 'COPY_ROTATION',
'subtarget' : bones['ik']['mch_target'],
Expand Down
29 changes: 15 additions & 14 deletions gamerig/rigs/limbs/limb.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,34 +96,34 @@ def create_ik( self, parent, needs_controller_parent ):
mch_nostr_1 = copy_bone(
self.obj,
org_bones[0],
get_bone_name( org_bones[1], 'mch', 'ik1_nostr' )
get_bone_name( org_bones[0], 'mch', 'ik_nostr' )
)
mch_nostr_2 = copy_bone(
self.obj,
org_bones[1],
get_bone_name( org_bones[1], 'mch', 'ik2_nostr' )
get_bone_name( org_bones[1], 'mch', 'ik_nostr' )
)
if self.pole_vector_ik:
mch_pole_1 = copy_bone(
self.obj,
org_bones[0],
get_bone_name( org_bones[0], 'mch', 'ik_pole1' )
get_bone_name( org_bones[0], 'mch', 'ik_pole' )
)
mch_pole_2 = copy_bone(
self.obj,
org_bones[1],
get_bone_name( org_bones[1], 'mch', 'ik_pole2' )
get_bone_name( org_bones[1], 'mch', 'ik_pole' )
)
if self.allow_ik_stretch:
mch_pole_nostr_1 = copy_bone(
self.obj,
org_bones[0],
get_bone_name( org_bones[0], 'mch', 'ik_pole1_nostr' )
get_bone_name( org_bones[0], 'mch', 'ik_pole_nostr' )
)
mch_pole_nostr_2 = copy_bone(
self.obj,
org_bones[1],
get_bone_name( org_bones[1], 'mch', 'ik_pole2_nostr' )
get_bone_name( org_bones[1], 'mch', 'ik_pole_nostr' )
)

if self.allow_ik_stretch or self.root_vector_ik and self.pole_vector_ik:
Expand Down Expand Up @@ -169,8 +169,12 @@ def create_ik( self, parent, needs_controller_parent ):
get_bone_name( org_bones[0], 'ctrl', 'ik_direction' )
)

eb[ dir_ctrl ].head = eb[ mch_str ].head + (eb[ mch_str ].tail - eb[ mch_str ].head) / 2
eb[ dir_ctrl ].tail = eb[ dir_ctrl ].head + ( -eb[ dir_ctrl ].z_axis if self.rot_axis == 'x' else eb[ dir_ctrl ].x_axis ) * eb[ dir_ctrl ].length
va = eb[ mch_str ].vector
vc = va.dot(eb[org_bones[0]].vector) / va.length_squared * va

eb[ dir_ctrl ].head = eb[ mch_str ].head + vc
vd = (eb[org_bones[0]].tail - eb[ dir_ctrl ].head).normalized()
eb[ dir_ctrl ].tail = eb[ dir_ctrl ].head + vd * eb[ mch_str ].length / 2
eb[ dir_ctrl ].align_roll(eb[ mch_str ].y_axis)
eb[ dir_ctrl ].inherit_scale = 'NONE'

Expand Down Expand Up @@ -802,7 +806,10 @@ def create_script(self, bones, script_template):
ik_final = [{", ".join(["'" + x + "'" if x else "''" for x in bones['ik']['mch_final']])}]
if is_selected( controls ):
# IK/FK
layout.prop( pose_bones[ '{bones['fk']['ctrl'][0]}' ], '["IK/FK"]', text='IK/FK ({self.org_bones[0]})', slider = True )
# FK limb follow
layout.prop( pose_bones[ '{bones['fk']['ctrl'][0]}' ], '["FK Limb Follow"]', text = 'FK Limb Follow ({self.org_bones[0]})', slider = True)
"""
if self.allow_ik_stretch or self.root_bone or (self.root_vector_ik and self.pole_vector_ik):
Expand All @@ -826,12 +833,6 @@ def create_script(self, bones, script_template):
# IK Pole Mode
layout.prop( pose_bones[ '{ik_master}' ], '["IK Pole Mode"]', text = 'IK Pole Mode ({self.org_bones[0]})', slider = True )
"""
code += f"""
if is_selected( fk_ctrls ):
# FK limb follow
layout.prop( pose_bones[ '{bones['fk']['ctrl'][0]}' ], '["FK Limb Follow"]', text = 'FK Limb Follow ({self.org_bones[0]})', slider = True)
"""
return code + script_template

Expand Down

0 comments on commit 84208b4

Please sign in to comment.