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
image

Press on the first one and expands all of them
image

and my patch

This does not affect the children of the TreeNode,
image

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.

image

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:

image

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

Best,
Anton

2 Likes

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