From 84208b4467c6e2e6d63992c493dc1912fca9c921 Mon Sep 17 00:00:00 2001 From: SAM-tak Date: Fri, 8 Sep 2023 18:52:22 +0900 Subject: [PATCH] fix wrong changes --- gamerig/__init__.py | 2 +- gamerig/rigs/limbs/leg.py | 18 +++++++++--------- gamerig/rigs/limbs/limb.py | 29 +++++++++++++++-------------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/gamerig/__init__.py b/gamerig/__init__.py index 5e35db3..3cdc444 100644 --- a/gamerig/__init__.py +++ b/gamerig/__init__.py @@ -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", diff --git a/gamerig/rigs/limbs/leg.py b/gamerig/rigs/limbs/leg.py index ab96718..2d2b8a1 100644 --- a/gamerig/rigs/limbs/leg.py +++ b/gamerig/rigs/limbs/leg.py @@ -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' @@ -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'], diff --git a/gamerig/rigs/limbs/limb.py b/gamerig/rigs/limbs/limb.py index a825e92..0c11f8d 100644 --- a/gamerig/rigs/limbs/limb.py +++ b/gamerig/rigs/limbs/limb.py @@ -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: @@ -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' @@ -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): @@ -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