Implement name filter to PropertyEditor

- Add search bar to Inspector tab and to Project and Editor settings dialog
This commit is contained in:
Franklin Sobrinho 2015-11-21 13:42:15 -03:00
parent dd09f13f68
commit 82c8190013
8 changed files with 255 additions and 73 deletions

View file

@ -4024,6 +4024,8 @@ void EditorNode::_bind_methods() {
ObjectTypeDB::bind_method("_prepare_history",&EditorNode::_prepare_history); ObjectTypeDB::bind_method("_prepare_history",&EditorNode::_prepare_history);
ObjectTypeDB::bind_method("_select_history",&EditorNode::_select_history); ObjectTypeDB::bind_method("_select_history",&EditorNode::_select_history);
ObjectTypeDB::bind_method("_toggle_search_bar",&EditorNode::_toggle_search_bar);
ObjectTypeDB::bind_method("_clear_search_box",&EditorNode::_clear_search_box);
ObjectTypeDB::bind_method(_MD("add_editor_import_plugin", "plugin"), &EditorNode::add_editor_import_plugin); ObjectTypeDB::bind_method(_MD("add_editor_import_plugin", "plugin"), &EditorNode::add_editor_import_plugin);
ObjectTypeDB::bind_method(_MD("remove_editor_import_plugin", "plugin"), &EditorNode::remove_editor_import_plugin); ObjectTypeDB::bind_method(_MD("remove_editor_import_plugin", "plugin"), &EditorNode::remove_editor_import_plugin);
@ -4517,6 +4519,30 @@ void EditorNode::_scene_tab_changed(int p_tab) {
} }
void EditorNode::_toggle_search_bar(bool p_pressed) {
property_editor->set_use_filter(p_pressed);
if (p_pressed) {
search_bar->show();
search_box->grab_focus();
search_box->select_all();
} else {
search_bar->hide();
}
}
void EditorNode::_clear_search_box() {
if (search_box->get_text()=="")
return;
search_box->clear();
property_editor->update_tree();
}
EditorNode::EditorNode() { EditorNode::EditorNode() {
EditorHelp::generate_doc(); //before any editor classes are crated EditorHelp::generate_doc(); //before any editor classes are crated
@ -5322,6 +5348,12 @@ EditorNode::EditorNode() {
editor_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); editor_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
prop_editor_hb->add_child(editor_path); prop_editor_hb->add_child(editor_path);
search_button = memnew( ToolButton );
search_button->set_toggle_mode(true);
search_button->set_pressed(false);
search_button->set_icon(gui_base->get_icon("Zoom","EditorIcons"));
prop_editor_hb->add_child(search_button);
search_button->connect("toggled",this,"_toggle_search_bar");
object_menu = memnew( MenuButton ); object_menu = memnew( MenuButton );
object_menu->set_icon(gui_base->get_icon("Tools","EditorIcons")); object_menu->set_icon(gui_base->get_icon("Tools","EditorIcons"));
@ -5333,6 +5365,22 @@ EditorNode::EditorNode() {
create_dialog->set_base_type("Resource"); create_dialog->set_base_type("Resource");
create_dialog->connect("create",this,"_resource_created"); create_dialog->connect("create",this,"_resource_created");
search_bar = memnew( HBoxContainer );
search_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL);
prop_editor_base->add_child(search_bar);
search_bar->hide();
l = memnew( Label("Search: ") );
search_bar->add_child(l);
search_box = memnew( LineEdit );
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
search_bar->add_child(search_box);
ToolButton *clear_button = memnew( ToolButton );
clear_button->set_icon(gui_base->get_icon("Close","EditorIcons"));
search_bar->add_child(clear_button);
clear_button->connect("pressed",this,"_clear_search_box");
property_editor = memnew( PropertyEditor ); property_editor = memnew( PropertyEditor );
property_editor->set_autoclear(true); property_editor->set_autoclear(true);
@ -5341,6 +5389,7 @@ EditorNode::EditorNode() {
property_editor->set_use_doc_hints(true); property_editor->set_use_doc_hints(true);
property_editor->hide_top_label(); property_editor->hide_top_label();
property_editor->register_text_enter(search_box);
prop_editor_base->add_child( property_editor ); prop_editor_base->add_child( property_editor );
property_editor->set_undo_redo(&editor_data.get_undo_redo()); property_editor->set_undo_redo(&editor_data.get_undo_redo());

View file

@ -250,6 +250,7 @@ class EditorNode : public Node {
ToolButton *play_scene_button; ToolButton *play_scene_button;
ToolButton *play_custom_scene_button; ToolButton *play_custom_scene_button;
MenuButton *debug_button; MenuButton *debug_button;
ToolButton *search_button;
TextureProgress *audio_vu; TextureProgress *audio_vu;
//MenuButton *fileserver_menu; //MenuButton *fileserver_menu;
@ -268,6 +269,9 @@ class EditorNode : public Node {
ScenesDock *scenes_dock; ScenesDock *scenes_dock;
EditorRunNative *run_native; EditorRunNative *run_native;
HBoxContainer *search_bar;
LineEdit *search_box;
CreateDialog *create_dialog; CreateDialog *create_dialog;
CallDialog *call_dialog; CallDialog *call_dialog;
@ -517,6 +521,9 @@ class EditorNode : public Node {
void _save_docks(); void _save_docks();
void _load_docks(); void _load_docks();
void _toggle_search_bar(bool p_pressed);
void _clear_search_box();
protected: protected:
void _notification(int p_what); void _notification(int p_what);
static void _bind_methods(); static void _bind_methods();

View file

@ -59,6 +59,9 @@ void ProjectSettings::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) { if (p_what==NOTIFICATION_ENTER_TREE) {
search_button->set_icon(get_icon("Zoom","EditorIcons"));
clear_button->set_icon(get_icon("Close","EditorIcons"));
translation_list->connect("button_pressed",this,"_translation_delete"); translation_list->connect("button_pressed",this,"_translation_delete");
_update_actions(); _update_actions();
popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),"Key",InputEvent::KEY); popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),"Key",InputEvent::KEY);
@ -1171,6 +1174,31 @@ void ProjectSettings::_update_autoload() {
} }
void ProjectSettings::_toggle_search_bar(bool p_pressed) {
globals_editor->set_use_filter(p_pressed);
if (p_pressed) {
search_bar->show();
add_prop_bar->hide();
search_box->grab_focus();
search_box->select_all();
} else {
search_bar->hide();
add_prop_bar->show();
}
}
void ProjectSettings::_clear_search_box() {
if (search_box->get_text()=="")
return;
search_box->clear();
globals_editor->update_tree();
}
void ProjectSettings::_bind_methods() { void ProjectSettings::_bind_methods() {
@ -1212,6 +1240,9 @@ void ProjectSettings::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_update_autoload"),&ProjectSettings::_update_autoload); ObjectTypeDB::bind_method(_MD("_update_autoload"),&ProjectSettings::_update_autoload);
ObjectTypeDB::bind_method(_MD("_autoload_delete"),&ProjectSettings::_autoload_delete); ObjectTypeDB::bind_method(_MD("_autoload_delete"),&ProjectSettings::_autoload_delete);
ObjectTypeDB::bind_method(_MD("_clear_search_box"),&ProjectSettings::_clear_search_box);
ObjectTypeDB::bind_method(_MD("_toggle_search_bar"),&ProjectSettings::_toggle_search_bar);
} }
ProjectSettings::ProjectSettings(EditorData *p_data) { ProjectSettings::ProjectSettings(EditorData *p_data) {
@ -1232,87 +1263,93 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
//tab_container->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 15 ); //tab_container->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 15 );
//tab_container->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); //tab_container->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 );
Control *props_base = memnew( Control ); VBoxContainer *props_base = memnew( VBoxContainer );
props_base->set_alignment(BoxContainer::ALIGN_BEGIN);
props_base->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tab_container->add_child(props_base); tab_container->add_child(props_base);
props_base->set_name("General"); props_base->set_name("General");
globals_editor = memnew( PropertyEditor );
props_base->add_child(globals_editor);
globals_editor->set_area_as_parent_rect();
globals_editor->hide_top_label();
globals_editor->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 55 );
globals_editor->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 );
globals_editor->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 );
globals_editor->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 );
globals_editor->set_capitalize_paths(false);
globals_editor->get_scene_tree()->connect("cell_selected",this,"_item_selected");
globals_editor->connect("property_toggled",this,"_item_checked");
globals_editor->connect("property_edited",this,"_settings_prop_edited");
HBoxContainer *hbc = memnew( HBoxContainer );
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
props_base->add_child(hbc);
search_button = memnew( ToolButton );
search_button->set_toggle_mode(true);
search_button->set_pressed(false);
search_button->set_text("Search");
hbc->add_child(search_button);
search_button->connect("toggled",this,"_toggle_search_bar");
hbc->add_child( memnew( VSeparator ) );
add_prop_bar = memnew( HBoxContainer );
add_prop_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->add_child(add_prop_bar);
Label *l = memnew( Label ); Label *l = memnew( Label );
props_base->add_child(l); add_prop_bar->add_child(l);
l->set_pos(Point2(6,5));
l->set_text("Category:"); l->set_text("Category:");
l = memnew( Label );
l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
props_base->add_child(l);
l->set_begin(Point2(0.21,5));
l->set_text("Property:");
l = memnew( Label );
l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
props_base->add_child(l);
l->set_begin(Point2(0.51,5));
l->set_text("Type:");
category = memnew( LineEdit ); category = memnew( LineEdit );
props_base->add_child(category); category->set_h_size_flags(Control::SIZE_EXPAND_FILL);
category->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); add_prop_bar->add_child(category);
category->set_begin( Point2(5,25) );
category->set_end( Point2(0.20,26) );
category->connect("text_entered",this,"_item_adds"); category->connect("text_entered",this,"_item_adds");
l = memnew( Label );
add_prop_bar->add_child(l);
l->set_text("Property:");
property = memnew( LineEdit ); property = memnew( LineEdit );
props_base->add_child(property); property->set_h_size_flags(Control::SIZE_EXPAND_FILL);
property->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); add_prop_bar->add_child(property);
property->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
property->set_begin( Point2(0.21,25) );
property->set_end( Point2(0.50,26) );
property->connect("text_entered",this,"_item_adds"); property->connect("text_entered",this,"_item_adds");
l = memnew( Label );
add_prop_bar->add_child(l);
l->set_text("Type:");
type = memnew( OptionButton ); type = memnew( OptionButton );
props_base->add_child(type); type->set_h_size_flags(Control::SIZE_EXPAND_FILL);
type->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); add_prop_bar->add_child(type);
type->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
type->set_begin( Point2(0.51,25) );
type->set_end( Point2(0.70,26) );
type->add_item("bool"); type->add_item("bool");
type->add_item("int"); type->add_item("int");
type->add_item("float"); type->add_item("float");
type->add_item("string"); type->add_item("string");
Button *add = memnew( Button ); Button *add = memnew( Button );
props_base->add_child(add); add_prop_bar->add_child(add);
add->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
add->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
add->set_begin( Point2(0.71,25) );
add->set_end( Point2(0.85,26) );
add->set_text("Add"); add->set_text("Add");
add->connect("pressed",this,"_item_add"); add->connect("pressed",this,"_item_add");
Button *del = memnew( Button ); Button *del = memnew( Button );
props_base->add_child(del); add_prop_bar->add_child(del);
del->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
del->set_anchor(MARGIN_RIGHT,ANCHOR_END);
del->set_begin( Point2(0.86,25) );
del->set_end( Point2(5,26) );
del->set_text("Del"); del->set_text("Del");
del->connect("pressed",this,"_item_del"); del->connect("pressed",this,"_item_del");
/* search_bar = memnew( HBoxContainer );
search_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->add_child(search_bar);
search_bar->hide();
search_box = memnew( LineEdit );
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
search_bar->add_child(search_box);
clear_button = memnew( ToolButton );
search_bar->add_child(clear_button);
clear_button->connect("pressed",this,"_clear_search_box");
globals_editor = memnew( PropertyEditor );
props_base->add_child(globals_editor);
globals_editor->hide_top_label();
globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
globals_editor->register_text_enter(search_box);
globals_editor->set_capitalize_paths(false);
globals_editor->get_scene_tree()->connect("cell_selected",this,"_item_selected");
globals_editor->connect("property_toggled",this,"_item_checked");
globals_editor->connect("property_edited",this,"_settings_prop_edited");
/*
Button *save = memnew( Button ); Button *save = memnew( Button );
props_base->add_child(save); props_base->add_child(save);
@ -1325,17 +1362,16 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
save->set_text("Save"); save->set_text("Save");
save->connect("pressed",this,"_save"); save->connect("pressed",this,"_save");
*/ */
hbc = memnew( HBoxContainer );
props_base->add_child(hbc);
popup_platform = memnew( MenuButton ); popup_platform = memnew( MenuButton );
popup_platform->set_text("Copy To Platform.."); popup_platform->set_text("Copy To Platform..");
popup_platform->set_disabled(true); popup_platform->set_disabled(true);
props_base->add_child(popup_platform); hbc->add_child(popup_platform);
popup_platform->set_anchor(MARGIN_LEFT,ANCHOR_BEGIN); hbc->add_spacer();
popup_platform->set_anchor(MARGIN_RIGHT,ANCHOR_BEGIN);
popup_platform->set_anchor(MARGIN_TOP,ANCHOR_END);
popup_platform->set_anchor(MARGIN_BOTTOM,ANCHOR_END);
popup_platform->set_begin( Point2(10,28) );
popup_platform->set_end( Point2(150,20) );
List<StringName> ep; List<StringName> ep;
EditorImportExport::get_singleton()->get_export_platforms(&ep); EditorImportExport::get_singleton()->get_export_platforms(&ep);

