Rename empty() to is_empty()

This commit is contained in:
Marcel Admiraal 2020-12-15 12:04:21 +00:00
parent 886571e0fc
commit 5b937d493f
289 changed files with 898 additions and 898 deletions

View file

@ -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<String> 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://") {

View file

@ -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<String> &names, const List<Varian
for (const List<String>::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() {

View file

@ -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);
}

View file

@ -806,7 +806,7 @@ void Input::accumulate_input_event(const Ref<InputEvent> &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
}

View file

@ -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 "";

View file

@ -71,7 +71,7 @@ void InputMap::erase_action(const StringName &p_action) {
Array InputMap::_get_actions() {
Array ret;
List<StringName> actions = get_actions();
if (actions.empty()) {
if (actions.is_empty()) {
return ret;
}
@ -84,7 +84,7 @@ Array InputMap::_get_actions() {
List<StringName> InputMap::get_actions() const {
List<StringName> actions = List<StringName>();
if (input_map.empty()) {
if (input_map.is_empty()) {
return actions;
}

View file

@ -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);
}

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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<Image> 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));
}
}

View file

@ -285,7 +285,7 @@ public:
/**
* returns true when the image is empty (0,0) in size
*/
bool empty() const;
bool is_empty() const;
Vector<uint8_t> get_data() const;

View file

@ -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));

View file

@ -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";
}

View file

@ -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);

View file

@ -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));

View file

