summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/editor/project_settings.cpp77
-rw-r--r--tools/editor/project_settings.h9
-rw-r--r--tools/editor/property_editor.cpp68
-rw-r--r--tools/editor/property_editor.h10
-rw-r--r--tools/editor/settings_config_dialog.cpp46
-rw-r--r--tools/editor/settings_config_dialog.h2
6 files changed, 124 insertions, 88 deletions
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index 26e8919375..6c5e18ec9a 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -60,6 +60,9 @@ void ProjectSettings::_notification(int p_what) {
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");
_update_actions();
popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),"Key",InputEvent::KEY);
@@ -90,9 +93,7 @@ void ProjectSettings::_notification(int p_what) {
autoload_file_open->add_filter("*."+E->get());
}
- } else if (p_what==NOTIFICATION_POST_POPUP) {
- globals_editor->clear_search_box();
}
}
@@ -1338,6 +1339,32 @@ void ProjectSettings::_update_autoload() {
}
+void ProjectSettings::_toggle_search_bar(bool p_pressed) {
+
+ globals_editor->get_property_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->get_property_editor()->update_tree();
+}
+
void ProjectSettings::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_item_selected"),&ProjectSettings::_item_selected);
@@ -1380,6 +1407,9 @@ void ProjectSettings::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_autoload_delete"),&ProjectSettings::_autoload_delete);
ObjectTypeDB::bind_method(_MD("_autoload_edited"),&ProjectSettings::_autoload_edited);
+ 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) {
@@ -1410,50 +1440,77 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
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 );
- hbc->add_child(l);
+ add_prop_bar->add_child(l);
l->set_text("Category:");
category = memnew( LineEdit );
category->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- hbc->add_child(category);
+ add_prop_bar->add_child(category);
category->connect("text_entered",this,"_item_adds");
l = memnew( Label );
- hbc->add_child(l);
+ add_prop_bar->add_child(l);
l->set_text("Property:");
property = memnew( LineEdit );
property->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- hbc->add_child(property);
+ add_prop_bar->add_child(property);
property->connect("text_entered",this,"_item_adds");
l = memnew( Label );
- hbc->add_child(l);
+ add_prop_bar->add_child(l);
l->set_text("Type:");
type = memnew( OptionButton );
type->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- hbc->add_child(type);
+ add_prop_bar->add_child(type);
type->add_item("bool");
type->add_item("int");
type->add_item("float");
type->add_item("string");
Button *add = memnew( Button );
- hbc->add_child(add);
+ add_prop_bar->add_child(add);
add->set_text("Add");
add->connect("pressed",this,"_item_add");
Button *del = memnew( Button );
- hbc->add_child(del);
+ add_prop_bar->add_child(del);
del->set_text("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( SectionedPropertyEditor );
props_base->add_child(globals_editor);
//globals_editor->hide_top_label();
globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ globals_editor->get_property_editor()->register_text_enter(search_box);
globals_editor->get_property_editor()->set_capitalize_paths(false);
globals_editor->get_property_editor()->get_scene_tree()->connect("cell_selected",this,"_item_selected");
globals_editor->get_property_editor()->connect("property_toggled",this,"_item_checked",varray(),CONNECT_DEFERRED);
diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h
index cbf24e7bfd..b689340fdf 100644
--- a/tools/editor/project_settings.h
+++ b/tools/editor/project_settings.h
@@ -48,6 +48,12 @@ class ProjectSettings : public AcceptDialog {
UndoRedo *undo_redo;
SectionedPropertyEditor *globals_editor;
+ HBoxContainer *search_bar;
+ ToolButton *search_button;
+ LineEdit *search_box;
+ ToolButton *clear_button;
+
+ HBoxContainer *add_prop_bar;
ConfirmationDialog *message;
LineEdit *category;
LineEdit *property;
@@ -136,6 +142,9 @@ class ProjectSettings : public AcceptDialog {
void _translation_res_option_changed();
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();
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index edaac2c632..e5dc2db021 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -3777,10 +3777,6 @@ class SectionedPropertyEditorFilter : public Object {
for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
PropertyInfo pi=E->get();
-
- if (section=="")
- p_list->push_back(pi);
-
int sp = pi.name.find("/");
if (sp!=-1) {
String ss = pi.name.substr(0,sp);
@@ -3790,7 +3786,7 @@ class SectionedPropertyEditorFilter : public Object {
p_list->push_back(pi);
}
} else {
- if (section=="global")
+ if (section=="")
p_list->push_back(pi);
}
}
@@ -3815,18 +3811,10 @@ public:
};
-void SectionedPropertyEditor::_notification(int p_what) {
-
- if (p_what==NOTIFICATION_ENTER_TREE) {
-
- clear_button->set_icon(get_icon("Close", "EditorIcons"));
- }
-}
void SectionedPropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method("_section_selected",&SectionedPropertyEditor::_section_selected);
- ObjectTypeDB::bind_method("_clear_search_box",&SectionedPropertyEditor::clear_search_box);
}
void SectionedPropertyEditor::_section_selected(int p_which) {
@@ -3834,30 +3822,9 @@ void SectionedPropertyEditor::_section_selected(int p_which) {
filter->set_section( sections->get_item_metadata(p_which) );
}
-void SectionedPropertyEditor::clear_search_box() {
-
- if (search_box->get_text().strip_edges()=="")
- return;
-
- search_box->clear();
- editor->update_tree();
-}
-
-
String SectionedPropertyEditor::get_current_section() const {
- String section = sections->get_item_metadata( sections->get_current() );
-
- if (section=="") {
- String name = editor->get_selected_path();
-
- int sp = name.find("/");
- if (sp!=-1)
- section = name.substr(0, sp);
-
- }
-
- return section;
+ return sections->get_item_metadata( sections->get_current() );
}
String SectionedPropertyEditor::get_full_item_path(const String& p_item) {
@@ -3877,20 +3844,11 @@ void SectionedPropertyEditor::edit(Object* p_object) {
sections->clear();
Set<String> existing_sections;
-
- existing_sections.insert("");
- sections->add_item("All");
- sections->set_item_metadata(0, "");
-
for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
PropertyInfo pi=E->get();
-
if (pi.usage&PROPERTY_USAGE_CATEGORY)
continue;
- if ( !(pi.usage&PROPERTY_USAGE_EDITOR) )
- continue;
-
if (pi.name.find(":")!=-1 || pi.name=="script/script")
continue;
int sp = pi.name.find("/");
@@ -3903,10 +3861,10 @@ void SectionedPropertyEditor::edit(Object* p_object) {
}
} else {
- if (!existing_sections.has("global")) {
- existing_sections.insert("global");
+ if (!existing_sections.has("")) {
+ existing_sections.insert("");
sections->add_item("Global");
- sections->set_item_metadata(sections->get_item_count()-1,"global");
+ sections->set_item_metadata(sections->get_item_count()-1,"");
}
}
@@ -3931,8 +3889,6 @@ PropertyEditor *SectionedPropertyEditor::get_property_editor() {
SectionedPropertyEditor::SectionedPropertyEditor() {
- add_constant_override("separation", 8);
-
VBoxContainer *left_vb = memnew( VBoxContainer);
left_vb->set_custom_minimum_size(Size2(160,0));
add_child(left_vb);
@@ -3947,21 +3903,7 @@ SectionedPropertyEditor::SectionedPropertyEditor() {
add_child(right_vb);
filter = memnew( SectionedPropertyEditorFilter );
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- right_vb->add_margin_child("Search:",hbc);
-
- search_box = memnew( LineEdit );
- search_box->set_h_size_flags(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");
-
editor = memnew( PropertyEditor );
- editor->register_text_enter(search_box);
- editor->set_use_filter(true);
editor->set_v_size_flags(SIZE_EXPAND_FILL);
right_vb->add_margin_child("Properties:",editor,true);
diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h
index 5dc2f6d154..63ad090901 100644
--- a/tools/editor/property_editor.h
+++ b/tools/editor/property_editor.h
@@ -259,16 +259,12 @@ class SectionedPropertyEditor : public HBoxContainer {
OBJ_TYPE(SectionedPropertyEditor,HBoxContainer);
ItemList *sections;
SectionedPropertyEditorFilter *filter;
- LineEdit *search_box;
- ToolButton *clear_button;
PropertyEditor *editor;
- void _section_selected(int p_which);
-
-protected:
- void _notification(int p_what);
static void _bind_methods();
+ void _section_selected(int p_which);
+
public:
PropertyEditor *get_property_editor();
@@ -276,8 +272,6 @@ public:
String get_full_item_path(const String& p_item);
String get_current_section() const;
- void clear_search_box();
-
SectionedPropertyEditor();
~SectionedPropertyEditor();
};
diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp
index 3d30b3882d..ebbc488ff2 100644
--- a/tools/editor/settings_config_dialog.cpp
+++ b/tools/editor/settings_config_dialog.cpp
@@ -73,6 +73,9 @@ void EditorSettingsDialog::popup_edit_settings() {
property_editor->edit(EditorSettings::get_singleton());
property_editor->get_property_editor()->update_tree();
+ search_box->select_all();
+ search_box->grab_focus();
+
popup_centered_ratio(0.7);
}
@@ -245,15 +248,22 @@ void EditorSettingsDialog::_update_plugins() {
}
+void EditorSettingsDialog::_clear_search_box() {
+
+ if (search_box->get_text()=="")
+ return;
+
+ search_box->clear();
+ property_editor->get_property_editor()->update_tree();
+}
+
void EditorSettingsDialog::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
rescan_plugins->set_icon(get_icon("Reload","EditorIcons"));
+ clear_button->set_icon(get_icon("Close","EditorIcons"));
_update_plugins();
- } else if (p_what==NOTIFICATION_POST_POPUP) {
-
- property_editor->clear_search_box();
}
}
@@ -265,6 +275,7 @@ void EditorSettingsDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_plugin_settings"),&EditorSettingsDialog::_plugin_settings);
ObjectTypeDB::bind_method(_MD("_plugin_edited"),&EditorSettingsDialog::_plugin_edited);
ObjectTypeDB::bind_method(_MD("_plugin_install"),&EditorSettingsDialog::_plugin_install);
+ ObjectTypeDB::bind_method(_MD("_clear_search_box"),&EditorSettingsDialog::_clear_search_box);
}
EditorSettingsDialog::EditorSettingsDialog() {
@@ -275,17 +286,38 @@ EditorSettingsDialog::EditorSettingsDialog() {
add_child(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( SectionedPropertyEditor );
//property_editor->hide_top_label();
- property_editor->set_name("General");
+ property_editor->get_property_editor()->set_use_filter(true);
+ property_editor->get_property_editor()->register_text_enter(search_box);
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- tabs->add_child(property_editor);
+ vbc->add_child(property_editor);
- VBoxContainer *vbc = memnew( VBoxContainer );
+ vbc = memnew( VBoxContainer );
tabs->add_child(vbc);
vbc->set_name("Plugins");
- HBoxContainer *hbc = memnew( HBoxContainer );
+ hbc = memnew( HBoxContainer );
vbc->add_child(hbc);
hbc->add_child( memnew( Label("Plugin List: ")));
hbc->add_spacer();
diff --git a/tools/editor/settings_config_dialog.h b/tools/editor/settings_config_dialog.h
index 119b4035ca..e1c3238a64 100644
--- a/tools/editor/settings_config_dialog.h
+++ b/tools/editor/settings_config_dialog.h
@@ -51,6 +51,8 @@ class EditorSettingsDialog : public AcceptDialog {
Button *rescan_plugins;
Tree *plugins;
+ LineEdit *search_box;
+ ToolButton *clear_button;
SectionedPropertyEditor *property_editor;
Timer *timer;