Imgui: TreeNode expand/collapse behavior

I think this time I found a bug, I don’t remember really what was the last version this was working properly, but, having a TreeNode in a Foreach loop and pressing on one element, automatically expands all the consequent TreeNodes.

Initializing correctly as collapsed

Press on the first one and expands all of them

and my patch

This does not affect the children of the TreeNode,

but same behavior happens as soon as I press on one child, then all the other children (belonging in different TreeNodes - but on same level) are being expanded (or collapsed) respectively.


please share the patch.

sure, here it is a simplified version with Repeat (same happens with Foreach)

TreeNode_missbehave.vl (10.1 KB)

Hi Nissidis,

Collapsed pin of the node is of type Channel. When it is not explicitly connected to any channel, then it looks like all of the TreeNodes in the loop gets the same channel.

Create a channel for every TreeNode like here:


Let’s see if this also can be done automagically.
Hope this helps for now.



Thanks @robotanton

I remember that in previous versions this was not necessary. So I presumed that it is a bug. I ll of course do this atm, but having this happening automagically would be awesome! Thanks

After taking another look at this issue we found a solution which brings back the behavior how it was before the 6.0 release.

Fixed in upcoming preview builds. Thanks for pointing it out!