More rigging work

This commit is contained in:
Alan O'Cull 2024-02-20 19:21:41 -05:00
parent b48a2b48b1
commit 440a6715a9
2 changed files with 16 additions and 6 deletions

BIN
characters/infantry/p9-lopoly.blend (Stored with Git LFS)

Binary file not shown.

View File

@ -103,6 +103,8 @@ def drv_constraint_1D(c: Constraint, bone_name: str, max_x: float, prop: str = '
t.bone_target = bone_name t.bone_target = bone_name
t.transform_type = prop t.transform_type = prop
t.transform_space = 'LOCAL_SPACE' t.transform_space = 'LOCAL_SPACE'
def drv_toggle_1D():
pass
def constrain_slider(b: PoseBone, minimum: float = 0, maximum: float = 0.06): def constrain_slider(b: PoseBone, minimum: float = 0, maximum: float = 0.06):
c = b.constraints.new('LIMIT_LOCATION') c = b.constraints.new('LIMIT_LOCATION')
c.use_min_y = True c.use_min_y = True
@ -118,9 +120,11 @@ def cpy_transforms(b: PoseBone, subtarget, influence = 1.0):
constraint.target_space = 'POSE' constraint.target_space = 'POSE'
constraint.owner_space = 'POSE' constraint.owner_space = 'POSE'
constraint.influence = influence constraint.influence = influence
return constraint
## Fix widget scalings, and constrain them ## Fix widget scalings, and constrain them
for b in rig.pose.bones: for b in rig.pose.bones:
## MENUS / WIDGETS
if b.name.startswith("menu_"): if b.name.startswith("menu_"):
b.use_custom_shape_bone_size = False b.use_custom_shape_bone_size = False
b.custom_shape_translation = (0.0, 0.03, 0.0) 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_rotation, [True, True, True])
arrcopy(b.lock_scale, [True, True, True]) arrcopy(b.lock_scale, [True, True, True])
b.lock_rotation_w = True b.lock_rotation_w = True
elif b.name == "axe_gripadjust":
b.custom_shape_scale_xyz = (1.0, 0.8, 0.1) ## WEAPONS
elif b.name == "baton_obj": elif b.name.startswith("grip_baton"):
b.custom_shape_scale_xyz = (0.2, 2.6, 0.2) b.custom_shape_scale_xyz = (0.2, 2.6, 0.2)
b.custom_shape_translation = (0.0, 0.25, 0.0) 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": elif b.name == "neck.001":
arrcopy(b.lock_location, [True, True, True]) arrcopy(b.lock_location, [True, True, True])
@ -171,7 +179,9 @@ for b in rig.pose.bones:
# lh_constraint.influence = 0.0 # lh_constraint.influence = 0.0
baton_grip = rig.pose.bones.get("grip_baton") 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 ### Set up driver constraint for the switches
#drv_constraint_1D(axe_constraint, 'slider1d_axe_gripadjust', 0.06) #drv_constraint_1D(axe_constraint, 'slider1d_axe_gripadjust', 0.06)