View file

@ -47,6 +47,12 @@ class ProjectSettings : public AcceptDialog {
UndoRedo *undo_redo; UndoRedo *undo_redo;
PropertyEditor *globals_editor; PropertyEditor *globals_editor;
HBoxContainer *search_bar;
ToolButton *search_button;
LineEdit *search_box;
ToolButton *clear_button;
HBoxContainer *add_prop_bar;
ConfirmationDialog *message; ConfirmationDialog *message;
LineEdit *category; LineEdit *category;
LineEdit *property; LineEdit *property;
@ -130,6 +136,9 @@ class ProjectSettings : public AcceptDialog {
void _translation_res_option_changed(); void _translation_res_option_changed();
void _translation_res_option_delete(Object *p_item,int p_column, int p_button); void _translation_res_option_delete(Object *p_item,int p_column, int p_button);
void _toggle_search_bar(bool p_pressed);
void _clear_search_box();
ProjectSettings(); ProjectSettings();

View file

@ -2363,6 +2363,8 @@ void PropertyEditor::update_tree() {
TreeItem * current_category=NULL; TreeItem * current_category=NULL;
String filter = search_box ? search_box->get_text() : "";
for (List<PropertyInfo>::Element *I=plist.front() ; I ; I=I->next()) { for (List<PropertyInfo>::Element *I=plist.front() ; I ; I=I->next()) {
PropertyInfo& p = I->get(); PropertyInfo& p = I->get();
@ -2426,6 +2428,14 @@ void PropertyEditor::update_tree() {
} else if ( ! (p.usage&PROPERTY_USAGE_EDITOR ) ) } else if ( ! (p.usage&PROPERTY_USAGE_EDITOR ) )
continue; continue;
String name = (p.name.find("/")!=-1)?p.name.right( p.name.find_last("/")+1 ):p.name;
if (capitalize_paths)
name = name.camelcase_to_underscore().capitalize();
if (use_filter && filter!="" && name.findn(filter)==-1)
continue;
String path=p.name.left( p.name.find_last("/") ) ; String path=p.name.left( p.name.find_last("/") ) ;
//printf("property %s\n",p.name.ascii().get_data()); //printf("property %s\n",p.name.ascii().get_data());
TreeItem * parent = get_parent_node(path,item_path,current_category?current_category:root ); TreeItem * parent = get_parent_node(path,item_path,current_category?current_category:root );
@ -2448,8 +2458,6 @@ void PropertyEditor::update_tree() {
TreeItem * item = tree->create_item( parent ); TreeItem * item = tree->create_item( parent );
String name = (p.name.find("/")!=-1)?p.name.right( p.name.find_last("/")+1 ):p.name;
if (level>0) { if (level>0) {
item->set_custom_bg_color(0,col); item->set_custom_bg_color(0,col);
//item->set_custom_bg_color(1,col); //item->set_custom_bg_color(1,col);
@ -2465,11 +2473,7 @@ void PropertyEditor::update_tree() {
item->set_checked(0,p.usage&PROPERTY_USAGE_CHECKED); item->set_checked(0,p.usage&PROPERTY_USAGE_CHECKED);
} }
if (capitalize_paths) item->set_text(0, name);
item->set_text( 0, name.camelcase_to_underscore().capitalize() );
else
item->set_text( 0, name );
item->set_tooltip(0, p.name); item->set_tooltip(0, p.name);
if (use_doc_hints) { if (use_doc_hints) {
@ -3403,6 +3407,11 @@ void PropertyEditor::_draw_flags(Object *t,const Rect2& p_rect) {
} }
void PropertyEditor::_filter_changed(const String& p_text) {
update_tree();
}
void PropertyEditor::_bind_methods() { void PropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method( "_item_edited",&PropertyEditor::_item_edited); ObjectTypeDB::bind_method( "_item_edited",&PropertyEditor::_item_edited);
@ -3415,6 +3424,7 @@ void PropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method( "_changed_callback",&PropertyEditor::_changed_callbacks); ObjectTypeDB::bind_method( "_changed_callback",&PropertyEditor::_changed_callbacks);
ObjectTypeDB::bind_method( "_draw_flags",&PropertyEditor::_draw_flags); ObjectTypeDB::bind_method( "_draw_flags",&PropertyEditor::_draw_flags);
ObjectTypeDB::bind_method( "_set_range_def",&PropertyEditor::_set_range_def); ObjectTypeDB::bind_method( "_set_range_def",&PropertyEditor::_set_range_def);
ObjectTypeDB::bind_method( "_filter_changed",&PropertyEditor::_filter_changed);
ADD_SIGNAL( MethodInfo("property_toggled",PropertyInfo( Variant::STRING, "property"),PropertyInfo( Variant::BOOL, "value"))); ADD_SIGNAL( MethodInfo("property_toggled",PropertyInfo( Variant::STRING, "property"),PropertyInfo( Variant::BOOL, "value")));
ADD_SIGNAL( MethodInfo("resource_selected", PropertyInfo( Variant::OBJECT, "res"),PropertyInfo( Variant::STRING, "prop") ) ); ADD_SIGNAL( MethodInfo("resource_selected", PropertyInfo( Variant::OBJECT, "res"),PropertyInfo( Variant::STRING, "prop") ) );
@ -3469,12 +3479,32 @@ void PropertyEditor::set_show_categories(bool p_show) {
update_tree(); update_tree();
} }
void PropertyEditor::set_use_filter(bool p_use) {
if (p_use==use_filter)
return;
use_filter=p_use;
update_tree();
}
void PropertyEditor::register_text_enter(Node* p_line_edit) {
ERR_FAIL_NULL(p_line_edit);
search_box=p_line_edit->cast_to<LineEdit>();
if (search_box)
search_box->connect("text_changed",this,"_filter_changed");
}
PropertyEditor::PropertyEditor() { PropertyEditor::PropertyEditor() {
_prop_edited="property_edited"; _prop_edited="property_edited";
_prop_edited_name.push_back(String()); _prop_edited_name.push_back(String());
undo_redo=NULL; undo_redo=NULL;
obj=NULL; obj=NULL;
search_box=NULL;
changing=false; changing=false;
update_tree_pending=false; update_tree_pending=false;
@ -3527,7 +3557,9 @@ PropertyEditor::PropertyEditor() {
show_categories=false; show_categories=false;
refresh_countdown=0; refresh_countdown=0;
use_doc_hints=false; use_doc_hints=false;
use_filter=false;
} }

View file

@ -147,6 +147,7 @@ class PropertyEditor : public Control {
Tree *tree; Tree *tree;
Label *top_label; Label *top_label;
//Object *object; //Object *object;
LineEdit *search_box;
Object* obj; Object* obj;
@ -163,6 +164,8 @@ class PropertyEditor : public Control {
float refresh_countdown; float refresh_countdown;
bool use_doc_hints; bool use_doc_hints;
bool use_filter;
HashMap<String,String> pending; HashMap<String,String> pending;
String selected_property; String selected_property;
@ -201,6 +204,8 @@ class PropertyEditor : public Control {
void _refresh_item(TreeItem *p_item); void _refresh_item(TreeItem *p_item);
void _set_range_def(Object *p_item, String prop, float p_frame); void _set_range_def(Object *p_item, String prop, float p_frame);
void _filter_changed(const String& p_text);
UndoRedo *undo_redo; UndoRedo *undo_redo;
protected: protected:
@ -230,7 +235,10 @@ public:
void set_show_categories(bool p_show); void set_show_categories(bool p_show);
void set_use_doc_hints(bool p_enable) { use_doc_hints=p_enable; } void set_use_doc_hints(bool p_enable) { use_doc_hints=p_enable; }
void set_use_filter(bool p_use);
void register_text_enter(Node *p_line_edit);
PropertyEditor(); PropertyEditor();
~PropertyEditor(); ~PropertyEditor();

View file

@ -72,6 +72,10 @@ void EditorSettingsDialog::popup_edit_settings() {
property_editor->edit(EditorSettings::get_singleton()); property_editor->edit(EditorSettings::get_singleton());
property_editor->update_tree(); property_editor->update_tree();
search_box->select_all();
search_box->grab_focus();
popup_centered_ratio(0.7); popup_centered_ratio(0.7);
} }
@ -244,11 +248,21 @@ void EditorSettingsDialog::_update_plugins() {
} }
void EditorSettingsDialog::_clear_search_box() {
if (search_box->get_text()=="")
return;
search_box->clear();
property_editor->update_tree();
}
void EditorSettingsDialog::_notification(int p_what) { void EditorSettingsDialog::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) { if (p_what==NOTIFICATION_ENTER_TREE) {
rescan_plugins->set_icon(get_icon("Reload","EditorIcons")); rescan_plugins->set_icon(get_icon("Reload","EditorIcons"));
clear_button->set_icon(get_icon("Close","EditorIcons"));
_update_plugins(); _update_plugins();
} }
} }
@ -261,6 +275,7 @@ void EditorSettingsDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_plugin_settings"),&EditorSettingsDialog::_plugin_settings); ObjectTypeDB::bind_method(_MD("_plugin_settings"),&EditorSettingsDialog::_plugin_settings);
ObjectTypeDB::bind_method(_MD("_plugin_edited"),&EditorSettingsDialog::_plugin_edited); ObjectTypeDB::bind_method(_MD("_plugin_edited"),&EditorSettingsDialog::_plugin_edited);
ObjectTypeDB::bind_method(_MD("_plugin_install"),&EditorSettingsDialog::_plugin_install); ObjectTypeDB::bind_method(_MD("_plugin_install"),&EditorSettingsDialog::_plugin_install);
ObjectTypeDB::bind_method(_MD("_clear_search_box"),&EditorSettingsDialog::_clear_search_box);
} }
EditorSettingsDialog::EditorSettingsDialog() { EditorSettingsDialog::EditorSettingsDialog() {
@ -271,16 +286,38 @@ EditorSettingsDialog::EditorSettingsDialog() {
add_child(tabs); add_child(tabs);
set_child_rect(tabs); set_child_rect(tabs);
VBoxContainer *vbc = memnew( VBoxContainer );
tabs->add_child(vbc);
vbc->set_name("General");
HBoxContainer *hbc = memnew( HBoxContainer );
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(hbc);
Label *l = memnew( Label );
l->set_text("Search: ");
hbc->add_child(l);
search_box = memnew( LineEdit );
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->add_child(search_box);
clear_button = memnew( ToolButton );
hbc->add_child(clear_button);
clear_button->connect("pressed",this,"_clear_search_box");
property_editor = memnew( PropertyEditor ); property_editor = memnew( PropertyEditor );
property_editor->hide_top_label(); property_editor->hide_top_label();
tabs->add_child(property_editor); property_editor->set_use_filter(true);
property_editor->set_name("General"); property_editor->register_text_enter(search_box);
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(property_editor);
VBoxContainer *vbc = memnew( VBoxContainer ); vbc = memnew( VBoxContainer );
tabs->add_child(vbc); tabs->add_child(vbc);
vbc->set_name("Plugins"); vbc->set_name("Plugins");
HBoxContainer *hbc = memnew( HBoxContainer ); hbc = memnew( HBoxContainer );
vbc->add_child(hbc); vbc->add_child(hbc);
hbc->add_child( memnew( Label("Plugin List: "))); hbc->add_child( memnew( Label("Plugin List: ")));
hbc->add_spacer(); hbc->add_spacer();

View file

@ -51,6 +51,8 @@ class EditorSettingsDialog : public AcceptDialog {
Button *rescan_plugins; Button *rescan_plugins;
Tree *plugins; Tree *plugins;
LineEdit *search_box;
ToolButton *clear_button;
PropertyEditor *property_editor; PropertyEditor *property_editor;
Timer *timer; Timer *timer;
@ -71,6 +73,8 @@ class EditorSettingsDialog : public AcceptDialog {
void _rescan_plugins(); void _rescan_plugins();
void _update_plugins(); void _update_plugins();
void _clear_search_box();
protected: protected:
static void _bind_methods(); static void _bind_methods();