diff options
Diffstat (limited to 'editor/editor_inspector.h')
-rw-r--r-- | editor/editor_inspector.h | 78 |
1 files changed, 46 insertions, 32 deletions
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 3c482a07e7..c5bcbe0725 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -31,10 +31,12 @@ #ifndef EDITOR_INSPECTOR_H #define EDITOR_INSPECTOR_H +#include "editor_property_name_processor.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/dialogs.h" #include "scene/gui/line_edit.h" +#include "scene/gui/option_button.h" #include "scene/gui/panel_container.h" #include "scene/gui/scroll_container.h" #include "scene/gui/texture_rect.h" @@ -66,7 +68,7 @@ private: String label; int text_size; friend class EditorInspector; - Object *object; + Object *object = nullptr; StringName property; String property_path; @@ -109,9 +111,9 @@ private: float split_ratio; Vector<Control *> focusables; - Control *label_reference; - Control *bottom_editor; - PopupMenu *menu; + Control *label_reference = nullptr; + Control *bottom_editor = nullptr; + PopupMenu *menu = nullptr; mutable String tooltip_text; @@ -126,7 +128,7 @@ protected: virtual void _set_read_only(bool p_read_only); virtual void gui_input(const Ref<InputEvent> &p_event) override; - virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override; + virtual void shortcut_input(const Ref<InputEvent> &p_event) override; const Color *_get_property_colors(); public: @@ -267,14 +269,14 @@ class EditorInspectorSection : public Container { bool foldable = false; int indent_depth = 0; - Timer *dropping_unfold_timer; + Timer *dropping_unfold_timer = nullptr; bool dropping = false; void _test_unfold(); protected: Object *object = nullptr; - VBoxContainer *vbox; + VBoxContainer *vbox = nullptr; void _notification(int p_what); static void _bind_methods(); @@ -295,7 +297,7 @@ public: class EditorInspectorArray : public EditorInspectorSection { GDCLASS(EditorInspectorArray, EditorInspectorSection); - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; enum Mode { MODE_NONE, @@ -307,16 +309,16 @@ class EditorInspectorArray : public EditorInspectorSection { int count = 0; - VBoxContainer *elements_vbox; + VBoxContainer *elements_vbox = nullptr; - Control *control_dropping; + Control *control_dropping = nullptr; bool dropping = false; - Button *add_button; + Button *add_button = nullptr; - AcceptDialog *resize_dialog; + AcceptDialog *resize_dialog = nullptr; int new_size = 0; - LineEdit *new_size_line_edit; + LineEdit *new_size_line_edit = nullptr; // Pagination int page_length = 5; @@ -335,14 +337,14 @@ class EditorInspectorArray : public EditorInspectorSection { OPTION_RESIZE_ARRAY, }; int popup_array_index_pressed = -1; - PopupMenu *rmb_popup; + PopupMenu *rmb_popup = nullptr; struct ArrayElement { - PanelContainer *panel; - MarginContainer *margin; - HBoxContainer *hbox; - TextureRect *move_texture_rect; - VBoxContainer *vbox; + PanelContainer *panel = nullptr; + MarginContainer *margin = nullptr; + HBoxContainer *hbox = nullptr; + TextureRect *move_texture_rect = nullptr; + VBoxContainer *vbox = nullptr; }; LocalVector<ArrayElement> array_elements; @@ -397,12 +399,12 @@ class EditorPaginator : public HBoxContainer { int page = 0; int max_page = 0; - Button *first_page_button; - Button *prev_page_button; - LineEdit *page_line_edit; - Label *page_count_label; - Button *next_page_button; - Button *last_page_button; + Button *first_page_button = nullptr; + Button *prev_page_button = nullptr; + LineEdit *page_line_edit = nullptr; + Label *page_count_label = nullptr; + Button *next_page_button = nullptr; + Button *last_page_button = nullptr; void _first_page_button_pressed(); void _prev_page_button_pressed(); @@ -423,14 +425,14 @@ public: class EditorInspector : public ScrollContainer { GDCLASS(EditorInspector, ScrollContainer); - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; enum { MAX_PLUGINS = 1024 }; static Ref<EditorInspectorPlugin> inspector_plugins[MAX_PLUGINS]; static int inspector_plugin_count; - VBoxContainer *main_vbox; + VBoxContainer *main_vbox = nullptr; //map use to cache the instantiated editors Map<StringName, List<EditorProperty *>> editor_property_map; @@ -438,15 +440,16 @@ class EditorInspector : public ScrollContainer { Set<StringName> pending; void _clear(); - Object *object; + Object *object = nullptr; // - LineEdit *search_box; + LineEdit *search_box = nullptr; bool show_categories = false; bool hide_script = true; + bool hide_metadata = true; bool use_doc_hints = false; - bool capitalize_paths = true; + EditorPropertyNameProcessor::Style property_name_style = EditorPropertyNameProcessor::STYLE_CAPITALIZED; bool use_filter = false; bool autoclear = false; bool use_folding = false; @@ -511,6 +514,15 @@ class EditorInspector : public ScrollContainer { void _update_inspector_bg(); + ConfirmationDialog *add_meta_dialog = nullptr; + LineEdit *add_meta_name = nullptr; + OptionButton *add_meta_type = nullptr; + Label *add_meta_error = nullptr; + + void _add_meta_confirm(); + void _show_add_meta_dialog(); + void _check_meta_name(String name); + protected: static void _bind_methods(); void _notification(int p_what); @@ -534,13 +546,15 @@ public: void set_keying(bool p_active); void set_read_only(bool p_read_only); - bool is_capitalize_paths_enabled() const; - void set_enable_capitalize_paths(bool p_capitalize); + EditorPropertyNameProcessor::Style get_property_name_style() const; + void set_property_name_style(EditorPropertyNameProcessor::Style p_style); + void set_autoclear(bool p_enable); void set_show_categories(bool p_show); void set_use_doc_hints(bool p_enable); void set_hide_script(bool p_hide); + void set_hide_metadata(bool p_hide); void set_use_filter(bool p_use); void register_text_enter(Node *p_line_edit); |