static bool find_next(const String &line, String pattern, int from, bool match_case, bool whole_words, int &out_begin, int &out_end) { int end = from; while (true) { int begin = match_case ? line.find(pattern, end) : line.findn(pattern, end); if (begin == -1) return false; end = begin + pattern.length(); out_begin = begin; out_end = end; if (whole_words) { if (begin > 0 && is_text_char(line[begin - 1])) { continue; } if (end < line.size() && is_text_char(line[end])) { continue; } } return true; } }
static bool _teststr(const String& p_what,const String& p_str) { if (p_what.findn("$"+p_str)!=-1) //blender and other stuff return true; if (p_what.to_lower().ends_with("-"+p_str)) //collada only supports "_" and "-" besides letters return true; return false; }
static String _fixstr(const String& p_what,const String& p_str) { if (p_what.findn("$"+p_str)!=-1) //blender and other stuff return p_what.replace("$"+p_str,""); if (p_what.to_lower().ends_with("-"+p_str)) //collada only supports "_" and "-" besides letters return p_what.substr(0,p_what.length()-(p_str.length()+1)); return p_what; }
bool test_18() { OS::get_singleton()->print("\n\nTest 18: find no case\n"); String s = "Pretty Whale"; OS::get_singleton()->print("\tString: %ls\n", s.c_str()); OS::get_singleton()->print("\t\"WHA\" is at %i pos.\n", s.findn("WHA")); OS::get_singleton()->print("\t\"Revenge of the Monster SawFish\" is at %i pos.\n", s.findn("Revenge of the Monster Truck")); if (s.findn("WHA") != 7) return false; if (s.findn("Revenge of the Monster SawFish") != -1) return false; return true; }
void TileMapEditor::_update_palette() { if (!node) return; int selected = get_selected_tile(); palette->clear(); Ref<TileSet> tileset=node->get_tileset(); if (tileset.is_null()) return; List<int> tiles; tileset->get_tile_list(&tiles); if (tiles.empty()) return; palette->set_max_columns(0); palette->set_icon_mode(ItemList::ICON_MODE_TOP); palette->set_max_text_lines(2); String filter = search_box->get_text().strip_edges(); for (List<int>::Element *E=tiles.front();E;E=E->next()) { String name; if (tileset->tile_get_name(E->get())!="") { name = tileset->tile_get_name(E->get()); } else { name = "#"+itos(E->get()); } if (filter != "" && name.findn(filter) == -1) continue; palette->add_item(name); Ref<Texture> tex = tileset->tile_get_texture(E->get()); if (tex.is_valid()) { Rect2 region = tileset->tile_get_region(E->get()); if (!region.has_no_area()) palette->set_item_icon_region(palette->get_item_count()-1, region); palette->set_item_icon(palette->get_item_count()-1, tex); } palette->set_item_metadata(palette->get_item_count()-1, E->get()); } if (selected != -1) set_selected_tile(selected); else palette->select(0, true); }
float EditorQuickOpen::_path_cmp(String search, String path) const { if (search == path) { return 1.2f; } if (path.findn(search) != -1) { return 1.1f; } return path.to_lower().similarity(search.to_lower()); }
void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) { if (!add_directories) { for(int i=0;i<efsd->get_subdir_count();i++) { _parse_fs(efsd->get_subdir(i)); } } TreeItem *root = search_options->get_root(); if (add_directories) { String path = efsd->get_path(); if (!path.ends_with("/")) path+="/"; if (path!="res://") { path=path.substr(6,path.length()); if (path.findn(search_box->get_text())!=-1) { TreeItem *ti = search_options->create_item(root); ti->set_text(0,path); Ref<Texture> icon = get_icon("folder","FileDialog"); ti->set_icon(0,icon); } } } for(int i=0;i<efsd->get_file_count();i++) { String file = efsd->get_file_path(i); file=file.substr(6,file.length()); if (ObjectTypeDB::is_type(efsd->get_file_type(i),base_type) && (search_box->get_text()=="" || file.findn(search_box->get_text())!=-1)) { TreeItem *ti = search_options->create_item(root); ti->set_text(0,file); Ref<Texture> icon = get_icon( (has_icon(efsd->get_file_type(i),ei)?efsd->get_file_type(i):ot),ei); ti->set_icon(0,icon); if (root->get_children()==ti) ti->select(0); } } if (add_directories) { for(int i=0;i<efsd->get_subdir_count();i++) { _parse_fs(efsd->get_subdir(i)); } } }
void VisualScriptPropertySelector::create_visualscript_item(const String &name, TreeItem *const root, const String &search_input, const String &text) { if (search_input == String() || text.findn(search_input) != -1) { TreeItem *item = search_options->create_item(root); item->set_text(0, text); item->set_icon(0, get_icon("VisualScript", "EditorIcons")); item->set_metadata(0, name); item->set_metadata(1, "action"); item->set_selectable(0, true); item->set_collapsed(1); item->set_selectable(1, false); item->set_selectable(2, false); item->set_metadata(2, connecting); } }
void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem *p_root,TreeItem **to_select) { if (p_types.has(p_type)) return; if (!ObjectTypeDB::is_type(p_type,base_type) || p_type==base_type) return; String inherits=ObjectTypeDB::type_inherits_from(p_type); TreeItem *parent=p_root; if (inherits.length()) { if (!p_types.has(inherits)) { add_type(inherits,p_types,p_root,to_select); } if (p_types.has(inherits) ) parent=p_types[inherits]; } TreeItem *item = search_options->create_item(parent); item->set_text(0,p_type); if (!ObjectTypeDB::can_instance(p_type)) { item->set_custom_color(0, Color(0.5,0.5,0.5) ); item->set_selectable(0,false); } else { if (!*to_select && (search_box->get_text()=="" || p_type.findn(search_box->get_text())!=-1)) { *to_select=item; } } if (has_icon(p_type,"EditorIcons")) { item->set_icon(0, get_icon(p_type,"EditorIcons")); } p_types[p_type]=item; }
void EditorHelpIndex::_update_class_list() { class_list->clear(); tree_item_map.clear(); TreeItem *root = class_list->create_item(); class_list->set_hide_root(true); String filter = search_box->get_text().strip_edges(); String to_select = ""; for(Map<String,DocData::ClassDoc>::Element *E=EditorHelp::get_doc_data()->class_list.front();E;E=E->next()) { if (filter == "") { add_type(E->key(),tree_item_map,root); } else { bool found = false; String type = E->key(); while(type != "") { if (type.findn(filter)!=-1) { if (to_select.empty()) { to_select = type; } found=true; break; } type = EditorHelp::get_doc_data()->class_list[type].inherits; } if (found) { add_type(E->key(),tree_item_map,root); } } } if (tree_item_map.has(filter)) { select_class(filter); } else if (to_select != "") { select_class(to_select); } }
void FindInFiles::_scan_file(String fpath) { FileAccess *f = FileAccess::open(fpath, FileAccess::READ); if (f == NULL) { print_line(String("Cannot open file ") + fpath); return; } int line_number = 0; while (!f->eof_reached()) { // line number starts at 1 ++line_number; int begin = 0; int end = 0; String line = f->get_line(); // Find all occurrences in the current line while (true) { begin = _match_case ? line.find(_pattern, end) : line.findn(_pattern, end); if (begin == -1) break; end = begin + _pattern.length(); if (_whole_words) { if (begin > 0 && is_text_char(line[begin - 1])) { continue; } if (end < line.size() && is_text_char(line[end])) { continue; } } emit_signal(SIGNAL_RESULT_FOUND, fpath, line_number, begin, end, line); } } f->close(); }
void ScriptEditorQuickOpen::_update_search() { search_options->clear(); TreeItem *root = search_options->create_item(); for(int i=0;i<functions.size();i++) { String file = functions[i]; if ((search_box->get_text()=="" || file.findn(search_box->get_text())!=-1)) { TreeItem *ti = search_options->create_item(root); ti->set_text(0,file); if (root->get_children()==ti) ti->select(0); } } get_ok()->set_disabled(root->get_children()==NULL); }
void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem *p_root,TreeItem **to_select) { if (p_types.has(p_type)) return; if (!ObjectTypeDB::is_type(p_type,base_type) || p_type==base_type) return; String inherits=ObjectTypeDB::type_inherits_from(p_type); TreeItem *parent=p_root; if (inherits.length()) { if (!p_types.has(inherits)) { add_type(inherits,p_types,p_root,to_select); } if (p_types.has(inherits) ) parent=p_types[inherits]; } TreeItem *item = search_options->create_item(parent); item->set_text(0,p_type); if (!ObjectTypeDB::can_instance(p_type)) { item->set_custom_color(0, Color(0.5,0.5,0.5) ); item->set_selectable(0,false); } else { if (!*to_select && (search_box->get_text()=="" || p_type.findn(search_box->get_text())!=-1)) { *to_select=item; } } if (bool(EditorSettings::get_singleton()->get("scenetree_editor/start_create_dialog_fully_expanded"))) { item->set_collapsed(false); } else { // don't collapse search results bool collapse = (search_box->get_text() == ""); // don't collapse the root node collapse &= (item != p_root); // don't collapse abstract nodes on the first tree level collapse &= ((parent != p_root) || (ObjectTypeDB::can_instance(p_type))); item->set_collapsed(collapse); } const String& description = EditorHelp::get_doc_data()->class_list[p_type].brief_description; item->set_tooltip(0,description); if (has_icon(p_type,"EditorIcons")) { item->set_icon(0, get_icon(p_type,"EditorIcons")); } p_types[p_type]=item; }
void ProjectManager::_load_recent_projects() { ProjectListFilter::FilterOption filter_option = project_filter->get_filter_option(); String search_term = project_filter->get_search_term(); while(scroll_childs->get_child_count()>0) { memdelete( scroll_childs->get_child(0)); } Map<String, String> selected_list_copy = selected_list; List<PropertyInfo> properties; EditorSettings::get_singleton()->get_property_list(&properties); Color font_color = gui_base->get_color("font_color","Tree"); List<ProjectItem> projects; List<ProjectItem> favorite_projects; for(List<PropertyInfo>::Element *E=properties.front();E;E=E->next()) { String _name = E->get().name; if (!_name.begins_with("projects/") && !_name.begins_with("favorite_projects/")) continue; String path = EditorSettings::get_singleton()->get(_name); if (filter_option == ProjectListFilter::FILTER_PATH && search_term!="" && path.findn(search_term)==-1) continue; String project = _name.get_slice("/",1); String conf=path.plus_file("engine.cfg"); bool favorite = (_name.begins_with("favorite_projects/"))?true:false; uint64_t last_modified = 0; if (FileAccess::exists(conf)) { last_modified = FileAccess::get_modified_time(conf); String fscache = path.plus_file(".fscache"); if (FileAccess::exists(fscache)) { uint64_t cache_modified = FileAccess::get_modified_time(fscache); if ( cache_modified > last_modified ) last_modified = cache_modified; } ProjectItem item(project, path, conf, last_modified, favorite); if (favorite) favorite_projects.push_back(item); else projects.push_back(item); } else { //project doesn't exist on disk but it's in the XML settings file EditorSettings::get_singleton()->erase(_name); //remove it } } projects.sort(); favorite_projects.sort(); for(List<ProjectItem>::Element *E=projects.front();E;) { List<ProjectItem>::Element *next = E->next(); if (favorite_projects.find(E->get()) != NULL) projects.erase(E->get()); E=next; } for(List<ProjectItem>::Element *E=favorite_projects.back();E;E=E->prev()) { projects.push_front(E->get()); } Ref<Texture> favorite_icon = get_icon("Favorites","EditorIcons"); for(List<ProjectItem>::Element *E=projects.front();E;E=E->next()) { ProjectItem &item = E->get(); String project = item.project; String path = item.path; String conf = item.conf; bool is_favorite = item.favorite; Ref<ConfigFile> cf = memnew( ConfigFile ); Error err = cf->load(conf); ERR_CONTINUE(err!=OK); String project_name=TTR("Unnamed Project"); if (cf->has_section_key("application","name")) { project_name = static_cast<String>(cf->get_value("application","name")).xml_unescape(); } if (filter_option==ProjectListFilter::FILTER_NAME && search_term!="" && project_name.findn(search_term)==-1) continue; Ref<Texture> icon; if (cf->has_section_key("application","icon")) { String appicon = cf->get_value("application","icon"); if (appicon!="") { Image img; Error err = img.load(appicon.replace_first("res://",path+"/")); if (err==OK) { img.resize(64,64); Ref<ImageTexture> it = memnew( ImageTexture ); it->create_from_image(img); icon=it; } } } if (icon.is_null()) { icon=get_icon("DefaultProjectIcon","EditorIcons"); } String main_scene; if (cf->has_section_key("application","main_scene")) { main_scene = cf->get_value("application","main_scene"); } selected_list_copy.erase(project); HBoxContainer *hb = memnew( HBoxContainer ); hb->set_meta("name",project); hb->set_meta("main_scene",main_scene); hb->set_meta("favorite",is_favorite); hb->connect("draw",this,"_panel_draw",varray(hb)); hb->connect("input_event",this,"_panel_input",varray(hb)); hb->add_constant_override("separation",10*EDSCALE); VBoxContainer *favorite_box = memnew( VBoxContainer ); TextureButton *favorite = memnew( TextureButton ); favorite->set_normal_texture(favorite_icon); if (!is_favorite) favorite->set_opacity(0.2); favorite->set_v_size_flags(SIZE_EXPAND); favorite->connect("pressed",this,"_favorite_pressed",varray(hb)); favorite_box->add_child(favorite); hb->add_child(favorite_box); TextureFrame *tf = memnew( TextureFrame ); tf->set_texture(icon); hb->add_child(tf); VBoxContainer *vb = memnew(VBoxContainer); hb->add_child(vb); Control *ec = memnew( Control ); ec->set_custom_minimum_size(Size2(0,1)); vb->add_child(ec); Label *title = memnew( Label(project_name) ); title->add_font_override("font", gui_base->get_font("large","Fonts")); title->add_color_override("font_color",font_color); vb->add_child(title); Label *fpath = memnew( Label(path) ); vb->add_child(fpath); fpath->set_opacity(0.5); fpath->add_color_override("font_color",font_color); scroll_childs->add_child(hb); } for (Map<String,String>::Element *E = selected_list_copy.front();E;E = E->next()) { String key = E->key(); selected_list.erase(key); } scroll->set_v_scroll(0); _update_project_buttons(); EditorSettings::get_singleton()->save(); tabs->set_current_tab(0); }
void CreateDialog::update_tree() { tree->clear(); List<String> type_list; ObjectTypeDB::get_type_list(&type_list); HashMap<String, TreeItem *> types; TreeItem *root = tree->create_item(); root->set_text(0, base); List<String>::Element *I = type_list.front(); for (; I; I = I->next()) { String type = I->get(); if (!ObjectTypeDB::can_instance(type)) continue; // cant create what can't be instanced if (filter->get_text() == "") add_type(type, types, root); else { bool found = false; String type = I->get(); while (type != "" && ObjectTypeDB::is_type(type, base) && type != base) { if (type.findn(filter->get_text()) != -1) { found = true; break; } type = ObjectTypeDB::type_inherits_from(type); } if (found) add_type(I->get(), types, root); } if (EditorNode::get_editor_data().get_custom_types().has(type)) { //there are custom types based on this... cool. const Vector<EditorData::CustomType> &ct = EditorNode::get_editor_data().get_custom_types()[type]; for (int i = 0; i < ct.size(); i++) { bool show = filter->get_text() == "" || ct[i].name.findn(filter->get_text()) != -1; if (!show) continue; if (!types.has(type)) add_type(type, types, root); TreeItem *ti; if (types.has(type)) ti = types[type]; else ti = tree->get_root(); TreeItem *item = tree->create_item(ti); item->set_metadata(0, type); item->set_text(0, ct[i].name); if (ct[i].icon.is_valid()) { item->set_icon(0, ct[i].icon); } } } } }
void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) { for(int i=0; i<efsd->get_subdir_count(); i++) { _parse_fs(efsd->get_subdir(i)); } for(int i=0; i<efsd->get_file_count(); i++) { String file = efsd->get_file_path(i); file=file.substr(6,file.length()); if (ObjectTypeDB::is_type(efsd->get_file_type(i),base_type) && (search_box->get_text()=="" || file.findn(search_box->get_text())!=-1)) { TreeItem *root = search_options->get_root(); TreeItem *ti = search_options->create_item(root); ti->set_text(0,file); Ref<Texture> icon = get_icon( (has_icon(efsd->get_file_type(i),"EditorIcons")?efsd->get_file_type(i):String("Object")),"EditorIcons"); ti->set_icon(0,icon); if (root->get_children()==ti) ti->select(0); } } }
void VisualScriptPropertySelector::_update_search() { set_title(TTR("Search VisualScript")); search_options->clear(); help_bit->set_text(""); TreeItem *root = search_options->create_item(); bool found = false; if (properties) { List<PropertyInfo> props; if (instance) { instance->get_property_list(&props, true); } else if (type != Variant::NIL) { Variant v; Variant::CallError ce; v = Variant::construct(type, NULL, 0, ce); v.get_property_list(&props); } else { Object *obj = ObjectDB::get_instance(script); if (Object::cast_to<Script>(obj)) { props.push_back(PropertyInfo(Variant::NIL, "Script Variables", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_CATEGORY)); Object::cast_to<Script>(obj)->get_script_property_list(&props); } StringName base = base_type; while (base) { props.push_back(PropertyInfo(Variant::NIL, base, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_CATEGORY)); ClassDB::get_property_list(base, &props, true); base = ClassDB::get_parent_class_nocheck(base); } } TreeItem *category = NULL; Ref<Texture> type_icons[Variant::VARIANT_MAX] = { Control::get_icon("Variant", "EditorIcons"), Control::get_icon("bool", "EditorIcons"), Control::get_icon("int", "EditorIcons"), Control::get_icon("float", "EditorIcons"), Control::get_icon("String", "EditorIcons"), Control::get_icon("Vector2", "EditorIcons"), Control::get_icon("Rect2", "EditorIcons"), Control::get_icon("Vector3", "EditorIcons"), Control::get_icon("Transform2D", "EditorIcons"), Control::get_icon("Plane", "EditorIcons"), Control::get_icon("Quat", "EditorIcons"), Control::get_icon("AABB", "EditorIcons"), Control::get_icon("Basis", "EditorIcons"), Control::get_icon("Transform", "EditorIcons"), Control::get_icon("Color", "EditorIcons"), Control::get_icon("Path", "EditorIcons"), Control::get_icon("RID", "EditorIcons"), Control::get_icon("Object", "EditorIcons"), Control::get_icon("Dictionary", "EditorIcons"), Control::get_icon("Array", "EditorIcons"), Control::get_icon("PoolByteArray", "EditorIcons"), Control::get_icon("PoolIntArray", "EditorIcons"), Control::get_icon("PoolRealArray", "EditorIcons"), Control::get_icon("PoolStringArray", "EditorIcons"), Control::get_icon("PoolVector2Array", "EditorIcons"), Control::get_icon("PoolVector3Array", "EditorIcons"), Control::get_icon("PoolColorArray", "EditorIcons") }; if (!seq_connect && !visual_script_generic) { get_visual_node_names("flow_control/type_cast", Set<String>(), found, root, search_box); get_visual_node_names("functions/built_in/print", Set<String>(), found, root, search_box); get_visual_node_names("functions/by_type/" + Variant::get_type_name(type), Set<String>(), found, root, search_box); get_visual_node_names("operators/compare/", Set<String>(), found, root, search_box); if (type == Variant::INT) { get_visual_node_names("operators/bitwise/", Set<String>(), found, root, search_box); } if (type == Variant::BOOL) { get_visual_node_names("operators/logic/", Set<String>(), found, root, search_box); } if (type == Variant::BOOL || type == Variant::INT || type == Variant::REAL || type == Variant::VECTOR2 || type == Variant::VECTOR3) { get_visual_node_names("operators/math/", Set<String>(), found, root, search_box); } } for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { if (E->get().usage == PROPERTY_USAGE_CATEGORY) { if (category && category->get_children() == NULL) { memdelete(category); //old category was unused } category = search_options->create_item(root); category->set_text(0, E->get().name); category->set_selectable(0, false); Ref<Texture> icon; if (E->get().name == "Script Variables") { icon = get_icon("Script", "EditorIcons"); } else { icon = EditorNode::get_singleton()->get_class_icon(E->get().name); } category->set_icon(0, icon); continue; } if (!(E->get().usage & PROPERTY_USAGE_EDITOR) && !(E->get().usage & PROPERTY_USAGE_SCRIPT_VARIABLE)) continue; if (type_filter.size() && type_filter.find(E->get().type) == -1) continue; // capitalize() also converts underscore to space, we'll match again both possible styles String get_text_raw = String(vformat(TTR("Get %s"), E->get().name)); String get_text = get_text_raw.capitalize(); String set_text_raw = String(vformat(TTR("Set %s"), E->get().name)); String set_text = set_text_raw.capitalize(); String input = search_box->get_text().capitalize(); if (input == String() || get_text_raw.findn(input) != -1 || get_text.findn(input) != -1) { TreeItem *item = search_options->create_item(category ? category : root); item->set_text(0, get_text); item->set_metadata(0, E->get().name); item->set_icon(0, type_icons[E->get().type]); item->set_metadata(1, "get"); item->set_collapsed(1); item->set_selectable(0, true); item->set_selectable(1, false); item->set_selectable(2, false); item->set_metadata(2, connecting); } if (input == String() || set_text_raw.findn(input) != -1 || set_text.findn(input) != -1) { TreeItem *item = search_options->create_item(category ? category : root); item->set_text(0, set_text); item->set_metadata(0, E->get().name); item->set_icon(0, type_icons[E->get().type]); item->set_metadata(1, "set"); item->set_selectable(0, true); item->set_selectable(1, false); item->set_selectable(2, false); item->set_metadata(2, connecting); } } if (category && category->get_children() == NULL) { memdelete(category); //old category was unused } } if (seq_connect && !visual_script_generic) { String text = search_box->get_text(); create_visualscript_item(String("VisualScriptCondition"), root, text, String("Condition")); create_visualscript_item(String("VisualScriptSwitch"), root, text, String("Switch")); create_visualscript_item(String("VisualScriptSequence"), root, text, String("Sequence")); create_visualscript_item(String("VisualScriptIterator"), root, text, String("Iterator")); create_visualscript_item(String("VisualScriptWhile"), root, text, String("While")); create_visualscript_item(String("VisualScriptReturn"), root, text, String("Return")); get_visual_node_names("flow_control/type_cast", Set<String>(), found, root, search_box); get_visual_node_names("functions/built_in/print", Set<String>(), found, root, search_box); } if (visual_script_generic) { get_visual_node_names("", Set<String>(), found, root, search_box); } List<MethodInfo> methods; if (type != Variant::NIL) { Variant v; Variant::CallError ce; v = Variant::construct(type, NULL, 0, ce); v.get_method_list(&methods); } else { Object *obj = ObjectDB::get_instance(script); if (Object::cast_to<Script>(obj)) { methods.push_back(MethodInfo("*Script Methods")); Object::cast_to<Script>(obj)->get_script_method_list(&methods); } StringName base = base_type; while (base) { methods.push_back(MethodInfo("*" + String(base))); ClassDB::get_method_list(base, &methods, true, true); base = ClassDB::get_parent_class_nocheck(base); } } TreeItem *category = NULL; bool script_methods = false; for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) { if (E->get().name.begins_with("*")) { if (category && category->get_children() == NULL) { memdelete(category); //old category was unused } category = search_options->create_item(root); category->set_text(0, E->get().name.replace_first("*", "")); category->set_selectable(0, false); Ref<Texture> icon; script_methods = false; String rep = E->get().name.replace("*", ""); if (E->get().name == "*Script Methods") { icon = get_icon("Script", "EditorIcons"); script_methods = true; } else { icon = EditorNode::get_singleton()->get_class_icon(rep); } category->set_icon(0, icon); continue; } String name = E->get().name.get_slice(":", 0); if (!script_methods && name.begins_with("_") && !(E->get().flags & METHOD_FLAG_VIRTUAL)) continue; if (virtuals_only && !(E->get().flags & METHOD_FLAG_VIRTUAL)) continue; if (!virtuals_only && (E->get().flags & METHOD_FLAG_VIRTUAL)) continue; MethodInfo mi = E->get(); String desc_arguments; if (mi.arguments.size() > 0) { desc_arguments = "("; for (int i = 0; i < mi.arguments.size(); i++) { if (i > 0) { desc_arguments += ", "; } if (mi.arguments[i].type == Variant::NIL) { desc_arguments += "var"; } else if (mi.arguments[i].name.find(":") != -1) { desc_arguments += mi.arguments[i].name.get_slice(":", 1); mi.arguments[i].name = mi.arguments[i].name.get_slice(":", 0); } else { desc_arguments += Variant::get_type_name(mi.arguments[i].type); } } desc_arguments += ")"; } String desc_raw = mi.name + desc_arguments; String desc = desc_raw.capitalize().replace("( ", "("); if (search_box->get_text() != String() && name.findn(search_box->get_text()) == -1 && desc.findn(search_box->get_text()) == -1 && desc_raw.findn(search_box->get_text()) == -1) { continue; } TreeItem *item = search_options->create_item(category ? category : root); item->set_text(0, desc); item->set_icon(0, get_icon("MemberMethod", "EditorIcons")); item->set_metadata(0, name); item->set_selectable(0, true); item->set_metadata(1, "method"); item->set_collapsed(1); item->set_selectable(1, false); item->set_selectable(2, false); item->set_metadata(2, connecting); if (category && category->get_children() == NULL) { memdelete(category); //old category was unused } } TreeItem *selected_item = search_options->search_item_text(search_box->get_text()); if (!found && selected_item != NULL) { selected_item->select(0); found = true; } if (category && category->get_children() == NULL) { memdelete(category); //old category was unused } get_ok()->set_disabled(root->get_children() == NULL); }