Is it possible to make scene instance local or "editable children" through tool?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Densevoid

Is it possible to make scene instance local or “editable children” through tool?

I found a solution like this:

node.filename=''
node.owner=get_tree().get_edited_scene_root()

But it doesn’t work for me.

I also tried to call the scene.instance(GenEditState.GEN_EDIT_STATE_INSTANCE) to make this instance local. Because the method description says: “If passed to instance(), provides local scene resources to the local scene.” But that also didn’t work.

Although changes appear in the editor before the first restart of the project. But when the game starts, all children return to their default state.

:bust_in_silhouette: Reply From: arthurZ

This an old question, but this is the answer for Godot 4.x at least:

Using the tool mode, as you mentioned, you need to set the owner of the editable child and use the set_editable_instance.
Like:

set_editable_instance(editable_node_child, true)

You can check this using is_editable_instance.

Hey Guys,

I really need a script to enable editable child on many objects. I tried ytour solution but it does not work :frowning:

Parse Error: Function "set_editable_instance()" not found in base self.

@tool
extends EditorScript



func _run():
    for node in get_all_children(get_scene()):

    set_editable_instance(node, true)


func get_all_children(in_node, children_acc = []):
    children_acc.push_back(in_node)
    for child in in_node.get_children():
        children_acc = get_all_children(child, children_acc)

    return children_acc