-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Revert invalid PopupMenu breaking change from #61102 #61181
Revert invalid PopupMenu breaking change from #61102 #61181
Conversation
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.
I also spotted a documentation error.
godot/doc/classes/OptionButton.xml
Lines 97 to 101 in b7523a9
<method name="get_selected_id" qualifiers="const"> | |
<return type="int" /> | |
<description> | |
Returns the ID of the selected item, or [code]-1[/code] if no item is selected. | |
</description> |
The special return value is not changed on 3.x
godot/scene/gui/option_button.cpp
Lines 260 to 264 in b7523a9
int OptionButton::get_selected_id() const { | |
int idx = get_selected(); | |
if (idx < 0) { | |
return 0; | |
} |
Hm maybe we should actually do that tiny compat breakage for 3.5, it feels more like a bugfix than an arbitrary behavior change. Since currently there would be no way to differentiate between "item 0 selected" and "no item selected". |
@akien-mga It's the ID of that item, not index. When using the default ID (passing -1 to the parameter), the auto assigned ID starts from 1. But yeah, -1 will never be a valid ID. So it's either the doc or the implementation that should be changed :P |
Looks like I've missed |
Maybe backport #54647 instead of reverting? Edit: or better not, since it depends on another PR... |
Corresponding change is here #61185 |
Yeah, I've already edited my message) |
See #61179 (comment) for rationale.
CC @okla.