diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2020-12-28 13:23:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-28 13:23:25 +0100 |
commit | be509bf5e4d00b33f2867e6d06a23285b2a8fd29 (patch) | |
tree | 975e0a7384bc6fc7cf5b73b9ddc1e8eef13579d8 /editor | |
parent | 886571e0fc54914f161ab3f1ccf9bfe40411bc20 (diff) | |
parent | 5b937d493f0046543a77a0be7920ad39f1e5fc3c (diff) |
Merge pull request #44401 from madmiraal/rename-empty-is_empty
Rename empty() to is_empty()
Diffstat (limited to 'editor')
67 files changed, 225 insertions, 225 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 9b2cc686e3..9a2d7b1e6d 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -3779,7 +3779,7 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b r_base_path = node->get_path(); } - if (leftover_path.empty()) { + if (leftover_path.is_empty()) { if (r_current_val) { if (res.is_valid()) { *r_current_val = res; @@ -4080,8 +4080,8 @@ void AnimationTrackEditor::_update_tracks() { object = res.ptr(); } - if (object && !leftover_path.empty()) { - if (pinfo.name.empty()) { + if (object && !leftover_path.is_empty()) { + if (pinfo.name.is_empty()) { pinfo.name = leftover_path[leftover_path.size() - 1]; } @@ -5285,7 +5285,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { scale_dialog->popup_centered(Size2(200, 100) * EDSCALE); } break; case EDIT_SCALE_CONFIRM: { - if (selection.empty()) { + if (selection.is_empty()) { return; } diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp index 0b6b1ef6a7..25a67d0041 100644 --- a/editor/array_property_edit.cpp +++ b/editor/array_property_edit.cpp @@ -259,7 +259,7 @@ void ArrayPropertyEdit::edit(Object *p_obj, const StringName &p_prop, const Stri obj = p_obj->get_instance_id(); default_type = p_deftype; - if (!p_hint_string.empty()) { + if (!p_hint_string.is_empty()) { int hint_subtype_separator = p_hint_string.find(":"); if (hint_subtype_separator >= 0) { String subtype_string = p_hint_string.substr(0, hint_subtype_separator); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index bca2979e72..a634b87366 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -325,7 +325,7 @@ void FindReplaceBar::_update_results_count() { results_count = 0; String searched = get_search_text(); - if (searched.empty()) { + if (searched.is_empty()) { return; } @@ -356,7 +356,7 @@ void FindReplaceBar::_update_results_count() { } void FindReplaceBar::_update_matches_label() { - if (search_text->get_text().empty() || results_count == -1) { + if (search_text->get_text().is_empty() || results_count == -1) { matches_label->hide(); } else { matches_label->show(); @@ -483,7 +483,7 @@ void FindReplaceBar::_show_search(bool p_focus_replace, bool p_show_only) { search_text->set_text(text_editor->get_selection_text()); } - if (!get_search_text().empty()) { + if (!get_search_text().is_empty()) { if (p_focus_replace) { replace_text->select_all(); replace_text->set_cursor_position(replace_text->get_text().length()); @@ -1309,7 +1309,7 @@ void CodeTextEditor::toggle_inline_comment(const String &delimiter) { for (int i = begin; i <= end; i++) { String line_text = text_editor->get_line(i); - if (line_text.strip_edges().empty()) { + if (line_text.strip_edges().is_empty()) { line_text = delimiter; } else { if (is_commented) { diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 473597b9b3..c4ab226b28 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -1008,7 +1008,7 @@ void ConnectionsDock::update_tree() { break; } } - if (!F->get().inherits.empty()) { + if (!F->get().inherits.is_empty()) { F = dd->class_list.find(F->get().inherits); } else { break; diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 118b8f9f2e..5b2dc3fc32 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -115,7 +115,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() { tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); } - if (!debugger_plugins.empty()) { + if (!debugger_plugins.is_empty()) { for (Set<Ref<Script>>::Element *i = debugger_plugins.front(); i; i = i->next()) { node->add_debugger_plugin(i->get()); } @@ -140,7 +140,7 @@ void EditorDebuggerNode::_error_selected(const String &p_file, int p_line, int p void EditorDebuggerNode::_text_editor_stack_goto(const ScriptEditorDebugger *p_debugger) { const String file = p_debugger->get_stack_script_file(); - if (file.empty()) { + if (file.is_empty()) { return; } stack_script = ResourceLoader::load(file); diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index ebac9b3482..e36f11ae1d 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -242,7 +242,7 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) { } break; case ITEM_MENU_COPY_NODE_PATH: { String text = get_selected_path(); - if (text.empty()) { + if (text.is_empty()) { return; } else if (text == "/root") { text = "."; diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp index 2068d42eb7..f73165881c 100644 --- a/editor/debugger/editor_performance_profiler.cpp +++ b/editor/debugger/editor_performance_profiler.cpp @@ -102,7 +102,7 @@ void EditorPerformanceProfiler::_monitor_draw() { } } - if (active.empty()) { + if (active.is_empty()) { info_message->show(); return; } @@ -217,7 +217,7 @@ void EditorPerformanceProfiler::_build_monitor_tree() { TreeItem *item = _create_monitor_item(i.value().name, base); item->set_checked(0, monitor_checked.has(i.key())); i.value().item = item; - if (!i.value().history.empty()) { + if (!i.value().history.is_empty()) { i.value().update_value(i.value().history.front()->get()); } } diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index 930aca6e5a..4871c35ea4 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -596,7 +596,7 @@ bool EditorProfiler::is_profiling() { Vector<Vector<String>> EditorProfiler::get_data_as_csv() const { Vector<Vector<String>> res; - if (frame_metrics.empty()) { + if (frame_metrics.is_empty()) { return res; } diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index fd33115cda..80d7934938 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -490,17 +490,17 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da if (oe.callstack.size() > 0) { // If available, use the script's stack in the error title. error_title = oe.callstack[oe.callstack.size() - 1].func + ": "; - } else if (!oe.source_func.empty()) { + } else if (!oe.source_func.is_empty()) { // Otherwise try to use the C++ source function. error_title += oe.source_func + ": "; } // If we have a (custom) error message, use it as title, and add a C++ Error // item with the original error condition. - error_title += oe.error_descr.empty() ? oe.error : oe.error_descr; + error_title += oe.error_descr.is_empty() ? oe.error : oe.error_descr; error->set_text(1, error_title); tooltip += " " + error_title + "\n"; - if (!oe.error_descr.empty()) { + if (!oe.error_descr.is_empty()) { // Add item for C++ error condition. TreeItem *cpp_cond = error_tree->create_item(error); cpp_cond->set_text(0, "<" + TTR("C++ Error") + ">"); @@ -516,7 +516,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da // Source of the error. String source_txt = (source_is_project_file ? oe.source_file.get_file() : oe.source_file) + ":" + itos(oe.source_line); - if (!oe.source_func.empty()) { + if (!oe.source_func.is_empty()) { source_txt += " @ " + oe.source_func + "()"; } diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index a27f196d49..208d390134 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -448,7 +448,7 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector< Vector<RemovedDependency> removed_deps; _find_all_removed_dependencies(EditorFileSystem::get_singleton()->get_filesystem(), removed_deps); removed_deps.sort(); - if (removed_deps.empty()) { + if (removed_deps.is_empty()) { owners->hide(); text->set_text(TTR("Remove selected files from the project? (no undo)\nYou can find the removed files in the system trash to restore them.")); set_size(Size2()); @@ -639,7 +639,7 @@ void OrphanResourcesDialog::ok_pressed() { paths.clear(); _find_to_delete(files->get_root(), paths); - if (paths.empty()) { + if (paths.is_empty()) { return; } diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h index 5d2ae582e6..008194bbd6 100644 --- a/editor/dependency_editor.h +++ b/editor/dependency_editor.h @@ -111,8 +111,8 @@ class DependencyRemoveDialog : public ConfirmationDialog { String dependency_folder; bool operator<(const RemovedDependency &p_other) const { - if (dependency_folder.empty() != p_other.dependency_folder.empty()) { - return p_other.dependency_folder.empty(); + if (dependency_folder.is_empty() != p_other.dependency_folder.is_empty()) { + return p_other.dependency_folder.is_empty(); } else { return dependency < p_other.dependency; } diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index 5ee9abb183..c21c957799 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -813,7 +813,7 @@ void DocTools::generate(bool p_basic_types) { } // Skip adding the lang if it doesn't expose anything (e.g. C#). - if (c.methods.empty() && c.constants.empty()) { + if (c.methods.is_empty() && c.constants.is_empty()) { continue; } @@ -1165,7 +1165,7 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str _write_string(f, 1, "<tutorials>"); for (int i = 0; i < c.tutorials.size(); i++) { DocData::TutorialDoc tutorial = c.tutorials.get(i); - String title_attribute = (!tutorial.title.empty()) ? " title=\"" + tutorial.title.xml_escape() + "\"" : ""; + String title_attribute = (!tutorial.title.is_empty()) ? " title=\"" + tutorial.title.xml_escape() + "\"" : ""; _write_string(f, 2, "<link" + title_attribute + ">" + tutorial.link.xml_escape() + "</link>"); } _write_string(f, 1, "</tutorials>"); diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 2251440544..5f429e7034 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -402,7 +402,7 @@ void EditorAutoloadSettings::update_autoload() { String name = pi.name.get_slice("/", 1); String path = ProjectSettings::get_singleton()->get(pi.name); - if (name.empty()) { + if (name.is_empty()) { continue; } @@ -774,7 +774,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() { String name = pi.name.get_slice("/", 1); String path = ProjectSettings::get_singleton()->get(pi.name); - if (name.empty()) { + if (name.is_empty()) { continue; } diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index eab1ecf373..05c7b58c72 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -331,7 +331,7 @@ Dictionary EditorData::get_editor_states() const { Dictionary metadata; for (int i = 0; i < editor_plugins.size(); i++) { Dictionary state = editor_plugins[i]->get_state(); - if (state.empty()) { + if (state.is_empty()) { continue; } metadata[editor_plugins[i]->get_name()] = state; @@ -493,7 +493,7 @@ void EditorData::remove_custom_type(const String &p_type) { for (int i = 0; i < E->get().size(); i++) { if (E->get()[i].name == p_type) { E->get().remove(i); - if (E->get().empty()) { + if (E->get().is_empty()) { custom_types.erase(E->key()); } return; @@ -901,7 +901,7 @@ String EditorData::script_class_get_icon_path(const String &p_class) const { String current = p_class; String ret = _script_class_icon_paths[current]; - while (ret.empty()) { + while (ret.is_empty()) { current = script_class_get_base(current); if (!ScriptServer::is_global_class(current)) { return String(); @@ -931,7 +931,7 @@ void EditorData::script_class_save_icon_paths() { } } - if (d.empty()) { + if (d.is_empty()) { if (ProjectSettings::get_singleton()->has_setting("_global_script_class_icons")) { ProjectSettings::get_singleton()->clear("_global_script_class_icons"); } @@ -1125,7 +1125,7 @@ List<Node *> EditorSelection::get_full_selected_node_list() { } void EditorSelection::clear() { - while (!selection.empty()) { + while (!selection.is_empty()) { remove_node(selection.front()->key()); } diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 07318c14bc..a0876ffa3d 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -521,7 +521,7 @@ void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String & Vector<String> filters; for (int i = 0; i < split.size(); i++) { String f = split[i].strip_edges(); - if (f.empty()) { + if (f.is_empty()) { continue; } filters.push_back(f); @@ -754,7 +754,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & Vector<String> enc_in_split = p_preset->get_enc_in_filter().split(","); for (int i = 0; i < enc_in_split.size(); i++) { String f = enc_in_split[i].strip_edges(); - if (f.empty()) { + if (f.is_empty()) { continue; } enc_in_filters.push_back(f); @@ -763,7 +763,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & Vector<String> enc_ex_split = p_preset->get_enc_ex_filter().split(","); for (int i = 0; i < enc_ex_split.size(); i++) { String f = enc_ex_split[i].strip_edges(); - if (f.empty()) { + if (f.is_empty()) { continue; } enc_ex_filters.push_back(f); @@ -1696,7 +1696,7 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset, valid = dvalid || rvalid; r_missing_templates = !valid; - if (!err.empty()) { + if (!err.is_empty()) { r_error = err; } return valid; @@ -1783,7 +1783,7 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr } } - if (err == OK && !so_files.empty()) { + if (err == OK && !so_files.is_empty()) { //if shared object files, copy them da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); for (int i = 0; i < so_files.size() && err == OK; i++) { diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index ecb659e7d3..280c13ec9d 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -96,7 +96,7 @@ void EditorFeatureProfile::set_disable_class_property(const StringName &p_class, } else { ERR_FAIL_COND(!disabled_properties.has(p_class)); disabled_properties[p_class].erase(p_property); - if (disabled_properties[p_class].empty()) { + if (disabled_properties[p_class].is_empty()) { disabled_properties.erase(p_class); } } diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 8ded47605c..0719d3f018 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -758,7 +758,7 @@ void EditorFileDialog::update_file_list() { dirs.sort_custom<NaturalNoCaseComparator>(); files.sort_custom<NaturalNoCaseComparator>(); - while (!dirs.empty()) { + while (!dirs.is_empty()) { const String &dir_name = dirs.front()->get(); item_list->add_item(dir_name); @@ -806,8 +806,8 @@ void EditorFileDialog::update_file_list() { } } - while (!files.empty()) { - bool match = patterns.empty(); + while (!files.is_empty()) { + bool match = patterns.is_empty(); for (List<String>::Element *E = patterns.front(); E; E = E->next()) { if (files.front()->get().matchn(E->get())) { diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 1592549e0c..5eff0f2e4a 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -167,12 +167,12 @@ void EditorHelp::_class_desc_resized() { void EditorHelp::_add_type(const String &p_type, const String &p_enum) { String t = p_type; - if (t.empty()) { + if (t.is_empty()) { t = "void"; } - bool can_ref = (t != "void") || !p_enum.empty(); + bool can_ref = (t != "void") || !p_enum.is_empty(); - if (!p_enum.empty()) { + if (!p_enum.is_empty()) { if (p_enum.get_slice_count(".") > 1) { t = p_enum.get_slice(".", 1); } else { @@ -188,7 +188,7 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { add_array = true; t = t.replace("[]", ""); } - if (p_enum.empty()) { + if (p_enum.is_empty()) { class_desc->push_meta("#" + t); //class } else { class_desc->push_meta("$" + p_enum); //class @@ -472,7 +472,7 @@ void EditorHelp::_update_doc() { for (int i = 0; i < cd.tutorials.size(); i++) { const String link = DTR(cd.tutorials[i].link); - String linktxt = (cd.tutorials[i].title.empty()) ? link : DTR(cd.tutorials[i].title); + String linktxt = (cd.tutorials[i].title.is_empty()) ? link : DTR(cd.tutorials[i].title); const int seppos = linktxt.find("//"); if (seppos != -1) { linktxt = link.right(seppos + 2); @@ -498,7 +498,7 @@ void EditorHelp::_update_doc() { if (cd.is_script_doc) { has_properties = false; for (int i = 0; i < cd.properties.size(); i++) { - if (cd.properties[i].name.begins_with("_") && cd.properties[i].description.empty()) { + if (cd.properties[i].name.begins_with("_") && cd.properties[i].description.is_empty()) { continue; } has_properties = true; @@ -522,7 +522,7 @@ void EditorHelp::_update_doc() { for (int i = 0; i < cd.properties.size(); i++) { // Ignore undocumented private. - if (cd.properties[i].name.begins_with("_") && cd.properties[i].description.empty()) { + if (cd.properties[i].name.begins_with("_") && cd.properties[i].description.is_empty()) { continue; } property_line[cd.properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description @@ -633,7 +633,7 @@ void EditorHelp::_update_doc() { } } // Ignore undocumented private. - if (cd.methods[i].name.begins_with("_") && cd.methods[i].description.empty()) { + if (cd.methods[i].name.begins_with("_") && cd.methods[i].description.is_empty()) { continue; } methods.push_back(cd.methods[i]); @@ -668,7 +668,7 @@ void EditorHelp::_update_doc() { } } - if (any_previous && !m.empty()) { + if (any_previous && !m.is_empty()) { class_desc->push_cell(); class_desc->pop(); //cell class_desc->push_cell(); @@ -702,7 +702,7 @@ void EditorHelp::_update_doc() { _add_method(m[i], true); } - any_previous = !m.empty(); + any_previous = !m.is_empty(); } class_desc->pop(); //table @@ -848,7 +848,7 @@ void EditorHelp::_update_doc() { Vector<DocData::ConstantDoc> constants; for (int i = 0; i < cd.constants.size(); i++) { - if (!cd.constants[i].enumeration.empty()) { + if (!cd.constants[i].enumeration.is_empty()) { if (!enums.has(cd.constants[i].enumeration)) { enums[cd.constants[i].enumeration] = Vector<DocData::ConstantDoc>(); } @@ -856,7 +856,7 @@ void EditorHelp::_update_doc() { enums[cd.constants[i].enumeration].push_back(cd.constants[i]); } else { // Ignore undocumented private. - if (cd.constants[i].name.begins_with("_") && cd.constants[i].description.empty()) { + if (cd.constants[i].name.begins_with("_") && cd.constants[i].description.is_empty()) { continue; } constants.push_back(cd.constants[i]); @@ -1174,7 +1174,7 @@ void EditorHelp::_update_doc() { class_desc->push_color(text_color); class_desc->push_font(doc_font); class_desc->push_indent(1); - if (!cd.properties[i].description.strip_edges().empty()) { + if (!cd.properties[i].description.strip_edges().is_empty()) { _add_text(DTR(cd.properties[i].description)); } else { class_desc->add_image(get_theme_icon("Error", "EditorIcons")); @@ -1229,7 +1229,7 @@ void EditorHelp::_update_doc() { class_desc->push_color(text_color); class_desc->push_font(doc_font); class_desc->push_indent(1); - if (!methods_filtered[i].description.strip_edges().empty()) { + if (!methods_filtered[i].description.strip_edges().is_empty()) { _add_text(DTR(methods_filtered[i].description)); } else { class_desc->add_image(get_theme_icon("Error", "EditorIcons")); @@ -1838,7 +1838,7 @@ void FindBar::popup_search() { grabbed_focus = true; } - if (!search_text->get_text().empty()) { + if (!search_text->get_text().is_empty()) { search_text->select_all(); search_text->set_cursor_position(search_text->get_text().length()); if (grabbed_focus) { @@ -1908,7 +1908,7 @@ void FindBar::_update_results_count() { results_count = 0; String searched = search_text->get_text(); - if (searched.empty()) { + if (searched.is_empty()) { return; } @@ -1928,7 +1928,7 @@ void FindBar::_update_results_count() { } void FindBar::_update_matches_label() { - if (search_text->get_text().empty() || results_count == -1) { + if (search_text->get_text().is_empty() || results_count == -1) { matches_label->hide(); } else { matches_label->show(); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index a36b5f5a6a..4d975512d4 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -865,7 +865,7 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const { String text; PackedStringArray slices = p_text.split("::", false); - if (!slices.empty()) { + if (!slices.is_empty()) { String property_name = slices[0].strip_edges(); text = TTR("Property:") + " [u][b]" + property_name + "[/b][/u]"; @@ -1098,7 +1098,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE); PackedStringArray slices = p_text.split("::", false); - if (!slices.empty()) { + if (!slices.is_empty()) { String property_name = slices[0].strip_edges(); String text = "[u][b]" + property_name + "[/b][/u]"; @@ -1901,7 +1901,7 @@ void EditorInspector::update_tree() { } } - if (!F->get().inherits.empty()) { + if (!F->get().inherits.is_empty()) { F = dd->class_list.find(F->get().inherits); } else { break; @@ -2525,7 +2525,7 @@ void EditorInspector::_update_script_class_properties(const Object &p_object, Li script = script->get_base_script(); } - if (classes.empty()) { + if (classes.is_empty()) { return; } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index ca8b278ab8..d883b6c909 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -377,9 +377,9 @@ void EditorNode::_version_control_menu_option(int p_idx) { void EditorNode::_update_title() { String appname = ProjectSettings::get_singleton()->get("application/config/name"); - String title = appname.empty() ? String(VERSION_FULL_NAME) : String(VERSION_NAME + String(" - ") + appname); + String title = appname.is_empty() ? String(VERSION_FULL_NAME) : String(VERSION_NAME + String(" - ") + appname); String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String(); - if (!edited.empty()) { + if (!edited.is_empty()) { title += " - " + String(edited.get_file()); } if (unsaved_cache) { @@ -782,8 +782,8 @@ void EditorNode::_fs_changed() { preset_name); } else { Ref<EditorExportPlatform> platform = preset->get_platform(); - const String export_path = export_defer.path.empty() ? preset->get_export_path() : export_defer.path; - if (export_path.empty()) { + const String export_path = export_defer.path.is_empty() ? preset->get_export_path() : export_defer.path; + if (export_path.is_empty()) { export_error = vformat("Export preset '%s' doesn't have a default export path, and none was specified.", preset_name); } else if (platform.is_null()) { export_error = vformat("Export preset '%s' doesn't have a matching platform.", preset_name); @@ -821,7 +821,7 @@ void EditorNode::_fs_changed() { } } - if (!export_error.empty()) { + if (!export_error.is_empty()) { ERR_PRINT(export_error); OS::get_singleton()->set_exit_code(EXIT_FAILURE); } @@ -1711,7 +1711,7 @@ void EditorNode::_dialog_action(String p_file) { current_obj->_change_notify(); } break; case SETTINGS_LAYOUT_SAVE: { - if (p_file.empty()) { + if (p_file.is_empty()) { return; } @@ -1739,7 +1739,7 @@ void EditorNode::_dialog_action(String p_file) { } break; case SETTINGS_LAYOUT_DELETE: { - if (p_file.empty()) { + if (p_file.is_empty()) { return; } @@ -1822,7 +1822,7 @@ void EditorNode::edit_item(Object *p_object) { sub_plugins = editor_data.get_subeditors(p_object); } - if (!sub_plugins.empty()) { + if (!sub_plugins.is_empty()) { bool same = true; if (sub_plugins.size() == editor_plugins_over->get_plugins_list().size()) { for (int i = 0; i < sub_plugins.size(); i++) { @@ -1998,7 +1998,7 @@ void EditorNode::_edit_current() { multi_nodes.push_back(node); } } - if (!multi_nodes.empty()) { + if (!multi_nodes.is_empty()) { // Pick the top-most node multi_nodes.sort_custom<Node::Comparator>(); selected_node = multi_nodes.front()->get(); @@ -2080,13 +2080,13 @@ void EditorNode::_edit_current() { sub_plugins = editor_data.get_subeditors(current_obj); } - if (!sub_plugins.empty()) { + if (!sub_plugins.is_empty()) { _display_top_editors(false); _set_top_editors(sub_plugins); _set_editing_top_editors(current_obj); _display_top_editors(true); - } else if (!editor_plugins_over->get_plugins_list().empty()) { + } else if (!editor_plugins_over->get_plugins_list().is_empty()) { hide_top_editors(); } } @@ -2256,7 +2256,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } break; case FILE_OPEN_PREV: { - if (previous_scenes.empty()) { + if (previous_scenes.is_empty()) { break; } opening_prev = true; @@ -2527,7 +2527,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } break; case RUN_PLAY_CUSTOM_SCENE: { - if (run_custom_filename.empty() || editor_run.get_status() == EditorRun::STATUS_STOP) { + if (run_custom_filename.is_empty() || editor_run.get_status() == EditorRun::STATUS_STOP) { _menu_option_confirm(RUN_STOP, true); quick_run->popup_dialog("PackedScene", true); quick_run->set_title(TTR("Quick Run Scene...")); @@ -2876,7 +2876,7 @@ void EditorNode::_update_file_menu_opened() { Ref<Shortcut> reopen_closed_scene_sc = ED_GET_SHORTCUT("editor/reopen_closed_scene"); reopen_closed_scene_sc->set_name(TTR("Reopen Closed Scene")); PopupMenu *pop = file_menu->get_popup(); - pop->set_item_disabled(pop->get_item_index(FILE_OPEN_PREV), previous_scenes.empty()); + pop->set_item_disabled(pop->get_item_index(FILE_OPEN_PREV), previous_scenes.is_empty()); } void EditorNode::_update_file_menu_closed() { @@ -3823,7 +3823,7 @@ Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String } Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p_fallback) const { - ERR_FAIL_COND_V_MSG(p_class.empty(), nullptr, "Class name cannot be empty."); + ERR_FAIL_COND_V_MSG(p_class.is_empty(), nullptr, "Class name cannot be empty."); if (ScriptServer::is_global_class(p_class)) { Ref<ImageTexture> icon; @@ -4555,7 +4555,7 @@ bool EditorNode::has_scenes_in_session() { return false; } Array scenes = config->get_value("EditorNode", "open_scenes"); - return !scenes.empty(); + return !scenes.is_empty(); } bool EditorNode::ensure_main_scene(bool p_from_native) { @@ -4781,7 +4781,7 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) { Ref<Shortcut> undo_close_tab_sc = ED_GET_SHORTCUT("editor/reopen_closed_scene"); undo_close_tab_sc->set_name(TTR("Undo Close Tab")); scene_tabs_context_menu->add_shortcut(undo_close_tab_sc, FILE_OPEN_PREV); - if (previous_scenes.empty()) { + if (previous_scenes.is_empty()) { scene_tabs_context_menu->set_item_disabled(scene_tabs_context_menu->get_item_index(FILE_OPEN_PREV), true); } scene_tabs_context_menu->add_item(TTR("Close Other Tabs"), FILE_CLOSE_OTHERS); @@ -5185,7 +5185,7 @@ void EditorNode::_add_dropped_files_recursive(const Vector<String> &p_files, Str next_file = sub_dir->get_next(); } - if (!sub_files.empty()) { + if (!sub_files.is_empty()) { dir->make_dir(to); _add_dropped_files_recursive(sub_files, to); } @@ -6950,8 +6950,8 @@ void EditorPluginList::remove_plugin(EditorPlugin *p_plugin) { plugins_list.erase(p_plugin); } -bool EditorPluginList::empty() { - return plugins_list.empty(); +bool EditorPluginList::is_empty() { + return plugins_list.is_empty(); } void EditorPluginList::clear() { diff --git a/editor/editor_node.h b/editor/editor_node.h index ab8d268801..a53ae6934f 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -903,7 +903,7 @@ public: void add_plugin(EditorPlugin *p_plugin); void remove_plugin(EditorPlugin *p_plugin); void clear(); - bool empty(); + bool is_empty(); EditorPluginList(); ~EditorPluginList(); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index f974ba9998..a84f26193a 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -128,7 +128,7 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh Main::iteration(); Main::iteration(); Ref<Image> img = RS::get_singleton()->texture_2d_get(viewport_texture); - ERR_CONTINUE(!img.is_valid() || img->empty()); + ERR_CONTINUE(!img.is_valid() || img->is_empty()); Ref<ImageTexture> it(memnew(ImageTexture)); it->create_from_image(img); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index f432d52bf6..972fd0723a 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2356,7 +2356,7 @@ void EditorPropertyResource::_file_selected(const String &p_path) { property_types = E->get().hint_string; } } - if (!property_types.empty()) { + if (!property_types.is_empty()) { bool any_type_matches = false; const Vector<String> split_property_types = property_types.split(","); for (int i = 0; i < split_property_types.size(); ++i) { @@ -2514,7 +2514,7 @@ void EditorPropertyResource::_menu_option(int p_which) { update_property(); break; } - ERR_FAIL_COND(inheritors_array.empty()); + ERR_FAIL_COND(inheritors_array.is_empty()); String intype = inheritors_array[p_which - TYPE_BASE_ID]; @@ -2658,7 +2658,7 @@ void EditorPropertyResource::_update_menu_items() { bool is_custom_resource = false; Ref<Texture2D> icon; - if (!custom_resources.empty()) { + if (!custom_resources.is_empty()) { for (int j = 0; j < custom_resources.size(); j++) { if (custom_resources[j].name == t) { is_custom_resource = true; diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index c2c309fc32..774c08c4f0 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -550,7 +550,7 @@ void EditorPropertyArray::_length_changed(double p_page) { void EditorPropertyArray::setup(Variant::Type p_array_type, const String &p_hint_string) { array_type = p_array_type; - if (array_type == Variant::ARRAY && !p_hint_string.empty()) { + if (array_type == Variant::ARRAY && !p_hint_string.is_empty()) { int hint_subtype_separator = p_hint_string.find(":"); if (hint_subtype_separator >= 0) { String subtype_string = p_hint_string.substr(0, hint_subtype_separator); diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp index 639da371bd..3ebcd16275 100644 --- a/editor/editor_run_native.cpp +++ b/editor/editor_run_native.cpp @@ -46,7 +46,7 @@ void EditorRunNative::_notification(int p_what) { Ref<Image> im = icon->get_data(); im = im->duplicate(); im->clear_mipmaps(); - if (!im->empty()) { + if (!im->is_empty()) { im->resize(16 * EDSCALE, 16 * EDSCALE); Ref<ImageTexture> small_icon; small_icon.instance(); diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index bc9ca15467..691f2e8228 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -234,7 +234,7 @@ void SectionedInspector::update_category_list() { continue; } - if (!filter.empty() && pi.name.findn(filter) == -1 && pi.name.replace("/", " ").capitalize().findn(filter) == -1) { + if (!filter.is_empty() && pi.name.findn(filter) == -1 && pi.name.replace("/", " ").capitalize().findn(filter) == -1) { continue; } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 73a191d317..3d131d373a 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -281,7 +281,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { locales_to_skip.push_back("te"); // Telugu } - if (!locales_to_skip.empty()) { + if (!locales_to_skip.is_empty()) { WARN_PRINT("Some locales are not properly supported by selected Text Server and are disabled."); } @@ -1476,7 +1476,7 @@ bool EditorSettings::is_default_text_editor_theme() { Vector<String> EditorSettings::get_script_templates(const String &p_extension, const String &p_custom_path) { Vector<String> templates; String template_dir = get_script_templates_dir(); - if (!p_custom_path.empty()) { + if (!p_custom_path.is_empty()) { template_dir = p_custom_path; } DirAccess *d = DirAccess::open(template_dir); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 6c8bd1901e..1efa38c181 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -531,7 +531,7 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa } String file_name = p_path.get_file(); - if (!file_name.empty()) { + if (!file_name.is_empty()) { for (int i = 0; i < files->get_item_count(); i++) { if (files->get_item_text(i) == file_name) { files->select(i, true); @@ -1528,7 +1528,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_ove if (!p_overwrite) { to_move_path = p_to_path; Vector<String> conflicting_items = _check_existing(); - if (!conflicting_items.empty()) { + if (!conflicting_items.is_empty()) { // Ask to do something. overwrite_dialog->set_text(vformat( TTR("The following files or folders conflict with items in the target location '%s':\n\n%s\n\nDo you wish to overwrite them?"), @@ -1721,7 +1721,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected paths.push_back(fpath); } } - if (!paths.empty()) { + if (!paths.is_empty()) { emit_signal("instance", paths); } } break; @@ -1753,7 +1753,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected case FILE_DEPENDENCIES: { // Checkout the file dependencies. - if (!p_selected.empty()) { + if (!p_selected.is_empty()) { String fpath = p_selected[0]; deps_editor->edit(fpath); } @@ -1761,7 +1761,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected case FILE_OWNERS: { // Checkout the file owners. - if (!p_selected.empty()) { + if (!p_selected.is_empty()) { String fpath = p_selected[0]; owners_editor->show(fpath); } @@ -1784,7 +1784,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected case FILE_RENAME: { // Rename the active file. - if (!p_selected.empty()) { + if (!p_selected.is_empty()) { to_rename.path = p_selected[0]; if (to_rename.path != "res://") { to_rename.is_file = !to_rename.path.ends_with("/"); @@ -1885,7 +1885,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected } break; case FILE_COPY_PATH: { - if (!p_selected.empty()) { + if (!p_selected.is_empty()) { String fpath = p_selected[0]; DisplayServer::get_singleton()->clipboard_set(fpath); } @@ -2013,7 +2013,7 @@ Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from) all_not_favorites = true; } - if (paths.empty()) { + if (paths.is_empty()) { return Variant(); } @@ -2061,7 +2061,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da String to_dir; bool favorite; _get_drag_target_folder(to_dir, favorite, p_point, p_from); - return !to_dir.empty(); + return !to_dir.is_empty(); } if (drag_data.has("type") && (String(drag_data["type"]) == "files" || String(drag_data["type"]) == "files_and_dirs")) { @@ -2074,7 +2074,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da return true; } - if (to_dir.empty()) { + if (to_dir.is_empty()) { return false; } @@ -2169,7 +2169,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, String to_dir; bool favorite; _get_drag_target_folder(to_dir, favorite, p_point, p_from); - if (res.is_valid() && !to_dir.empty()) { + if (res.is_valid() && !to_dir.is_empty()) { EditorNode::get_singleton()->push_item(res.ptr()); EditorNode::get_singleton()->save_resource_as(res, to_dir); } @@ -2180,7 +2180,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, String to_dir; bool favorite; _get_drag_target_folder(to_dir, favorite, p_point, p_from); - if (!to_dir.empty()) { + if (!to_dir.is_empty()) { Vector<String> fnames = drag_data["files"]; to_move.clear(); for (int i = 0; i < fnames.size(); i++) { @@ -2188,7 +2188,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, to_move.push_back(FileOrFolder(fnames[i], !fnames[i].ends_with("/"))); } } - if (!to_move.empty()) { + if (!to_move.is_empty()) { if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { for (int i = 0; i < to_move.size(); i++) { String new_path; @@ -2291,7 +2291,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options) { // Add options for files and folders. - ERR_FAIL_COND_MSG(p_paths.empty(), "Path cannot be empty."); + ERR_FAIL_COND_MSG(p_paths.is_empty(), "Path cannot be empty."); Vector<String> filenames; Vector<String> foldernames; @@ -2414,7 +2414,7 @@ void FileSystemDock::_tree_rmb_select(const Vector2 &p_pos) { } // Popup. - if (!paths.empty()) { + if (!paths.is_empty()) { tree_popup->set_size(Size2(1, 1)); _file_and_folders_fill_popup(tree_popup, paths); tree_popup->set_position(tree->get_screen_position() + p_pos); @@ -2454,7 +2454,7 @@ void FileSystemDock::_file_list_rmb_select(int p_item, const Vector2 &p_pos) { } // Popup. - if (!paths.empty()) { + if (!paths.is_empty()) { file_list_popup->clear(); file_list_popup->set_size(Size2(1, 1)); _file_and_folders_fill_popup(file_list_popup, paths, searched_string.length() == 0); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index e8588bbed5..ac4acc613f 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -499,8 +499,8 @@ void FindInFilesDialog::_on_search_text_modified(String text) { ERR_FAIL_COND(!_find_button); ERR_FAIL_COND(!_replace_button); - _find_button->set_disabled(get_search_text().empty()); - _replace_button->set_disabled(get_search_text().empty()); + _find_button->set_disabled(get_search_text().is_empty()); + _replace_button->set_disabled(get_search_text().is_empty()); } void FindInFilesDialog::_on_search_text_entered(String text) { diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index 1eaf7d70b7..55bd475543 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -198,7 +198,7 @@ void GroupDialog::_add_group(String p_name) { } String name = p_name.strip_edges(); - if (name.empty() || groups->get_item_with_text(name)) { + if (name.is_empty() || groups->get_item_with_text(name)) { return; } @@ -551,7 +551,7 @@ void GroupsEditor::_add_group(const String &p_group) { } const String name = group_name->get_text().strip_edges(); - if (name.empty()) { + if (name.is_empty()) { return; } diff --git a/editor/import/collada.cpp b/editor/import/collada.cpp index 8eb68ecdcf..91c4e3afd2 100644 --- a/editor/import/collada.cpp +++ b/editor/import/collada.cpp @@ -1365,7 +1365,7 @@ Collada::Node *Collada::_parse_visual_instance_geometry(XMLParser &parser) { } if (geom->controller) { - if (geom->skeletons.empty()) { + if (geom->skeletons.is_empty()) { //XSI style if (state.skin_controller_data_map.has(geom->source)) { @@ -2321,7 +2321,7 @@ void Collada::_optimize() { i--; } - while (!mgeom.empty()) { + while (!mgeom.is_empty()) { Node *n = mgeom.front()->get(); n->parent->children.push_back(n); mgeom.pop_front(); diff --git a/editor/import/collada.h b/editor/import/collada.h index 29d49d4aa7..354a3e697a 100644 --- a/editor/import/collada.h +++ b/editor/import/collada.h @@ -274,7 +274,7 @@ public: if (normal == p_vert.normal) { if (uv == p_vert.uv) { if (uv2 == p_vert.uv2) { - if (!weights.empty() || !p_vert.weights.empty()) { + if (!weights.is_empty() || !p_vert.weights.is_empty()) { if (weights.size() == p_vert.weights.size()) { for (int i = 0; i < weights.size(); i++) { if (weights[i].bone_idx != p_vert.weights[i].bone_idx) { diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index db5b7b36aa..19a846bf37 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -1027,7 +1027,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres Vector<String> skeletons = ng2->skeletons; - ERR_FAIL_COND_V(skeletons.empty(), ERR_INVALID_DATA); + ERR_FAIL_COND_V(skeletons.is_empty(), ERR_INVALID_DATA); String skname = skeletons[0]; ERR_FAIL_COND_V(!node_map.has(skname), ERR_INVALID_DATA); @@ -1471,7 +1471,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones } Vector<float> data = at.get_value_at_time(snapshots[i]); - ERR_CONTINUE(data.empty()); + ERR_CONTINUE(data.is_empty()); Collada::Node::XForm &xf = cn->xform_list.write[xform_idx]; diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp index ac068c05cf..6166b83ae0 100644 --- a/editor/import/resource_importer_layered_texture.cpp +++ b/editor/import/resource_importer_layered_texture.cpp @@ -373,7 +373,7 @@ Error ResourceImporterLayeredTexture::import(const String &p_source_file, const int x = slice_w * j; int y = slice_h * i; Ref<Image> slice = image->get_rect(Rect2(x, y, slice_w, slice_h)); - ERR_CONTINUE(slice.is_null() || slice->empty()); + ERR_CONTINUE(slice.is_null() || slice->is_empty()); if (slice->get_width() != slice_w || slice->get_height() != slice_h) { slice->resize(slice_w, slice_h); } diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index d36d811ce8..ea16551f18 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -1468,7 +1468,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p if (!ret_used_cache) { // Cache was not used, add the generated entry to the current cache - if (cache_data.empty()) { + if (cache_data.is_empty()) { cache_data.resize(4 + ret_cache_size); int *data = (int *)cache_data.ptrw(); data[0] = 1; diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index c8dae53722..0bffc4a2d0 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -82,7 +82,7 @@ void ResourceImporterTexture::update_imports() { MutexLock lock(mutex); Vector<String> to_reimport; { - if (make_flags.empty()) { + if (make_flags.is_empty()) { return; } diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index e0ba50fe4f..0620d572e3 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -452,7 +452,7 @@ void InspectorDock::update(Object *p_object) { List<MethodInfo> methods; p_object->get_method_list(&methods); - if (!methods.empty()) { + if (!methods.is_empty()) { bool found = false; List<MethodInfo>::Element *I = methods.front(); int i = 0; diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp index 1f6c32ed70..1d09ad8a4c 100644 --- a/editor/node_3d_editor_gizmos.cpp +++ b/editor/node_3d_editor_gizmos.cpp @@ -198,7 +198,7 @@ void EditorNode3DGizmo::add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard, } void EditorNode3DGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material, bool p_billboard, const Color &p_modulate) { - if (p_lines.empty()) { + if (p_lines.is_empty()) { return; } @@ -4205,7 +4205,7 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { } } - if (faces.empty()) { + if (faces.is_empty()) { return; } @@ -4521,7 +4521,7 @@ Joint3DGizmoPlugin::Joint3DGizmoPlugin() { } void Joint3DGizmoPlugin::incremental_update_gizmos() { - if (!current_gizmos.empty()) { + if (!current_gizmos.is_empty()) { update_idx++; update_idx = update_idx % current_gizmos.size(); redraw(current_gizmos[update_idx]); diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index a780750633..c63f51c512 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -126,7 +126,7 @@ void PluginConfigDialog::_on_cancelled() { void PluginConfigDialog::_on_required_text_changed(const String &) { int lang_idx = script_option_edit->get_selected(); String ext = ScriptServer::get_language(lang_idx)->get_extension(); - get_ok_button()->set_disabled(script_edit->get_text().get_basename().empty() || script_edit->get_text().get_extension() != ext || name_edit->get_text().empty()); + get_ok_button()->set_disabled(script_edit->get_text().get_basename().is_empty() || script_edit->get_text().get_extension() != ext || name_edit->get_text().is_empty()); } void PluginConfigDialog::_notification(int p_what) { diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index a20bbd2b62..d301e8ff7b 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -416,7 +416,7 @@ void AnimationNodeBlendTreeEditor::_delete_nodes_request() { } } - if (to_erase.empty()) { + if (to_erase.is_empty()) { return; } @@ -537,7 +537,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano default: { } break; } - if (!track_type_name.empty()) { + if (!track_type_name.is_empty()) { types[track_path].insert(track_type_name); } } diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 4b97dacbc1..491aab1258 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -680,7 +680,7 @@ void AnimationPlayerEditor::set_state(const Dictionary &p_state) { if (p_state.has("animation")) { String anim = p_state["animation"]; - if (!anim.empty() && player->has_animation(anim)) { + if (!anim.is_empty() && player->has_animation(anim)) { _select_anim_by_name(anim); _animation_edit(); } diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index bd70e649e6..6420a28d50 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -702,7 +702,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PackedB } } - if (!image->empty()) { + if (!image->is_empty()) { switch (image_queue[p_queue_id].image_type) { case IMAGE_QUEUE_ICON: @@ -1151,7 +1151,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const asset_bottom_page = _make_pages(page, pages, page_len, total_items, result.size()); library_vb->add_child(asset_bottom_page); - if (result.empty()) { + if (result.is_empty()) { if (filter->get_text() != String()) { library_error->set_text( vformat(TTR("No results for \"%s\"."), filter->get_text())); @@ -1188,7 +1188,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const } } - if (!result.empty()) { + if (!result.is_empty()) { library_scroll->set_v_scroll(0); } } break; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index a5064de838..ecd0a20c1a 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -518,7 +518,7 @@ void CanvasItemEditor::_keying_changed() { } Rect2 CanvasItemEditor::_get_encompassing_rect_from_list(List<CanvasItem *> p_list) { - ERR_FAIL_COND_V(p_list.empty(), Rect2()); + ERR_FAIL_COND_V(p_list.is_empty(), Rect2()); // Handles the first element CanvasItem *canvas_item = p_list.front()->get(); @@ -1147,7 +1147,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve if (dragged_guide_index >= 0) { vguides.remove(dragged_guide_index); undo_redo->create_action(TTR("Remove Vertical Guide")); - if (vguides.empty()) { + if (vguides.is_empty()) { undo_redo->add_do_method(EditorNode::get_singleton()->get_edited_scene(), "remove_meta", "_edit_vertical_guides_"); } else { undo_redo->add_do_method(EditorNode::get_singleton()->get_edited_scene(), "set_meta", "_edit_vertical_guides_", vguides); @@ -1180,7 +1180,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve if (dragged_guide_index >= 0) { hguides.remove(dragged_guide_index); undo_redo->create_action(TTR("Remove Horizontal Guide")); - if (hguides.empty()) { + if (hguides.is_empty()) { undo_redo->add_do_method(EditorNode::get_singleton()->get_edited_scene(), "remove_meta", "_edit_horizontal_guides_"); } else { undo_redo->add_do_method(EditorNode::get_singleton()->get_edited_scene(), "set_meta", "_edit_horizontal_guides_", hguides); @@ -2400,7 +2400,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { _select_click_on_item(item, click, b->get_shift()); return true; - } else if (!selection_results.empty()) { + } else if (!selection_results.is_empty()) { // Sorts items according the their z-index selection_results.sort(); @@ -2463,13 +2463,13 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { // Retrieve the bones Vector<_SelectResult> selection = Vector<_SelectResult>(); _get_bones_at_pos(click, selection); - if (!selection.empty()) { + if (!selection.is_empty()) { canvas_item = selection[0].item; } else { // Retrieve the canvas items selection = Vector<_SelectResult>(); _get_canvas_items_at_pos(click, selection); - if (!selection.empty()) { + if (!selection.is_empty()) { canvas_item = selection[0].item; } } @@ -3916,7 +3916,7 @@ void CanvasItemEditor::_draw_viewport() { bool all_locked = true; bool all_group = true; List<Node *> selection = editor_selection->get_selected_node_list(); - if (selection.empty()) { + if (selection.is_empty()) { all_locked = false; all_group = false; } else { @@ -3935,10 +3935,10 @@ void CanvasItemEditor::_draw_viewport() { } lock_button->set_visible(!all_locked); - lock_button->set_disabled(selection.empty()); + lock_button->set_disabled(selection.is_empty()); unlock_button->set_visible(all_locked); group_button->set_visible(!all_group); - group_button->set_disabled(selection.empty()); + group_button->set_disabled(selection.is_empty()); ungroup_button->set_visible(all_group); info_overlay->set_offset(SIDE_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10); @@ -3956,11 +3956,11 @@ void CanvasItemEditor::_draw_viewport() { RenderingServer::get_singleton()->canvas_item_add_set_transform(ci, Transform2D()); EditorPluginList *over_plugin_list = editor->get_editor_plugins_over(); - if (!over_plugin_list->empty()) { + if (!over_plugin_list->is_empty()) { over_plugin_list->forward_canvas_draw_over_viewport(viewport); } EditorPluginList *force_over_plugin_list = editor->get_editor_plugins_force_over(); - if (!force_over_plugin_list->empty()) { + if (!force_over_plugin_list->is_empty()) { force_over_plugin_list->forward_canvas_force_draw_over_viewport(viewport); } diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 2fc0e35f82..7c3b393cd5 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -106,7 +106,7 @@ Ref<Texture2D> EditorTexturePreviewPlugin::generate(const RES &p_from, const Siz } } - if (img.is_null() || img->empty()) { + if (img.is_null() || img->is_empty()) { return Ref<Texture2D>(); } @@ -150,7 +150,7 @@ bool EditorImagePreviewPlugin::handles(const String &p_type) const { Ref<Texture2D> EditorImagePreviewPlugin::generate(const RES &p_from, const Size2 &p_size) const { Ref<Image> img = p_from; - if (img.is_null() || img->empty()) { + if (img.is_null() || img->is_empty()) { return Ref<Image>(); } diff --git a/editor/plugins/font_editor_plugin.cpp b/editor/plugins/font_editor_plugin.cpp index a82547182c..55419e1042 100644 --- a/editor/plugins/font_editor_plugin.cpp +++ b/editor/plugins/font_editor_plugin.cpp @@ -216,7 +216,7 @@ void FontDataEditor::init_script_edit() { void FontDataEditor::add_lang() { FontData *fd = Object::cast_to<FontData>(get_edited_object()); - if (fd != nullptr && !le->get_text().empty()) { + if (fd != nullptr && !le->get_text().is_empty()) { fd->set_language_support_override(le->get_text(), chk->is_pressed()); le->set_text(""); chk->set_pressed(false); diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp index 2a08e3a8b5..c8a85267ac 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp @@ -63,7 +63,7 @@ void MeshInstance3DEditor::_menu_option(int p_option) { List<Node *> selection = editor_selection->get_selected_node_list(); - if (selection.empty()) { + if (selection.is_empty()) { Ref<Shape3D> shape = mesh->create_trimesh_shape(); if (shape.is_null()) { err_dialog->set_text(TTR("Couldn't create a Trimesh collision shape.")); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index da305df69b..d92ee48247 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -612,7 +612,7 @@ void Node3DEditorViewport::_find_items_at_pos(const Point2 &p_pos, bool &r_inclu results.push_back(res); } - if (results.empty()) { + if (results.is_empty()) { return; } @@ -1045,7 +1045,7 @@ void Node3DEditorViewport::_list_select(Ref<InputEventMouseButton> b) { clicked = ObjectID(); } - } else if (!selection_results.empty()) { + } else if (!selection_results.is_empty()) { NodePath root_path = get_tree()->get_edited_scene_root()->get_path(); StringName root_name = root_path.get_name(root_path.get_name_count() - 1); @@ -1097,7 +1097,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { { EditorNode *en = editor; EditorPluginList *force_input_forwarding_list = en->get_editor_plugins_force_input_forwarding(); - if (!force_input_forwarding_list->empty()) { + if (!force_input_forwarding_list->is_empty()) { bool discard = force_input_forwarding_list->forward_spatial_gui_input(camera, p_event, true); if (discard) { return; @@ -1107,7 +1107,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { { EditorNode *en = editor; EditorPluginList *over_plugin_list = en->get_editor_plugins_over(); - if (!over_plugin_list->empty()) { + if (!over_plugin_list->is_empty()) { bool discard = over_plugin_list->forward_spatial_gui_input(camera, p_event, false); if (discard) { return; @@ -2615,12 +2615,12 @@ static void draw_indicator_bar(Control &surface, real_t fill, const Ref<Texture2 void Node3DEditorViewport::_draw() { EditorPluginList *over_plugin_list = EditorNode::get_singleton()->get_editor_plugins_over(); - if (!over_plugin_list->empty()) { + if (!over_plugin_list->is_empty()) { over_plugin_list->forward_spatial_draw_over_viewport(surface); } EditorPluginList *force_over_plugin_list = editor->get_editor_plugins_force_over(); - if (!force_over_plugin_list->empty()) { + if (!force_over_plugin_list->is_empty()) { force_over_plugin_list->forward_spatial_force_draw_over_viewport(surface); } @@ -5778,7 +5778,7 @@ void Node3DEditor::_refresh_menu_icons() { List<Node *> &selection = editor_selection->get_selected_node_list(); - if (selection.empty()) { + if (selection.is_empty()) { all_locked = false; all_grouped = false; } else { @@ -5797,11 +5797,11 @@ void Node3DEditor::_refresh_menu_icons() { } tool_button[TOOL_LOCK_SELECTED]->set_visible(!all_locked); - tool_button[TOOL_LOCK_SELECTED]->set_disabled(selection.empty()); + tool_button[TOOL_LOCK_SELECTED]->set_disabled(selection.is_empty()); tool_button[TOOL_UNLOCK_SELECTED]->set_visible(all_locked); tool_button[TOOL_GROUP_SELECTED]->set_visible(!all_grouped); - tool_button[TOOL_GROUP_SELECTED]->set_disabled(selection.empty()); + tool_button[TOOL_GROUP_SELECTED]->set_disabled(selection.is_empty()); tool_button[TOOL_UNGROUP_SELECTED]->set_visible(all_grouped); } diff --git a/editor/plugins/packed_scene_translation_parser_plugin.cpp b/editor/plugins/packed_scene_translation_parser_plugin.cpp index 608b5c3104..09d2303359 100644 --- a/editor/plugins/packed_scene_translation_parser_plugin.cpp +++ b/editor/plugins/packed_scene_translation_parser_plugin.cpp @@ -81,14 +81,14 @@ Error PackedSceneEditorTranslationParserPlugin::parse_file(const String &p_path, Vector<String> str_values = property_value; for (int k = 0; k < str_values.size(); k++) { String desc = str_values[k].get_slice(";", 1).strip_edges(); - if (!desc.empty()) { + if (!desc.is_empty()) { parsed_strings.push_back(desc); } } } else if (property_value.get_type() == Variant::STRING) { String str_value = String(property_value); // Prevent reading text containing only spaces. - if (!str_value.strip_edges().empty()) { + if (!str_value.strip_edges().is_empty()) { parsed_strings.push_back(str_value); } } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 7607ab482c..10bd7cc952 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -587,7 +587,7 @@ void ScriptEditor::_go_to_tab(int p_idx) { } void ScriptEditor::_add_recent_script(String p_path) { - if (p_path.empty()) { + if (p_path.is_empty()) { return; } @@ -702,7 +702,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) { } } if (script.is_valid()) { - if (!script->get_path().empty()) { + if (!script->get_path().is_empty()) { // Only saved scripts can be restored. previous_scripts.push_back(script->get_path()); } @@ -1129,7 +1129,7 @@ void ScriptEditor::_menu_option(int p_option) { return; } break; case FILE_REOPEN_CLOSED: { - if (previous_scripts.empty()) { + if (previous_scripts.is_empty()) { return; } @@ -1381,7 +1381,7 @@ void ScriptEditor::_menu_option(int p_option) { case SHOW_IN_FILE_SYSTEM: { const RES script = current->get_edited_resource(); const String path = script->get_path(); - if (!path.empty()) { + if (!path.is_empty()) { FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock(); file_system_dock->navigate_to_path(path); // Ensure that the FileSystem dock is visible. @@ -1887,7 +1887,7 @@ void ScriptEditor::_update_script_names() { if (se) { Ref<Texture2D> icon = se->get_theme_icon(); String path = se->get_edited_resource()->get_path(); - bool saved = !path.empty(); + bool saved = !path.is_empty(); if (saved) { // The script might be deleted, moved, or renamed, so make sure // to update original path to previously edited resource. @@ -1934,7 +1934,7 @@ void ScriptEditor::_update_script_names() { sd.name = name; } break; case DISPLAY_DIR_AND_NAME: { - if (!path.get_base_dir().get_file().empty()) { + if (!path.get_base_dir().get_file().is_empty()) { sd.name = path.get_base_dir().get_file().plus_file(name); } else { sd.name = name; @@ -1988,7 +1988,7 @@ void ScriptEditor::_update_script_names() { } } - if (_sort_list_on_update && !sedata.empty()) { + if (_sort_list_on_update && !sedata.is_empty()) { sedata.sort(); // change actual order of tab_container so that the order can be rearranged by user @@ -2052,7 +2052,7 @@ void ScriptEditor::_update_script_names() { _update_help_overview_visibility(); _update_script_colors(); - file_menu->get_popup()->set_item_disabled(file_menu->get_popup()->get_item_index(FILE_REOPEN_CLOSED), previous_scripts.empty()); + file_menu->get_popup()->set_item_disabled(file_menu->get_popup()->get_item_index(FILE_REOPEN_CLOSED), previous_scripts.is_empty()); } void ScriptEditor::_update_script_connections() { @@ -2806,7 +2806,7 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) { String path = scripts[i]; Dictionary script_info = scripts[i]; - if (!script_info.empty()) { + if (!script_info.is_empty()) { path = script_info["path"]; } @@ -2833,7 +2833,7 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) { } } - if (!script_info.empty()) { + if (!script_info.is_empty()) { ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(tab_container->get_tab_count() - 1)); if (se) { se->set_edit_state(script_info["state"]); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index ed2c0c9f26..f34224ab95 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -349,7 +349,7 @@ void ScriptTextEditor::update_settings() { bool ScriptTextEditor::is_unsaved() { const bool unsaved = code_editor->get_text_editor()->get_version() != code_editor->get_text_editor()->get_saved_version() || - script->get_path().empty(); // In memory. + script->get_path().is_empty(); // In memory. return unsaved; } @@ -427,7 +427,7 @@ String ScriptTextEditor::get_name() { if (script->get_path().find("local://") == -1 && script->get_path().find("::") == -1) { name = script->get_path().get_file(); if (is_unsaved()) { - if (script->get_path().empty()) { + if (script->get_path().is_empty()) { name = TTR("[unsaved]"); } name += "(*)"; @@ -551,7 +551,7 @@ void ScriptTextEditor::_validate_script() { if (safe_lines.has(i + 1)) { te->set_line_gutter_item_color(i, line_number_gutter, safe_line_number_color); last_is_safe = true; - } else if (last_is_safe && (te->is_line_comment(i) || te->get_line(i).strip_edges().empty())) { + } else if (last_is_safe && (te->is_line_comment(i) || te->get_line(i).strip_edges().is_empty())) { te->set_line_gutter_item_color(i, line_number_gutter, safe_line_number_color); } else { te->set_line_gutter_item_color(i, line_number_gutter, default_line_number_color); diff --git a/editor/plugins/shader_file_editor_plugin.cpp b/editor/plugins/shader_file_editor_plugin.cpp index f15a801530..f6ce3f7958 100644 --- a/editor/plugins/shader_file_editor_plugin.cpp +++ b/editor/plugins/shader_file_editor_plugin.cpp @@ -59,7 +59,7 @@ void ShaderFileEditor::_version_selected(int p_option) { ERR_FAIL_COND(bytecode.is_null()); for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) { - if (bytecode->get_stage_bytecode(RD::ShaderStage(i)).empty() && bytecode->get_stage_compile_error(RD::ShaderStage(i)) == String()) { + if (bytecode->get_stage_bytecode(RD::ShaderStage(i)).is_empty() && bytecode->get_stage_compile_error(RD::ShaderStage(i)) == String()) { stages[i]->set_icon(Ref<Texture2D>()); continue; } @@ -182,7 +182,7 @@ void ShaderFileEditor::_update_options() { for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) { Vector<uint8_t> bc = bytecode->get_stage_bytecode(RD::ShaderStage(i)); String error = bytecode->get_stage_compile_error(RD::ShaderStage(i)); - bool disable = error == String() && bc.empty(); + bool disable = error == String() && bc.is_empty(); stages[i]->set_disabled(disable); if (!disable) { if (stages[i]->is_pressed()) { diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 22f50c0689..d22157fda7 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -293,7 +293,7 @@ void BoneTransformEditor::_key_button_pressed() { const BoneId bone_id = property.get_slicec('/', 1).to_int(); const String name = skeleton->get_bone_name(bone_id); - if (name.empty()) + if (name.is_empty()) return; // Need to normalize the basis before you key it diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp index 1be6b979b1..0bfd9e0c36 100644 --- a/editor/plugins/sprite_2d_editor_plugin.cpp +++ b/editor/plugins/sprite_2d_editor_plugin.cpp @@ -340,7 +340,7 @@ void Sprite2DEditor::_convert_to_mesh_2d_node() { } void Sprite2DEditor::_convert_to_polygon_2d_node() { - if (computed_outline_lines.empty()) { + if (computed_outline_lines.is_empty()) { err_dialog->set_text(TTR("Invalid geometry, can't create polygon.")); err_dialog->popup_centered(); return; @@ -398,7 +398,7 @@ void Sprite2DEditor::_convert_to_polygon_2d_node() { } void Sprite2DEditor::_create_collision_polygon_2d_node() { - if (computed_outline_lines.empty()) { + if (computed_outline_lines.is_empty()) { err_dialog->set_text(TTR("Invalid geometry, can't create collision polygon.")); err_dialog->popup_centered(); return; @@ -420,7 +420,7 @@ void Sprite2DEditor::_create_collision_polygon_2d_node() { } void Sprite2DEditor::_create_light_occluder_2d_node() { - if (computed_outline_lines.empty()) { + if (computed_outline_lines.is_empty()) { err_dialog->set_text(TTR("Invalid geometry, can't create light occluder.")); err_dialog->popup_centered(); return; diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index b79d829c34..099f2c8a7f 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -318,7 +318,7 @@ void SpriteFramesEditor::_file_load_request(const Vector<String> &p_path, int p_ resources.push_back(resource); } - if (resources.empty()) { + if (resources.is_empty()) { return; } diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index b95abe8994..37899293d5 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -119,7 +119,7 @@ String TextEditor::get_name() { if (text_file->get_path().find("local://") == -1 && text_file->get_path().find("::") == -1) { name = text_file->get_path().get_file(); if (is_unsaved()) { - if (text_file->get_path().empty()) { + if (text_file->get_path().is_empty()) { name = TTR("[unsaved]"); } name += "(*)"; @@ -242,7 +242,7 @@ void TextEditor::apply_code() { bool TextEditor::is_unsaved() { const bool unsaved = code_editor->get_text_editor()->get_version() != code_editor->get_text_editor()->get_saved_version() || - text_file->get_path().empty(); // In memory. + text_file->get_path().is_empty(); // In memory. return unsaved; } diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 49eb68c93a..7351136593 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -449,7 +449,7 @@ void TileMapEditor::_update_palette() { List<int> tiles; tileset->get_tile_list(&tiles); - if (tiles.empty()) { + if (tiles.is_empty()) { return; } @@ -1779,7 +1779,7 @@ void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { return; } - if (paint_undo.empty()) { + if (paint_undo.is_empty()) { return; } @@ -1810,7 +1810,7 @@ void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { } } } else if (tool == TOOL_PASTING) { - if (copydata.empty()) { + if (copydata.is_empty()) { return; } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 2fbfa2a8e3..ec1de43b6f 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -1015,7 +1015,7 @@ void VisualShaderEditor::_update_options_menu() { TreeItem *root = members->create_item(); String filter = node_filter->get_text().strip_edges(); - bool use_filter = !filter.empty(); + bool use_filter = !filter.is_empty(); bool is_first_item = true; @@ -2108,7 +2108,7 @@ void VisualShaderEditor::_delete_nodes_request() { } } - if (to_erase.empty()) { + if (to_erase.is_empty()) { return; } @@ -2145,13 +2145,13 @@ void VisualShaderEditor::_graph_gui_input(const Ref<InputEvent> &p_event) { } } } - if (to_change.empty() && copy_nodes_buffer.empty()) { + if (to_change.is_empty() && copy_nodes_buffer.is_empty()) { _show_members_dialog(true); } else { - popup_menu->set_item_disabled(NodeMenuOptions::COPY, to_change.empty()); - popup_menu->set_item_disabled(NodeMenuOptions::PASTE, copy_nodes_buffer.empty()); - popup_menu->set_item_disabled(NodeMenuOptions::DELETE, to_change.empty()); - popup_menu->set_item_disabled(NodeMenuOptions::DUPLICATE, to_change.empty()); + popup_menu->set_item_disabled(NodeMenuOptions::COPY, to_change.is_empty()); + popup_menu->set_item_disabled(NodeMenuOptions::PASTE, copy_nodes_buffer.is_empty()); + popup_menu->set_item_disabled(NodeMenuOptions::DELETE, to_change.is_empty()); + popup_menu->set_item_disabled(NodeMenuOptions::DUPLICATE, to_change.is_empty()); menu_point = graph->get_local_mouse_position(); Point2 gpos = Input::get_singleton()->get_mouse_position(); popup_menu->set_position(gpos); @@ -2445,7 +2445,7 @@ void VisualShaderEditor::_duplicate_nodes() { _dup_copy_nodes(type, nodes, excluded); - if (nodes.empty()) { + if (nodes.is_empty()) { return; } @@ -2463,7 +2463,7 @@ void VisualShaderEditor::_copy_nodes() { } void VisualShaderEditor::_paste_nodes(bool p_use_custom_position, const Vector2 &p_custom_position) { - if (copy_nodes_buffer.empty()) { + if (copy_nodes_buffer.is_empty()) { return; } diff --git a/editor/pot_generator.cpp b/editor/pot_generator.cpp index 9b3227ad28..789d0e6ba5 100644 --- a/editor/pot_generator.cpp +++ b/editor/pot_generator.cpp @@ -135,7 +135,7 @@ void POTGenerator::_write_to_pot(const String &p_file) { } // Write context. - if (!context.empty()) { + if (!context.is_empty()) { file->store_line("msgctxt \"" + context + "\""); } @@ -143,7 +143,7 @@ void POTGenerator::_write_to_pot(const String &p_file) { _write_msgid(file, msgid, false); // Write msgid_plural - if (!plural.empty()) { + if (!plural.is_empty()) { _write_msgid(file, plural, true); file->store_line("msgstr[0] \"\""); file->store_line("msgstr[1] \"\"\n"); @@ -185,7 +185,7 @@ void POTGenerator::_add_new_msgid(const String &p_msgid, const String &p_context Vector<MsgidData> &v_mdata = all_translation_strings[p_msgid]; for (int i = 0; i < v_mdata.size(); i++) { if (v_mdata[i].ctx == p_context) { - if (!v_mdata[i].plural.empty() && !p_plural.empty() && v_mdata[i].plural != p_plural) { + if (!v_mdata[i].plural.is_empty() && !p_plural.is_empty() && v_mdata[i].plural != p_plural) { WARN_PRINT("Redefinition of plural message (msgid_plural), under the same message (msgid) and context (msgctxt)"); } v_mdata.write[i].locations.insert(p_location); diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp index a37f4776ac..d6d8e5789e 100644 --- a/editor/progress_dialog.cpp +++ b/editor/progress_dialog.cpp @@ -111,7 +111,7 @@ void BackgroundProgress::task_step(const String &p_task, int p_step) { bool no_updates = true; { _THREAD_SAFE_METHOD_ - no_updates = updates.empty(); + no_updates = updates.is_empty(); } if (no_updates) { @@ -218,7 +218,7 @@ void ProgressDialog::end_task(const String &p_task) { memdelete(t.vb); tasks.erase(p_task); - if (tasks.empty()) { + if (tasks.is_empty()) { hide(); } else { _popup(); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 68710920a5..4eb1b76d63 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -516,7 +516,7 @@ void ProjectExportDialog::_script_encryption_key_changed(const String &p_key) { bool ProjectExportDialog::_validate_script_encryption_key(const String &p_key) { bool is_valid = false; - if (!p_key.empty() && p_key.is_valid_hex_number(false) && p_key.length() == 64) { + if (!p_key.is_empty() && p_key.is_valid_hex_number(false) && p_key.length() == 64) { is_valid = true; } return is_valid; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 3068bdd672..6e32445124 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1545,7 +1545,7 @@ bool ProjectList::is_any_project_missing() const { } void ProjectList::erase_missing_projects() { - if (_projects.empty()) { + if (_projects.is_empty()) { return; } @@ -1875,7 +1875,7 @@ void ProjectManager::_dim_window() { void ProjectManager::_update_project_buttons() { Vector<ProjectList::Item> selected_projects = _project_list->get_selected_projects(); - bool empty_selection = selected_projects.empty(); + bool empty_selection = selected_projects.is_empty(); bool is_missing_project_selected = false; for (int i = 0; i < selected_projects.size(); ++i) { diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 9995c6ad65..a294a64dbe 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -156,7 +156,7 @@ void ProjectSettingsEditor::_update_advanced_bar() { bool disable_add = true; bool disable_del = true; - if (!property_box->get_text().empty()) { + if (!property_box->get_text().is_empty()) { const String setting = _get_setting_name(); bool setting_exists = ps->has_setting(setting); if (setting_exists) { @@ -197,7 +197,7 @@ void ProjectSettingsEditor::_update_advanced_bar() { String ProjectSettingsEditor::_get_setting_name() const { const String cat = category_box->get_text(); - const String name = (cat.empty() ? "global" : cat.strip_edges()).plus_file(property_box->get_text().strip_edges()); + const String name = (cat.is_empty() ? "global" : cat.strip_edges()).plus_file(property_box->get_text().strip_edges()); const String feature = feature_override->get_item_text(feature_override->get_selected()); return (feature == "") ? name : (name + "." + feature); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index d45ee1eae1..9a58a23cb0 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -251,7 +251,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { emit_signal("variant_changed"); break; } - ERR_FAIL_COND(inheritors_array.empty()); + ERR_FAIL_COND(inheritors_array.is_empty()); String intype = inheritors_array[p_which - TYPE_BASE_ID]; @@ -367,18 +367,18 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: int c = hint_text.get_slice_count(","); float min = 0, max = 100, step = type == Variant::FLOAT ? .01 : 1; if (c >= 1) { - if (!hint_text.get_slice(",", 0).empty()) { + if (!hint_text.get_slice(",", 0).is_empty()) { min = hint_text.get_slice(",", 0).to_float(); } } if (c >= 2) { - if (!hint_text.get_slice(",", 1).empty()) { + if (!hint_text.get_slice(",", 1).is_empty()) { max = hint_text.get_slice(",", 1).to_float(); } } if (c >= 3) { - if (!hint_text.get_slice(",", 2).empty()) { + if (!hint_text.get_slice(",", 2).is_empty()) { step = hint_text.get_slice(",", 2).to_float(); } } @@ -882,7 +882,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: bool is_custom_resource = false; Ref<Texture2D> icon; - if (!custom_resources.empty()) { + if (!custom_resources.is_empty()) { for (int k = 0; k < custom_resources.size(); k++) { if (custom_resources[k].name == t) { is_custom_resource = true; @@ -1246,7 +1246,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { } break; case Variant::OBJECT: { if (p_which == 0) { - ERR_FAIL_COND(inheritors_array.empty()); + ERR_FAIL_COND(inheritors_array.is_empty()); String intype = inheritors_array[0]; diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index a60937a86b..379faf2131 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -572,7 +572,7 @@ void RenameDialog::rename() { // Forward recursive as opposed to the actual renaming. _iterate_scene(root_node, selected_node_list, &global_count); - if (undo_redo && !to_rename.empty()) { + if (undo_redo && !to_rename.is_empty()) { undo_redo->create_action(TTR("Batch Rename")); // Make sure to iterate reversed so that child nodes will find parents. diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 91ae81dea2..89750f6043 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -361,7 +361,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (current_edited_scene_root) { String root_class = current_edited_scene_root->get_class_name(); static Vector<String> preferred_types; - if (preferred_types.empty()) { + if (preferred_types.is_empty()) { preferred_types.push_back("Control"); preferred_types.push_back("Node2D"); preferred_types.push_back("Node3D"); @@ -416,7 +416,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } Node *selected = scene_tree->get_selected(); - if (!selected && !editor_selection->get_selected_node_list().empty()) { + if (!selected && !editor_selection->get_selected_node_list().is_empty()) { selected = editor_selection->get_selected_node_list().front()->get(); } @@ -438,7 +438,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { Array selection = editor_selection->get_selected_nodes(); - if (selection.empty()) { + if (selection.is_empty()) { return; } @@ -737,7 +737,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { List<Node *> remove_list = editor_selection->get_selected_node_list(); - if (remove_list.empty()) { + if (remove_list.is_empty()) { return; } @@ -1529,7 +1529,7 @@ void SceneTreeDock::_node_reparent(NodePath p_path, bool p_keep_global_xform) { List<Node *> selection = editor_selection->get_selected_node_list(); - if (selection.empty()) { + if (selection.is_empty()) { return; // Nothing to reparent. } @@ -1703,7 +1703,7 @@ bool SceneTreeDock::_is_collapsed_recursive(TreeItem *p_item) const { List<TreeItem *> needs_check; needs_check.push_back(p_item); - while (!needs_check.empty()) { + while (!needs_check.is_empty()) { TreeItem *item = needs_check.back()->get(); needs_check.pop_back(); @@ -1725,7 +1725,7 @@ void SceneTreeDock::_set_collapsed_recursive(TreeItem *p_item, bool p_collapsed) List<TreeItem *> to_collapse; to_collapse.push_back(p_item); - while (!to_collapse.empty()) { + while (!to_collapse.is_empty()) { TreeItem *item = to_collapse.back()->get(); to_collapse.pop_back(); @@ -1742,7 +1742,7 @@ void SceneTreeDock::_set_collapsed_recursive(TreeItem *p_item, bool p_collapsed) void SceneTreeDock::_script_created(Ref<Script> p_script) { List<Node *> selected = editor_selection->get_selected_node_list(); - if (selected.empty()) { + if (selected.is_empty()) { return; } @@ -1811,7 +1811,7 @@ void SceneTreeDock::_toggle_editable_children(Node *p_node) { void SceneTreeDock::_delete_confirm() { List<Node *> remove_list = editor_selection->get_selected_node_list(); - if (remove_list.empty()) { + if (remove_list.is_empty()) { return; } @@ -2349,7 +2349,7 @@ void SceneTreeDock::_script_dropped(String p_file, NodePath p_to) { void SceneTreeDock::_nodes_dragged(Array p_nodes, NodePath p_to, int p_type) { List<Node *> selection = editor_selection->get_selected_node_list(); - if (selection.empty()) { + if (selection.is_empty()) { return; //nothing to reparent } @@ -2601,7 +2601,7 @@ void SceneTreeDock::attach_script_to_selected(bool p_extend) { } List<Node *> selection = editor_selection->get_selected_node_list(); - if (selection.empty()) { + if (selection.is_empty()) { return; } diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 40fc5c02fc..f30ad02f5e 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -251,7 +251,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { if (can_rename) { //should be can edit.. String warning = p_node->get_configuration_warning(); - if (!warning.empty()) { + if (!warning.is_empty()) { item->add_button(0, get_theme_icon("NodeWarning", "EditorIcons"), BUTTON_WARNING, false, TTR("Node configuration warning:") + "\n" + p_node->get_configuration_warning()); } @@ -754,7 +754,7 @@ void SceneTreeEditor::_renamed() { ERR_FAIL_COND(!n); // Empty node names are not allowed, so resets it to previous text and show warning - if (which->get_text(0).strip_edges().empty()) { + if (which->get_text(0).strip_edges().is_empty()) { which->set_text(0, n->get_name()); EditorNode::get_singleton()->show_warning(TTR("No name provided.")); return; @@ -765,7 +765,7 @@ void SceneTreeEditor::_renamed() { error->set_text(TTR("Invalid node name, the following characters are not allowed:") + "\n" + Node::invalid_character); error->popup_centered(); - if (new_name.empty()) { + if (new_name.is_empty()) { which->set_text(0, n->get_name()); return; } @@ -931,7 +931,7 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from next = tree->get_next_selected(next); } - if (selected.empty()) { + if (selected.is_empty()) { return Variant(); } diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 2b95231542..7fd2613c1e 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -50,7 +50,7 @@ void ScriptCreateDialog::_theme_changed() { } String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", ""); - if (!last_lang.empty()) { + if (!last_lang.is_empty()) { for (int i = 0; i < language_menu->get_item_count(); i++) { if (language_menu->get_item_text(i) == last_lang) { language_menu->select(i); |