From 440a6715a98f6d4927ba751a65c66a0c80945d5c Mon Sep 17 00:00:00 2001 From: Alan O'Cull Date: Tue, 20 Feb 2024 19:21:41 -0500 Subject: [PATCH] More rigging work --- characters/infantry/p9-lopoly.blend | 4 ++-- characters/infantry/post_rig.py | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/characters/infantry/p9-lopoly.blend b/characters/infantry/p9-lopoly.blend index 1023540..b424b5f 100644 --- a/characters/infantry/p9-lopoly.blend +++ b/characters/infantry/p9-lopoly.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8ab57c5c47611049cec8c22ac0c72e91d654d97eb4e876cfd22d4e618d3d0709 -size 4875672 +oid sha256:fe5dc6bad87bb91de5ad5e2cd5c05be2329d1fcc1e1f7974dadb2a7df08f0ba2 +size 4861004 diff --git a/characters/infantry/post_rig.py b/characters/infantry/post_rig.py index b556973..36b587a 100644 --- a/characters/infantry/post_rig.py +++ b/characters/infantry/post_rig.py @@ -103,6 +103,8 @@ def drv_constraint_1D(c: Constraint, bone_name: str, max_x: float, prop: str = ' t.bone_target = bone_name t.transform_type = prop t.transform_space = 'LOCAL_SPACE' +def drv_toggle_1D(): + pass def constrain_slider(b: PoseBone, minimum: float = 0, maximum: float = 0.06): c = b.constraints.new('LIMIT_LOCATION') c.use_min_y = True @@ -118,9 +120,11 @@ def cpy_transforms(b: PoseBone, subtarget, influence = 1.0): constraint.target_space = 'POSE' constraint.owner_space = 'POSE' constraint.influence = influence + return constraint ## Fix widget scalings, and constrain them for b in rig.pose.bones: + ## MENUS / WIDGETS if b.name.startswith("menu_"): b.use_custom_shape_bone_size = False b.custom_shape_translation = (0.0, 0.03, 0.0) @@ -134,11 +138,15 @@ for b in rig.pose.bones: arrcopy(b.lock_rotation, [True, True, True]) arrcopy(b.lock_scale, [True, True, True]) b.lock_rotation_w = True - elif b.name == "axe_gripadjust": - b.custom_shape_scale_xyz = (1.0, 0.8, 0.1) - elif b.name == "baton_obj": + + ## WEAPONS + elif b.name.startswith("grip_baton"): b.custom_shape_scale_xyz = (0.2, 2.6, 0.2) b.custom_shape_translation = (0.0, 0.25, 0.0) + if not b.name.endswith("_free"): + b.custom_shape_scale_xyz *= 0.9 + + ## BODY elif b.name == "neck.001": arrcopy(b.lock_location, [True, True, True]) @@ -171,7 +179,9 @@ for b in rig.pose.bones: # lh_constraint.influence = 0.0 baton_grip = rig.pose.bones.get("grip_baton") -cpy_transforms(baton_grip, 'baton_obj', 1.0) +bg_constraint = cpy_transforms(baton_grip, 'grip_baton_free', 1.0) + +drv_constrain_1D(bg_constraint, 'slider1d_baton_IK-FK', 0.06) ### Set up driver constraint for the switches #drv_constraint_1D(axe_constraint, 'slider1d_axe_gripadjust', 0.06)