Dictionary Editor : keep the type of the last added item.

This commit is contained in:
ajreckof 2024-02-21 17:44:05 +01:00
parent 846d075a2f
commit 7f7d253e53
1 changed files with 13 additions and 3 deletions

View File

@ -780,9 +780,19 @@ void EditorPropertyDictionary::_add_key_value() {
}
Dictionary dict = object->get_dict().duplicate();
dict[object->get_new_item_key()] = object->get_new_item_value();
object->set_new_item_key(Variant());
object->set_new_item_value(Variant());
Variant new_key = object->get_new_item_key();
Variant new_value = object->get_new_item_value();
dict[new_key] = new_value;
Variant::Type type = new_key.get_type();
new_key.zero();
VariantInternal::initialize(&new_key, type);
object->set_new_item_key(new_key);
type = new_value.get_type();
new_value.zero();
VariantInternal::initialize(&new_value, type);
object->set_new_item_value(new_value);
emit_changed(get_edited_property(), dict, "", false);
update_property();