Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer, web workflow engine and protocol, tooling, docs and task records. Large generated evidence, user-testing archives, build snapshots and imported test assets remain untracked. Co-Authored-By: Claude Code <noreply@anthropic.com>
37 lines
1.6 KiB
Python
37 lines
1.6 KiB
Python
import bpy
|
|
import json
|
|
import pathlib
|
|
import sys
|
|
|
|
request = json.loads(pathlib.Path(sys.argv[sys.argv.index("--") + 1]).read_text())
|
|
|
|
|
|
def vector(values):
|
|
return [round(float(value), 6) for value in values]
|
|
|
|
|
|
states = {}
|
|
for label, file in request["files"].items():
|
|
bpy.ops.wm.open_mainfile(filepath=str(pathlib.Path(file).resolve()))
|
|
states[label] = {
|
|
"objects": [{"name": obj.name, "type": obj.type,
|
|
"data": obj.data.name if obj.data else None}
|
|
for obj in sorted(bpy.data.objects, key=lambda obj: obj.name)],
|
|
"curves": [{
|
|
"name": curve.name, "type": curve.bl_rna.identifier,
|
|
"splines": [{
|
|
"type": spline.type,
|
|
"cyclicU": spline.use_cyclic_u, "cyclicV": spline.use_cyclic_v,
|
|
"u": spline.point_count_u, "v": spline.point_count_v,
|
|
"orderU": spline.order_u if spline.type == "NURBS" else None,
|
|
"orderV": spline.order_v if spline.type == "NURBS" and spline.point_count_v > 1 else None,
|
|
"points": [vector(point.co) for point in spline.points],
|
|
"bezier": [{"co": vector(point.co),
|
|
"left": vector(point.handle_left), "right": vector(point.handle_right),
|
|
"leftType": point.handle_left_type, "rightType": point.handle_right_type}
|
|
for point in spline.bezier_points],
|
|
} for spline in curve.splines],
|
|
} for curve in sorted(bpy.data.curves, key=lambda curve: curve.name)],
|
|
}
|
|
pathlib.Path(request["output"]).write_text(json.dumps(states, indent=2) + "\n")
|