How to set a node as closed in an editor script?

Godot Version

4.2.1

Question

I’m writing a plugin that runs in the editor and which the user can use to generate a tree of nodes which are added to the current scene. At the moment every node I generate is shown in the Scene panel in an expanded state. I would like some of the nodes to be closed. How can I indicate in my script that a node should be closed when displayed in the Scene panel?

The Scene Tree Dock is based on a Tree node.
You could try setting TreeItem.collapsed of the TreeItem that represents the node.

I think what you’re looking for is set_display_folded

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.