Files
workinf_Blender_Wasm/web/tests/fixtures/sequencer-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

53 lines
2.0 KiB
Python

import json
import hashlib
import pathlib
import sys
import bpy
def strip_state(strip):
return {
"name": strip.name,
"type": strip.type,
"channel": strip.channel,
"start": strip.frame_final_start,
"end": strip.frame_final_end,
"sourceStart": strip.frame_offset_start,
"sourceEnd": strip.frame_offset_end,
"muted": strip.mute,
"locked": strip.lock,
"inputs": [getattr(strip, key).name for key in ("input_1", "input_2")
if getattr(strip, key, None)],
"children": sorted((strip_state(child) for child in strip.strips),
key=lambda child: child["name"]) if strip.type == "META" else [],
"source": {
"sound": strip.sound.filepath if strip.type == "SOUND" and strip.sound else None,
"movie": strip.filepath if strip.type == "MOVIE" else None,
"scene": strip.scene.name if strip.type == "SCENE" and strip.scene else None,
"directory": strip.directory if strip.type == "IMAGE" else None,
"images": [element.filename for element in strip.elements] if strip.type == "IMAGE" else [],
},
}
directory = pathlib.Path(sys.argv[sys.argv.index("--") + 1])
snapshots = {}
for blend in sorted(directory.glob("*.blend")):
bpy.ops.wm.open_mainfile(filepath=str(blend))
snapshots[blend.stem] = {
scene.name: sorted((strip_state(strip) for strip in scene.sequence_editor.strips),
key=lambda strip: strip["name"])
if scene.sequence_editor else []
for scene in bpy.data.scenes
}
snapshots[blend.stem]["__soundData"] = sorted(({
"name": sound.name,
"path": sound.filepath,
"users": sound.users,
"packedSha256": hashlib.sha256(sound.packed_file.data).hexdigest()
if sound.packed_file else None,
} for sound in bpy.data.sounds), key=lambda sound: sound["name"])
(directory / "native-sequencer-snapshots.json").write_text(
json.dumps(snapshots, indent=2, sort_keys=True) + "\n")