-
-
Notifications
You must be signed in to change notification settings - Fork 97
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 get_item_at_index(int idx)
to ItemList
#11764
Comments
What it supposed to return? |
|
Item as a single object? There's no such thing as |
get_item_at_index(int idx)
to ItemList
It could return a Dictionary with item's data. |
What would be the key(s) of that return Dictionary then? |
There are already functions to get the different values associated with an index, so coming up with names for the keys of the dictionary is easy: keep it consistent with the function names, in camel case, since that would be consistent with other APIs (e.g. you get the value form |
Describe the project you are working on
Puzzle game with level select.
Describe the problem or limitation you are having in your project
Currently ItemList has:
get_item_metadata ( idx )
get_item_text ( idx )
get_item_tooltip ( idx )
get_item_icon_region ( idx )
get_item_custom_bg_color ( idx )
get_item_custom_fg_color ( idx )
get_item_icon ( idx )
get_item_icon_modulate ( idx )
But it does not have:
get_item_at_index ( idx )
It only has:
get_item_at_position ( [Vector2] position, [bool] exact=false ) const
So the only choice to get an index in an ItemList is to loop through every item, if not using the selected signal.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add
get_item_at_index ( idx )
to ItemList.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
It would be exactly the same as the other ways of getting the other information from ItemList items at indexes.
If this enhancement will not be used often, can it be worked around with a few lines of script?
The workaround is current to loop through the entire ItemList.
Is there a reason why this should be core and not an add-on in the asset library?
It is an engine related feature.
The text was updated successfully, but these errors were encountered: