summaryrefslogtreecommitdiff
path: root/editor/property_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/property_editor.cpp')
-rw-r--r--editor/property_editor.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 8a9fd2cde5..31be4e1818 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -815,16 +815,12 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
color_picker = memnew(ColorPicker);
add_child(color_picker);
color_picker->hide();
- color_picker->set_area_as_parent_rect();
- for (int i = 0; i < 4; i++)
- color_picker->set_margin((Margin)i, 5);
color_picker->connect("color_changed", this, "_color_changed");
}
color_picker->show();
color_picker->set_edit_alpha(hint != PROPERTY_HINT_COLOR_NO_ALPHA);
color_picker->set_pick_color(v);
- set_size(Size2(307 * EDSCALE, 460 * EDSCALE));
color_picker->set_focus_on_line_edit();
/*
int ofs=80;
@@ -4331,7 +4327,7 @@ PropertyEditor::PropertyEditor() {
_prop_edited = "property_edited";
- hide_script = false;
+ hide_script = true;
use_folding = false;
undo_redo = NULL;
@@ -4512,6 +4508,7 @@ public:
void SectionedPropertyEditor::_bind_methods() {
ClassDB::bind_method("_section_selected", &SectionedPropertyEditor::_section_selected);
+ ClassDB::bind_method("_search_changed", &SectionedPropertyEditor::_search_changed);
ClassDB::bind_method("update_category_list", &SectionedPropertyEditor::update_category_list);
}
@@ -4609,6 +4606,10 @@ void SectionedPropertyEditor::update_category_list() {
if (pi.name.find(":") != -1 || pi.name == "script" || pi.name == "resource_name" || pi.name == "resource_path")
continue;
+
+ if (search_box && search_box->get_text() != String() && pi.name.findn(search_box->get_text()) == -1)
+ continue;
+
int sp = pi.name.find("/");
if (sp == -1)
pi.name = "Global/" + pi.name;
@@ -4616,7 +4617,9 @@ void SectionedPropertyEditor::update_category_list() {
Vector<String> sectionarr = pi.name.split("/");
String metasection;
- for (int i = 0; i < MIN(2, sectionarr.size() - 1); i++) {
+ int sc = MIN(2, sectionarr.size() - 1);
+
+ for (int i = 0; i < sc; i++) {
TreeItem *parent = section_map[metasection];
@@ -4631,6 +4634,12 @@ void SectionedPropertyEditor::update_category_list() {
section_map[metasection] = ms;
ms->set_text(0, sectionarr[i].capitalize());
ms->set_metadata(0, metasection);
+ ms->set_selectable(0, false);
+ }
+
+ if (i == sc - 1) {
+ //if it has children, make selectable
+ section_map[metasection]->set_selectable(0, true);
}
}
}
@@ -4640,6 +4649,18 @@ void SectionedPropertyEditor::update_category_list() {
}
}
+void SectionedPropertyEditor::register_search_box(LineEdit *p_box) {
+
+ search_box = p_box;
+ editor->register_text_enter(p_box);
+ search_box->connect("text_changed", this, "_search_changed");
+}
+
+void SectionedPropertyEditor::_search_changed(const String &p_what) {
+
+ update_category_list();
+}
+
PropertyEditor *SectionedPropertyEditor::get_property_editor() {
return editor;
@@ -4649,6 +4670,8 @@ SectionedPropertyEditor::SectionedPropertyEditor() {
obj = -1;
+ search_box = NULL;
+
VBoxContainer *left_vb = memnew(VBoxContainer);
left_vb->set_custom_minimum_size(Size2(160, 0) * EDSCALE);
add_child(left_vb);