import bpy, sys, mathutils
a=sys.argv[sys.argv.index("--")+1:]
bpy.ops.wm.read_factory_settings(use_empty=True); bpy.ops.import_scene.gltf(filepath=a[0])
for o in list(bpy.context.scene.objects):
    if o.type=="MESH" and o.name.startswith("Ico"): bpy.data.objects.remove(o)
arm=[o for o in bpy.context.scene.objects if o.type=="ARMATURE"][0]; A=arm.matrix_world
arm.data.pose_position="REST"; bpy.context.view_layer.update()
me=[o for o in bpy.context.scene.objects if o.type=="MESH"][0]; MW=me.matrix_world
vs=[MW@v.co for v in me.data.vertices]
for side,sg in (("Left",1),("Right",-1)):
    for bn in ("Arm","ForeArm","Hand"):
        b=arm.data.bones[side+bn]; h=A@b.head_local
        sl=[p for p in vs if abs(p.z-h.z)<0.04 and sg*p.x>0.45]
        if sl:
            cx=sum(p.x for p in sl)/len(sl); cy=sum(p.y for p in sl)/len(sl)
            print("JOINT %-12s bone(%.2f %.2f %.2f)  mesh-slice ctr(%.2f %.2f) x %.2f..%.2f  offset_x=%.2f offset_y=%.2f"%(side+bn,h.x,h.y,h.z,cx,cy,min(p.x for p in sl),max(p.x for p in sl),h.x-cx,h.y-cy))
act=bpy.data.actions[0]
paths={}
for fc in (act.fcurves if hasattr(act,"fcurves") and len(act.fcurves) else [c for l in act.layers for s in l.strips for cb in s.channelbags for c in cb.fcurves]):
    bone=fc.data_path.split('"')[1] if '"' in fc.data_path else fc.data_path
    paths.setdefault(fc.data_path.split(".")[-1],set()).add(bone)
for k,v in paths.items(): print("CHANNEL",k,len(v),"bones",sorted(v)[:6])
