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

Fix invisible CanvasItem visibility issue #58413

Merged
merged 1 commit into from
Feb 28, 2022

Conversation

Sauermann
Copy link
Contributor

@Sauermann Sauermann commented Feb 22, 2022

Attempt to fix #58388

Make sure that parent is visible in tree before updating Rendering server.
I believe, that NOTIFICATION_VISIBILITY_CHANGED should be sent independent on the visibility status of the parent.

@Sauermann Sauermann requested a review from a team as a code owner February 22, 2022 00:27
@YuriSizov
Copy link
Contributor

I believe, that NOTIFICATION_VISIBILITY_CHANGED should be sent independent on the visibility status of the parent.

It was like that already, _propagate_visibility_changed() sends that notification if this method call is reached. With your changes the notification will be send out twice if the parent is visible.

@YuriSizov YuriSizov added this to the 4.0 milestone Feb 22, 2022
@YuriSizov YuriSizov requested a review from a team February 22, 2022 00:30
@Sauermann
Copy link
Contributor Author

Sauermann commented Feb 22, 2022

When should NOTIFICATION_VISIBILITY_CHANGED be sent?

  • when the actual visibility of an CanvasItem on screen changes or
  • when the variable CanvasItem.visible changes

@KoBeWi
Copy link
Member

KoBeWi commented Feb 22, 2022

^
Both. When visibility actually changes as a result of parent node turning (in)visible or when the node itself changes its visible property. The latter is actually only needed for SceneTreeDock to update the eye icon.

Also I think the bug might not be related to CanvasItem code at all, I edited the issue with more details. The recent changes might've just exposed it.

@Sauermann Sauermann force-pushed the fix-canvas-item-visibility branch from 28695bc to b02ecf8 Compare February 22, 2022 00:43
@Sauermann
Copy link
Contributor Author

Thanks for the explanation. I updated the patch.

@KoBeWi
Copy link
Member

KoBeWi commented Feb 22, 2022

Unfortunately this creates a new bug:
godot windows tools 64_qE8uGb3O3R

@Sauermann Sauermann force-pushed the fix-canvas-item-visibility branch from b02ecf8 to daa3d15 Compare February 22, 2022 02:51
@Sauermann
Copy link
Contributor Author

Sauermann commented Feb 22, 2022

CanvasItem::_propagate_visibility_changed is a bit confusing - it tries to do too much. Sorry, but I had to split this function up, in order to fix the bug.

@Sauermann Sauermann force-pushed the fix-canvas-item-visibility branch from daa3d15 to 0ffc581 Compare February 22, 2022 03:10
@Sauermann Sauermann changed the title Update visibility of canvas item only if parent is visible in tree Fix invisible CanvasItem visibility issue Feb 22, 2022
@Sauermann Sauermann force-pushed the fix-canvas-item-visibility branch from 0ffc581 to dce6cb7 Compare February 22, 2022 09:19
@KoBeWi
Copy link
Member

KoBeWi commented Feb 22, 2022

Now it seems to fix all issues, but the code should be checked by @reduz

Copy link
Member

@reduz reduz left a comment

Choose a reason for hiding this comment

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

Looks nice and tidy to me, great job!

@akien-mga akien-mga merged commit 9b7aeaf into godotengine:master Feb 28, 2022
@akien-mga
Copy link
Member

Thanks!

@akien-mga akien-mga added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Feb 28, 2022
@Sauermann Sauermann deleted the fix-canvas-item-visibility branch February 28, 2022 10:25
@akien-mga
Copy link
Member

This could use a dedicated backport for 3.x following #57900 (CC @timothyqiu).

The conflicts are relatively easy to solve when cherry-picking but the one thing I'm unsure is whether change_notify("visible") (not present in master) should go in _handle_visibility_change directly or stay only in set_visible.

@timothyqiu
Copy link
Member

the one thing I'm unsure is whether change_notify("visible") (not present in master) should go in _handle_visibility_change directly or stay only in set_visible.

change_notify("visible") is only for changes of the visible property, so I believe it should stay only in set_visible.

@timothyqiu timothyqiu removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Mar 9, 2022
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.

CanvasItem shows despite not visible in tree
6 participants