Merge pull request #76814 from KoBeWi/underdata

Don't refresh inspector when changing internal meta
This commit is contained in:
Rémi Verschelde 2023-05-09 17:44:49 +02:00
commit ee931e2be5
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 13 additions and 4 deletions

View File

@ -884,8 +884,13 @@ void Object::set_meta(const StringName &p_name, const Variant &p_value) {
if (p_value.get_type() == Variant::NIL) {
if (metadata.has(p_name)) {
metadata.erase(p_name);
metadata_properties.erase("metadata/" + p_name.operator String());
notify_property_list_changed();
const String &sname = p_name;
metadata_properties.erase("metadata/" + sname);
if (!sname.begins_with("_")) {
// Metadata starting with _ don't show up in the inspector, so no need to update.
notify_property_list_changed();
}
}
return;
}
@ -896,8 +901,12 @@ void Object::set_meta(const StringName &p_name, const Variant &p_value) {
} else {
ERR_FAIL_COND(!p_name.operator String().is_valid_identifier());
Variant *V = &metadata.insert(p_name, p_value)->value;
metadata_properties["metadata/" + p_name.operator String()] = V;
notify_property_list_changed();
const String &sname = p_name;
metadata_properties["metadata/" + sname] = V;
if (!sname.begins_with("_")) {
notify_property_list_changed();
}
}
}