How would i build a Node-Selector Dialog for my Plugin?

Godot Version

4.3

Question

As the title says, my question ist:
How would i build a Node-Selector Dialog for my Plugin?

I am trying to make a Plugin where i need to select a Node from the Scene i am currently editing. But i cant seem to make it work the way i want it to.

What i want is something like this (honestly exactly this would be perfect):


(this is the node selector that is opened when you want to add a propertie track to an animation)

But every time i try it, all the children of the scene instance get displayed in my tree too.
I´ve deleted most of what i did out of frustration. So i would need some time to provide pictures of my problem, if anyone wants them.

Have you looked at the godot manual? There’s several different ways to manipulate scene/node data. I think one is get_parent(). Gets the parent of the scene/node that it belongs to.

For example, if it was used on “some_node”, it would get the parent, “animation_play”.

I might be wrong on what it’s called, how its used, etc. but, there is options to navigate how/what you need for the scene tree.

If I can find it in manual, ill link it.

Might be Worth looking at:

https://docs.godotengine.org/en/stable/classes/class_node.html

You can also reference nodes & instantiated scenes in script directly.

1 Like

If I understand it correctly, you’re trying to make a node-picker, but end up with the children of the scenes in your tree/picker?
Are you using a recursive function? You can check if a node has an owner that isn’t the root node then return from the recursive function. You can also force tree to collapse that specific branch.

1 Like

Yes, that is pretty much what i want.
I made a recursive function, but i didnt realy know what to check for.
I am going to try that right now. But from the sound of it, that should work for me.

On a side note, is there any way to get the icon that is used to display the nodes in the scene view on the left ?

EDIT:
i tried it with the owner of the node and it works now!
ty for the quick replies!

EDIT2:
for anyone looking at this in the future: this is my final result, and pretty much exactly what i wanted.