|
@@ -87,6 +87,9 @@ void PropertySelector::_update_search() {
|
|
|
|
|
|
TreeItem *root = search_options->create_item();
|
|
TreeItem *root = search_options->create_item();
|
|
|
|
|
|
|
|
+ // Allow using spaces in place of underscores in the search string (makes the search more fault-tolerant).
|
|
|
|
+ const String search_text = search_box->get_text().replace(" ", "_");
|
|
|
|
+
|
|
if (properties) {
|
|
if (properties) {
|
|
|
|
|
|
List<PropertyInfo> props;
|
|
List<PropertyInfo> props;
|
|
@@ -172,7 +175,7 @@ void PropertySelector::_update_search() {
|
|
if (!(E->get().usage & PROPERTY_USAGE_EDITOR) && !(E->get().usage & PROPERTY_USAGE_SCRIPT_VARIABLE))
|
|
if (!(E->get().usage & PROPERTY_USAGE_EDITOR) && !(E->get().usage & PROPERTY_USAGE_SCRIPT_VARIABLE))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- if (search_box->get_text() != String() && E->get().name.find(search_box->get_text()) == -1)
|
|
|
|
|
|
+ if (search_box->get_text() != String() && E->get().name.findn(search_text) == -1)
|
|
continue;
|
|
continue;
|
|
|
|
|
|
if (type_filter.size() && type_filter.find(E->get().type) == -1)
|
|
if (type_filter.size() && type_filter.find(E->get().type) == -1)
|
|
@@ -183,7 +186,7 @@ void PropertySelector::_update_search() {
|
|
item->set_metadata(0, E->get().name);
|
|
item->set_metadata(0, E->get().name);
|
|
item->set_icon(0, type_icons[E->get().type]);
|
|
item->set_icon(0, type_icons[E->get().type]);
|
|
|
|
|
|
- if (!found && search_box->get_text() != String() && E->get().name.find(search_box->get_text()) != -1) {
|
|
|
|
|
|
+ if (!found && search_box->get_text() != String() && E->get().name.findn(search_text) != -1) {
|
|
item->select(0);
|
|
item->select(0);
|
|
found = true;
|
|
found = true;
|
|
}
|
|
}
|
|
@@ -258,7 +261,7 @@ void PropertySelector::_update_search() {
|
|
if (!virtuals_only && (E->get().flags & METHOD_FLAG_VIRTUAL))
|
|
if (!virtuals_only && (E->get().flags & METHOD_FLAG_VIRTUAL))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- if (search_box->get_text() != String() && name.find(search_box->get_text()) == -1)
|
|
|
|
|
|
+ if (search_box->get_text() != String() && name.findn(search_text) == -1)
|
|
continue;
|
|
continue;
|
|
|
|
|
|
TreeItem *item = search_options->create_item(category ? category : root);
|
|
TreeItem *item = search_options->create_item(category ? category : root);
|
|
@@ -269,30 +272,32 @@ void PropertySelector::_update_search() {
|
|
if (mi.name.find(":") != -1) {
|
|
if (mi.name.find(":") != -1) {
|
|
desc = mi.name.get_slice(":", 1) + " ";
|
|
desc = mi.name.get_slice(":", 1) + " ";
|
|
mi.name = mi.name.get_slice(":", 0);
|
|
mi.name = mi.name.get_slice(":", 0);
|
|
- } else if (mi.return_val.type != Variant::NIL)
|
|
|
|
|
|
+ } else if (mi.return_val.type != Variant::NIL) {
|
|
desc = Variant::get_type_name(mi.return_val.type);
|
|
desc = Variant::get_type_name(mi.return_val.type);
|
|
- else
|
|
|
|
- desc = "void ";
|
|
|
|
|
|
+ } else {
|
|
|
|
+ desc = "void";
|
|
|
|
+ }
|
|
|
|
|
|
- desc += " " + mi.name + " ( ";
|
|
|
|
|
|
+ desc += vformat(" %s(", mi.name);
|
|
|
|
|
|
for (int i = 0; i < mi.arguments.size(); i++) {
|
|
for (int i = 0; i < mi.arguments.size(); i++) {
|
|
|
|
|
|
if (i > 0)
|
|
if (i > 0)
|
|
desc += ", ";
|
|
desc += ", ";
|
|
|
|
|
|
- if (mi.arguments[i].type == Variant::NIL)
|
|
|
|
- desc += "var ";
|
|
|
|
- else if (mi.arguments[i].name.find(":") != -1) {
|
|
|
|
- desc += mi.arguments[i].name.get_slice(":", 1) + " ";
|
|
|
|
- mi.arguments[i].name = mi.arguments[i].name.get_slice(":", 0);
|
|
|
|
- } else
|
|
|
|
- desc += Variant::get_type_name(mi.arguments[i].type) + " ";
|
|
|
|
-
|
|
|
|
desc += mi.arguments[i].name;
|
|
desc += mi.arguments[i].name;
|
|
|
|
+
|
|
|
|
+ if (mi.arguments[i].type == Variant::NIL) {
|
|
|
|
+ desc += ": Variant";
|
|
|
|
+ } else if (mi.arguments[i].name.find(":") != -1) {
|
|
|
|
+ desc += vformat(": %s", mi.arguments[i].name.get_slice(":", 1));
|
|
|
|
+ mi.arguments[i].name = mi.arguments[i].name.get_slice(":", 0);
|
|
|
|
+ } else {
|
|
|
|
+ desc += vformat(": %s", Variant::get_type_name(mi.arguments[i].type));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- desc += " )";
|
|
|
|
|
|
+ desc += ")";
|
|
|
|
|
|
if (E->get().flags & METHOD_FLAG_CONST)
|
|
if (E->get().flags & METHOD_FLAG_CONST)
|
|
desc += " const";
|
|
desc += " const";
|
|
@@ -304,7 +309,7 @@ void PropertySelector::_update_search() {
|
|
item->set_metadata(0, name);
|
|
item->set_metadata(0, name);
|
|
item->set_selectable(0, true);
|
|
item->set_selectable(0, true);
|
|
|
|
|
|
- if (!found && search_box->get_text() != String() && name.find(search_box->get_text()) != -1) {
|
|
|
|
|
|
+ if (!found && search_box->get_text() != String() && name.findn(search_text) != -1) {
|
|
item->select(0);
|
|
item->select(0);
|
|
found = true;
|
|
found = true;
|
|
}
|
|
}
|