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 metadata storing empty dictionary in scenes #30715

Closed
wants to merge 1 commit into from
Closed

Fix metadata storing empty dictionary in scenes #30715

wants to merge 1 commit into from

Conversation

Xrayez
Copy link
Contributor

@Xrayez Xrayez commented Jul 20, 2019

Fixes an issue described in #22642 (comment).

Completely not sure whether it's a good way to manipulate property usage flags this way. There was some flags that allowed this kind of usage but those are deprecated now (which might explain why it worked a year ago @YeldhamDev):

godot/core/object.h

Lines 107 to 109 in 2ca3e47

//those below are deprecated thanks to ClassDB's now class value cache
//PROPERTY_USAGE_STORE_IF_NONZERO = 512, //only store if nonzero
//PROPERTY_USAGE_STORE_IF_NONONE = 1024, //only store if false

This would prevent unnecessary noise in version control systems for projects already in work.

p_list->push_back(PropertyInfo(Variant::DICTIONARY, "__meta__", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT));
int metadata_property_usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK;
if (!metadata.empty()) {
metadata_property_usage |= PROPERTY_USAGE_STORAGE;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes it PROPERTY_USAGE_DEFAULT.

@akien-mga
Copy link
Member

It seems to work fine for script without the need to do this conditional storage, I think the issue is deeper than that (likely related to the Dictionary type). That's why in #22642 (comment) it also appears as "revertable" even when empty.

@akien-mga akien-mga added this to the 3.2 milestone Jul 20, 2019
@akien-mga
Copy link
Member

So far there's no other exposed property of type Dictionary which is not using either PROPERTY_USAGE_INTERNAL and/or PROPERTY_USAGE_NOEDITOR.

I guess the logic for EditorPropertyRevert::can_property_revert() doesn't properly handle Dictionary, and maybe the logic used for export (Dictionary) is different? (CC @bojidar-bg)

@bojidar-bg
Copy link
Contributor

I think #29222 would resolve this. Currently Dictionary equality checks are done by reference, unlike other non-Object types, which are compared by value.

@Xrayez
Copy link
Contributor Author

Xrayez commented Jul 21, 2019

Yes, #29222 does solve this, manually cherry-picked it locally on top of master to test it, so this one could be closed once that's merged. It also get rids of the issue with appearing "revertable".

@akien-mga
Copy link
Member

Superseded by #30749 (and #29222 once it would be merged).

@akien-mga akien-mga closed this Jul 22, 2019
@Xrayez Xrayez deleted the metadata-empty branch July 22, 2019 10:07
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.

3 participants