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 exported typed dictionaries in .NET not being loaded correctly when their default value is null #98546

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

juanjp600
Copy link
Contributor

@juanjp600 juanjp600 commented Oct 26, 2024

Along with #98545, this should fix #97850.

This is not entirely correct if the type arguments for the dictionary are script types. However, the hint string does not include any information about scripts, so I'm not sure what the best way to address it is.

@juanjp600 juanjp600 requested review from a team as code owners October 26, 2024 07:01
@juanjp600 juanjp600 changed the title Fix exported typed dictionaries in .NET not being loaded correctly wh… Fix exported typed dictionaries in .NET not being loaded correctly when their default value is null Oct 26, 2024
@timothyqiu timothyqiu added this to the 4.4 milestone Oct 26, 2024
@juanjp600 juanjp600 force-pushed the dotnet-typed-dictionaries-default-null-export-fix branch from f8b5698 to 2d287a1 Compare December 8, 2024 19:15
@juanjp600 juanjp600 force-pushed the dotnet-typed-dictionaries-default-null-export-fix branch from 2d287a1 to 48d56f6 Compare December 8, 2024 19:15
}
r_key_subtype = Variant::Type(key_subtype_string.to_int());
if (r_key_class_name != nullptr) {
*r_key_class_name = p_hint_string.substr(key_subtype_separator + 1, key_value_separator - (key_subtype_separator + 1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work for Dictionary<MyEnum, Node> (see #101801). It will take the enum hint_string Value1,Value2,Value3 as the class_name which results in the following error when calling Dictionary::set_typed:

ERROR: Class names can only be set for type OBJECT.

I don't think you can assume that the hint_string will always be the class_name. I think that only works when the PropertyHint is PROPERTY_HINT_NODE_TYPE or PROPERTY_HINT_RESOURCE_TYPE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nodes in typed dictionaries do not do not show changes in game made by code (4.4 dev 3 / C#)
3 participants