import json import pathlib import sys import bpy directory = pathlib.Path(sys.argv[sys.argv.index("--") + 1]) states = {} for blend in sorted(directory.glob("*.blend")): bpy.ops.wm.open_mainfile(filepath=str(blend)) states[blend.stem] = { scene.name: { "camera": scene.camera.name if scene.camera else None, "objects": sorted(obj.name for obj in scene.objects), "strips": sorted(({ "name": strip.name, "type": strip.type, "start": strip.frame_final_start, "end": strip.frame_final_end, "channel": strip.channel, "mute": strip.mute, "sourceScene": strip.scene.name if strip.type == "SCENE" and strip.scene else None, "sourceSound": strip.sound.filepath if strip.type == "SOUND" and strip.sound else None, "images": [element.filename for element in strip.elements] if strip.type == "IMAGE" else [], } for strip in scene.sequence_editor.strips), key=lambda strip: strip["name"]) if scene.sequence_editor else [], } for scene in bpy.data.scenes } (directory / "native-scene-strip-snapshots.json").write_text(json.dumps(states, indent=2, sort_keys=True) + "\n")