@ -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) {

View file

@ -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 {

View file

@ -572,7 +572,7 @@ bool Octree<T, use_pairs, AL>::_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<T, use_pairs, AL>::_cull_convex(Octant *p_octant, _CullConvexData *p
return; //pointless
}
if (!p_octant->elements.empty()) {
if (!p_octant->elements.is_empty()) {
typename List<Element *, AL>::Element *I;
I = p_octant->elements.front();
@ -965,7 +965,7 @@ void Octree<T, use_pairs, AL>::_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 *, AL>::Element *I;
I = p_octant->pairable_elements.front();
@ -1001,7 +1001,7 @@ void Octree<T, use_pairs, AL>::_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 *, AL>::Element *I;
I = p_octant->elements.front();
for (; I; I = I->next()) {
@ -1027,7 +1027,7 @@ void Octree<T, use_pairs, AL>::_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 *, AL>::Element *I;
I = p_octant->pairable_elements.front();
for (; I; I = I->next()) {
@ -1065,7 +1065,7 @@ void Octree<T, use_pairs, AL>::_cull_segment(Octant *p_octant, const Vector3 &p_
return; //pointless
}
if (!p_octant->elements.empty()) {
if (!p_octant->elements.is_empty()) {
typename List<Element *, AL>::Element *I;
I = p_octant->elements.front();
for (; I; I = I->next()) {
@ -1091,7 +1091,7 @@ void Octree<T, use_pairs, AL>::_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 *, AL>::Element *I;
I = p_octant->pairable_elements.front();
for (; I; I = I->next()) {
@ -1132,7 +1132,7 @@ void Octree<T, use_pairs, AL>::_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 *, AL>::Element *I;
I = p_octant->elements.front();
for (; I; I = I->next()) {
@ -1158,7 +1158,7 @@ void Octree<T, use_pairs, AL>::_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 *, AL>::Element *I;
I = p_octant->pairable_elements.front();
for (; I; I = I->next()) {

View file

@ -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

View file

@ -506,7 +506,7 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const {
}
void Object::set_indexed(const Vector<StringName> &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<StringName> &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<StringName> &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<PropertyInfo> *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);
}

View file

@ -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");
}

View file

@ -40,7 +40,7 @@ class StringBuffer {
int string_length = 0;
_FORCE_INLINE_ char32_t *current_buffer_ptr() {
return static_cast<String &>(buffer).empty() ? short_buffer : buffer.ptrw();
return static_cast<String &>(buffer).is_empty() ? short_buffer : buffer.ptrw();
}
public:
@ -122,7 +122,7 @@ StringBuffer<SHORT_BUFFER_SIZE> &StringBuffer<SHORT_BUFFER_SIZE>::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<SHORT_BUFFER_SIZE>::length() const {
template <int SHORT_BUFFER_SIZE>
String StringBuffer<SHORT_BUFFER_SIZE>::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);

View file

@ -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;

View file

@ -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<String> &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];
}

View file

@ -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) + "\"");

View file

@ -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<char32_t>(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<String> 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<uint8_t> String::to_ascii_buffer() const {
const String *s = this;
if (s->empty()) {
if (s->is_empty()) {
return Vector<uint8_t>();
}
CharString charstr = s->ascii();
@ -4776,7 +4776,7 @@ Vector<uint8_t> String::to_ascii_buffer() const {
Vector<uint8_t> String::to_utf8_buffer() const {
const String *s = this;
if (s->empty()) {
if (s->is_empty()) {
return Vector<uint8_t>();
}
CharString charstr = s->utf8();
@ -4792,7 +4792,7 @@ Vector<uint8_t> String::to_utf8_buffer() const {
Vector<uint8_t> String::to_utf16_buffer() const {
const String *s = this;
if (s->empty()) {
if (s->is_empty()) {
return Vector<uint8_t>();
}
Char16String charstr = s->utf16();
@ -4808,7 +4808,7 @@ Vector<uint8_t> String::to_utf16_buffer() const {
Vector<uint8_t> String::to_utf32_buffer() const {
const String *s = this;
if (s->empty()) {
if (s->is_empty()) {
return Vector<uint8_t>();
}

View file

@ -394,7 +394,7 @@ public:
Vector<uint8_t> sha1_buffer() const;
Vector<uint8_t> 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;

View file

@ -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());

View file

@ -497,7 +497,7 @@ public:
return elements;
}
inline bool empty() const {
inline bool is_empty() const {
return elements == 0;
}

View file

@ -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);
}

View file

@ -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) {

View file

@ -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 {

View file

@ -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;
}

View file

@ -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 {

View file

@ -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 {

View file

@ -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); }

View file

@ -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();

View file

@ -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(); }

View file

@ -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;

View file

@ -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;

View file

@ -40,7 +40,7 @@ struct DictionaryPrivate {
};
void Dictionary::get_key_list(List<Variant> *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;
}

View file

@ -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;

View file

@ -912,11 +912,11 @@ bool Variant::is_zero() const {
} break;
case DICTIONARY: {
return reinterpret_cast<const Dictionary *>(_data._mem)->empty();
return reinterpret_cast<const Dictionary *>(_data._mem)->is_empty();
} break;
case ARRAY: {
return reinterpret_cast<const Array *>(_data._mem)->empty();
return reinterpret_cast<const Array *>(_data._mem)->is_empty();
} break;

View file

@ -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());

View file

@ -1477,7 +1477,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const {
case STRING: {
const String *str = reinterpret_cast<const String *>(_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<const Dictionary *>(_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<const Array *>(_data._mem);
if (arr->empty()) {
if (arr->is_empty()) {
return false;
}
r_iter = 0;

View file

@ -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.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -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.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -92,7 +92,7 @@
Creates a copy of the array, and returns it.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -59,7 +59,7 @@
Creates a copy of the array, and returns it.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -60,7 +60,7 @@
Creates a copy of the array, and returns it.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -60,7 +60,7 @@
Creates a copy of the array, and returns it.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -60,7 +60,7 @@
Creates a copy of the array, and returns it.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -60,7 +60,7 @@
Creates a copy of the array, and returns it.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -60,7 +60,7 @@
Creates a copy of the array, and returns it.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -60,7 +60,7 @@
Creates a copy of the array, and returns it.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -59,7 +59,7 @@
Creates a copy of the array, and returns it.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -135,7 +135,7 @@
Returns a copy of the string with indentation (leading tabs and spaces) removed.
</description>
</method>
<method name="empty">
<method name="is_empty">
<return type="bool">
</return>
<description>

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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) {

View file

@ -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;

View file

@ -115,7 +115,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() {
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles"));
}
if (!debugger_plugins.empty()) {
if (!debugger_plugins.is_empty()) {
for (Set<Ref<Script>>::Element *i = debugger_plugins.front(); i; i = i->next()) {
node->add_debugger_plugin(i->get());
}
@ -140,7 +140,7 @@ void EditorDebuggerNode::_error_selected(const String &p_file, int p_line, int p
void EditorDebuggerNode::_text_editor_stack_goto(const ScriptEditorDebugger *p_debugger) {
const String file = p_debugger->get_stack_script_file();
if (file.empty()) {
if (file.is_empty()) {
return;
}
stack_script = ResourceLoader::load(file);

View file

@ -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 = ".";

View file

@ -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());
}
}

View file

@ -596,7 +596,7 @@ bool EditorProfiler::is_profiling() {
Vector<Vector<String>> EditorProfiler::get_data_as_csv() const {
Vector<Vector<String>> res;
if (frame_metrics.empty()) {
if (frame_metrics.is_empty()) {
return res;
}

View file

@ -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 + "()";
}

View file

@ -448,7 +448,7 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector<
Vector<RemovedDependency> removed_deps;
_find_all_removed_dependencies(EditorFileSystem::get_singleton()->get_filesystem(), removed_deps);
removed_deps.sort();
if (removed_deps.empty()) {
if (removed_deps.is_empty()) {
owners->hide();
text->set_text(TTR("Remove selected files from the project? (no undo)\nYou can find the removed files in the system trash to restore them."));
set_size(Size2());
@ -639,7 +639,7 @@ void OrphanResourcesDialog::ok_pressed() {
paths.clear();
_find_to_delete(files->get_root(), paths);
if (paths.empty()) {
if (paths.is_empty()) {
return;
}

View file

@ -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;
}

View file

@ -813,7 +813,7 @@ void DocTools::generate(bool p_basic_types) {
}
// Skip adding the lang if it doesn't expose anything (e.g. C#).
if (c.methods.empty() && c.constants.empty()) {
if (c.methods.is_empty() && c.constants.is_empty()) {
continue;
}
@ -1165,7 +1165,7 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
_write_string(f, 1, "<tutorials>");
for (int i = 0; i < c.tutorials.size(); i++) {
DocData::TutorialDoc tutorial = c.tutorials.get(i);
String title_attribute = (!tutorial.title.empty()) ? " title=\"" + tutorial.title.xml_escape() + "\"" : "";
String title_attribute = (!tutorial.title.is_empty()) ? " title=\"" + tutorial.title.xml_escape() + "\"" : "";
_write_string(f, 2, "<link" + title_attribute + ">" + tutorial.link.xml_escape() + "</link>");
}
_write_string(f, 1, "</tutorials>");

View file

@ -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;
}

View file

@ -331,7 +331,7 @@ Dictionary EditorData::get_editor_states() const {
Dictionary metadata;
for (int i = 0; i < editor_plugins.size(); i++) {
Dictionary state = editor_plugins[i]->get_state();
if (state.empty()) {
if (state.is_empty()) {
continue;
}
metadata[editor_plugins[i]->get_name()] = state;
@ -493,7 +493,7 @@ void EditorData::remove_custom_type(const String &p_type) {
for (int i = 0; i < E->get().size(); i++) {
if (E->get()[i].name == p_type) {
E->get().remove(i);
if (E->get().empty()) {
if (E->get().is_empty()) {
custom_types.erase(E->key());
}
return;
@ -901,7 +901,7 @@ String EditorData::script_class_get_icon_path(const String &p_class) const {
String current = p_class;
String ret = _script_class_icon_paths[current];
while (ret.empty()) {
while (ret.is_empty()) {
current = script_class_get_base(current);
if (!ScriptServer::is_global_class(current)) {
return String();
@ -931,7 +931,7 @@ void EditorData::script_class_save_icon_paths() {
}
}
if (d.empty()) {
if (d.is_empty()) {
if (ProjectSettings::get_singleton()->has_setting("_global_script_class_icons")) {
ProjectSettings::get_singleton()->clear("_global_script_class_icons");
}
@ -1125,7 +1125,7 @@ List<Node *> EditorSelection::get_full_selected_node_list() {
}
void EditorSelection::clear() {
while (!selection.empty()) {
while (!selection.is_empty()) {
remove_node(selection.front()->key());
}

View file

@ -521,7 +521,7 @@ void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String &
Vector<String> filters;
for (int i = 0; i < split.size(); i++) {
String f = split[i].strip_edges();
if (f.empty()) {
if (f.is_empty()) {
continue;
}
filters.push_back(f);
@ -754,7 +754,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
Vector<String> enc_in_split = p_preset->get_enc_in_filter().split(",");
for (int i = 0; i < enc_in_split.size(); i++) {
String f = enc_in_split[i].strip_edges();
if (f.empty()) {
if (f.is_empty()) {
continue;
}
enc_in_filters.push_back(f);
@ -763,7 +763,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
Vector<String> enc_ex_split = p_preset->get_enc_ex_filter().split(",");
for (int i = 0; i < enc_ex_split.size(); i++) {
String f = enc_ex_split[i].strip_edges();
if (f.empty()) {
if (f.is_empty()) {
continue;
}
enc_ex_filters.push_back(f);
@ -1696,7 +1696,7 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset,
valid = dvalid || rvalid;
r_missing_templates = !valid;
if (!err.empty()) {
if (!err.is_empty()) {
r_error = err;
}
return valid;
@ -1783,7 +1783,7 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
}
}
if (err == OK && !so_files.empty()) {
if (err == OK && !so_files.is_empty()) {
//if shared object files, copy them
da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
for (int i = 0; i < so_files.size() && err == OK; i++) {

View file

@ -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);
}
}

View file

@ -758,7 +758,7 @@ void EditorFileDialog::update_file_list() {
dirs.sort_custom<NaturalNoCaseComparator>();
files.sort_custom<NaturalNoCaseComparator>();
while (!dirs.empty()) {
while (!dirs.is_empty()) {
const String &dir_name = dirs.front()->get();
item_list->add_item(dir_name);
@ -806,8 +806,8 @@ void EditorFileDialog::update_file_list() {
}
}
while (!files.empty()) {
bool match = patterns.empty();
while (!files.is_empty()) {
bool match = patterns.is_empty();
for (List<String>::Element *E = patterns.front(); E; E = E->next()) {
if (files.front()->get().matchn(E->get())) {

View file

@ -167,12 +167,12 @@ void EditorHelp::_class_desc_resized() {
void EditorHelp::_add_type(const String &p_type, const String &p_enum) {
String t = p_type;
if (t.empty()) {
if (t.is_empty()) {
t = "void";
}
bool can_ref = (t != "void") || !p_enum.empty();
bool can_ref = (t != "void") || !p_enum.is_empty();
if (!p_enum.empty()) {
if (!p_enum.is_empty()) {
if (p_enum.get_slice_count(".") > 1) {
t = p_enum.get_slice(".", 1);
} else {
@ -188,7 +188,7 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) {
add_array = true;
t = t.replace("[]", "");
}
if (p_enum.empty()) {
if (p_enum.is_empty()) {
class_desc->push_meta("#" + t); //class
} else {
class_desc->push_meta("$" + p_enum); //class
@ -472,7 +472,7 @@ void EditorHelp::_update_doc() {
for (int i = 0; i < cd.tutorials.size(); i++) {
const String link = DTR(cd.tutorials[i].link);
String linktxt = (cd.tutorials[i].title.empty()) ? link : DTR(cd.tutorials[i].title);
String linktxt = (cd.tutorials[i].title.is_empty()) ? link : DTR(cd.tutorials[i].title);
const int seppos = linktxt.find("//");
if (seppos != -1) {
linktxt = link.right(seppos + 2);
@ -498,7 +498,7 @@ void EditorHelp::_update_doc() {
if (cd.is_script_doc) {
has_properties = false;
for (int i = 0; i < cd.properties.size(); i++) {
if (cd.properties[i].name.begins_with("_") && cd.properties[i].description.empty()) {
if (cd.properties[i].name.begins_with("_") && cd.properties[i].description.is_empty()) {
continue;
}
has_properties = true;
@ -522,7 +522,7 @@ void EditorHelp::_update_doc() {
for (int i = 0; i < cd.properties.size(); i++) {
// Ignore undocumented private.
if (cd.properties[i].name.begins_with("_") && cd.properties[i].description.empty()) {
if (cd.properties[i].name.begins_with("_") && cd.properties[i].description.is_empty()) {
continue;
}
property_line[cd.properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description
@ -633,7 +633,7 @@ void EditorHelp::_update_doc() {
}
}
// Ignore undocumented private.
if (cd.methods[i].name.begins_with("_") && cd.methods[i].description.empty()) {
if (cd.methods[i].name.begins_with("_") && cd.methods[i].description.is_empty()) {
continue;
}
methods.push_back(cd.methods[i]);
@ -668,7 +668,7 @@ void EditorHelp::_update_doc() {
}
}
if (any_previous && !m.empty()) {
if (any_previous && !m.is_empty()) {
class_desc->push_cell();
class_desc->pop(); //cell
class_desc->push_cell();
@ -702,7 +702,7 @@ void EditorHelp::_update_doc() {
_add_method(m[i], true);
}
any_previous = !m.empty();
any_previous = !m.is_empty();
}
class_desc->pop(); //table
@ -848,7 +848,7 @@ void EditorHelp::_update_doc() {
Vector<DocData::ConstantDoc> constants;
for (int i = 0; i < cd.constants.size(); i++) {
if (!cd.constants[i].enumeration.empty()) {
if (!cd.constants[i].enumeration.is_empty()) {
if (!enums.has(cd.constants[i].enumeration)) {
enums[cd.constants[i].enumeration] = Vector<DocData::ConstantDoc>();
}
@ -856,7 +856,7 @@ void EditorHelp::_update_doc() {
enums[cd.constants[i].enumeration].push_back(cd.constants[i]);
} else {
// Ignore undocumented private.
if (cd.constants[i].name.begins_with("_") && cd.constants[i].description.empty()) {
if (cd.constants[i].name.begins_with("_") && cd.constants[i].description.is_empty()) {
continue;
}
constants.push_back(cd.constants[i]);
@ -1174,7 +1174,7 @@ void EditorHelp::_update_doc() {
class_desc->push_color(text_color);
class_desc->push_font(doc_font);
class_desc->push_indent(1);
if (!cd.properties[i].description.strip_edges().empty()) {
if (!cd.properties[i].description.strip_edges().is_empty()) {
_add_text(DTR(cd.properties[i].description));
} else {
class_desc->add_image(get_theme_icon("Error", "EditorIcons"));
@ -1229,7 +1229,7 @@ void EditorHelp::_update_doc() {
class_desc->push_color(text_color);
class_desc->push_font(doc_font);
class_desc->push_indent(1);
if (!methods_filtered[i].description.strip_edges().empty()) {
if (!methods_filtered[i].description.strip_edges().is_empty()) {
_add_text(DTR(methods_filtered[i].description));
} else {
class_desc->add_image(get_theme_icon("Error", "EditorIcons"));
@ -1838,7 +1838,7 @@ void FindBar::popup_search() {
grabbed_focus = true;
}
if (!search_text->get_text().empty()) {
if (!search_text->get_text().is_empty()) {
search_text->select_all();
search_text->set_cursor_position(search_text->get_text().length());
if (grabbed_focus) {
@ -1908,7 +1908,7 @@ void FindBar::_update_results_count() {
results_count = 0;
String searched = search_text->get_text();
if (searched.empty()) {
if (searched.is_empty()) {
return;
}
@ -1928,7 +1928,7 @@ void FindBar::_update_results_count() {
}
void FindBar::_update_matches_label() {
if (search_text->get_text().empty() || results_count == -1) {
if (search_text->get_text().is_empty() || results_count == -1) {
matches_label->hide();
} else {
matches_label->show();

View file

@ -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;
}

View file

@ -377,9 +377,9 @@ void EditorNode::_version_control_menu_option(int p_idx) {
void EditorNode::_update_title() {
String appname = ProjectSettings::get_singleton()->get("application/config/name");
String title = appname.empty() ? String(VERSION_FULL_NAME) : String(VERSION_NAME + String(" - ") + appname);
String title = appname.is_empty() ? String(VERSION_FULL_NAME) : String(VERSION_NAME + String(" - ") + appname);
String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String();
if (!edited.empty()) {
if (!edited.is_empty()) {
title += " - " + String(edited.get_file());
}
if (unsaved_cache) {
@ -782,8 +782,8 @@ void EditorNode::_fs_changed() {
preset_name);
} else {
Ref<EditorExportPlatform> platform = preset->get_platform();
const String export_path = export_defer.path.empty() ? preset->get_export_path() : export_defer.path;
if (export_path.empty()) {
const String export_path = export_defer.path.is_empty() ? preset->get_export_path() : export_defer.path;
if (export_path.is_empty()) {
export_error = vformat("Export preset '%s' doesn't have a default export path, and none was specified.", preset_name);
} else if (platform.is_null()) {
export_error = vformat("Export preset '%s' doesn't have a matching platform.", preset_name);
@ -821,7 +821,7 @@ void EditorNode::_fs_changed() {
}
}
if (!export_error.empty()) {
if (!export_error.is_empty()) {
ERR_PRINT(export_error);
OS::get_singleton()->set_exit_code(EXIT_FAILURE);
}
@ -1711,7 +1711,7 @@ void EditorNode::_dialog_action(String p_file) {
current_obj->_change_notify();
} break;
case SETTINGS_LAYOUT_SAVE: {
if (p_file.empty()) {
if (p_file.is_empty()) {
return;
}
@ -1739,7 +1739,7 @@ void EditorNode::_dialog_action(String p_file) {
} break;
case SETTINGS_LAYOUT_DELETE: {
if (p_file.empty()) {
if (p_file.is_empty()) {
return;
}
@ -1822,7 +1822,7 @@ void EditorNode::edit_item(Object *p_object) {
sub_plugins = editor_data.get_subeditors(p_object);
}
if (!sub_plugins.empty()) {
if (!sub_plugins.is_empty()) {
bool same = true;
if (sub_plugins.size() == editor_plugins_over->get_plugins_list().size()) {
for (int i = 0; i < sub_plugins.size(); i++) {
@ -1998,7 +1998,7 @@ void EditorNode::_edit_current() {
multi_nodes.push_back(node);
}
}
if (!multi_nodes.empty()) {
if (!multi_nodes.is_empty()) {
// Pick the top-most node
multi_nodes.sort_custom<Node::Comparator>();
selected_node = multi_nodes.front()->get();
@ -2080,13 +2080,13 @@ void EditorNode::_edit_current() {
sub_plugins = editor_data.get_subeditors(current_obj);
}
if (!sub_plugins.empty()) {
if (!sub_plugins.is_empty()) {
_display_top_editors(false);
_set_top_editors(sub_plugins);
_set_editing_top_editors(current_obj);
_display_top_editors(true);
} else if (!editor_plugins_over->get_plugins_list().empty()) {
} else if (!editor_plugins_over->get_plugins_list().is_empty()) {
hide_top_editors();
}
}
@ -2256,7 +2256,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case FILE_OPEN_PREV: {
if (previous_scenes.empty()) {
if (previous_scenes.is_empty()) {
break;
}
opening_prev = true;
@ -2527,7 +2527,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case RUN_PLAY_CUSTOM_SCENE: {
if (run_custom_filename.empty() || editor_run.get_status() == EditorRun::STATUS_STOP) {
if (run_custom_filename.is_empty() || editor_run.get_status() == EditorRun::STATUS_STOP) {
_menu_option_confirm(RUN_STOP, true);
quick_run->popup_dialog("PackedScene", true);
quick_run->set_title(TTR("Quick Run Scene..."));
@ -2876,7 +2876,7 @@ void EditorNode::_update_file_menu_opened() {
Ref<Shortcut> reopen_closed_scene_sc = ED_GET_SHORTCUT("editor/reopen_closed_scene");
reopen_closed_scene_sc->set_name(TTR("Reopen Closed Scene"));
PopupMenu *pop = file_menu->get_popup();
pop->set_item_disabled(pop->get_item_index(FILE_OPEN_PREV), previous_scenes.empty());
pop->set_item_disabled(pop->get_item_index(FILE_OPEN_PREV), previous_scenes.is_empty());
}
void EditorNode::_update_file_menu_closed() {
@ -3823,7 +3823,7 @@ Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String
}
Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p_fallback) const {
ERR_FAIL_COND_V_MSG(p_class.empty(), nullptr, "Class name cannot be empty.");
ERR_FAIL_COND_V_MSG(p_class.is_empty(), nullptr, "Class name cannot be empty.");
if (ScriptServer::is_global_class(p_class)) {
Ref<ImageTexture> icon;
@ -4555,7 +4555,7 @@ bool EditorNode::has_scenes_in_session() {
return false;
}
Array scenes = config->get_value("EditorNode", "open_scenes");
return !scenes.empty();
return !scenes.is_empty();
}
bool EditorNode::ensure_main_scene(bool p_from_native) {
@ -4781,7 +4781,7 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) {
Ref<Shortcut> undo_close_tab_sc = ED_GET_SHORTCUT("editor/reopen_closed_scene");
undo_close_tab_sc->set_name(TTR("Undo Close Tab"));
scene_tabs_context_menu->add_shortcut(undo_close_tab_sc, FILE_OPEN_PREV);
if (previous_scenes.empty()) {
if (previous_scenes.is_empty()) {
scene_tabs_context_menu->set_item_disabled(scene_tabs_context_menu->get_item_index(FILE_OPEN_PREV), true);
}
scene_tabs_context_menu->add_item(TTR("Close Other Tabs"), FILE_CLOSE_OTHERS);
@ -5185,7 +5185,7 @@ void EditorNode::_add_dropped_files_recursive(const Vector<String> &p_files, Str
next_file = sub_dir->get_next();
}
if (!sub_files.empty()) {
if (!sub_files.is_empty()) {
dir->make_dir(to);
_add_dropped_files_recursive(sub_files, to);
}
@ -6950,8 +6950,8 @@ void EditorPluginList::remove_plugin(EditorPlugin *p_plugin) {
plugins_list.erase(p_plugin);
}
bool EditorPluginList::empty() {
return plugins_list.empty();
bool EditorPluginList::is_empty() {
return plugins_list.is_empty();
}
void EditorPluginList::clear() {

View file

@ -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();

View file

@ -128,7 +128,7 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh
Main::iteration();
Main::iteration();
Ref<Image> img = RS::get_singleton()->texture_2d_get(viewport_texture);
ERR_CONTINUE(!img.is_valid() || img->empty());
ERR_CONTINUE(!img.is_valid() || img->is_empty());
Ref<ImageTexture> it(memnew(ImageTexture));
it->create_from_image(img);

View file

@ -2356,7 +2356,7 @@ void EditorPropertyResource::_file_selected(const String &p_path) {
property_types = E->get().hint_string;
}
}
if (!property_types.empty()) {
if (!property_types.is_empty()) {
bool any_type_matches = false;
const Vector<String> split_property_types = property_types.split(",");
for (int i = 0; i < split_property_types.size(); ++i) {
@ -2514,7 +2514,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
update_property();
break;
}
ERR_FAIL_COND(inheritors_array.empty());
ERR_FAIL_COND(inheritors_array.is_empty());
String intype = inheritors_array[p_which - TYPE_BASE_ID];
@ -2658,7 +2658,7 @@ void EditorPropertyResource::_update_menu_items() {
bool is_custom_resource = false;
Ref<Texture2D> icon;
if (!custom_resources.empty()) {
if (!custom_resources.is_empty()) {
for (int j = 0; j < custom_resources.size(); j++) {
if (custom_resources[j].name == t) {
is_custom_resource = true;

View file

@ -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);

View file

@ -46,7 +46,7 @@ void EditorRunNative::_notification(int p_what) {
Ref<Image> im = icon->get_data();
im = im->duplicate();
im->clear_mipmaps();
if (!im->empty()) {
if (!im->is_empty()) {
im->resize(16 * EDSCALE, 16 * EDSCALE);
Ref<ImageTexture> small_icon;
small_icon.instance();

View file

@ -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;
}

View file

@ -281,7 +281,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
locales_to_skip.push_back("te"); // Telugu
}
if (!locales_to_skip.empty()) {
if (!locales_to_skip.is_empty()) {
WARN_PRINT("Some locales are not properly supported by selected Text Server and are disabled.");
}
@ -1476,7 +1476,7 @@ bool EditorSettings::is_default_text_editor_theme() {
Vector<String> EditorSettings::get_script_templates(const String &p_extension, const String &p_custom_path) {
Vector<String> templates;
String template_dir = get_script_templates_dir();
if (!p_custom_path.empty()) {
if (!p_custom_path.is_empty()) {
template_dir = p_custom_path;
}
DirAccess *d = DirAccess::open(template_dir);

View file

@ -531,7 +531,7 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa
}
String file_name = p_path.get_file();
if (!file_name.empty()) {
if (!file_name.is_empty()) {
for (int i = 0; i < files->get_item_count(); i++) {
if (files->get_item_text(i) == file_name) {
files->select(i, true);
@ -1528,7 +1528,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_ove
if (!p_overwrite) {
to_move_path = p_to_path;
Vector<String> conflicting_items = _check_existing();
if (!conflicting_items.empty()) {
if (!conflicting_items.is_empty()) {
// Ask to do something.
overwrite_dialog->set_text(vformat(
TTR("The following files or folders conflict with items in the target location '%s':\n\n%s\n\nDo you wish to overwrite them?"),
@ -1721,7 +1721,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
paths.push_back(fpath);
}
}
if (!paths.empty()) {
if (!paths.is_empty()) {
emit_signal("instance", paths);
}
} break;
@ -1753,7 +1753,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
case FILE_DEPENDENCIES: {
// Checkout the file dependencies.
if (!p_selected.empty()) {
if (!p_selected.is_empty()) {
String fpath = p_selected[0];
deps_editor->edit(fpath);
}
@ -1761,7 +1761,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
case FILE_OWNERS: {
// Checkout the file owners.
if (!p_selected.empty()) {
if (!p_selected.is_empty()) {
String fpath = p_selected[0];
owners_editor->show(fpath);
}
@ -1784,7 +1784,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
case FILE_RENAME: {
// Rename the active file.
if (!p_selected.empty()) {
if (!p_selected.is_empty()) {
to_rename.path = p_selected[0];
if (to_rename.path != "res://") {
to_rename.is_file = !to_rename.path.ends_with("/");
@ -1885,7 +1885,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
} break;
case FILE_COPY_PATH: {
if (!p_selected.empty()) {
if (!p_selected.is_empty()) {
String fpath = p_selected[0];
DisplayServer::get_singleton()->clipboard_set(fpath);
}
@ -2013,7 +2013,7 @@ Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from)
all_not_favorites = true;
}
if (paths.empty()) {
if (paths.is_empty()) {
return Variant();
}
@ -2061,7 +2061,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da
String to_dir;
bool favorite;
_get_drag_target_folder(to_dir, favorite, p_point, p_from);
return !to_dir.empty();
return !to_dir.is_empty();
}
if (drag_data.has("type") && (String(drag_data["type"]) == "files" || String(drag_data["type"]) == "files_and_dirs")) {
@ -2074,7 +2074,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da
return true;
}
if (to_dir.empty()) {
if (to_dir.is_empty()) {
return false;
}
@ -2169,7 +2169,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
String to_dir;
bool favorite;
_get_drag_target_folder(to_dir, favorite, p_point, p_from);
if (res.is_valid() && !to_dir.empty()) {
if (res.is_valid() && !to_dir.is_empty()) {
EditorNode::get_singleton()->push_item(res.ptr());
EditorNode::get_singleton()->save_resource_as(res, to_dir);
}
@ -2180,7 +2180,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
String to_dir;
bool favorite;
_get_drag_target_folder(to_dir, favorite, p_point, p_from);
if (!to_dir.empty()) {
if (!to_dir.is_empty()) {
Vector<String> fnames = drag_data["files"];
to_move.clear();
for (int i = 0; i < fnames.size(); i++) {
@ -2188,7 +2188,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
to_move.push_back(FileOrFolder(fnames[i], !fnames[i].ends_with("/")));
}
}
if (!to_move.empty()) {
if (!to_move.is_empty()) {
if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
for (int i = 0; i < to_move.size(); i++) {
String new_path;
@ -2291,7 +2291,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori
void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options) {
// Add options for files and folders.
ERR_FAIL_COND_MSG(p_paths.empty(), "Path cannot be empty.");
ERR_FAIL_COND_MSG(p_paths.is_empty(), "Path cannot be empty.");
Vector<String> filenames;
Vector<String> foldernames;
@ -2414,7 +2414,7 @@ void FileSystemDock::_tree_rmb_select(const Vector2 &p_pos) {
}
// Popup.
if (!paths.empty()) {
if (!paths.is_empty()) {
tree_popup->set_size(Size2(1, 1));
_file_and_folders_fill_popup(tree_popup, paths);
tree_popup->set_position(tree->get_screen_position() + p_pos);
@ -2454,7 +2454,7 @@ void FileSystemDock::_file_list_rmb_select(int p_item, const Vector2 &p_pos) {
}
// Popup.
if (!paths.empty()) {
if (!paths.is_empty()) {
file_list_popup->clear();
file_list_popup->set_size(Size2(1, 1));
_file_and_folders_fill_popup(file_list_popup, paths, searched_string.length() == 0);

View file

@ -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) {

View file

@ -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;
}

View file

@ -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();

View file

@ -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) {

View file

@ -1027,7 +1027,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
Vector<String> skeletons = ng2->skeletons;
ERR_FAIL_COND_V(skeletons.empty(), ERR_INVALID_DATA);
ERR_FAIL_COND_V(skeletons.is_empty(), ERR_INVALID_DATA);
String skname = skeletons[0];
ERR_FAIL_COND_V(!node_map.has(skname), ERR_INVALID_DATA);
@ -1471,7 +1471,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
}
Vector<float> data = at.get_value_at_time(snapshots[i]);
ERR_CONTINUE(data.empty());
ERR_CONTINUE(data.is_empty());
Collada::Node::XForm &xf = cn->xform_list.write[xform_idx];

View file

@ -373,7 +373,7 @@ Error ResourceImporterLayeredTexture::import(const String &p_source_file, const
int x = slice_w * j;
int y = slice_h * i;
Ref<Image> slice = image->get_rect(Rect2(x, y, slice_w, slice_h));
ERR_CONTINUE(slice.is_null() || slice->empty());
ERR_CONTINUE(slice.is_null() || slice->is_empty());
if (slice->get_width() != slice_w || slice->get_height() != slice_h) {
slice->resize(slice_w, slice_h);
}

View file

@ -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;

View file

@ -82,7 +82,7 @@ void ResourceImporterTexture::update_imports() {
MutexLock lock(mutex);
Vector<String> to_reimport;
{
if (make_flags.empty()) {
if (make_flags.is_empty()) {
return;
}

View file

@ -452,7 +452,7 @@ void InspectorDock::update(Object *p_object) {
List<MethodInfo> methods;
p_object->get_method_list(&methods);
if (!methods.empty()) {
if (!methods.is_empty()) {
bool found = false;
List<MethodInfo>::Element *I = methods.front();
int i = 0;

View file

@ -198,7 +198,7 @@ void EditorNode3DGizmo::add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard,
}
void EditorNode3DGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material, bool p_billboard, const Color &p_modulate) {
if (p_lines.empty()) {
if (p_lines.is_empty()) {
return;
}
@ -4205,7 +4205,7 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
}
}
if (faces.empty()) {
if (faces.is_empty()) {
return;
}
@ -4521,7 +4521,7 @@ Joint3DGizmoPlugin::Joint3DGizmoPlugin() {
}
void Joint3DGizmoPlugin::incremental_update_gizmos() {
if (!current_gizmos.empty()) {
if (!current_gizmos.is_empty()) {
update_idx++;
update_idx = update_idx % current_gizmos.size();
redraw(current_gizmos[update_idx]);

View file

@ -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) {

View file

@ -416,7 +416,7 @@ void AnimationNodeBlendTreeEditor::_delete_nodes_request() {
}
}
if (to_erase.empty()) {
if (to_erase.is_empty()) {
return;
}
@ -537,7 +537,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
default: {
} break;
}
if (!track_type_name.empty()) {
if (!track_type_name.is_empty()) {
types[track_path].insert(track_type_name);
}
}

View file

@ -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();
}

View file

@ -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;

Some files were not shown because too many files have changed in this diff Show more