diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-12-31 17:46:07 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-12-31 17:46:07 -0300 |
commit | 565513fb899577b11a1fa3337e479926214eefb9 (patch) | |
tree | 7fbcebe15578b8e1f3bb185e20c597d3a7a6b426 /tools | |
parent | ec3d17b4e2b3d87ec6b46c57280ec853b264b20b (diff) |
When inserting new values in array property editor, keep type of last item, closes #2391
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/array_property_edit.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/editor/array_property_edit.cpp b/tools/editor/array_property_edit.cpp index 64a2762095..8c83ed1c9c 100644 --- a/tools/editor/array_property_edit.cpp +++ b/tools/editor/array_property_edit.cpp @@ -72,6 +72,15 @@ bool ArrayPropertyEdit::_set(const StringName& p_name, const Variant& p_value){ ur->add_undo_method(this,"_set_value",i,arr.get(i)); } + } else if (newsize>size && size) { + + Variant init; + Variant::CallError ce; + init = Variant::construct(arr.get(size-1).get_type(),NULL,0,ce); + for(int i=size;i<newsize;i++) { + ur->add_do_method(this,"_set_value",i,init); + } + } ur->add_do_method(this,"_notif_change"); ur->add_undo_method(this,"_notif_change"); |