diff --git a/tools/editor/plugins/item_list_editor_plugin.cpp b/tools/editor/plugins/item_list_editor_plugin.cpp index fa261edea30..9c53c73afdf 100644 --- a/tools/editor/plugins/item_list_editor_plugin.cpp +++ b/tools/editor/plugins/item_list_editor_plugin.cpp @@ -30,7 +30,6 @@ #include "io/resource_loader.h" - bool ItemListPlugin::_set(const StringName& p_name, const Variant& p_value) { String name = p_name; @@ -45,12 +44,10 @@ bool ItemListPlugin::_set(const StringName& p_name, const Variant& p_value) { set_item_checkable(idx,p_value); else if (what=="checked") set_item_checked(idx,p_value); - else if (what=="enabled") - set_item_enabled(idx,p_value); - else if (what=="accel") - set_item_accel(idx,p_value); else if (what=="id") set_item_id(idx,p_value); + else if (what=="enabled") + set_item_enabled(idx,p_value); else if (what=="separator") set_item_separator(idx,p_value); else @@ -60,6 +57,7 @@ bool ItemListPlugin::_set(const StringName& p_name, const Variant& p_value) { } bool ItemListPlugin::_get(const StringName& p_name,Variant &r_ret) const { + String name = p_name; int idx = name.get_slice("/",0).to_int(); String what=name.get_slice("/",1); @@ -72,12 +70,10 @@ bool ItemListPlugin::_get(const StringName& p_name,Variant &r_ret) const { r_ret=is_item_checkable(idx); else if (what=="checked") r_ret=is_item_checked(idx); - else if (what=="enabled") - r_ret=is_item_enabled(idx); - else if (what=="accel") - r_ret=get_item_accel(idx); else if (what=="id") r_ret=get_item_id(idx); + else if (what=="enabled") + r_ret=is_item_enabled(idx); else if (what=="separator") r_ret=is_item_separator(idx); else @@ -93,35 +89,112 @@ void ItemListPlugin::_get_property_list( List *p_list) const { p_list->push_back( PropertyInfo(Variant::STRING,base+"text") ); p_list->push_back( PropertyInfo(Variant::OBJECT,base+"icon",PROPERTY_HINT_RESOURCE_TYPE,"Texture") ); - if (get_flags()&FLAG_CHECKABLE) { + int flags = get_flags(); + + if (flags&FLAG_CHECKABLE) { p_list->push_back( PropertyInfo(Variant::BOOL,base+"checkable") ); p_list->push_back( PropertyInfo(Variant::BOOL,base+"checked") ); - } - if (get_flags()&FLAG_ENABLE) { - - p_list->push_back( PropertyInfo(Variant::BOOL,base+"enabled") ); - - } - if (get_flags()&FLAG_ACCEL) { - - p_list->push_back( PropertyInfo(Variant::INT,base+"accel",PROPERTY_HINT_KEY_ACCEL) ); - - } - if (get_flags()&FLAG_ID) { + if (flags&FLAG_ID) p_list->push_back( PropertyInfo(Variant::INT,base+"id",PROPERTY_HINT_RANGE,"-1,4096") ); - } - if (get_flags()&FLAG_SEPARATOR) { + if (flags&FLAG_ENABLE) + p_list->push_back( PropertyInfo(Variant::BOOL,base+"enabled") ); + if (flags&FLAG_SEPARATOR) p_list->push_back( PropertyInfo(Variant::BOOL,base+"separator") ); - - } } } +/////////////////////////////////////////////////////////////// +///////////////////////// PLUGINS ///////////////////////////// +/////////////////////////////////////////////////////////////// + +void ItemListOptionButtonPlugin::set_object(Object *p_object) { + + ob = p_object->cast_to(); +} + +bool ItemListOptionButtonPlugin::handles(Object *p_object) const { + + return p_object->is_type("OptionButton"); +} + +int ItemListOptionButtonPlugin::get_flags() const { + + return FLAG_ICON|FLAG_ID|FLAG_ENABLE; +} + +void ItemListOptionButtonPlugin::add_item() { + + ob->add_item( "Item "+itos(ob->get_item_count())); + _change_notify(); +} + +int ItemListOptionButtonPlugin::get_item_count() const { + + return ob->get_item_count(); +} + +void ItemListOptionButtonPlugin::erase(int p_idx) { + + ob->remove_item(p_idx); + _change_notify(); +} + +ItemListOptionButtonPlugin::ItemListOptionButtonPlugin() { + + ob=NULL; +} + +/////////////////////////////////////////////////////////////// + +void ItemListPopupMenuPlugin::set_object(Object *p_object) { + + if (p_object->is_type("MenuButton")) + pp = p_object->cast_to()->get_popup(); + else + pp = p_object->cast_to(); +} + +bool ItemListPopupMenuPlugin::handles(Object *p_object) const { + + return p_object->is_type("PopupMenu") || p_object->is_type("MenuButton"); +} + +int ItemListPopupMenuPlugin::get_flags() const { + + return FLAG_ICON|FLAG_CHECKABLE|FLAG_ID|FLAG_ENABLE|FLAG_SEPARATOR; +} + +void ItemListPopupMenuPlugin::add_item() { + + pp->add_item( "Item "+itos(pp->get_item_count())); + _change_notify(); +} + +int ItemListPopupMenuPlugin::get_item_count() const { + + return pp->get_item_count(); +} + +void ItemListPopupMenuPlugin::erase(int p_idx) { + + pp->remove_item(p_idx); + _change_notify(); +} + +ItemListPopupMenuPlugin::ItemListPopupMenuPlugin() { + + pp=NULL; +} + +/////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////// + void ItemListEditor::_node_removed(Node *p_node) { if(p_node==item_list) { @@ -129,30 +202,6 @@ void ItemListEditor::_node_removed(Node *p_node) { hide(); dialog->hide(); } - - -} - -void ItemListEditor::_delete_pressed() { - - String p = prop_editor->get_selected_path(); - - if (p.find("/")!=-1) { - - if (selected_idx<0 || selected_idx>=item_plugins.size()) - return; - - item_plugins[selected_idx]->erase(p.get_slice("/",0).to_int());; - } - -} - -void ItemListEditor::_add_pressed() { - - if (selected_idx<0 || selected_idx>=item_plugins.size()) - return; - - item_plugins[selected_idx]->add_item(); } void ItemListEditor::_notification(int p_notification) { @@ -160,57 +209,73 @@ void ItemListEditor::_notification(int p_notification) { if (p_notification==NOTIFICATION_ENTER_TREE) { add_button->set_icon(get_icon("Add","EditorIcons")); - del_button->set_icon(get_icon("Del","EditorIcons")); + del_button->set_icon(get_icon("Remove","EditorIcons")); } } +void ItemListEditor::_add_pressed() { -void ItemListEditor::_menu_option(int p_option) { + if (selected_idx==-1) + return; - - switch(p_option) { - - case MENU_EDIT_ITEMS: { - - dialog->popup_centered_ratio(); - } break; - } + item_plugins[selected_idx]->add_item(); } +void ItemListEditor::_delete_pressed() { + + TreeItem *ti = tree->get_selected(); + + if (!ti) + return; + + if (ti->get_parent()!=tree->get_root()) + return; + + int idx = ti->get_text(0).to_int(); + + if (selected_idx==-1) + return; + + item_plugins[selected_idx]->erase(idx); +} + +void ItemListEditor::_edit_items() { + + dialog->popup_centered(Vector2(300, 400)); +} void ItemListEditor::edit(Node *p_item_list) { item_list=p_item_list; + if (!item_list) { + selected_idx=-1; + property_editor->edit(NULL); + return; + } + for(int i=0;ihandles(p_item_list)) { item_plugins[i]->set_object(p_item_list); - prop_editor->edit(item_plugins[i]); + property_editor->edit(item_plugins[i]); + + if (has_icon(item_list->get_type(), "EditorIcons")) + toolbar_button->set_icon(get_icon(item_list->get_type(), "EditorIcons")); + else + toolbar_button->set_icon(Ref()); + selected_idx=i; return; } } selected_idx=-1; - - prop_editor->edit(NULL); - -} - - -void ItemListEditor::_bind_methods() { - - ObjectTypeDB::bind_method("_menu_option",&ItemListEditor::_menu_option); - ObjectTypeDB::bind_method("_add_button",&ItemListEditor::_add_pressed); - ObjectTypeDB::bind_method("_delete_button",&ItemListEditor::_delete_pressed); - - //ObjectTypeDB::bind_method("_populate",&ItemListEditor::_populate); - + property_editor->edit(NULL); } bool ItemListEditor::handles(Object *p_object) const { - return false; + for(int i=0;ihandles(p_object)) { return true; @@ -218,56 +283,64 @@ bool ItemListEditor::handles(Object *p_object) const { } return false; - } + +void ItemListEditor::_bind_methods() { + + ObjectTypeDB::bind_method("_edit_items",&ItemListEditor::_edit_items); + ObjectTypeDB::bind_method("_add_button",&ItemListEditor::_add_pressed); + ObjectTypeDB::bind_method("_delete_button",&ItemListEditor::_delete_pressed); +} + ItemListEditor::ItemListEditor() { selected_idx=-1; - options = memnew( MenuButton ); - add_child(options); - options->set_area_as_parent_rect(); - options->set_text("Items"); - options->get_popup()->add_item("Edit Items",MENU_EDIT_ITEMS); - //options->get_popup()->add_item("Clear",MENU_CLEAR); + add_child( memnew( VSeparator ) ); - options->get_popup()->connect("item_pressed", this,"_menu_option"); + toolbar_button = memnew( ToolButton ); + toolbar_button->set_text("Items"); + add_child(toolbar_button); + toolbar_button->connect("pressed",this,"_edit_items"); dialog = memnew( AcceptDialog ); + dialog->set_title("Item List Editor"); add_child( dialog ); - + VBoxContainer *vbc = memnew( VBoxContainer ); + dialog->add_child(vbc); + dialog->set_child_rect(vbc); HBoxContainer *hbc = memnew( HBoxContainer ); - - dialog->add_child(hbc); - dialog->set_child_rect(hbc); - - prop_editor = memnew( PropertyEditor ); - - hbc->add_child(prop_editor); - prop_editor->set_h_size_flags(SIZE_EXPAND_FILL); - - VBoxContainer *vbc = memnew( VBoxContainer ); - hbc->add_child(vbc); + hbc->set_h_size_flags(SIZE_EXPAND_FILL); + vbc->add_child(hbc); add_button = memnew( Button ); - //add_button->set_text("Add"); + add_button->set_text("Add"); + hbc->add_child(add_button); add_button->connect("pressed",this,"_add_button"); - vbc->add_child(add_button); + + hbc->add_spacer(); del_button = memnew( Button ); - //del_button->set_text("Del"); + del_button->set_text("Delete"); + hbc->add_child(del_button); del_button->connect("pressed",this,"_delete_button"); - vbc->add_child(del_button); - - dialog->set_title("Item List"); - prop_editor->hide_top_label(); - + property_editor = memnew( PropertyEditor ); + property_editor->hide_top_label(); + property_editor->set_subsection_selectable(true); + vbc->add_child(property_editor); + property_editor->set_v_size_flags(SIZE_EXPAND_FILL); + tree = property_editor->get_scene_tree(); } +ItemListEditor::~ItemListEditor() { + + for(int i=0;ihide(); item_list_editor->edit(NULL); } - } - -ItemListEditor::~ItemListEditor() { - - for(int i=0;icast_to(); } - - virtual bool handles(Object *p_object) const { return p_object->cast_to()!=NULL; } - - virtual int get_flags() const { return FLAG_ICON|FLAG_ID|FLAG_ENABLE; } - - virtual void set_item_text(int p_idx,const String& p_text){ ob->set_item_text(p_idx,p_text);} - virtual void set_item_icon(int p_idx,const Ref& p_tex){ ob->set_item_icon(p_idx,p_tex);} - virtual void set_item_enabled(int p_idx,int p_enabled){ ob->set_item_disabled(p_idx,!p_enabled);} - virtual void set_item_id(int p_idx,int p_id){ ob->set_item_ID(p_idx,p_id);} - - - virtual String get_item_text(int p_idx) const{ return ob->get_item_text(p_idx); }; - virtual Ref get_item_icon(int p_idx) const{ return ob->get_item_icon(p_idx); }; - virtual bool is_item_enabled(int p_idx) const{ return !ob->is_item_disabled(p_idx); }; - virtual int get_item_id(int p_idx) const{ return ob->get_item_ID(p_idx); }; - - virtual void add_item() { ob->add_item( "New Item "+itos(ob->get_item_count())); _change_notify();} - virtual int get_item_count() const { return ob->get_item_count(); } - virtual void erase(int p_idx) { ob->remove_item(p_idx); _change_notify();} - - - ItemListOptionButtonPlugin() { ob=NULL; } -}; - -class ItemListPopupMenuPlugin : public ItemListPlugin { - - OBJ_TYPE(ItemListPopupMenuPlugin,ItemListPlugin); - - PopupMenu *pp; -public: - - virtual void set_object(Object *p_object) { - if (p_object->cast_to()) - pp = p_object->cast_to()->get_popup(); - else - pp = p_object->cast_to(); - } - - virtual bool handles(Object *p_object) const { return p_object->cast_to()!=NULL || p_object->cast_to()!=NULL; } - - virtual int get_flags() const { return FLAG_ICON|FLAG_ID|FLAG_ENABLE|FLAG_CHECKABLE|FLAG_SEPARATOR|FLAG_ACCEL; } - - virtual void set_item_text(int p_idx,const String& p_text){ pp->set_item_text(p_idx,p_text); } - virtual void set_item_icon(int p_idx,const Ref& p_tex){ pp->set_item_icon(p_idx,p_tex);} - virtual void set_item_checkable(int p_idx,bool p_check){ pp->set_item_as_checkable(p_idx,p_check);} - virtual void set_item_checked(int p_idx,bool p_checked){ pp->set_item_checked(p_idx,p_checked);} - virtual void set_item_accel(int p_idx,int p_accel){ pp->set_item_accelerator(p_idx,p_accel);} - virtual void set_item_enabled(int p_idx,int p_enabled){ pp->set_item_disabled(p_idx,!p_enabled);} - virtual void set_item_id(int p_idx,int p_id){ pp->set_item_ID(p_idx,p_idx);} - virtual void set_item_separator(int p_idx,bool p_separator){ pp->set_item_as_separator(p_idx,p_separator);} - - - virtual String get_item_text(int p_idx) const{ return pp->get_item_text(p_idx); }; - virtual Ref get_item_icon(int p_idx) const{ return pp->get_item_icon(p_idx); }; - virtual bool is_item_checkable(int p_idx) const{ return pp->is_item_checkable(p_idx); }; - virtual bool is_item_checked(int p_idx) const{ return pp->is_item_checked(p_idx); }; - virtual int get_item_accel(int p_idx) const{ return pp->get_item_accelerator(p_idx); }; - virtual bool is_item_enabled(int p_idx) const{ return !pp->is_item_disabled(p_idx); }; - virtual int get_item_id(int p_idx) const{ return pp->get_item_ID(p_idx); }; - virtual bool is_item_separator(int p_idx) const{ return pp->is_item_separator(p_idx); }; - - - - virtual void add_item() { pp->add_item( "New Item "+itos(pp->get_item_count())); _change_notify();} - virtual int get_item_count() const { return pp->get_item_count(); } - virtual void erase(int p_idx) { pp->remove_item(p_idx); _change_notify();} - - - ItemListPopupMenuPlugin() { pp=NULL; } -}; - - - - - - ItemListEditorPlugin::ItemListEditorPlugin(EditorNode *p_node) { editor=p_node; item_list_editor = memnew( ItemListEditor ); - editor->get_viewport()->add_child(item_list_editor); - -// item_list_editor->set_anchor(MARGIN_LEFT,Control::ANCHOR_END); -// item_list_editor->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END); - item_list_editor->set_margin(MARGIN_LEFT,180); - item_list_editor->set_margin(MARGIN_RIGHT,230); - item_list_editor->set_margin(MARGIN_TOP,0); - item_list_editor->set_margin(MARGIN_BOTTOM,10); - + CanvasItemEditor::get_singleton()->add_control_to_menu_panel(item_list_editor); item_list_editor->hide(); - item_list_editor->add_plugin( memnew( ItemListOptionButtonPlugin) ); - item_list_editor->add_plugin( memnew( ItemListPopupMenuPlugin) ); + item_list_editor->add_plugin( memnew( ItemListOptionButtonPlugin ) ); + item_list_editor->add_plugin( memnew( ItemListPopupMenuPlugin ) ); } - ItemListEditorPlugin::~ItemListEditorPlugin() { } diff --git a/tools/editor/plugins/item_list_editor_plugin.h b/tools/editor/plugins/item_list_editor_plugin.h index 351dbb800d4..b40a2c22f85 100644 --- a/tools/editor/plugins/item_list_editor_plugin.h +++ b/tools/editor/plugins/item_list_editor_plugin.h @@ -31,10 +31,11 @@ #include "tools/editor/editor_plugin.h" #include "tools/editor/editor_node.h" +#include "canvas_item_editor_plugin.h" + #include "scene/gui/option_button.h" #include "scene/gui/menu_button.h" #include "scene/gui/popup_menu.h" -#include "scene/gui/spin_box.h" /** @author Juan Linietsky @@ -51,43 +52,42 @@ protected: bool _get(const StringName& p_name,Variant &r_ret) const; void _get_property_list( List *p_list) const; - public: enum Flags { FLAG_ICON=1, FLAG_CHECKABLE=2, - FLAG_ACCEL=4, - FLAG_ID=8, - FLAG_ENABLE=16, - FLAG_SEPARATOR=32 + FLAG_ID=4, + FLAG_ENABLE=8, + FLAG_SEPARATOR=16 }; virtual void set_object(Object *p_object)=0; - virtual bool handles(Object *p_object) const=0; virtual int get_flags() const=0; - virtual void set_item_text(int p_idx,const String& p_text){} - virtual void set_item_icon(int p_idx,const Ref& p_tex){} - virtual void set_item_checkable(int p_idx,bool p_check){} - virtual void set_item_checked(int p_idx,bool p_checked){} - virtual void set_item_accel(int p_idx,int p_accel){} - virtual void set_item_enabled(int p_idx,int p_enabled){} - virtual void set_item_id(int p_idx,int p_id){} - virtual void set_item_separator(int p_idx,bool p_separator){} - - + virtual void set_item_text(int p_idx, const String& p_text) {} virtual String get_item_text(int p_idx) const{ return ""; }; + + virtual void set_item_icon(int p_idx, const Ref& p_tex) {} virtual Ref get_item_icon(int p_idx) const{ return Ref(); }; + + virtual void set_item_checkable(int p_idx, bool p_check) {} virtual bool is_item_checkable(int p_idx) const{ return false; }; + + virtual void set_item_checked(int p_idx, bool p_checked) {} virtual bool is_item_checked(int p_idx) const{ return false; }; - virtual int get_item_accel(int p_idx) const{ return 0; }; + + virtual void set_item_enabled(int p_idx, int p_enabled) {} virtual bool is_item_enabled(int p_idx) const{ return false; }; + + virtual void set_item_id(int p_idx, int p_id) {} virtual int get_item_id(int p_idx) const{ return -1; }; - virtual bool is_item_separator(int p_idx) const{ return false; }; + + virtual void set_item_separator(int p_idx, bool p_separator) {} + virtual bool is_item_separator(int p_idx) const { return false; }; virtual void add_item()=0; virtual int get_item_count() const=0; @@ -96,41 +96,107 @@ public: ItemListPlugin() {} }; -class ItemListEditor : public Control { +/////////////////////////////////////////////////////////////// - OBJ_TYPE(ItemListEditor, Control ); +class ItemListOptionButtonPlugin : public ItemListPlugin { + + OBJ_TYPE(ItemListOptionButtonPlugin,ItemListPlugin); + + OptionButton *ob; +public: + + virtual void set_object(Object *p_object); + virtual bool handles(Object *p_object) const; + virtual int get_flags() const; + + virtual void set_item_text(int p_idx, const String& p_text) { ob->set_item_text(p_idx,p_text); } + virtual String get_item_text(int p_idx) const { return ob->get_item_text(p_idx); } + + virtual void set_item_icon(int p_idx, const Ref& p_tex) { ob->set_item_icon(p_idx, p_tex); } + virtual Ref get_item_icon(int p_idx) const { return ob->get_item_icon(p_idx); } + + virtual void set_item_enabled(int p_idx, int p_enabled) { ob->set_item_disabled(p_idx, !p_enabled); } + virtual bool is_item_enabled(int p_idx) const { return !ob->is_item_disabled(p_idx); } + + virtual void set_item_id(int p_idx, int p_id) { ob->set_item_ID(p_idx,p_id); } + virtual int get_item_id(int p_idx) const { return ob->get_item_ID(p_idx); } + + virtual void add_item(); + virtual int get_item_count() const; + virtual void erase(int p_idx); + + ItemListOptionButtonPlugin(); +}; + +class ItemListPopupMenuPlugin : public ItemListPlugin { + + OBJ_TYPE(ItemListPopupMenuPlugin,ItemListPlugin); + + PopupMenu *pp; +public: + + virtual void set_object(Object *p_object); + virtual bool handles(Object *p_object) const; + virtual int get_flags() const; + + virtual void set_item_text(int p_idx, const String& p_text) { pp->set_item_text(p_idx,p_text); } + virtual String get_item_text(int p_idx) const { return pp->get_item_text(p_idx); } + + virtual void set_item_icon(int p_idx, const Ref& p_tex) { pp->set_item_icon(p_idx,p_tex); } + virtual Ref get_item_icon(int p_idx) const { return pp->get_item_icon(p_idx); } + + virtual void set_item_checkable(int p_idx, bool p_check) { pp->set_item_as_checkable(p_idx,p_check); } + virtual bool is_item_checkable(int p_idx) const { return pp->is_item_checkable(p_idx); } + + virtual void set_item_checked(int p_idx, bool p_checked) { pp->set_item_checked(p_idx,p_checked); } + virtual bool is_item_checked(int p_idx) const { return pp->is_item_checked(p_idx); } + + virtual void set_item_enabled(int p_idx, int p_enabled) { pp->set_item_disabled(p_idx,!p_enabled); } + virtual bool is_item_enabled(int p_idx) const { return !pp->is_item_disabled(p_idx); } + + virtual void set_item_id(int p_idx, int p_id) { pp->set_item_ID(p_idx,p_idx); } + virtual int get_item_id(int p_idx) const { return pp->get_item_ID(p_idx); } + + virtual void set_item_separator(int p_idx, bool p_separator) { pp->set_item_as_separator(p_idx,p_separator); } + virtual bool is_item_separator(int p_idx) const { return pp->is_item_separator(p_idx); } + + virtual void add_item(); + virtual int get_item_count() const; + virtual void erase(int p_idx); + + ItemListPopupMenuPlugin(); +}; + +/////////////////////////////////////////////////////////////// + +class ItemListEditor : public HBoxContainer { + + OBJ_TYPE(ItemListEditor,HBoxContainer); Node *item_list; - enum { - - MENU_EDIT_ITEMS, - MENU_CLEAR - }; + ToolButton *toolbar_button; AcceptDialog *dialog; - - PropertyEditor *prop_editor; - - MenuButton * options; - int selected_idx; - + PropertyEditor *property_editor; + Tree *tree; Button *add_button; Button *del_button; - -// FileDialog *emission_file_dialog; - void _menu_option(int); + int selected_idx; Vector item_plugins; - void _node_removed(Node *p_node); + void _edit_items(); + void _add_pressed(); void _delete_pressed(); + + void _node_removed(Node *p_node); + protected: void _notification(int p_notification); - static void _bind_methods(); public: @@ -143,7 +209,7 @@ public: class ItemListEditorPlugin : public EditorPlugin { - OBJ_TYPE( ItemListEditorPlugin, EditorPlugin ); + OBJ_TYPE(ItemListEditorPlugin,EditorPlugin); ItemListEditor *item_list_editor; EditorNode *editor; diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 0fe3dee2ea4..7ab09f04874 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -2207,9 +2207,9 @@ TreeItem *PropertyEditor::get_parent_node(String p_path,HashMapset_editable(0,false); - item->set_selectable(0,false); + item->set_selectable(0,subsection_selectable); item->set_editable(1,false); - item->set_selectable(1,false); + item->set_selectable(1,subsection_selectable); if (item->get_parent()==root) { @@ -3511,7 +3511,15 @@ void PropertyEditor::register_text_enter(Node* p_line_edit) { if (search_box) search_box->connect("text_changed",this,"_filter_changed"); +} +void PropertyEditor::set_subsection_selectable(bool p_selectable) { + + if (p_selectable==subsection_selectable) + return; + + subsection_selectable=p_selectable; + update_tree(); } PropertyEditor::PropertyEditor() { @@ -3573,8 +3581,8 @@ PropertyEditor::PropertyEditor() { show_categories=false; refresh_countdown=0; use_doc_hints=false; - use_filter=false; + subsection_selectable=false; } diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index 5fb8386b1b3..f004616c081 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -163,8 +163,8 @@ class PropertyEditor : public Control { bool show_categories; float refresh_countdown; bool use_doc_hints; - bool use_filter; + bool subsection_selectable; HashMap pending; String selected_property; @@ -239,6 +239,8 @@ public: void set_use_filter(bool p_use); void register_text_enter(Node *p_line_edit); + void set_subsection_selectable(bool p_selectable); + PropertyEditor(); ~PropertyEditor();