Adding a node to scene via editor plugin

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

I am making this plugin that makes a volume out of a MeshInstance and then adds the resulting nose to the mesh as child. It worked out in the end, except for one problem.
The generated volume node doesn’t show up in the scene tree. How are users going to edit it if they can’t select it from the scene tree? How do you get it to appear?

:bust_in_silhouette: Reply From: volzhs

you need to set owner to the new node, something like this.

new_node.owner = get_editor_interface().get_edited_scene_root()

Thanks man! :slight_smile:

SIsilicon | 2018-06-14 21:26

I’ve made a mistake assuming that owner could be any node inside scene, but seems like only instanced type of nodes can be set as owner that way, but makes sense.

Xrayez | 2019-08-03 13:35