Add prototype gameplay loop with character/battlefield assets and server game APIs.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
"""Read imported world geometry, transforms and bind matrices for rig diagnosis."""
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import bpy
|
||||
from mathutils import Vector
|
||||
|
||||
for arg in sys.argv[sys.argv.index('--') + 1:]:
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
path = Path(arg)
|
||||
if path.suffix.lower() == '.fbx':
|
||||
bpy.ops.import_scene.fbx(filepath=str(path))
|
||||
else:
|
||||
bpy.ops.import_scene.gltf(filepath=str(path))
|
||||
print('FILE', str(path))
|
||||
for o in bpy.data.objects:
|
||||
if o.type not in ('MESH', 'ARMATURE'):
|
||||
continue
|
||||
print('OBJECT', o.name, o.type, 'parent', o.parent.name if o.parent else None,
|
||||
'matrix', [list(v) for v in o.matrix_world])
|
||||
if o.type == 'MESH':
|
||||
points = [o.matrix_world @ v.co for v in o.data.vertices]
|
||||
mn = [min(p[i] for p in points) for i in range(3)]
|
||||
mx = [max(p[i] for p in points) for i in range(3)]
|
||||
print('GEOMETRY', len(points), 'min', mn, 'max', mx,
|
||||
'modifiers', [(m.type, m.object.name if getattr(m, 'object', None) else None) for m in o.modifiers])
|
||||
links=[[] for _ in points]
|
||||
for edge in o.data.edges:
|
||||
a,b=edge.vertices;links[a].append(b);links[b].append(a)
|
||||
unseen=set(range(len(points)));components=[]
|
||||
while unseen:
|
||||
stack=[unseen.pop()];indices=[]
|
||||
while stack:
|
||||
v=stack.pop();indices.append(v)
|
||||
for n in links[v]:
|
||||
if n in unseen:unseen.remove(n);stack.append(n)
|
||||
components.append(indices)
|
||||
for indices in sorted(components,key=len,reverse=True)[:12]:
|
||||
print('COMPONENT',len(indices),'min',[min(points[v][i] for v in indices) for i in range(3)],
|
||||
'max',[max(points[v][i] for v in indices) for i in range(3)])
|
||||
else:
|
||||
print('BONES', len(o.data.bones))
|
||||
for b in o.data.bones:
|
||||
print('BONE', b.name, 'parent', b.parent.name if b.parent else None, 'worldhead', list(o.matrix_world @ b.head_local),
|
||||
'worldtail', list(o.matrix_world @ b.tail_local))
|
||||
Reference in New Issue
Block a user