-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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 optional default value to get_meta()
#58608
Conversation
I'd prefer to add an optional third argument to Having a separate method is warranted for having |
I don't think having such method makes sense. We have
This basically means that we'd add |
We discussed in PR review meeting that this makes sense, but could actually be done by adding the default value to As mentioned in the PR review, that doesn't cover the use case that |
I checked my code for use of var icon = icon_cache.get(tab_scenes[i], null)
if icon:
slot.set_texture(icon)
else:
generate_icon(instance as Node2D, slot) The if node.has_meta("meta"):
value = node.get_meta("meta")
else:
value = something_else In such cases I need to access the "meta" twice. But I guess it's rare enough to live with that. I'll make the discussed changes. |
Tbh I think the If it were my choice I would either have the _or_default version, or veto this overall. |
Done. |
Does this need a rebase after #59452 or is it fine as is? |
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.
Approved based on what we discussed last time.
Tested, still works. |
Thanks! |
Cherry-picked for 3.5. |
get_meta()
Closes godotengine/godot-proposals#2383