Skip to content
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: Resource encoding to dict #73545

Closed

Conversation

mashumafi
Copy link
Contributor

@mashumafi mashumafi commented Feb 18, 2023

Addressing #64202. Unless there is some technical reason to keep this logic of forcing only resource files being encoded then maybe this check can be removed.

The error before said: Invalid type in GDScript utility function '<unknown function>'. Cannot convert argument 1 from Object to Dictionary

Bugsquad edit:

@mashumafi mashumafi requested a review from a team as a code owner February 18, 2023 04:44
@YuriSizov YuriSizov added this to the 4.x milestone Feb 18, 2023
@dalexeev
Copy link
Member

Unless there is some technical reason to keep this logic of forcing only resource files being encoded then maybe this check can be removed.

The path is needed in order to restore the value in dict_to_inst() later:

Ref<Script> scr = ResourceLoader::load(d["@path"]);
if (!scr.is_valid()) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0;
r_error.expected = Variant::OBJECT;
*r_ret = RTR("Invalid instance dictionary format (can't load script at @path)");
return;

I think we should make the error message clearer instead.

var_to_str() has exactly the same limitation (and var_to_bytes() should too, see #78219).

@mashumafi
Copy link
Contributor Author

Might not be a bug

@mashumafi mashumafi closed this Dec 14, 2023
@dalexeev dalexeev added archived and removed bug labels Dec 14, 2023
@dalexeev dalexeev removed this from the 4.x milestone Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants