diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-07-15 14:01:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-15 14:01:31 +0200 |
commit | 6ddaebc0910d7a145b0fb1ffe4f6cdb1cc011f59 (patch) | |
tree | 3fa92bac5f3cefd8c4cb2443ea90c7d3b27ad16c /editor/editor_properties_array_dict.h | |
parent | eb23e5254244815c56aeb34c9ed2e604c10933f0 (diff) | |
parent | ec67266af388496a6d134144dc2c3d38710b154e (diff) |
Merge pull request #47538 from LightningAA/inspector-reorder-array-4.0
Add the ability to reorder array elements 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(); |