Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add is_visible_in_tree in TreeItem #88300

Conversation

FaycalElOuariachi
Copy link
Contributor

@FaycalElOuariachi FaycalElOuariachi commented Feb 13, 2024

Addind a member is_visible_in_tree in TreeItem, which returns true if the item and all its ancestors are visible.
This fixes #88251

Each TreeItem, after visibility changes, propagate its state to its children.
Some uses of TreeItem::is_visible are replaced by the new TreeItem::is_visible_in_tree (I did my best to analyze which ones should be replaced or not).

Tested with the minimal repoduction project attached to the corresponding issue #88251

Here is a slightly modified version, where we can turn on and off the visibility of some TreeItem with keyboard (1 to 9 normal and numpad keys)

Tree Item-is_visible_in_tree.zip

Video captures :
(master)

TreeItem.-.is_visible.bug.mp4

(fix)

TreeItem.-.is_visible.fix.mp4

Copy link
Contributor

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

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

Documentation is just fine

This bugfix makes sense. is_visible_in_tree, akin to CanvasItem and Node3D is likely to benefit many and the internal editor code for things like the Scene Tree dock.

However, there's now 3 (possibly more?) Objects that share this similar snippet of code. I don't know if that's going to be a good thing in the long run.

doc/classes/TreeItem.xml Outdated Show resolved Hide resolved
scene/gui/tree.cpp Outdated Show resolved Hide resolved
@FaycalElOuariachi FaycalElOuariachi force-pushed the add-TreeItem-is_visible_in_tree branch from 8b276fb to 2121fca Compare February 14, 2024 12:04
scene/gui/tree.cpp Outdated Show resolved Hide resolved
scene/gui/tree.cpp Outdated Show resolved Hide resolved
@FaycalElOuariachi FaycalElOuariachi force-pushed the add-TreeItem-is_visible_in_tree branch from 2121fca to 50cf7e1 Compare March 5, 2024 02:43
@akien-mga akien-mga requested a review from KoBeWi March 5, 2024 08:42
@akien-mga akien-mga merged commit c84d338 into godotengine:master Mar 5, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Tree function get_item_area_rect return wrong value when some item are hiden inside the tree
5 participants