diff options
author | Lightning_A <aaronjrecord@gmail.com> | 2021-03-29 10:45:42 -0600 |
---|---|---|
committer | Lightning_A <aaronjrecord@gmail.com> | 2021-07-11 16:09:39 -0600 |
commit | ec67266af388496a6d134144dc2c3d38710b154e (patch) | |
tree | 93a34bfdff21e2afb76cdce8422a2fca3abf6759 /editor/editor_properties_array_dict.h | |
parent | fb3961b2ef9ed03501f98a8aa621f78679cc2be9 (diff) | |
download | redot-engine-ec67266af388496a6d134144dc2c3d38710b154e.tar.gz |
Add the ability to reorder arrays from the inspector
Diffstat (limited to 'editor/editor_properties_array_dict.h')
-rw-r--r-- | editor/editor_properties_array_dict.h | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h index aa2d8744b1..7547d57346 100644 --- a/editor/editor_properties_array_dict.h +++ b/editor/editor_properties_array_dict.h @@ -84,19 +84,25 @@ class EditorPropertyArray : public EditorProperty { bool dropping; Ref<EditorPropertyArrayObject> object; - int page_len = 20; - int page_idx = 0; - int changing_type_idx; + int page_length = 20; + int page_index = 0; + int changing_type_index; Button *edit; VBoxContainer *vbox; - EditorSpinSlider *length; - EditorSpinSlider *page; - HBoxContainer *page_hb; + EditorSpinSlider *size_slider; + EditorSpinSlider *page_slider; + HBoxContainer *page_hbox; Variant::Type array_type; Variant::Type subtype; PropertyHint subtype_hint; String subtype_hint_string; + int reorder_from_index = -1; + int reorder_to_index = -1; + float reorder_mouse_y_delta = 0.0f; + HBoxContainer *reorder_selected_element_hbox = nullptr; + Button *reorder_selected_button = nullptr; + void _page_changed(double p_page); void _length_changed(double p_page); void _edit_pressed(); @@ -112,6 +118,10 @@ class EditorPropertyArray : public EditorProperty { bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); + void _reorder_button_gui_input(const Ref<InputEvent> &p_event); + void _reorder_button_down(int p_index); + void _reorder_button_up(); + protected: static void _bind_methods(); void _notification(int p_what); @@ -129,14 +139,14 @@ class EditorPropertyDictionary : public EditorProperty { bool updating; Ref<EditorPropertyDictionaryObject> object; - int page_len = 20; - int page_idx = 0; - int changing_type_idx; + int page_length = 20; + int page_index = 0; + int changing_type_index; Button *edit; VBoxContainer *vbox; - EditorSpinSlider *length; - EditorSpinSlider *page; - HBoxContainer *page_hb; + EditorSpinSlider *size_slider; + EditorSpinSlider *page_slider; + HBoxContainer *page_hbox; void _page_changed(double p_page); void _edit_pressed(); |