Files
Hunter/blender/repair_hand_scale.py
T
2026-11-29 15:49:17 +03:00

16 lines
1.1 KiB
Python

import bpy,json
r=next(o for o in bpy.context.scene.objects if o.type=='ARMATURE' and o.name.startswith('Armature'))
print(json.dumps([{'name':p.name,'scale':list(p.scale),'basis_scale':list(p.matrix_basis.to_scale())} for p in r.pose.bones if 'hand' in p.name or 'lowerarm' in p.name]))
for p in r.pose.bones:
if 'hand_IK' in p.name:p.scale=(1,1,1)
bpy.context.view_layer.update()
print('AFTER',json.dumps([{'name':p.name,'scale':list(p.scale)} for p in r.pose.bones if 'hand_IK' in p.name]))
bpy.ops.wm.save_as_mainfile(filepath=r'C:\roblox\hunter\3D models\sniper_reference_v11_hands_fix.blend')
s=bpy.context.scene
# Inspection angle shows both arm chains rather than hiding them behind the rifle.
from mathutils import Vector
cam=s.camera;cam.location=(5,-11,4);cam.rotation_euler=(Vector((-.3,0,-.2))-cam.location).to_track_quat('-Z','Y').to_euler();cam.data.type='ORTHO';cam.data.ortho_scale=11
s.render.resolution_x=1200;s.render.resolution_y=800;s.cycles.samples=16
s.render.filepath=r'C:\roblox\hunter\3D models\hands_fix_check.png'
bpy.ops.render.render(write_still=True)