Refactored variant constructor logic
This commit is contained in:
parent
593e35346a
commit
221a2a1742
33 changed files with 1369 additions and 571 deletions
|
|
@ -186,7 +186,7 @@ void EditorPropertyArray::_change_type_menu(int p_index) {
|
|||
|
||||
Variant value;
|
||||
Callable::CallError ce;
|
||||
value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
|
||||
Variant::construct(Variant::Type(p_index), value, nullptr, 0, ce);
|
||||
Variant array = object->get_array();
|
||||
array.set(changing_type_idx, value);
|
||||
|
||||
|
|
@ -445,7 +445,7 @@ void EditorPropertyArray::drop_data_fw(const Point2 &p_point, const Variant &p_d
|
|||
// Handle the case where array is not initialised yet
|
||||
if (!array.is_array()) {
|
||||
Callable::CallError ce;
|
||||
array = Variant::construct(array_type, nullptr, 0, ce);
|
||||
Variant::construct(array_type, array, nullptr, 0, ce);
|
||||
}
|
||||
|
||||
// Loop the file array and add to existing array
|
||||
|
|
@ -491,7 +491,7 @@ void EditorPropertyArray::_edit_pressed() {
|
|||
Variant array = get_edited_object()->get(get_edited_property());
|
||||
if (!array.is_array()) {
|
||||
Callable::CallError ce;
|
||||
array = Variant::construct(array_type, nullptr, 0, ce);
|
||||
Variant::construct(array_type, array, nullptr, 0, ce);
|
||||
|
||||
get_edited_object()->set(get_edited_property(), array);
|
||||
}
|
||||
|
|
@ -524,7 +524,9 @@ void EditorPropertyArray::_length_changed(double p_page) {
|
|||
for (int i = previous_size; i < size; i++) {
|
||||
if (array.get(i).get_type() == Variant::NIL) {
|
||||
Callable::CallError ce;
|
||||
array.set(i, Variant::construct(subtype, nullptr, 0, ce));
|
||||
Variant r;
|
||||
Variant::construct(subtype, r, nullptr, 0, ce);
|
||||
array.set(i, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -534,7 +536,9 @@ void EditorPropertyArray::_length_changed(double p_page) {
|
|||
// Pool*Array don't initialize their elements, have to do it manually
|
||||
for (int i = previous_size; i < size; i++) {
|
||||
Callable::CallError ce;
|
||||
array.set(i, Variant::construct(array.get(i).get_type(), nullptr, 0, ce));
|
||||
Variant r;
|
||||
Variant::construct(array.get(i).get_type(), r, nullptr, 0, ce);
|
||||
array.set(i, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -657,7 +661,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) {
|
|||
if (changing_type_idx < 0) {
|
||||
Variant value;
|
||||
Callable::CallError ce;
|
||||
value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
|
||||
Variant::construct(Variant::Type(p_index), value, nullptr, 0, ce);
|
||||
if (changing_type_idx == -1) {
|
||||
object->set_new_item_key(value);
|
||||
} else {
|
||||
|
|
@ -672,7 +676,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) {
|
|||
if (p_index < Variant::VARIANT_MAX) {
|
||||
Variant value;
|
||||
Callable::CallError ce;
|
||||
value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
|
||||
Variant::construct(Variant::Type(p_index), value, nullptr, 0, ce);
|
||||
Variant key = dict.get_key_at_index(changing_type_idx);
|
||||
dict[key] = value;
|
||||
} else {
|
||||
|
|
@ -1044,7 +1048,7 @@ void EditorPropertyDictionary::_edit_pressed() {
|
|||
Variant prop_val = get_edited_object()->get(get_edited_property());
|
||||
if (prop_val.get_type() == Variant::NIL) {
|
||||
Callable::CallError ce;
|
||||
prop_val = Variant::construct(Variant::DICTIONARY, nullptr, 0, ce);
|
||||
Variant::construct(Variant::DICTIONARY, prop_val, nullptr, 0, ce);
|
||||
get_edited_object()->set(get_edited_property(), prop_val);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue