Inspector: Fix clearing array/dictionary element with `<Object#null>`

(cherry picked from commit ed86c33002)
This commit is contained in:
Danil Alexeev 2023-10-31 11:36:29 +03:00 committed by Rémi Verschelde
parent 5db5f0b52b
commit d25e28d9ae
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 8 additions and 0 deletions

View File

@ -198,6 +198,10 @@ void EditorPropertyArray::_property_changed(const String &p_property, Variant p_
return; return;
} }
if (p_value.get_type() == Variant::OBJECT && p_value.is_null()) {
p_value = Variant(); // `EditorResourcePicker` resets to `Ref<Resource>()`. See GH-82716.
}
int index; int index;
if (p_property.begins_with("metadata/")) { if (p_property.begins_with("metadata/")) {
index = p_property.get_slice("/", 2).to_int(); index = p_property.get_slice("/", 2).to_int();
@ -726,6 +730,10 @@ EditorPropertyArray::EditorPropertyArray() {
///////////////////// DICTIONARY /////////////////////////// ///////////////////// DICTIONARY ///////////////////////////
void EditorPropertyDictionary::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) { void EditorPropertyDictionary::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) {
if (p_value.get_type() == Variant::OBJECT && p_value.is_null()) {
p_value = Variant(); // `EditorResourcePicker` resets to `Ref<Resource>()`. See GH-82716.
}
if (p_property == "new_item_key") { if (p_property == "new_item_key") {
object->set_new_item_key(p_value); object->set_new_item_key(p_value);
} else if (p_property == "new_item_value") { } else if (p_property == "new_item_value") {