+1 vote

For example, I incorrectly named a bunch of nodes, is there a way to rename them all with a script?

A repl for the editor would be really cool actually ...

in Engine by (34 points)

1 Answer

+3 votes
Best answer

Sure, just load your scene and do your changes on an instance of it. Then you can save it back to the disk resource using ResourceSaver.save().

Short example:

var scene_path = "res://my_scene.tscn"
var scene = load(scene_path)
var root = scene.instance()
for node in root.get_children():
    node.set_name(new_name)
scene.pack(root)
ResourceSaver.save(scene_path, scene)
by (924 points)
edited by

Even though the OP didn't say thanks I'd like to. That's great help for something I'm facing at present.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.