godot
godot copied to clipboard
Fix `TabContainer` regressions related to switching tabs in certain cases
Fixes #91135.
-
Fix regression caused by #83893, where setting the current tab right after entering the tree would make the value be reset to 0.
-
The other one is bit more complicated (caused by #87194). It happens because the tab visibility change is also triggered if it becomes visible in the tree (even if it was already set to
visible
), ~and I'm not sure how to fix this without some ugly hackiness.~ Alright, did the cleanest attempt I could, suggestions are welcomed.
Thanks to @jsjtxietian for pointing me in the right direction and saving me time.
partially fixes https://github.com/godotengine/godot/issues/91135
You should unlink the issue then. I tested and the visibility problem is not fixed.
We could make the tab visibility callback only apply in the editor when it is part of the edited scene, since that is where it is most intended for.
Also, the reason it used NOTIFICATION_POST_ENTER_TREE
is to let the TabContainer's children be set up first, but I guess it isn't needed.
You should unlink the issue then. I tested and the visibility problem is not fixed.
Wait, I just forgot to update the PR's description, because both issues are fixed on my end. What happens in the visibility test scene on your end?
Nevermind, I didn't test properly.
Thanks!