0 votes

How do I Make Local MyLineEdit node, programmatically via script?
I need this so if I make a change to the original MyLineEdit scene, it does not affect the one I added in the Control Scene. I tried changing the owner of the instance, but does not seem to work.

enter image description here

in Engine by (805 points)

This is what the engine C++ does:

    undo_redo->create_action(TTR("Make Local"));
    undo_redo->add_do_method(node, "set_filename", "");
    undo_redo->add_undo_method(node, "set_filename", node->get_filename());
    _node_replace_owner(node, node, root);
    undo_redo->add_do_method(scene_tree, "update_tree");
    undo_redo->add_undo_method(scene_tree, "update_tree");

So I assume a GDScript equivalent would be (without undo/redo):


I guess this turns the instance into a non-instance.

Yep that did it. Thanks for looking it up. Would be nice if that were a single method.

I guess setting the filename to empty string, severs the relationship from the original scene. Interesting.


1 Answer

0 votes

see comment above.

by (805 points)
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 [email protected] with your username.