-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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 bottom panel sizing with multiple options #99594
base: master
Are you sure you want to change the base?
Conversation
editor/gui/editor_bottom_panel.cpp
Outdated
@@ -125,6 +143,65 @@ bool EditorBottomPanel::_button_drag_hover(const Vector2 &, const Variant &, But | |||
return false; | |||
} | |||
|
|||
void EditorBottomPanel::_focus_pressed_button(Button *p_btn) { | |||
if (!Variant(p_btn).get_validated_object()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work, you should use an ObjectID
instead if you need to handle freed objects
get_validated_object
only makes sense for a Variant
created from a valid pointer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, how would I do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would get the ObjectID
using get_instance_id
and then fetch the object with ObjectDB::get_instance
8015f70
to
2bcb8a0
Compare
For testing, I re-uploaded the two extreme MRPs from the issue for convenience:
This PR handles both of them just fine: I'm not sure why, but in the Many Small MRP, this PR can't open any of the custom bottom panel tabs besides godot.windows.editor.x86_64_CxssMxSWXO.mp4So the really bad cases seem solved by this (once the issue with Many Small is solved). I also tested casually with a more normal workload using only built-in bottom panels, and it works as expected. Is it possible to have the popup appear so the base is aligned with the top of the three dot button, rather than covering it? Other three dot buttons spawn their popups directly below the button, they don't cover the button: |
2bcb8a0
to
da91726
Compare
Resolved (will do a review later)
da91726
to
5761070
Compare
The last editor artifact is broken for me on Windows 10: Edit: If I spam click on it, it works correctly. This might be an unrelated bug, it seems familiar. Yep, it's #99581 or something similar. |
5761070
to
d621721
Compare
This didn't happen before? Tried another approach with the button. Does this also trigger the above issue? |
d621721
to
7ffc0cd
Compare
godot.windows.editor.x86_64_MKuKmqzoKP.mp4With this one, it's easier to get a correctly spawned popup, but it's still possible to get the bad version of the popup by spamming left click. I really suspect that this problem is unrelated to your PR, and is something similar to #99581. But I haven't reviewed your actual code and I don't know enough to, all I can do is test the functionality. |
b4e3256
to
7a548e3
Compare
Thanks for testing! About the spam clicking, missed a bit of code in your latest test. Added it in now, |
7a548e3
to
06ce2bf
Compare
Both this PR and #97878 use ScrollContainer, but the other PR uses side arrows instead of popup: |
We can have the menu button before the left arrow button, so why don't we combine both ? Also we can allow hiding the menu button in editor settings because i also don't like it, but others may see it useful. |
Fixes: #95681
Did see this issue a while ago and thought it looked interesting, as I needed to create something similar in gdscript and if a version could be made for the editor.
I did now see there is PR for this already. Haven't looked how it is implemented or tested it.
If not used in its entirety maybe something here can be useful or combined in to a PR.
Features:
I first made a version with < prev and next > buttons. But decided to remove them to save space in the bottom panel, as the popup menu gives you a good overview of all the options.
Before:
After (looks the same):
Compact
Default:
Light:
Oled:
Resizing and scrolling between options:
You can speed up scroll by holding alt key.
Screencast_20241123_091418.webm
Scrolls to clicked option:
Screencast_20241123_091707.webm
Scrolls to popup menu selection:
Popup only shows buttons visible in the bottom panel.
Screencast_20241123_092159.webm
Scrolls to the editor opened by events such as clicking on a node in the tree:
Screencast_20241123_092408.webm