diff --git a/core/debugger/engine_debugger.cpp b/core/debugger/engine_debugger.cpp index 4bf31aa55fc..5ef802957fa 100644 --- a/core/debugger/engine_debugger.cpp +++ b/core/debugger/engine_debugger.cpp @@ -135,7 +135,7 @@ void EngineDebugger::iteration(uint64_t p_frame_ticks, uint64_t p_idle_ticks, ui void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, Vector p_breakpoints) { register_uri_handler("tcp://", RemoteDebuggerPeerTCP::create); // TCP is the default protocol. Platforms/modules can add more. - if (p_uri.empty()) { + if (p_uri.is_empty()) { return; } if (p_uri == "local://") { diff --git a/core/debugger/local_debugger.cpp b/core/debugger/local_debugger.cpp index 876be794187..e8401655f1f 100644 --- a/core/debugger/local_debugger.cpp +++ b/core/debugger/local_debugger.cpp @@ -117,7 +117,7 @@ struct LocalDebugger::ScriptsProfiler { void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) { ScriptLanguage *script_lang = script_debugger->get_break_language(); - if (!target_function.empty()) { + if (!target_function.is_empty()) { String current_function = script_lang->debug_get_stack_level_function(0); if (current_function != target_function) { script_debugger->set_depth(0); @@ -259,7 +259,7 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) { String source = breakpoint.first; int linenr = breakpoint.second; - if (source.empty()) { + if (source.is_empty()) { continue; } @@ -285,7 +285,7 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) { String source = breakpoint.first; int linenr = breakpoint.second; - if (source.empty()) { + if (source.is_empty()) { continue; } @@ -323,7 +323,7 @@ void LocalDebugger::print_variables(const List &names, const List::Element *E = names.front(); E; E = E->next()) { value = String(V->get()); - if (variable_prefix.empty()) { + if (variable_prefix.is_empty()) { print_line(E->get() + ": " + String(V->get())); } else { print_line(E->get() + ":"); @@ -359,7 +359,7 @@ void LocalDebugger::send_message(const String &p_message, const Array &p_args) { } void LocalDebugger::send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, ErrorHandlerType p_type) { - print_line("ERROR: '" + (p_descr.empty() ? p_err : p_descr) + "'"); + print_line("ERROR: '" + (p_descr.is_empty() ? p_err : p_descr) + "'"); } LocalDebugger::LocalDebugger() { diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp index ff895174972..4e16bb0182c 100644 --- a/core/debugger/remote_debugger.cpp +++ b/core/debugger/remote_debugger.cpp @@ -553,7 +553,7 @@ void RemoteDebugger::flush_output() { for (int i = 0; i < output_strings.size(); i++) { const OutputString &output_string = output_strings[i]; if (output_string.type == MESSAGE_TYPE_ERROR) { - if (!joined_log_strings.empty()) { + if (!joined_log_strings.is_empty()) { strings.push_back(String("\n").join(joined_log_strings)); types.push_back(MESSAGE_TYPE_LOG); joined_log_strings.clear(); @@ -565,7 +565,7 @@ void RemoteDebugger::flush_output() { } } - if (!joined_log_strings.empty()) { + if (!joined_log_strings.is_empty()) { strings.push_back(String("\n").join(joined_log_strings)); types.push_back(MESSAGE_TYPE_LOG); } diff --git a/core/input/input.cpp b/core/input/input.cpp index 153656e44a4..c49193562e9 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -806,7 +806,7 @@ void Input::accumulate_input_event(const Ref &p_event) { parse_input_event(p_event); return; } - if (!accumulated_events.empty() && accumulated_events.back()->get()->accumulate(p_event)) { + if (!accumulated_events.is_empty() && accumulated_events.back()->get()->accumulate(p_event)) { return; //event was accumulated, exit } diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index 82bfaa82a51..bdfa5dff5f4 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -210,7 +210,7 @@ String InputEventWithModifiers::as_text() const { mod_names.push_back(find_keycode_name(KEY_META)); } - if (!mod_names.empty()) { + if (!mod_names.is_empty()) { return String("+").join(mod_names); } else { return ""; diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp index 979809c7afe..45e2ddc71d5 100644 --- a/core/input/input_map.cpp +++ b/core/input/input_map.cpp @@ -71,7 +71,7 @@ void InputMap::erase_action(const StringName &p_action) { Array InputMap::_get_actions() { Array ret; List actions = get_actions(); - if (actions.empty()) { + if (actions.is_empty()) { return ret; } @@ -84,7 +84,7 @@ Array InputMap::_get_actions() { List InputMap::get_actions() const { List actions = List(); - if (input_map.empty()) { + if (input_map.is_empty()) { return actions; } diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 8be39178dbc..a53431cab29 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -67,7 +67,7 @@ void ConfigFile::set_value(const String &p_section, const String &p_key, const V return; // ? } values[p_section].erase(p_key); - if (values[p_section].empty()) { + if (values[p_section].is_empty()) { values.erase(p_section); } diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 1e9266f118c..207d5757ecd 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -350,7 +350,7 @@ void FileAccessNetwork::_queue_page(int p_page) const { if (p_page >= pages.size()) { return; } - if (pages[p_page].buffer.empty() && !pages[p_page].queued) { + if (pages[p_page].buffer.is_empty() && !pages[p_page].queued) { FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton; { MutexLock lock(nc->blockrequest_mutex); @@ -386,7 +386,7 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const { if (page != last_page) { buffer_mutex.lock(); - if (pages[page].buffer.empty()) { + if (pages[page].buffer.is_empty()) { waiting_on_page = page; for (int j = 0; j < read_ahead; j++) { _queue_page(page + j); diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index a025ca57304..30c94d6a4d6 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -89,7 +89,7 @@ void PackedData::add_path(const String &pkg_path, const String &path, uint64_t o } String filename = path.get_file(); // Don't add as a file if the path points to a directory - if (!filename.empty()) { + if (!filename.is_empty()) { cd->files.insert(filename); } } diff --git a/core/io/image.cpp b/core/io/image.cpp index 56d84325b59..fec7a6a0c5b 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -375,7 +375,7 @@ Image::Image3DValidateError Image::validate_3d_image(Image::Format p_format, int if (idx >= p_images.size()) { return VALIDATE_3D_ERR_MISSING_IMAGES; } - if (p_images[idx].is_null() || p_images[idx]->empty()) { + if (p_images[idx].is_null() || p_images[idx]->is_empty()) { return VALIDATE_3D_ERR_IMAGE_EMPTY; } if (p_images[idx]->get_format() != p_format) { @@ -1756,7 +1756,7 @@ Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, con double *normal_sat = nullptr; //summed area table for normalmap int normal_w = 0, normal_h = 0; - ERR_FAIL_COND_V_MSG(p_normal_map.is_null() || p_normal_map->empty(), ERR_INVALID_PARAMETER, "Must provide a valid normalmap for roughness mipmaps"); + ERR_FAIL_COND_V_MSG(p_normal_map.is_null() || p_normal_map->is_empty(), ERR_INVALID_PARAMETER, "Must provide a valid normalmap for roughness mipmaps"); Ref nm = p_normal_map->duplicate(); if (nm->is_compressed()) { @@ -1950,7 +1950,7 @@ void Image::clear_mipmaps() { return; } - if (empty()) { + if (is_empty()) { return; } @@ -1961,7 +1961,7 @@ void Image::clear_mipmaps() { mipmaps = false; } -bool Image::empty() const { +bool Image::is_empty() const { return (data.size() == 0); } @@ -3090,7 +3090,7 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("create", "width", "height", "use_mipmaps", "format"), &Image::_create_empty); ClassDB::bind_method(D_METHOD("create_from_data", "width", "height", "use_mipmaps", "format", "data"), &Image::_create_from_data); - ClassDB::bind_method(D_METHOD("is_empty"), &Image::empty); + ClassDB::bind_method(D_METHOD("is_empty"), &Image::is_empty); ClassDB::bind_method(D_METHOD("load", "path"), &Image::load); ClassDB::bind_method(D_METHOD("save_png", "path"), &Image::save_png); @@ -3585,7 +3585,7 @@ Image::Image(const uint8_t *p_mem_png_jpg, int p_len) { copy_internals_from(_png_mem_loader_func(p_mem_png_jpg, p_len)); } - if (empty() && _jpg_mem_loader_func) { + if (is_empty() && _jpg_mem_loader_func) { copy_internals_from(_jpg_mem_loader_func(p_mem_png_jpg, p_len)); } } diff --git a/core/io/image.h b/core/io/image.h index 6b4488bd662..7280500c85e 100644 --- a/core/io/image.h +++ b/core/io/image.h @@ -285,7 +285,7 @@ public: /** * returns true when the image is empty (0,0) in size */ - bool empty() const; + bool is_empty() const; Vector get_data() const; diff --git a/core/io/ip.cpp b/core/io/ip.cpp index 9f3540efad8..beb3c7fc2e8 100644 --- a/core/io/ip.cpp +++ b/core/io/ip.cpp @@ -189,7 +189,7 @@ void IP::erase_resolve_item(ResolverID p_id) { void IP::clear_cache(const String &p_hostname) { MutexLock lock(resolver->mutex); - if (p_hostname.empty()) { + if (p_hostname.is_empty()) { resolver->cache.clear(); } else { resolver->cache.erase(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_NONE)); diff --git a/core/io/json.cpp b/core/io/json.cpp index d61c2b82360..f9d96c5e1f0 100644 --- a/core/io/json.cpp +++ b/core/io/json.cpp @@ -47,7 +47,7 @@ const char *JSON::tk_name[TK_MAX] = { static String _make_indent(const String &p_indent, int p_size) { String indent_text = ""; - if (!p_indent.empty()) { + if (!p_indent.is_empty()) { for (int i = 0; i < p_size; i++) { indent_text += p_indent; } @@ -59,7 +59,7 @@ String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_ String colon = ":"; String end_statement = ""; - if (!p_indent.empty()) { + if (!p_indent.is_empty()) { colon += " "; end_statement += "\n"; } diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 5480d3c535d..f2b0c80aabc 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -53,7 +53,7 @@ void PCKPacker::_bind_methods() { } Error PCKPacker::pck_start(const String &p_file, int p_alignment, const String &p_key, bool p_encrypt_directory) { - ERR_FAIL_COND_V_MSG((p_key.empty() || !p_key.is_valid_hex_number(false) || p_key.length() != 64), ERR_CANT_CREATE, "Invalid Encryption Key (must be 64 characters long)."); + ERR_FAIL_COND_V_MSG((p_key.is_empty() || !p_key.is_valid_hex_number(false) || p_key.length() != 64), ERR_CANT_CREATE, "Invalid Encryption Key (must be 64 characters long)."); String _key = p_key.to_lower(); key.resize(32); diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index 34cccca5400..88cd0896638 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -70,7 +70,7 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error) { is_eof = f->eof_reached(); // If we reached last line and it's not a content line, break, otherwise let processing that last loop - if (is_eof && l.empty()) { + if (is_eof && l.is_empty()) { if (status == STATUS_READING_ID || status == STATUS_READING_CONTEXT || (status == STATUS_READING_PLURAL && plural_index != plural_forms - 1)) { memdelete(f); ERR_FAIL_V_MSG(RES(), "Unexpected EOF while reading PO file at: " + path + ":" + itos(line)); diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index b4410acf7d7..6b97cba9f9e 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -35,7 +35,7 @@ #include "scene/scene_string_names.h" int AStar::get_available_point_id() const { - if (points.empty()) { + if (points.is_empty()) { return 1; } @@ -341,7 +341,7 @@ bool AStar::_solve(Point *begin_point, Point *end_point) { begin_point->f_score = _estimate_cost(begin_point->id, end_point->id); open_list.push_back(begin_point); - while (!open_list.empty()) { + while (!open_list.is_empty()) { Point *p = open_list[0]; // The currently processed point if (p == end_point) { @@ -805,7 +805,7 @@ bool AStar2D::_solve(AStar::Point *begin_point, AStar::Point *end_point) { begin_point->f_score = _estimate_cost(begin_point->id, end_point->id); open_list.push_back(begin_point); - while (!open_list.empty()) { + while (!open_list.is_empty()) { AStar::Point *p = open_list[0]; // The currently processed point if (p == end_point) { diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h index ecf2feb3d8d..8b0d390465b 100644 --- a/core/math/dynamic_bvh.h +++ b/core/math/dynamic_bvh.h @@ -278,7 +278,7 @@ private: public: // Methods void clear(); - bool empty() const { return (0 == bvh_root); } + bool is_empty() const { return (0 == bvh_root); } void optimize_bottom_up(); void optimize_top_down(int bu_threshold = 128); void optimize_incremental(int passes); @@ -332,7 +332,7 @@ void DynamicBVH::aabb_query(const AABB &p_box, QueryResult &r_result) { if (n->volume.intersects(volume)) { if (n->is_internal()) { if (depth > threshold) { - if (aux_stack.empty()) { + if (aux_stack.is_empty()) { aux_stack.resize(ALLOCA_STACK_SIZE * 2); copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); } else { @@ -388,7 +388,7 @@ void DynamicBVH::convex_query(const Plane *p_planes, int p_plane_count, const Ve if (n->volume.intersects(volume) && n->volume.intersects_convex(p_planes, p_plane_count, p_points, p_point_count)) { if (n->is_internal()) { if (depth > threshold) { - if (aux_stack.empty()) { + if (aux_stack.is_empty()) { aux_stack.resize(ALLOCA_STACK_SIZE * 2); copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); } else { @@ -445,7 +445,7 @@ void DynamicBVH::ray_query(const Vector3 &p_from, const Vector3 &p_to, QueryResu if (result1) { if (node->is_internal()) { if (depth > threshold) { - if (aux_stack.empty()) { + if (aux_stack.is_empty()) { aux_stack.resize(ALLOCA_STACK_SIZE * 2); copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); } else { diff --git a/core/math/octree.h b/core/math/octree.h index be1e7d6a619..f7ff4faef38 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -572,7 +572,7 @@ bool Octree::_remove_element_from_octant(Element *p_element, O Octant *parent = p_octant->parent; - if (p_octant->children_count == 0 && p_octant->elements.empty() && p_octant->pairable_elements.empty()) { + if (p_octant->children_count == 0 && p_octant->elements.is_empty() && p_octant->pairable_elements.is_empty()) { // erase octant if (p_octant == root) { // won't have a parent, just erase @@ -942,7 +942,7 @@ void Octree::_cull_convex(Octant *p_octant, _CullConvexData *p return; //pointless } - if (!p_octant->elements.empty()) { + if (!p_octant->elements.is_empty()) { typename List::Element *I; I = p_octant->elements.front(); @@ -965,7 +965,7 @@ void Octree::_cull_convex(Octant *p_octant, _CullConvexData *p } } - if (use_pairs && !p_octant->pairable_elements.empty()) { + if (use_pairs && !p_octant->pairable_elements.is_empty()) { typename List::Element *I; I = p_octant->pairable_elements.front(); @@ -1001,7 +1001,7 @@ void Octree::_cull_aabb(Octant *p_octant, const AABB &p_aabb, return; //pointless } - if (!p_octant->elements.empty()) { + if (!p_octant->elements.is_empty()) { typename List::Element *I; I = p_octant->elements.front(); for (; I; I = I->next()) { @@ -1027,7 +1027,7 @@ void Octree::_cull_aabb(Octant *p_octant, const AABB &p_aabb, } } - if (use_pairs && !p_octant->pairable_elements.empty()) { + if (use_pairs && !p_octant->pairable_elements.is_empty()) { typename List::Element *I; I = p_octant->pairable_elements.front(); for (; I; I = I->next()) { @@ -1065,7 +1065,7 @@ void Octree::_cull_segment(Octant *p_octant, const Vector3 &p_ return; //pointless } - if (!p_octant->elements.empty()) { + if (!p_octant->elements.is_empty()) { typename List::Element *I; I = p_octant->elements.front(); for (; I; I = I->next()) { @@ -1091,7 +1091,7 @@ void Octree::_cull_segment(Octant *p_octant, const Vector3 &p_ } } - if (use_pairs && !p_octant->pairable_elements.empty()) { + if (use_pairs && !p_octant->pairable_elements.is_empty()) { typename List::Element *I; I = p_octant->pairable_elements.front(); for (; I; I = I->next()) { @@ -1132,7 +1132,7 @@ void Octree::_cull_point(Octant *p_octant, const Vector3 &p_po return; //pointless } - if (!p_octant->elements.empty()) { + if (!p_octant->elements.is_empty()) { typename List::Element *I; I = p_octant->elements.front(); for (; I; I = I->next()) { @@ -1158,7 +1158,7 @@ void Octree::_cull_point(Octant *p_octant, const Vector3 &p_po } } - if (use_pairs && !p_octant->pairable_elements.empty()) { + if (use_pairs && !p_octant->pairable_elements.is_empty()) { typename List::Element *I; I = p_octant->pairable_elements.front(); for (; I; I = I->next()) { diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index f5171f60ec6..6cdaacf1643 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -377,7 +377,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) { while ((k = t->method_map.next(k))) { String name = k->operator String(); - ERR_CONTINUE(name.empty()); + ERR_CONTINUE(name.is_empty()); if (name[0] == '_') { continue; // Ignore non-virtual methods that start with an underscore diff --git a/core/object/object.cpp b/core/object/object.cpp index 681e1188ff7..a53925f9908 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -506,7 +506,7 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const { } void Object::set_indexed(const Vector &p_names, const Variant &p_value, bool *r_valid) { - if (p_names.empty()) { + if (p_names.is_empty()) { if (r_valid) { *r_valid = false; } @@ -561,11 +561,11 @@ void Object::set_indexed(const Vector &p_names, const Variant &p_val set(p_names[0], value_stack.back()->get(), r_valid); value_stack.pop_back(); - ERR_FAIL_COND(!value_stack.empty()); + ERR_FAIL_COND(!value_stack.is_empty()); } Variant Object::get_indexed(const Vector &p_names, bool *r_valid) const { - if (p_names.empty()) { + if (p_names.is_empty()) { if (r_valid) { *r_valid = false; } @@ -599,7 +599,7 @@ void Object::get_property_list(List *p_list, bool p_reversed) cons if (!is_class("Script")) { // can still be set, but this is for userfriendlyness p_list->push_back(PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_DEFAULT)); } - if (!metadata.empty()) { + if (!metadata.is_empty()) { p_list->push_back(PropertyInfo(Variant::DICTIONARY, "__meta__", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); } if (script_instance && !p_reversed) { @@ -1089,7 +1089,7 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int } } - while (!disconnect_data.empty()) { + while (!disconnect_data.is_empty()) { const _ObjectSignalDisconnectData &dd = disconnect_data.front()->get(); _disconnect(dd.signal, dd.callable); @@ -1373,7 +1373,7 @@ void Object::_disconnect(const StringName &p_signal, const Callable &p_callable, target_object->connections.erase(slot->cE); s->slot_map.erase(*p_callable.get_base_comparator()); - if (s->slot_map.empty() && ClassDB::has_signal(get_class_name(), p_signal)) { + if (s->slot_map.is_empty() && ClassDB::has_signal(get_class_name(), p_signal)) { //not user signal, delete signal_map.erase(p_signal); } diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 17ac75e19f1..f9cc5174480 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -275,7 +275,7 @@ void ScriptServer::save_global_classes() { gcarr.push_back(d); } - if (gcarr.empty()) { + if (gcarr.is_empty()) { if (ProjectSettings::get_singleton()->has_setting("_global_script_classes")) { ProjectSettings::get_singleton()->clear("_global_script_classes"); } diff --git a/core/string/string_buffer.h b/core/string/string_buffer.h index 1317b538d4a..6f58e128be2 100644 --- a/core/string/string_buffer.h +++ b/core/string/string_buffer.h @@ -40,7 +40,7 @@ class StringBuffer { int string_length = 0; _FORCE_INLINE_ char32_t *current_buffer_ptr() { - return static_cast(buffer).empty() ? short_buffer : buffer.ptrw(); + return static_cast(buffer).is_empty() ? short_buffer : buffer.ptrw(); } public: @@ -122,7 +122,7 @@ StringBuffer &StringBuffer::reserve(int p_ return *this; } - bool need_copy = string_length > 0 && buffer.empty(); + bool need_copy = string_length > 0 && buffer.is_empty(); buffer.resize(next_power_of_2(p_size)); if (need_copy) { memcpy(buffer.ptrw(), short_buffer, string_length * sizeof(char32_t)); @@ -139,7 +139,7 @@ int StringBuffer::length() const { template String StringBuffer::as_string() { current_buffer_ptr()[string_length] = '\0'; - if (buffer.empty()) { + if (buffer.is_empty()) { return String(short_buffer); } else { buffer.resize(string_length + 1); diff --git a/core/string/string_name.h b/core/string/string_name.h index 320f63bf68f..1c0a4e582d2 100644 --- a/core/string/string_name.h +++ b/core/string/string_name.h @@ -83,7 +83,7 @@ class StringName { StringName(_Data *p_data) { _data = p_data; } public: - operator const void *() const { return (_data && (_data->cname || !_data->name.empty())) ? (void *)1 : nullptr; } + operator const void *() const { return (_data && (_data->cname || !_data->name.is_empty())) ? (void *)1 : nullptr; } bool operator==(const String &p_name) const; bool operator==(const char *p_name) const; diff --git a/core/string/translation.cpp b/core/string/translation.cpp index 7b8c28e2e2d..5828f0e127b 100644 --- a/core/string/translation.cpp +++ b/core/string/translation.cpp @@ -851,7 +851,7 @@ void Translation::add_message(const StringName &p_src_text, const StringName &p_ void Translation::add_plural_message(const StringName &p_src_text, const Vector &p_plural_xlated_texts, const StringName &p_context) { WARN_PRINT("Translation class doesn't handle plural messages. Calling add_plural_message() on a Translation instance is probably a mistake. \nUse a derived Translation class that handles plurals, such as TranslationPO class"); - ERR_FAIL_COND_MSG(p_plural_xlated_texts.empty(), "Parameter vector p_plural_xlated_texts passed in is empty."); + ERR_FAIL_COND_MSG(p_plural_xlated_texts.is_empty(), "Parameter vector p_plural_xlated_texts passed in is empty."); translation_map[p_src_text] = p_plural_xlated_texts[0]; } diff --git a/core/string/translation_po.cpp b/core/string/translation_po.cpp index 203f29026ba..08927410211 100644 --- a/core/string/translation_po.cpp +++ b/core/string/translation_po.cpp @@ -230,7 +230,7 @@ StringName TranslationPO::get_message(const StringName &p_src_text, const String if (!translation_map.has(p_context) || !translation_map[p_context].has(p_src_text)) { return StringName(); } - ERR_FAIL_COND_V_MSG(translation_map[p_context][p_src_text].empty(), StringName(), "Source text \"" + String(p_src_text) + "\" is registered but doesn't have a translation. Please report this bug."); + ERR_FAIL_COND_V_MSG(translation_map[p_context][p_src_text].is_empty(), StringName(), "Source text \"" + String(p_src_text) + "\" is registered but doesn't have a translation. Please report this bug."); return translation_map[p_context][p_src_text][0]; } @@ -246,7 +246,7 @@ StringName TranslationPO::get_plural_message(const StringName &p_src_text, const if (!translation_map.has(p_context) || !translation_map[p_context].has(p_src_text)) { return StringName(); } - ERR_FAIL_COND_V_MSG(translation_map[p_context][p_src_text].empty(), StringName(), "Source text \"" + String(p_src_text) + "\" is registered but doesn't have a translation. Please report this bug."); + ERR_FAIL_COND_V_MSG(translation_map[p_context][p_src_text].is_empty(), StringName(), "Source text \"" + String(p_src_text) + "\" is registered but doesn't have a translation. Please report this bug."); if (translation_map[p_context][p_src_text].size() == 1) { WARN_PRINT("Source string \"" + String(p_src_text) + "\" doesn't have plural translations. Use singular translation API for such as tr(), TTR() to translate \"" + String(p_src_text) + "\""); diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index fee168993b8..3276038c4d2 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -427,12 +427,12 @@ String operator+(char32_t p_chr, const String &p_str) { } String &String::operator+=(const String &p_str) { - if (empty()) { + if (is_empty()) { *this = p_str; return *this; } - if (p_str.empty()) { + if (p_str.is_empty()) { return *this; } @@ -519,7 +519,7 @@ bool String::operator==(const char *p_str) const { if (length() != len) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -558,7 +558,7 @@ bool String::operator==(const char32_t *p_str) const { if (length() != len) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -580,7 +580,7 @@ bool String::operator==(const String &p_str) const { if (length() != p_str.length()) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -605,7 +605,7 @@ bool String::operator==(const StrRange &p_str_range) const { if (length() != len) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -678,20 +678,20 @@ bool String::operator>=(const String &p_str) const { } bool String::operator<(const char *p_str) const { - if (empty() && p_str[0] == 0) { + if (is_empty() && p_str[0] == 0) { return false; } - if (empty()) { + if (is_empty()) { return true; } return is_str_less(get_data(), p_str); } bool String::operator<(const wchar_t *p_str) const { - if (empty() && p_str[0] == 0) { + if (is_empty() && p_str[0] == 0) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -705,10 +705,10 @@ bool String::operator<(const wchar_t *p_str) const { } bool String::operator<(const char32_t *p_str) const { - if (empty() && p_str[0] == 0) { + if (is_empty() && p_str[0] == 0) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -720,13 +720,13 @@ bool String::operator<(const String &p_str) const { } signed char String::nocasecmp_to(const String &p_str) const { - if (empty() && p_str.empty()) { + if (is_empty() && p_str.is_empty()) { return 0; } - if (empty()) { + if (is_empty()) { return -1; } - if (p_str.empty()) { + if (p_str.is_empty()) { return 1; } @@ -752,13 +752,13 @@ signed char String::nocasecmp_to(const String &p_str) const { } signed char String::casecmp_to(const String &p_str) const { - if (empty() && p_str.empty()) { + if (is_empty() && p_str.is_empty()) { return 0; } - if (empty()) { + if (is_empty()) { return -1; } - if (p_str.empty()) { + if (p_str.is_empty()) { return 1; } @@ -949,10 +949,10 @@ String String::get_with_code_lines() const { } int String::get_slice_count(String p_splitter) const { - if (empty()) { + if (is_empty()) { return 0; } - if (p_splitter.empty()) { + if (p_splitter.is_empty()) { return 0; } @@ -968,7 +968,7 @@ int String::get_slice_count(String p_splitter) const { } String String::get_slice(String p_splitter, int p_slice) const { - if (empty() || p_splitter.empty()) { + if (is_empty() || p_splitter.is_empty()) { return ""; } @@ -1008,7 +1008,7 @@ String String::get_slice(String p_splitter, int p_slice) const { } String String::get_slicec(char32_t p_splitter, int p_slice) const { - if (empty()) { + if (is_empty()) { return String(); } @@ -2585,7 +2585,7 @@ int64_t String::to_int(const char32_t *p_str, int p_len, bool p_clamp) { } double String::to_float() const { - if (empty()) { + if (is_empty()) { return 0; } return built_in_strtod(get_data()); @@ -2767,7 +2767,7 @@ String String::substr(int p_from, int p_chars) const { p_chars = length() - p_from; } - if (empty() || p_from < 0 || p_from >= length() || p_chars <= 0) { + if (is_empty() || p_from < 0 || p_from >= length() || p_chars <= 0) { return ""; } @@ -3142,7 +3142,7 @@ bool String::is_quoted() const { } int String::_count(const String &p_string, int p_from, int p_to, bool p_case_insensitive) const { - if (p_string.empty()) { + if (p_string.is_empty()) { return 0; } int len = length(); @@ -4241,7 +4241,7 @@ bool String::is_valid_ip_address() const { Vector ip = split(":"); for (int i = 0; i < ip.size(); i++) { String n = ip[i]; - if (n.empty()) { + if (n.is_empty()) { continue; } if (n.is_valid_hex_number(false)) { @@ -4331,7 +4331,7 @@ String String::get_extension() const { } String String::plus_file(const String &p_file) const { - if (empty()) { + if (is_empty()) { return p_file; } if (operator[](length() - 1) == '/' || (p_file.size() > 0 && p_file.operator[](0) == '/')) { @@ -4760,7 +4760,7 @@ String String::unquote() const { Vector String::to_ascii_buffer() const { const String *s = this; - if (s->empty()) { + if (s->is_empty()) { return Vector(); } CharString charstr = s->ascii(); @@ -4776,7 +4776,7 @@ Vector String::to_ascii_buffer() const { Vector String::to_utf8_buffer() const { const String *s = this; - if (s->empty()) { + if (s->is_empty()) { return Vector(); } CharString charstr = s->utf8(); @@ -4792,7 +4792,7 @@ Vector String::to_utf8_buffer() const { Vector String::to_utf16_buffer() const { const String *s = this; - if (s->empty()) { + if (s->is_empty()) { return Vector(); } Char16String charstr = s->utf16(); @@ -4808,7 +4808,7 @@ Vector String::to_utf16_buffer() const { Vector String::to_utf32_buffer() const { const String *s = this; - if (s->empty()) { + if (s->is_empty()) { return Vector(); } diff --git a/core/string/ustring.h b/core/string/ustring.h index 7ff78b2d86b..b42814a0a36 100644 --- a/core/string/ustring.h +++ b/core/string/ustring.h @@ -394,7 +394,7 @@ public: Vector sha1_buffer() const; Vector sha256_buffer() const; - _FORCE_INLINE_ bool empty() const { return length() == 0; } + _FORCE_INLINE_ bool is_empty() const { return length() == 0; } // path functions bool is_abs_path() const; diff --git a/core/templates/cowdata.h b/core/templates/cowdata.h index d5eb08286d7..705eae8f9f4 100644 --- a/core/templates/cowdata.h +++ b/core/templates/cowdata.h @@ -135,7 +135,7 @@ public: } _FORCE_INLINE_ void clear() { resize(0); } - _FORCE_INLINE_ bool empty() const { return _ptr == nullptr; } + _FORCE_INLINE_ bool is_empty() const { return _ptr == nullptr; } _FORCE_INLINE_ void set(int p_index, const T &p_elem) { CRASH_BAD_INDEX(p_index, size()); diff --git a/core/templates/hash_map.h b/core/templates/hash_map.h index e1ba3815953..2e983028098 100644 --- a/core/templates/hash_map.h +++ b/core/templates/hash_map.h @@ -497,7 +497,7 @@ public: return elements; } - inline bool empty() const { + inline bool is_empty() const { return elements == 0; } diff --git a/core/templates/list.h b/core/templates/list.h index 8e14aaa90df..bab51983801 100644 --- a/core/templates/list.h +++ b/core/templates/list.h @@ -373,7 +373,7 @@ public: /** * return whether the list is empty */ - _FORCE_INLINE_ bool empty() const { + _FORCE_INLINE_ bool is_empty() const { return (!_data || !_data->size_cache); } diff --git a/core/templates/local_vector.h b/core/templates/local_vector.h index 4ef040dc77a..1bf4161f875 100644 --- a/core/templates/local_vector.h +++ b/core/templates/local_vector.h @@ -104,7 +104,7 @@ public: capacity = 0; } } - _FORCE_INLINE_ bool empty() const { return count == 0; } + _FORCE_INLINE_ bool is_empty() const { return count == 0; } _FORCE_INLINE_ void reserve(U p_size) { p_size = nearest_power_of_2_templated(p_size); if (p_size > capacity) { diff --git a/core/templates/map.h b/core/templates/map.h index c454d692562..4e002b67f8d 100644 --- a/core/templates/map.h +++ b/core/templates/map.h @@ -625,7 +625,7 @@ public: return e; } - inline bool empty() const { return _data.size_cache == 0; } + inline bool is_empty() const { return _data.size_cache == 0; } inline int size() const { return _data.size_cache; } int calculate_depth() const { diff --git a/core/templates/oa_hash_map.h b/core/templates/oa_hash_map.h index d9d632b4ce3..49551ffc2d6 100644 --- a/core/templates/oa_hash_map.h +++ b/core/templates/oa_hash_map.h @@ -190,7 +190,7 @@ public: _FORCE_INLINE_ uint32_t get_capacity() const { return capacity; } _FORCE_INLINE_ uint32_t get_num_elements() const { return num_elements; } - bool empty() const { + bool is_empty() const { return num_elements == 0; } diff --git a/core/templates/ordered_hash_map.h b/core/templates/ordered_hash_map.h index 9398868b016..fce9bcfbfc4 100644 --- a/core/templates/ordered_hash_map.h +++ b/core/templates/ordered_hash_map.h @@ -265,7 +265,7 @@ public: return ConstElement(list.back()); } - inline bool empty() const { return list.empty(); } + inline bool is_empty() const { return list.is_empty(); } inline int size() const { return list.size(); } const void *id() const { diff --git a/core/templates/set.h b/core/templates/set.h index d0ac71a710f..c3236180628 100644 --- a/core/templates/set.h +++ b/core/templates/set.h @@ -576,7 +576,7 @@ public: return e; } - inline bool empty() const { return _data.size_cache == 0; } + inline bool is_empty() const { return _data.size_cache == 0; } inline int size() const { return _data.size_cache; } int calculate_depth() const { diff --git a/core/templates/vector.h b/core/templates/vector.h index 7420384bf71..1c06e7e3abe 100644 --- a/core/templates/vector.h +++ b/core/templates/vector.h @@ -79,7 +79,7 @@ public: _FORCE_INLINE_ T *ptrw() { return _cowdata.ptrw(); } _FORCE_INLINE_ const T *ptr() const { return _cowdata.ptr(); } _FORCE_INLINE_ void clear() { resize(0); } - _FORCE_INLINE_ bool empty() const { return _cowdata.empty(); } + _FORCE_INLINE_ bool is_empty() const { return _cowdata.is_empty(); } _FORCE_INLINE_ T get(int p_index) { return _cowdata.get(p_index); } _FORCE_INLINE_ const T &get(int p_index) const { return _cowdata.get(p_index); } diff --git a/core/templates/vmap.h b/core/templates/vmap.h index 8d2a3d2a9c8..5fdfa1a7b57 100644 --- a/core/templates/vmap.h +++ b/core/templates/vmap.h @@ -54,7 +54,7 @@ private: _FORCE_INLINE_ int _find(const T &p_val, bool &r_exact) const { r_exact = false; - if (_cowdata.empty()) { + if (_cowdata.is_empty()) { return 0; } @@ -89,7 +89,7 @@ private: } _FORCE_INLINE_ int _find_exact(const T &p_val) const { - if (_cowdata.empty()) { + if (_cowdata.is_empty()) { return -1; } @@ -147,7 +147,7 @@ public: } _FORCE_INLINE_ int size() const { return _cowdata.size(); } - _FORCE_INLINE_ bool empty() const { return _cowdata.empty(); } + _FORCE_INLINE_ bool is_empty() const { return _cowdata.is_empty(); } const Pair *get_array() const { return _cowdata.ptr(); diff --git a/core/templates/vset.h b/core/templates/vset.h index 4c0b8717b69..f2ea5c814bb 100644 --- a/core/templates/vset.h +++ b/core/templates/vset.h @@ -40,7 +40,7 @@ class VSet { _FORCE_INLINE_ int _find(const T &p_val, bool &r_exact) const { r_exact = false; - if (_data.empty()) { + if (_data.is_empty()) { return 0; } @@ -76,7 +76,7 @@ class VSet { } _FORCE_INLINE_ int _find_exact(const T &p_val) const { - if (_data.empty()) { + if (_data.is_empty()) { return -1; } @@ -126,7 +126,7 @@ public: return _find_exact(p_val); } - _FORCE_INLINE_ bool empty() const { return _data.empty(); } + _FORCE_INLINE_ bool is_empty() const { return _data.is_empty(); } _FORCE_INLINE_ int size() const { return _data.size(); } diff --git a/core/variant/array.cpp b/core/variant/array.cpp index 5043868b1d3..9b8ef24cb9d 100644 --- a/core/variant/array.cpp +++ b/core/variant/array.cpp @@ -86,8 +86,8 @@ int Array::size() const { return _p->array.size(); } -bool Array::empty() const { - return _p->array.empty(); +bool Array::is_empty() const { + return _p->array.is_empty(); } void Array::clear() { @@ -318,7 +318,7 @@ Array Array::slice(int p_begin, int p_end, int p_step, bool p_deep) const { // l ERR_FAIL_COND_V_MSG(p_step == 0, new_arr, "Array slice step size cannot be zero."); - if (empty()) { // Don't try to slice empty arrays. + if (is_empty()) { // Don't try to slice empty arrays. return new_arr; } if (p_step > 0) { @@ -459,7 +459,7 @@ void Array::push_front(const Variant &p_value) { } Variant Array::pop_back() { - if (!_p->array.empty()) { + if (!_p->array.is_empty()) { int n = _p->array.size() - 1; Variant ret = _p->array.get(n); _p->array.resize(n); @@ -469,7 +469,7 @@ Variant Array::pop_back() { } Variant Array::pop_front() { - if (!_p->array.empty()) { + if (!_p->array.is_empty()) { Variant ret = _p->array.get(0); _p->array.remove(0); return ret; diff --git a/core/variant/array.h b/core/variant/array.h index e01ac13168d..6d21446b07a 100644 --- a/core/variant/array.h +++ b/core/variant/array.h @@ -57,7 +57,7 @@ public: const Variant &get(int p_idx) const; int size() const; - bool empty() const; + bool is_empty() const; void clear(); bool operator==(const Array &p_array) const; diff --git a/core/variant/dictionary.cpp b/core/variant/dictionary.cpp index 2bc1f7a86de..aff3f1326ae 100644 --- a/core/variant/dictionary.cpp +++ b/core/variant/dictionary.cpp @@ -40,7 +40,7 @@ struct DictionaryPrivate { }; void Dictionary::get_key_list(List *p_keys) const { - if (_p->variant_map.empty()) { + if (_p->variant_map.is_empty()) { return; } @@ -121,7 +121,7 @@ int Dictionary::size() const { return _p->variant_map.size(); } -bool Dictionary::empty() const { +bool Dictionary::is_empty() const { return !_p->variant_map.size(); } @@ -192,7 +192,7 @@ uint32_t Dictionary::hash() const { Array Dictionary::keys() const { Array varr; - if (_p->variant_map.empty()) { + if (_p->variant_map.is_empty()) { return varr; } @@ -209,7 +209,7 @@ Array Dictionary::keys() const { Array Dictionary::values() const { Array varr; - if (_p->variant_map.empty()) { + if (_p->variant_map.is_empty()) { return varr; } diff --git a/core/variant/dictionary.h b/core/variant/dictionary.h index bbe94122adb..8bc559a73d2 100644 --- a/core/variant/dictionary.h +++ b/core/variant/dictionary.h @@ -60,7 +60,7 @@ public: Variant get(const Variant &p_key, const Variant &p_default) const; int size() const; - bool empty() const; + bool is_empty() const; void clear(); bool has(const Variant &p_key) const; diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 9eb512f71da..8e14886e387 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -912,11 +912,11 @@ bool Variant::is_zero() const { } break; case DICTIONARY: { - return reinterpret_cast(_data._mem)->empty(); + return reinterpret_cast(_data._mem)->is_empty(); } break; case ARRAY: { - return reinterpret_cast(_data._mem)->empty(); + return reinterpret_cast(_data._mem)->is_empty(); } break; diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index 854c0c01ef8..2b6364786e1 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -940,7 +940,7 @@ static void _register_variant_builtin_methods() { bind_method(String, md5_buffer, sarray(), varray()); bind_method(String, sha1_buffer, sarray(), varray()); bind_method(String, sha256_buffer, sarray(), varray()); - bind_method(String, empty, sarray(), varray()); + bind_method(String, is_empty, sarray(), varray()); // FIXME: Static function, not sure how to bind //bind_method(String, humanize_size, sarray("size"), varray()); @@ -1269,7 +1269,7 @@ static void _register_variant_builtin_methods() { /* Dictionary */ bind_method(Dictionary, size, sarray(), varray()); - bind_method(Dictionary, empty, sarray(), varray()); + bind_method(Dictionary, is_empty, sarray(), varray()); bind_method(Dictionary, clear, sarray(), varray()); bind_method(Dictionary, has, sarray("key"), varray()); bind_method(Dictionary, has_all, sarray("keys"), varray()); @@ -1283,7 +1283,7 @@ static void _register_variant_builtin_methods() { /* Array */ bind_method(Array, size, sarray(), varray()); - bind_method(Array, empty, sarray(), varray()); + bind_method(Array, is_empty, sarray(), varray()); bind_method(Array, clear, sarray(), varray()); bind_method(Array, hash, sarray(), varray()); bind_method(Array, push_back, sarray("value"), varray()); @@ -1316,7 +1316,7 @@ static void _register_variant_builtin_methods() { /* Byte Array */ bind_method(PackedByteArray, size, sarray(), varray()); - bind_method(PackedByteArray, empty, sarray(), varray()); + bind_method(PackedByteArray, is_empty, sarray(), varray()); bind_method(PackedByteArray, set, sarray("index", "value"), varray()); bind_method(PackedByteArray, push_back, sarray("value"), varray()); bind_method(PackedByteArray, append, sarray("value"), varray()); @@ -1342,7 +1342,7 @@ static void _register_variant_builtin_methods() { /* Int32 Array */ bind_method(PackedInt32Array, size, sarray(), varray()); - bind_method(PackedInt32Array, empty, sarray(), varray()); + bind_method(PackedInt32Array, is_empty, sarray(), varray()); bind_method(PackedInt32Array, set, sarray("index", "value"), varray()); bind_method(PackedInt32Array, push_back, sarray("value"), varray()); bind_method(PackedInt32Array, append, sarray("value"), varray()); @@ -1360,7 +1360,7 @@ static void _register_variant_builtin_methods() { /* Int64 Array */ bind_method(PackedInt64Array, size, sarray(), varray()); - bind_method(PackedInt64Array, empty, sarray(), varray()); + bind_method(PackedInt64Array, is_empty, sarray(), varray()); bind_method(PackedInt64Array, set, sarray("index", "value"), varray()); bind_method(PackedInt64Array, push_back, sarray("value"), varray()); bind_method(PackedInt64Array, append, sarray("value"), varray()); @@ -1378,7 +1378,7 @@ static void _register_variant_builtin_methods() { /* Float32 Array */ bind_method(PackedFloat32Array, size, sarray(), varray()); - bind_method(PackedFloat32Array, empty, sarray(), varray()); + bind_method(PackedFloat32Array, is_empty, sarray(), varray()); bind_method(PackedFloat32Array, set, sarray("index", "value"), varray()); bind_method(PackedFloat32Array, push_back, sarray("value"), varray()); bind_method(PackedFloat32Array, append, sarray("value"), varray()); @@ -1396,7 +1396,7 @@ static void _register_variant_builtin_methods() { /* Float64 Array */ bind_method(PackedFloat64Array, size, sarray(), varray()); - bind_method(PackedFloat64Array, empty, sarray(), varray()); + bind_method(PackedFloat64Array, is_empty, sarray(), varray()); bind_method(PackedFloat64Array, set, sarray("index", "value"), varray()); bind_method(PackedFloat64Array, push_back, sarray("value"), varray()); bind_method(PackedFloat64Array, append, sarray("value"), varray()); @@ -1414,7 +1414,7 @@ static void _register_variant_builtin_methods() { /* String Array */ bind_method(PackedStringArray, size, sarray(), varray()); - bind_method(PackedStringArray, empty, sarray(), varray()); + bind_method(PackedStringArray, is_empty, sarray(), varray()); bind_method(PackedStringArray, set, sarray("index", "value"), varray()); bind_method(PackedStringArray, push_back, sarray("value"), varray()); bind_method(PackedStringArray, append, sarray("value"), varray()); @@ -1432,7 +1432,7 @@ static void _register_variant_builtin_methods() { /* Vector2 Array */ bind_method(PackedVector2Array, size, sarray(), varray()); - bind_method(PackedVector2Array, empty, sarray(), varray()); + bind_method(PackedVector2Array, is_empty, sarray(), varray()); bind_method(PackedVector2Array, set, sarray("index", "value"), varray()); bind_method(PackedVector2Array, push_back, sarray("value"), varray()); bind_method(PackedVector2Array, append, sarray("value"), varray()); @@ -1450,7 +1450,7 @@ static void _register_variant_builtin_methods() { /* Vector3 Array */ bind_method(PackedVector3Array, size, sarray(), varray()); - bind_method(PackedVector3Array, empty, sarray(), varray()); + bind_method(PackedVector3Array, is_empty, sarray(), varray()); bind_method(PackedVector3Array, set, sarray("index", "value"), varray()); bind_method(PackedVector3Array, push_back, sarray("value"), varray()); bind_method(PackedVector3Array, append, sarray("value"), varray()); @@ -1468,7 +1468,7 @@ static void _register_variant_builtin_methods() { /* Color Array */ bind_method(PackedColorArray, size, sarray(), varray()); - bind_method(PackedColorArray, empty, sarray(), varray()); + bind_method(PackedColorArray, is_empty, sarray(), varray()); bind_method(PackedColorArray, set, sarray("index", "value"), varray()); bind_method(PackedColorArray, push_back, sarray("value"), varray()); bind_method(PackedColorArray, append, sarray("value"), varray()); diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp index dd3e70fc6a9..f099c768a08 100644 --- a/core/variant/variant_setget.cpp +++ b/core/variant/variant_setget.cpp @@ -1477,7 +1477,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { case STRING: { const String *str = reinterpret_cast(_data._mem); - if (str->empty()) { + if (str->is_empty()) { return false; } r_iter = 0; @@ -1485,7 +1485,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { } break; case DICTIONARY: { const Dictionary *dic = reinterpret_cast(_data._mem); - if (dic->empty()) { + if (dic->is_empty()) { return false; } @@ -1496,7 +1496,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { } break; case ARRAY: { const Array *arr = reinterpret_cast(_data._mem); - if (arr->empty()) { + if (arr->is_empty()) { return false; } r_iter = 0; diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 6a9eb89602d..e4f9dcf993e 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -228,7 +228,7 @@ If [code]deep[/code] is [code]true[/code], a deep copy is performed: all nested arrays and dictionaries are duplicated and will not be shared with the original array. If [code]false[/code], a shallow copy is made and references to the original nested arrays and dictionaries are kept, so that modifying a sub-array or dictionary in the copy will also impact those referenced in the source array. - + diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index cd0b5ac0278..2ca705cec78 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -215,7 +215,7 @@ Creates a copy of the dictionary, and returns it. The [code]deep[/code] parameter causes inner dictionaries and arrays to be copied recursively, but does not apply to objects. - + diff --git a/doc/classes/PackedByteArray.xml b/doc/classes/PackedByteArray.xml index 0cef26df796..b00c59ade9a 100644 --- a/doc/classes/PackedByteArray.xml +++ b/doc/classes/PackedByteArray.xml @@ -92,7 +92,7 @@ Creates a copy of the array, and returns it. - + diff --git a/doc/classes/PackedColorArray.xml b/doc/classes/PackedColorArray.xml index b45e2cbe2eb..d6cd5196e4e 100644 --- a/doc/classes/PackedColorArray.xml +++ b/doc/classes/PackedColorArray.xml @@ -59,7 +59,7 @@ Creates a copy of the array, and returns it. - + diff --git a/doc/classes/PackedFloat32Array.xml b/doc/classes/PackedFloat32Array.xml index d6825dbcd7c..52f6ece1585 100644 --- a/doc/classes/PackedFloat32Array.xml +++ b/doc/classes/PackedFloat32Array.xml @@ -60,7 +60,7 @@ Creates a copy of the array, and returns it. - + diff --git a/doc/classes/PackedFloat64Array.xml b/doc/classes/PackedFloat64Array.xml index 9b6df93cf5c..2f317d4b8ce 100644 --- a/doc/classes/PackedFloat64Array.xml +++ b/doc/classes/PackedFloat64Array.xml @@ -60,7 +60,7 @@ Creates a copy of the array, and returns it. - + diff --git a/doc/classes/PackedInt32Array.xml b/doc/classes/PackedInt32Array.xml index 7923b268a4c..bda902b15f8 100644 --- a/doc/classes/PackedInt32Array.xml +++ b/doc/classes/PackedInt32Array.xml @@ -60,7 +60,7 @@ Creates a copy of the array, and returns it. - + diff --git a/doc/classes/PackedInt64Array.xml b/doc/classes/PackedInt64Array.xml index f7e91284109..9c52ec808bd 100644 --- a/doc/classes/PackedInt64Array.xml +++ b/doc/classes/PackedInt64Array.xml @@ -60,7 +60,7 @@ Creates a copy of the array, and returns it. - + diff --git a/doc/classes/PackedStringArray.xml b/doc/classes/PackedStringArray.xml index 1ae0d55177b..24406c53d4b 100644 --- a/doc/classes/PackedStringArray.xml +++ b/doc/classes/PackedStringArray.xml @@ -60,7 +60,7 @@ Creates a copy of the array, and returns it. - + diff --git a/doc/classes/PackedVector2Array.xml b/doc/classes/PackedVector2Array.xml index 9ab3a03edb9..2f583e2b9bb 100644 --- a/doc/classes/PackedVector2Array.xml +++ b/doc/classes/PackedVector2Array.xml @@ -60,7 +60,7 @@ Creates a copy of the array, and returns it. - + diff --git a/doc/classes/PackedVector3Array.xml b/doc/classes/PackedVector3Array.xml index 80787547ac0..6004454dc97 100644 --- a/doc/classes/PackedVector3Array.xml +++ b/doc/classes/PackedVector3Array.xml @@ -59,7 +59,7 @@ Creates a copy of the array, and returns it. - + diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 4ee9dbf1f95..cbaf1196e30 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -135,7 +135,7 @@ Returns a copy of the string with indentation (leading tabs and spaces) removed. - + diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 03216c667eb..2c927072708 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -4577,7 +4577,7 @@ void RenderingDeviceVulkan::_descriptor_pool_free(const DescriptorPoolKey &p_key vkDestroyDescriptorPool(device, p_pool->pool, nullptr); descriptor_pools[p_key].erase(p_pool); memdelete(p_pool); - if (descriptor_pools[p_key].empty()) { + if (descriptor_pools[p_key].is_empty()) { descriptor_pools.erase(p_key); } } diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 9b2cc686e3a..9a2d7b1e6d2 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 0b6b1ef6a71..25a67d00410 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 bca2979e72d..a634b873662 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 473597b9b37..c4ab226b286 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 118b8f9f2e9..5b2dc3fc32c 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>::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 ebac9b34823..e36f11ae1d7 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 2068d42eb79..f73165881ca 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 930aca6e5a6..4871c35ea43 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -596,7 +596,7 @@ bool EditorProfiler::is_profiling() { Vector> EditorProfiler::get_data_as_csv() const { Vector> 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 fd33115cda7..80d79349388 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 a27f196d498..208d390134e 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -448,7 +448,7 @@ void DependencyRemoveDialog::show(const Vector &p_folders, const Vector< Vector 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 5d2ae582e6a..008194bbd63 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 5ee9abb1838..c21c957799d 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"); 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, "" + tutorial.link.xml_escape() + ""); } _write_string(f, 1, ""); diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 22514405440..5f429e70346 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 eab1ecf373d..05c7b58c721 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 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 07318c14bc6..a0876ffa3d3 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -521,7 +521,7 @@ void EditorExportPlatform::_edit_filter_list(Set &r_list, const String & Vector 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 & Vector 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 & Vector 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 &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 &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 ecb659e7d3d..280c13ec9d5 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 8ded47605c4..0719d3f0189 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(); files.sort_custom(); - 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::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 1592549e0c9..5eff0f2e4a5 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 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(); } @@ -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 a36b5f5a6a2..4d975512d4e 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 ca8b278ab83..d883b6c909f 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 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(); 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 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 EditorNode::get_object_icon(const Object *p_object, const String } Ref 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 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 &p_input) { Ref 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 &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 ab8d2688012..a53ae6934fb 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 f974ba99989..a84f26193a9 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -128,7 +128,7 @@ Vector> EditorInterface::make_mesh_previews(const Vector 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 it(memnew(ImageTexture)); it->create_from_image(img); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index f432d52bf6b..972fd0723a9 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 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 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 c2c309fc325..774c08c4f00 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 639da371bdb..3ebcd162754 100644 --- a/editor/editor_run_native.cpp +++ b/editor/editor_run_native.cpp @@ -46,7 +46,7 @@ void EditorRunNative::_notification(int p_what) { Ref im = icon->get_data(); im = im->duplicate(); im->clear_mipmaps(); - if (!im->empty()) { + if (!im->is_empty()) { im->resize(16 * EDSCALE, 16 * EDSCALE); Ref small_icon; small_icon.instance(); diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index bc9ca154674..691f2e8228a 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 73a191d3171..3d131d373a2 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -281,7 +281,7 @@ void EditorSettings::_load_defaults(Ref 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 EditorSettings::get_script_templates(const String &p_extension, const String &p_custom_path) { Vector 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 6c8bd1901e0..1efa38c181d 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 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 &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 &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 &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 &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 &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 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 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 filenames; Vector 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 e8588bbed51..ac4acc613f9 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 1eaf7d70b77..55bd475543c 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 8eb68ecdcfe..91c4e3afd2c 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 29d49d4aa7f..354a3e697a3 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 db5b7b36aaf..19a846bf370 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 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 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 ac068c05cff..6166b83ae01 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 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 d36d811ce83..ea16551f18c 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 c8dae537225..0bffc4a2d0b 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 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 e0ba50fe4fe..0620d572e34 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -452,7 +452,7 @@ void InspectorDock::update(Object *p_object) { List methods; p_object->get_method_list(&methods); - if (!methods.empty()) { + if (!methods.is_empty()) { bool found = false; List::Element *I = methods.front(); int i = 0; diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp index 1f6c32ed705..1d09ad8a4cc 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 &p_mesh, bool p_billboard, } void EditorNode3DGizmo::add_lines(const Vector &p_lines, const Ref &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 a7807506330..c63f51c5124 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 a20bbd2b620..d301e8ff7bd 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 &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 4b97dacbc11..491aab12586 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 bd70e649e6c..6420a28d509 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 a5064de8386..ecd0a20c1a0 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 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 &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 &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 &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 &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 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 2fc0e35f822..7c3b393cd50 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -106,7 +106,7 @@ Ref EditorTexturePreviewPlugin::generate(const RES &p_from, const Siz } } - if (img.is_null() || img->empty()) { + if (img.is_null() || img->is_empty()) { return Ref(); } @@ -150,7 +150,7 @@ bool EditorImagePreviewPlugin::handles(const String &p_type) const { Ref EditorImagePreviewPlugin::generate(const RES &p_from, const Size2 &p_size) const { Ref img = p_from; - if (img.is_null() || img->empty()) { + if (img.is_null() || img->is_empty()) { return Ref(); } diff --git a/editor/plugins/font_editor_plugin.cpp b/editor/plugins/font_editor_plugin.cpp index a82547182ca..55419e10427 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(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 2a08e3a8b5e..c8a85267acb 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 selection = editor_selection->get_selected_node_list(); - if (selection.empty()) { + if (selection.is_empty()) { Ref 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 da305df69b9..d92ee482479 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 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 &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 &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 Refget_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 &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 608b5c3104e..09d23033594 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 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 7607ab482cd..10bd7cc9529 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 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 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 p_layout) { } } - if (!script_info.empty()) { + if (!script_info.is_empty()) { ScriptEditorBase *se = Object::cast_to(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 ed2c0c9f26a..f34224ab953 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 f15a8015305..f6ce3f7958f 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()); continue; } @@ -182,7 +182,7 @@ void ShaderFileEditor::_update_options() { for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) { Vector 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 22f50c0689f..d22157fda74 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 1be6b979b10..0bfd9e0c363 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 b79d829c346..099f2c8a7fd 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 &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 b95abe8994b..37899293d51 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 49eb68c93a1..73511365935 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 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 2fbfa2a8e34..ec1de43b6fd 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 &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 9b3227ad286..789d0e6ba5d 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 &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 a37f4776acb..d6d8e5789ee 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 68710920a5f..4eb1b76d639 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 3068bdd6720..6e324451243 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 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 9995c6ad651..a294a64dbe2 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 d45ee1eae17..9a58a23cb0c 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 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 a60937a86ba..379faf21312 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 91ae81dea2a..89750f60431 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 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 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 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 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 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