diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2020-11-09 14:34:49 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-09 14:34:49 +0100 | 
| commit | 01154f1ad20e7c6707ef1229394a4330eb4e31b7 (patch) | |
| tree | 3a3195b3e39238c7c307b8d7e941a72871f60c0c /editor/array_property_edit.cpp | |
| parent | eda8f69c19ffaa219bdb0afe67dfb7df17a46d1c (diff) | |
| parent | 221a2a17422dfbb7e0be5ca42fe56b91adb656e3 (diff) | |
Merge pull request #43403 from reduz/variant-constructor-refactor
Refactored variant constructor logic
Diffstat (limited to 'editor/array_property_edit.cpp')
| -rw-r--r-- | editor/array_property_edit.cpp | 7 | 
1 files changed, 4 insertions, 3 deletions
diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp index 20f947e707..0b6b1ef6a7 100644 --- a/editor/array_property_edit.cpp +++ b/editor/array_property_edit.cpp @@ -43,7 +43,7 @@ Variant ArrayPropertyEdit::get_array() const {  	Variant arr = o->get(property);  	if (!arr.is_array()) {  		Callable::CallError ce; -		arr = Variant::construct(default_type, nullptr, 0, ce); +		Variant::construct(default_type, arr, nullptr, 0, ce);  	}  	return arr;  } @@ -107,7 +107,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {  					new_type = arr.get(size - 1).get_type();  				}  				if (new_type != Variant::NIL) { -					init = Variant::construct(new_type, nullptr, 0, ce); +					Variant::construct(new_type, init, nullptr, 0, ce);  					for (int i = size; i < newsize; i++) {  						ur->add_do_method(this, "_set_value", i, init);  					} @@ -136,7 +136,8 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {  			Variant value = arr.get(idx);  			if (value.get_type() != type && type >= 0 && type < Variant::VARIANT_MAX) {  				Callable::CallError ce; -				Variant new_value = Variant::construct(Variant::Type(type), nullptr, 0, ce); +				Variant new_value; +				Variant::construct(Variant::Type(type), new_value, nullptr, 0, ce);  				UndoRedo *ur = EditorNode::get_undo_redo();  				ur->create_action(TTR("Change Array Value Type"));  |