Skip to content

Add expand/collapse support to TreeView - #7451

Open
MiriShulman wants to merge 6 commits into
isl-org:mainfrom
MiriShulman:treeview-expand-clean
Open

Add expand/collapse support to TreeView#7451
MiriShulman wants to merge 6 commits into
isl-org:mainfrom
MiriShulman:treeview-expand-clean

Conversation

@MiriShulman

Copy link
Copy Markdown

Adds expand/collapse support to TreeView.

This introduces:

  • SetItemExpanded
  • IsItemExpanded
  • Python bindings exposure

Fixes #7396

@update-docs

update-docs Bot commented Mar 2, 2026

Copy link
Copy Markdown

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

@ssheorey
ssheorey self-requested a review July 24, 2026 23:04

@ssheorey ssheorey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MiriShulman thanks for reworking the PR! Could you close the old PR, please?

AI Review comments for this one (please verify yourself if they are correct):

1: SetItemExpanded won't actually expand or collapse already-rendered nodes because ImGuiTreeNodeFlags_DefaultOpen only affects the initial state of a tree node. After the first frame, ImGui stores its own internal state and ignores this flag entirely. The codebase already has the correct pattern in Layout.cpp, which uses ImGui::SetNextItemOpen() before the tree node call to override ImGui's stored state. Without that, calling SetItemExpanded sets item.expanded, but on the next draw frame ImGui returns its own stored state, immediately overwriting the value back.

2: The TreeViewTest executable is defined outside the if (BUILD_GUI) guard, so it's always added to the build regardless of whether GUI support is enabled. Since it includes GUI headers (Application.h, Window.h, TreeView.h) and links to Open3D::Open3D expecting GUI symbols, it will fail to compile or link when BUILD_GUI is OFF. The existing test content in the same file is properly guarded.

  1. git and treeview-clean are accidentally added to the commit.

Let me know if I can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the "collapse" and "open" functions to TreeView in python

2 participants