## Emit a ProcNodeGraph as the JSON the Blender deserializer consumes.
##
## ⚠ RUNNING GODOT DIRECTLY REWRITES project.godot. The editor strips every
## comment and drops any setting that equals its default -- it ate the 30-line
## Jolt block and `screen_space_roughness_limiter/enabled` during this script's
## own development. scripts/dev-editor.sh restores it; a bare `godot --headless
## --path .` does not. Check `git status project.godot` after running this
## locally. CI is unaffected: it runs in a throwaway git-archive extraction.
extends SceneTree
func _init() -> void:
var a := OS.get_cmdline_user_args()
var g: ProcNodeGraph = ResourceLoader.load(a[0])
if g == null:
push_error("no graph at " + a[0]); quit(1); return
var j := GraphExporter.export_to_json(g)
var f := FileAccess.open(a[1], FileAccess.WRITE)
f.store_string(j); f.close()
print("wrote ", j.length(), " bytes")
quit()