16 lines
655 B
GDScript
16 lines
655 B
GDScript
# tools/fixtures/_godot_tres.gd: run by tools/fixtures/godot.py (godot --headless -s ... -- <file.tres>...): loads each
|
|
# resource with Godot's loader and prints one JSON line: its class and every stored property as var_to_str text.
|
|
extends SceneTree
|
|
|
|
func _init():
|
|
for path in OS.get_cmdline_user_args():
|
|
var r = load(path)
|
|
var res = {"file": path, "ok": r != null, "props": {}}
|
|
if r:
|
|
res["class"] = r.get_class()
|
|
for p in r.get_property_list():
|
|
if p.usage & PROPERTY_USAGE_STORAGE and p.name != "script" and p.name != "resource_path":
|
|
res["props"][p.name] = var_to_str(r.get(p.name))
|
|
print("JSON:" + JSON.stringify(res))
|
|
quit()
|