Files
workinf_Blender_Wasm/web/tests/fixtures/armature-authoring-main-snapshots.py
mes123456 f3e21c6b98
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender migration source, tools and docs
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>
2026-11-10 11:18:01 +08:00

38 lines
1.5 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()))
obj = bpy.data.objects["PoseConstraintArmatureObject"]
states[label] = {
"mirrorX": obj.data.use_mirror_x,
"bones": [{
"name": bone.name,
"parent": bone.parent.name if bone.parent else None,
"connected": bone.use_connect,
"head": vector(bone.head_local),
"tail": vector(bone.tail_local),
"matrix": [vector(row) for row in bone.matrix_local],
} for bone in sorted(obj.data.bones, key=lambda bone: bone.name)],
"constraints": [{
"bone": bone.name,
"items": [{"name": constraint.name, "type": constraint.type,
"target": constraint.target.name if getattr(constraint, "target", None) else None,
"subtarget": getattr(constraint, "subtarget", ""),
"influence": round(float(constraint.influence), 6),
"enabled": not constraint.mute}
for constraint in bone.constraints],
} for bone in sorted(obj.pose.bones, key=lambda bone: bone.name)],
}
pathlib.Path(request["output"]).write_text(json.dumps(states, indent=2) + "\n")