Replace String comparisons with "", String() to is_empty()

Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
This commit is contained in:
Nathan Franke 2021-12-09 03:42:46 -06:00
parent 31ded7e126
commit 49403cbfa0
No known key found for this signature in database
GPG key ID: 92164DCCF3B1F723
226 changed files with 1051 additions and 1034 deletions

View file

@ -184,7 +184,7 @@ String ProjectSettings::localize_path(const String &p_path) const {
String parent = path.substr(0, sep); String parent = path.substr(0, sep);
String plocal = localize_path(parent); String plocal = localize_path(parent);
if (plocal == "") { if (plocal.is_empty()) {
return ""; return "";
} }
// Only strip the starting '/' from 'path' if its parent ('plocal') ends with '/' // Only strip the starting '/' from 'path' if its parent ('plocal') ends with '/'
@ -228,13 +228,13 @@ bool ProjectSettings::get_ignore_value_in_docs(const String &p_name) const {
String ProjectSettings::globalize_path(const String &p_path) const { String ProjectSettings::globalize_path(const String &p_path) const {
if (p_path.begins_with("res://")) { if (p_path.begins_with("res://")) {
if (resource_path != "") { if (!resource_path.is_empty()) {
return p_path.replace("res:/", resource_path); return p_path.replace("res:/", resource_path);
} }
return p_path.replace("res://", ""); return p_path.replace("res://", "");
} else if (p_path.begins_with("user://")) { } else if (p_path.begins_with("user://")) {
String data_dir = OS::get_singleton()->get_user_data_dir(); String data_dir = OS::get_singleton()->get_user_data_dir();
if (data_dir != "") { if (!data_dir.is_empty()) {
return p_path.replace("user:/", data_dir); return p_path.replace("user:/", data_dir);
} }
return p_path.replace("user://", ""); return p_path.replace("user://", "");
@ -456,7 +456,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
// Attempt with a user-defined main pack first // Attempt with a user-defined main pack first
if (p_main_pack != "") { if (!p_main_pack.is_empty()) {
bool ok = _load_resource_pack(p_main_pack); bool ok = _load_resource_pack(p_main_pack);
ERR_FAIL_COND_V_MSG(!ok, ERR_CANT_OPEN, "Cannot open resource pack '" + p_main_pack + "'."); ERR_FAIL_COND_V_MSG(!ok, ERR_CANT_OPEN, "Cannot open resource pack '" + p_main_pack + "'.");
@ -471,7 +471,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
String exec_path = OS::get_singleton()->get_executable_path(); String exec_path = OS::get_singleton()->get_executable_path();
if (exec_path != "") { if (!exec_path.is_empty()) {
// We do several tests sequentially until one succeeds to find a PCK, // We do several tests sequentially until one succeeds to find a PCK,
// and if so, we attempt loading it at the end. // and if so, we attempt loading it at the end.
@ -523,11 +523,11 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
// Try to use the filesystem for files, according to OS. // Try to use the filesystem for files, according to OS.
// (Only Android -when reading from pck- and iOS use this.) // (Only Android -when reading from pck- and iOS use this.)
if (OS::get_singleton()->get_resource_dir() != "") { if (!OS::get_singleton()->get_resource_dir().is_empty()) {
// OS will call ProjectSettings->get_resource_path which will be empty if not overridden! // OS will call ProjectSettings->get_resource_path which will be empty if not overridden!
// If the OS would rather use a specific location, then it will not be empty. // If the OS would rather use a specific location, then it will not be empty.
resource_path = OS::get_singleton()->get_resource_dir().replace("\\", "/"); resource_path = OS::get_singleton()->get_resource_dir().replace("\\", "/");
if (resource_path != "" && resource_path[resource_path.length() - 1] == '/') { if (!resource_path.is_empty() && resource_path[resource_path.length() - 1] == '/') {
resource_path = resource_path.substr(0, resource_path.length() - 1); // Chop end. resource_path = resource_path.substr(0, resource_path.length() - 1); // Chop end.
} }
@ -591,7 +591,7 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bo
Error err = _setup(p_path, p_main_pack, p_upwards, p_ignore_override); Error err = _setup(p_path, p_main_pack, p_upwards, p_ignore_override);
if (err == OK) { if (err == OK) {
String custom_settings = GLOBAL_DEF("application/config/project_settings_override", ""); String custom_settings = GLOBAL_DEF("application/config/project_settings_override", "");
if (custom_settings != "") { if (!custom_settings.is_empty()) {
_load_settings_text(custom_settings); _load_settings_text(custom_settings);
} }
} }
@ -699,21 +699,21 @@ Error ProjectSettings::_load_settings_text(const String &p_path) {
return err; return err;
} }
if (assign != String()) { if (!assign.is_empty()) {
if (section == String() && assign == "config_version") { if (section.is_empty() && assign == "config_version") {
config_version = value; config_version = value;
if (config_version > CONFIG_VERSION) { if (config_version > CONFIG_VERSION) {
memdelete(f); memdelete(f);
ERR_FAIL_V_MSG(ERR_FILE_CANT_OPEN, vformat("Can't open project at '%s', its `config_version` (%d) is from a more recent and incompatible version of the engine. Expected config version: %d.", p_path, config_version, CONFIG_VERSION)); ERR_FAIL_V_MSG(ERR_FILE_CANT_OPEN, vformat("Can't open project at '%s', its `config_version` (%d) is from a more recent and incompatible version of the engine. Expected config version: %d.", p_path, config_version, CONFIG_VERSION));
} }
} else { } else {
if (section == String()) { if (section.is_empty()) {
set(assign, value); set(assign, value);
} else { } else {
set(section + "/" + assign, value); set(section + "/" + assign, value);
} }
} }
} else if (next_tag.name != String()) { } else if (!next_tag.name.is_empty()) {
section = next_tag.name; section = next_tag.name;
} }
} }
@ -797,7 +797,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
count += E.value.size(); count += E.value.size();
} }
if (p_custom_features != String()) { if (!p_custom_features.is_empty()) {
file->store_32(count + 1); file->store_32(count + 1);
//store how many properties are saved, add one for custom featuers, which must always go first //store how many properties are saved, add one for custom featuers, which must always go first
String key = CoreStringNames::get_singleton()->_custom_features; String key = CoreStringNames::get_singleton()->_custom_features;
@ -827,7 +827,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
for (Map<String, List<String>>::Element *E = props.front(); E; E = E->next()) { for (Map<String, List<String>>::Element *E = props.front(); E; E = E->next()) {
for (String &key : E->get()) { for (String &key : E->get()) {
if (E->key() != "") { if (!E->key().is_empty()) {
key = E->key() + "/" + key; key = E->key() + "/" + key;
} }
Variant value; Variant value;
@ -881,7 +881,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
file->store_line(""); file->store_line("");
file->store_string("config_version=" + itos(CONFIG_VERSION) + "\n"); file->store_string("config_version=" + itos(CONFIG_VERSION) + "\n");
if (p_custom_features != String()) { if (!p_custom_features.is_empty()) {
file->store_string("custom_features=\"" + p_custom_features + "\"\n"); file->store_string("custom_features=\"" + p_custom_features + "\"\n");
} }
file->store_string("\n"); file->store_string("\n");
@ -891,12 +891,12 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
file->store_string("\n"); file->store_string("\n");
} }
if (E->key() != "") { if (!E->key().is_empty()) {
file->store_string("[" + E->key() + "]\n\n"); file->store_string("[" + E->key() + "]\n\n");
} }
for (const String &F : E->get()) { for (const String &F : E->get()) {
String key = F; String key = F;
if (E->key() != "") { if (!E->key().is_empty()) {
key = E->key() + "/" + key; key = E->key() + "/" + key;
} }
Variant value; Variant value;
@ -924,7 +924,7 @@ Error ProjectSettings::_save_custom_bnd(const String &p_file) { // add other par
} }
Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_custom, const Vector<String> &p_custom_features, bool p_merge_with_current) { Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_custom, const Vector<String> &p_custom_features, bool p_merge_with_current) {
ERR_FAIL_COND_V_MSG(p_path == "", ERR_INVALID_PARAMETER, "Project settings save path cannot be empty."); ERR_FAIL_COND_V_MSG(p_path.is_empty(), ERR_INVALID_PARAMETER, "Project settings save path cannot be empty.");
PackedStringArray project_features = has_setting("application/config/features") ? (PackedStringArray)get_setting("application/config/features") : PackedStringArray(); PackedStringArray project_features = has_setting("application/config/features") ? (PackedStringArray)get_setting("application/config/features") : PackedStringArray();
// If there is no feature list currently present, force one to generate. // If there is no feature list currently present, force one to generate.
@ -933,7 +933,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
} }
// Check the rendering API. // Check the rendering API.
const String rendering_api = has_setting("rendering/quality/driver/driver_name") ? (String)get_setting("rendering/quality/driver/driver_name") : String(); const String rendering_api = has_setting("rendering/quality/driver/driver_name") ? (String)get_setting("rendering/quality/driver/driver_name") : String();
if (rendering_api != "") { if (!rendering_api.is_empty()) {
// Add the rendering API as a project feature if it doesn't already exist. // Add the rendering API as a project feature if it doesn't already exist.
if (!project_features.has(rendering_api)) { if (!project_features.has(rendering_api)) {
project_features.append(rendering_api); project_features.append(rendering_api);

View file

@ -1483,7 +1483,7 @@ String Directory::get_next() {
ERR_FAIL_COND_V_MSG(!is_open(), "", "Directory must be opened before use."); ERR_FAIL_COND_V_MSG(!is_open(), "", "Directory must be opened before use.");
String next = d->get_next(); String next = d->get_next();
while (next != "" && ((_list_skip_navigational && (next == "." || next == "..")) || (_list_skip_hidden && d->current_is_hidden()))) { while (!next.is_empty() && ((_list_skip_navigational && (next == "." || next == "..")) || (_list_skip_hidden && d->current_is_hidden()))) {
next = d->get_next(); next = d->get_next();
} }
return next; return next;
@ -1665,7 +1665,7 @@ String Marshalls::variant_to_base64(const Variant &p_var, bool p_full_objects) {
ERR_FAIL_COND_V_MSG(err != OK, "", "Error when trying to encode Variant."); ERR_FAIL_COND_V_MSG(err != OK, "", "Error when trying to encode Variant.");
String ret = CryptoCore::b64_encode_str(&w[0], len); String ret = CryptoCore::b64_encode_str(&w[0], len);
ERR_FAIL_COND_V(ret == "", ret); ERR_FAIL_COND_V(ret.is_empty(), ret);
return ret; return ret;
} }
@ -1690,7 +1690,7 @@ Variant Marshalls::base64_to_variant(const String &p_str, bool p_allow_objects)
String Marshalls::raw_to_base64(const Vector<uint8_t> &p_arr) { String Marshalls::raw_to_base64(const Vector<uint8_t> &p_arr) {
String ret = CryptoCore::b64_encode_str(p_arr.ptr(), p_arr.size()); String ret = CryptoCore::b64_encode_str(p_arr.ptr(), p_arr.size());
ERR_FAIL_COND_V(ret == "", ret); ERR_FAIL_COND_V(ret.is_empty(), ret);
return ret; return ret;
} }
@ -1714,7 +1714,7 @@ Vector<uint8_t> Marshalls::base64_to_raw(const String &p_str) {
String Marshalls::utf8_to_base64(const String &p_str) { String Marshalls::utf8_to_base64(const String &p_str) {
CharString cstr = p_str.utf8(); CharString cstr = p_str.utf8();
String ret = CryptoCore::b64_encode_str((unsigned char *)cstr.get_data(), cstr.length()); String ret = CryptoCore::b64_encode_str((unsigned char *)cstr.get_data(), cstr.length());
ERR_FAIL_COND_V(ret == "", ret); ERR_FAIL_COND_V(ret.is_empty(), ret);
return ret; return ret;
} }

View file

@ -139,7 +139,7 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
// Cache options // Cache options
String variable_prefix = options["variable_prefix"]; String variable_prefix = options["variable_prefix"];
if (line == "") { if (line.is_empty()) {
print_line("\nDebugger Break, Reason: '" + script_lang->debug_get_error() + "'"); print_line("\nDebugger Break, Reason: '" + script_lang->debug_get_error() + "'");
print_line("*Frame " + itos(current_frame) + " - " + script_lang->debug_get_stack_level_source(current_frame) + ":" + itos(script_lang->debug_get_stack_level_line(current_frame)) + " in function '" + script_lang->debug_get_stack_level_function(current_frame) + "'"); print_line("*Frame " + itos(current_frame) + " - " + script_lang->debug_get_stack_level_source(current_frame) + ":" + itos(script_lang->debug_get_stack_level_line(current_frame)) + " in function '" + script_lang->debug_get_stack_level_function(current_frame) + "'");
print_line("Enter \"help\" for assistance."); print_line("Enter \"help\" for assistance.");

View file

@ -33,7 +33,7 @@
void DocData::return_doc_from_retinfo(DocData::MethodDoc &p_method, const PropertyInfo &p_retinfo) { void DocData::return_doc_from_retinfo(DocData::MethodDoc &p_method, const PropertyInfo &p_retinfo) {
if (p_retinfo.type == Variant::INT && p_retinfo.hint == PROPERTY_HINT_INT_IS_POINTER) { if (p_retinfo.type == Variant::INT && p_retinfo.hint == PROPERTY_HINT_INT_IS_POINTER) {
p_method.return_type = p_retinfo.hint_string; p_method.return_type = p_retinfo.hint_string;
if (p_method.return_type == "") { if (p_method.return_type.is_empty()) {
p_method.return_type = "void*"; p_method.return_type = "void*";
} else { } else {
p_method.return_type += "*"; p_method.return_type += "*";
@ -64,7 +64,7 @@ void DocData::argument_doc_from_arginfo(DocData::ArgumentDoc &p_argument, const
if (p_arginfo.type == Variant::INT && p_arginfo.hint == PROPERTY_HINT_INT_IS_POINTER) { if (p_arginfo.type == Variant::INT && p_arginfo.hint == PROPERTY_HINT_INT_IS_POINTER) {
p_argument.type = p_arginfo.hint_string; p_argument.type = p_arginfo.hint_string;
if (p_argument.type == "") { if (p_argument.type.is_empty()) {
p_argument.type = "void*"; p_argument.type = "void*";
} else { } else {
p_argument.type += "*"; p_argument.type += "*";

View file

@ -40,7 +40,7 @@
static String get_type_name(const PropertyInfo &p_info) { static String get_type_name(const PropertyInfo &p_info) {
if (p_info.type == Variant::INT && (p_info.hint == PROPERTY_HINT_INT_IS_POINTER)) { if (p_info.type == Variant::INT && (p_info.hint == PROPERTY_HINT_INT_IS_POINTER)) {
if (p_info.hint_string == "") { if (p_info.hint_string.is_empty()) {
return "void*"; return "void*";
} else { } else {
return p_info.hint_string + "*"; return p_info.hint_string + "*";
@ -340,7 +340,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
int value = CoreConstants::get_global_constant_value(i); int value = CoreConstants::get_global_constant_value(i);
String enum_name = CoreConstants::get_global_constant_enum(i); String enum_name = CoreConstants::get_global_constant_enum(i);
String name = CoreConstants::get_global_constant_name(i); String name = CoreConstants::get_global_constant_name(i);
if (enum_name != String()) { if (!enum_name.is_empty()) {
enum_list[enum_name].push_back(Pair<String, int>(name, value)); enum_list[enum_name].push_back(Pair<String, int>(name, value));
} else { } else {
Dictionary d; Dictionary d;

View file

@ -397,7 +397,7 @@ RES NativeExtensionResourceLoader::load(const String &p_path, const String &p_or
} }
} }
if (library_path == String()) { if (library_path.is_empty()) {
if (r_error) { if (r_error) {
*r_error = ERR_FILE_NOT_FOUND; *r_error = ERR_FILE_NOT_FOUND;
} }

View file

@ -115,7 +115,7 @@ void NativeExtensionManager::load_extensions() {
FileAccessRef f = FileAccess::open(NativeExtension::get_extension_list_config_file(), FileAccess::READ); FileAccessRef f = FileAccess::open(NativeExtension::get_extension_list_config_file(), FileAccess::READ);
while (f && !f->eof_reached()) { while (f && !f->eof_reached()) {
String s = f->get_line().strip_edges(); String s = f->get_line().strip_edges();
if (s != String()) { if (!s.is_empty()) {
LoadStatus err = load_extension(s); LoadStatus err = load_extension(s);
ERR_CONTINUE_MSG(err == LOAD_STATUS_FAILED, "Error loading extension: " + s); ERR_CONTINUE_MSG(err == LOAD_STATUS_FAILED, "Error loading extension: " + s);
} }

View file

@ -403,7 +403,7 @@ void Input::joy_connection_changed(int p_idx, bool p_connected, String p_name, S
if (p_connected) { if (p_connected) {
String uidname = p_guid; String uidname = p_guid;
if (p_guid == "") { if (p_guid.is_empty()) {
int uidlen = MIN(p_name.length(), 16); int uidlen = MIN(p_name.length(), 16);
for (int i = 0; i < uidlen; i++) { for (int i = 0; i < uidlen; i++) {
uidname = uidname + _hex_str(p_name[i]); uidname = uidname + _hex_str(p_name[i]);
@ -1249,7 +1249,7 @@ void Input::parse_mapping(String p_mapping) {
int idx = 1; int idx = 1;
while (++idx < entry.size()) { while (++idx < entry.size()) {
if (entry[idx] == "") { if (entry[idx].is_empty()) {
continue; continue;
} }
@ -1420,10 +1420,10 @@ Input::Input() {
// If defined, parse SDL_GAMECONTROLLERCONFIG for possible new mappings/overrides. // If defined, parse SDL_GAMECONTROLLERCONFIG for possible new mappings/overrides.
String env_mapping = OS::get_singleton()->get_environment("SDL_GAMECONTROLLERCONFIG"); String env_mapping = OS::get_singleton()->get_environment("SDL_GAMECONTROLLERCONFIG");
if (env_mapping != "") { if (!env_mapping.is_empty()) {
Vector<String> entries = env_mapping.split("\n"); Vector<String> entries = env_mapping.split("\n");
for (int i = 0; i < entries.size(); i++) { for (int i = 0; i < entries.size(); i++) {
if (entries[i] == "") { if (entries[i].is_empty()) {
continue; continue;
} }
parse_mapping(entries[i]); parse_mapping(entries[i]);

View file

@ -360,12 +360,12 @@ String InputEventKey::as_text() const {
kc = keycode_get_string(keycode); kc = keycode_get_string(keycode);
} }
if (kc == String()) { if (kc.is_empty()) {
return kc; return kc;
} }
String mods_text = InputEventWithModifiers::as_text(); String mods_text = InputEventWithModifiers::as_text();
return mods_text == "" ? kc : mods_text + "+" + kc; return mods_text.is_empty() ? kc : mods_text + "+" + kc;
} }
String InputEventKey::to_string() { String InputEventKey::to_string() {
@ -382,7 +382,7 @@ String InputEventKey::to_string() {
} }
String mods = InputEventWithModifiers::as_text(); String mods = InputEventWithModifiers::as_text();
mods = mods == "" ? TTR("none") : mods; mods = mods.is_empty() ? TTR("none") : mods;
return vformat("InputEventKey: keycode=%s, mods=%s, physical=%s, pressed=%s, echo=%s", kc, mods, physical, p, e); return vformat("InputEventKey: keycode=%s, mods=%s, physical=%s, pressed=%s, echo=%s", kc, mods, physical, p, e);
} }
@ -634,7 +634,7 @@ static const char *_mouse_button_descriptions[9] = {
String InputEventMouseButton::as_text() const { String InputEventMouseButton::as_text() const {
// Modifiers // Modifiers
String mods_text = InputEventWithModifiers::as_text(); String mods_text = InputEventWithModifiers::as_text();
String full_string = mods_text == "" ? "" : mods_text + "+"; String full_string = mods_text.is_empty() ? "" : mods_text + "+";
// Button // Button
MouseButton idx = get_button_index(); MouseButton idx = get_button_index();
@ -687,7 +687,7 @@ String InputEventMouseButton::to_string() {
} }
String mods = InputEventWithModifiers::as_text(); String mods = InputEventWithModifiers::as_text();
mods = mods == "" ? TTR("none") : mods; mods = mods.is_empty() ? TTR("none") : mods;
// Work around the fact vformat can only take 5 substitutions but 6 need to be passed. // Work around the fact vformat can only take 5 substitutions but 6 need to be passed.
String index_and_mods = vformat("button_index=%s, mods=%s", button_index, mods); String index_and_mods = vformat("button_index=%s, mods=%s", button_index, mods);

View file

@ -718,7 +718,7 @@ const OrderedHashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins_with
String name = split[0]; String name = split[0];
String override_for = split.size() > 1 ? split[1] : String(); String override_for = split.size() > 1 ? split[1] : String();
if (override_for != String() && OS::get_singleton()->has_feature(override_for)) { if (!override_for.is_empty() && OS::get_singleton()->has_feature(override_for)) {
builtins_with_overrides[name].push_back(override_for); builtins_with_overrides[name].push_back(override_for);
} }
} }
@ -730,12 +730,12 @@ const OrderedHashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins_with
String name = split[0]; String name = split[0];
String override_for = split.size() > 1 ? split[1] : String(); String override_for = split.size() > 1 ? split[1] : String();
if (builtins_with_overrides.has(name) && override_for == String()) { if (builtins_with_overrides.has(name) && override_for.is_empty()) {
// Builtin has an override but this particular one is not an override, so skip. // Builtin has an override but this particular one is not an override, so skip.
continue; continue;
} }
if (override_for != String() && !OS::get_singleton()->has_feature(override_for)) { if (!override_for.is_empty() && !OS::get_singleton()->has_feature(override_for)) {
// OS does not support this override - skip. // OS does not support this override - skip.
continue; continue;
} }

View file

@ -183,7 +183,7 @@ Error ConfigFile::_internal_save(FileAccess *file) {
if (E != values.front()) { if (E != values.front()) {
file->store_string("\n"); file->store_string("\n");
} }
if (E.key() != "") { if (!E.key().is_empty()) {
file->store_string("[" + E.key() + "]\n\n"); file->store_string("[" + E.key() + "]\n\n");
} }
@ -287,9 +287,9 @@ Error ConfigFile::_parse(const String &p_path, VariantParser::Stream *p_stream)
return err; return err;
} }
if (assign != String()) { if (!assign.is_empty()) {
set_value(section, assign, value); set_value(section, assign, value);
} else if (next_tag.name != String()) { } else if (!next_tag.name.is_empty()) {
section = next_tag.name; section = next_tag.name;
} }
} }

View file

@ -79,7 +79,7 @@ static Error _erase_recursive(DirAccess *da) {
da->list_dir_begin(); da->list_dir_begin();
String n = da->get_next(); String n = da->get_next();
while (n != String()) { while (!n.is_empty()) {
if (n != "." && n != "..") { if (n != "." && n != "..") {
if (da->current_is_dir()) { if (da->current_is_dir()) {
dirs.push_back(n); dirs.push_back(n);
@ -183,7 +183,7 @@ String DirAccess::fix_path(String p_path) const {
if (ProjectSettings::get_singleton()) { if (ProjectSettings::get_singleton()) {
if (p_path.begins_with("res://")) { if (p_path.begins_with("res://")) {
String resource_path = ProjectSettings::get_singleton()->get_resource_path(); String resource_path = ProjectSettings::get_singleton()->get_resource_path();
if (resource_path != "") { if (!resource_path.is_empty()) {
return p_path.replace_first("res:/", resource_path); return p_path.replace_first("res:/", resource_path);
} }
return p_path.replace_first("res://", ""); return p_path.replace_first("res://", "");
@ -194,7 +194,7 @@ String DirAccess::fix_path(String p_path) const {
case ACCESS_USERDATA: { case ACCESS_USERDATA: {
if (p_path.begins_with("user://")) { if (p_path.begins_with("user://")) {
String data_dir = OS::get_singleton()->get_user_data_dir(); String data_dir = OS::get_singleton()->get_user_data_dir();
if (data_dir != "") { if (!data_dir.is_empty()) {
return p_path.replace_first("user:/", data_dir); return p_path.replace_first("user:/", data_dir);
} }
return p_path.replace_first("user://", ""); return p_path.replace_first("user://", "");
@ -337,7 +337,7 @@ Error DirAccess::_copy_dir(DirAccess *p_target_da, String p_to, int p_chmod_flag
String curdir = get_current_dir(); String curdir = get_current_dir();
list_dir_begin(); list_dir_begin();
String n = get_next(); String n = get_next();
while (n != String()) { while (!n.is_empty()) {
if (n != "." && n != "..") { if (n != "." && n != "..") {
if (p_copy_links && is_link(get_current_dir().plus_file(n))) { if (p_copy_links && is_link(get_current_dir().plus_file(n))) {
create_link(read_link(get_current_dir().plus_file(n)), p_to + n); create_link(read_link(get_current_dir().plus_file(n)), p_to + n);

View file

@ -127,7 +127,7 @@ String FileAccess::fix_path(const String &p_path) const {
if (ProjectSettings::get_singleton()) { if (ProjectSettings::get_singleton()) {
if (r_path.begins_with("res://")) { if (r_path.begins_with("res://")) {
String resource_path = ProjectSettings::get_singleton()->get_resource_path(); String resource_path = ProjectSettings::get_singleton()->get_resource_path();
if (resource_path != "") { if (!resource_path.is_empty()) {
return r_path.replace("res:/", resource_path); return r_path.replace("res:/", resource_path);
} }
return r_path.replace("res://", ""); return r_path.replace("res://", "");
@ -138,7 +138,7 @@ String FileAccess::fix_path(const String &p_path) const {
case ACCESS_USERDATA: { case ACCESS_USERDATA: {
if (r_path.begins_with("user://")) { if (r_path.begins_with("user://")) {
String data_dir = OS::get_singleton()->get_user_data_dir(); String data_dir = OS::get_singleton()->get_user_data_dir();
if (data_dir != "") { if (!data_dir.is_empty()) {
return r_path.replace("user:/", data_dir); return r_path.replace("user:/", data_dir);
} }
return r_path.replace("user://", ""); return r_path.replace("user://", "");

View file

@ -459,7 +459,7 @@ PackedData::PackedDir *DirAccessPack::_find_dir(String p_dir) {
nd = nd.simplify_path(); nd = nd.simplify_path();
if (nd == "") { if (nd.is_empty()) {
nd = "."; nd = ".";
} }

View file

@ -136,7 +136,7 @@ void RotatedFileLogger::clear_old_backups() {
da->list_dir_begin(); da->list_dir_begin();
String f = da->get_next(); String f = da->get_next();
Set<String> backups; Set<String> backups;
while (f != String()) { while (!f.is_empty()) {
if (!da->current_is_dir() && f.begins_with(basename) && f.get_extension() == extension && f != base_path.get_file()) { if (!da->current_is_dir() && f.begins_with(basename) && f.get_extension() == extension && f != base_path.get_file()) {
backups.insert(f); backups.insert(f);
} }
@ -163,7 +163,7 @@ void RotatedFileLogger::rotate_file() {
if (max_files > 1) { if (max_files > 1) {
String timestamp = Time::get_singleton()->get_datetime_string_from_system().replace(":", "."); String timestamp = Time::get_singleton()->get_datetime_string_from_system().replace(":", ".");
String backup_name = base_path.get_basename() + timestamp; String backup_name = base_path.get_basename() + timestamp;
if (base_path.get_extension() != String()) { if (!base_path.get_extension().is_empty()) {
backup_name += "." + base_path.get_extension(); backup_name += "." + base_path.get_extension();
} }

View file

@ -562,7 +562,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
return err; return err;
} }
if (str == String()) { if (str.is_empty()) {
r_variant = (Object *)nullptr; r_variant = (Object *)nullptr;
} else { } else {
Object *obj = ClassDB::instantiate(str); Object *obj = ClassDB::instantiate(str);

View file

@ -52,7 +52,7 @@ void Resource::set_path(const String &p_path, bool p_take_over) {
return; return;
} }
if (path_cache != "") { if (!path_cache.is_empty()) {
ResourceCache::lock.write_lock(); ResourceCache::lock.write_lock();
ResourceCache::resources.erase(path_cache); ResourceCache::resources.erase(path_cache);
ResourceCache::lock.write_unlock(); ResourceCache::lock.write_unlock();
@ -82,7 +82,7 @@ void Resource::set_path(const String &p_path, bool p_take_over) {
} }
path_cache = p_path; path_cache = p_path;
if (path_cache != "") { if (!path_cache.is_empty()) {
ResourceCache::lock.write_lock(); ResourceCache::lock.write_lock();
ResourceCache::resources[path_cache] = this; ResourceCache::resources[path_cache] = this;
ResourceCache::lock.write_unlock(); ResourceCache::lock.write_unlock();
@ -383,7 +383,7 @@ bool Resource::is_translation_remapped() const {
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
//helps keep IDs same number when loading/saving scenes. -1 clears ID and it Returns -1 when no id stored //helps keep IDs same number when loading/saving scenes. -1 clears ID and it Returns -1 when no id stored
void Resource::set_id_for_path(const String &p_path, const String &p_id) { void Resource::set_id_for_path(const String &p_path, const String &p_id) {
if (p_id == "") { if (p_id.is_empty()) {
ResourceCache::path_cache_lock.write_lock(); ResourceCache::path_cache_lock.write_lock();
ResourceCache::resource_path_cache[p_path].erase(get_path()); ResourceCache::resource_path_cache[p_path].erase(get_path());
ResourceCache::path_cache_lock.write_unlock(); ResourceCache::path_cache_lock.write_unlock();
@ -434,7 +434,7 @@ Resource::Resource() :
remapped_list(this) {} remapped_list(this) {}
Resource::~Resource() { Resource::~Resource() {
if (path_cache != "") { if (!path_cache.is_empty()) {
ResourceCache::lock.write_lock(); ResourceCache::lock.write_lock();
ResourceCache::resources.erase(path_cache); ResourceCache::resources.erase(path_cache);
ResourceCache::lock.write_unlock(); ResourceCache::lock.write_unlock();

View file

@ -727,7 +727,7 @@ Error ResourceLoaderBinary::load() {
} }
res = RES(r); res = RES(r);
if (path != String() && cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) { if (!path.is_empty() && cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) {
r->set_path(path, cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE); //if got here because the resource with same path has different type, replace it r->set_path(path, cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE); //if got here because the resource with same path has different type, replace it
} }
r->set_scene_unique_id(id); r->set_scene_unique_id(id);
@ -829,7 +829,7 @@ void ResourceLoaderBinary::get_dependencies(FileAccess *p_f, List<String> *p_dep
dep = external_resources[i].path; dep = external_resources[i].path;
} }
if (p_add_types && external_resources[i].type != String()) { if (p_add_types && !external_resources[i].type.is_empty()) {
dep += "::" + external_resources[i].type; dep += "::" + external_resources[i].type;
} }
@ -1026,7 +1026,7 @@ RES ResourceFormatLoaderBinary::load(const String &p_path, const String &p_origi
loader.cache_mode = p_cache_mode; loader.cache_mode = p_cache_mode;
loader.use_sub_threads = p_use_sub_threads; loader.use_sub_threads = p_use_sub_threads;
loader.progress = r_progress; loader.progress = r_progress;
String path = p_original_path != "" ? p_original_path : p_path; String path = !p_original_path.is_empty() ? p_original_path : p_path;
loader.local_path = ProjectSettings::get_singleton()->localize_path(path); loader.local_path = ProjectSettings::get_singleton()->localize_path(path);
loader.res_path = loader.local_path; loader.res_path = loader.local_path;
//loader.set_local_path( Globals::get_singleton()->localize_path(p_path) ); //loader.set_local_path( Globals::get_singleton()->localize_path(p_path) );
@ -1045,7 +1045,7 @@ RES ResourceFormatLoaderBinary::load(const String &p_path, const String &p_origi
} }
void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const { void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const {
if (p_type == "") { if (p_type.is_empty()) {
get_recognized_extensions(p_extensions); get_recognized_extensions(p_extensions);
return; return;
} }
@ -1979,7 +1979,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
for (RES &r : saved_resources) { for (RES &r : saved_resources) {
if (r->is_built_in()) { if (r->is_built_in()) {
if (r->get_scene_unique_id() != "") { if (!r->get_scene_unique_id().is_empty()) {
if (used_unique_ids.has(r->get_scene_unique_id())) { if (used_unique_ids.has(r->get_scene_unique_id())) {
r->set_scene_unique_id(""); r->set_scene_unique_id("");
} else { } else {
@ -1993,7 +1993,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
int res_index = 0; int res_index = 0;
for (RES &r : saved_resources) { for (RES &r : saved_resources) {
if (r->is_built_in()) { if (r->is_built_in()) {
if (r->get_scene_unique_id() == "") { if (r->get_scene_unique_id().is_empty()) {
String new_id; String new_id;
while (true) { while (true) {

View file

@ -78,8 +78,8 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
return err; return err;
} }
if (assign != String()) { if (!assign.is_empty()) {
if (!path_found && assign.begins_with("path.") && r_path_and_type.path == String()) { if (!path_found && assign.begins_with("path.") && r_path_and_type.path.is_empty()) {
String feature = assign.get_slicec('.', 1); String feature = assign.get_slicec('.', 1);
if (OS::get_singleton()->has_feature(feature)) { if (OS::get_singleton()->has_feature(feature)) {
r_path_and_type.path = value; r_path_and_type.path = value;
@ -112,7 +112,7 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
memdelete(f); memdelete(f);
if (r_path_and_type.path == String() || r_path_and_type.type == String()) { if (r_path_and_type.path.is_empty() || r_path_and_type.type.is_empty()) {
return ERR_FILE_CORRUPT; return ERR_FILE_CORRUPT;
} }
return OK; return OK;
@ -158,7 +158,7 @@ void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extension
} }
void ResourceFormatImporter::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const { void ResourceFormatImporter::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const {
if (p_type == "") { if (p_type.is_empty()) {
get_recognized_extensions(p_extensions); get_recognized_extensions(p_extensions);
return; return;
} }
@ -167,7 +167,7 @@ void ResourceFormatImporter::get_recognized_extensions_for_type(const String &p_
for (int i = 0; i < importers.size(); i++) { for (int i = 0; i < importers.size(); i++) {
String res_type = importers[i]->get_resource_type(); String res_type = importers[i]->get_resource_type();
if (res_type == String()) { if (res_type.is_empty()) {
continue; continue;
} }
@ -246,7 +246,7 @@ int ResourceFormatImporter::get_import_order(const String &p_path) const {
bool ResourceFormatImporter::handles_type(const String &p_type) const { bool ResourceFormatImporter::handles_type(const String &p_type) const {
for (int i = 0; i < importers.size(); i++) { for (int i = 0; i < importers.size(); i++) {
String res_type = importers[i]->get_resource_type(); String res_type = importers[i]->get_resource_type();
if (res_type == String()) { if (res_type.is_empty()) {
continue; continue;
} }
if (ClassDB::is_parent_class(res_type, p_type)) { if (ClassDB::is_parent_class(res_type, p_type)) {
@ -300,7 +300,7 @@ void ResourceFormatImporter::get_internal_resource_path_list(const String &p_pat
return; return;
} }
if (assign != String()) { if (!assign.is_empty()) {
if (assign.begins_with("path.")) { if (assign.begins_with("path.")) {
r_paths->push_back(value); r_paths->push_back(value);
} else if (assign == "path") { } else if (assign == "path") {

View file

@ -52,7 +52,7 @@ bool ResourceFormatLoader::recognize_path(const String &p_path, const String &p_
String extension = p_path.get_extension(); String extension = p_path.get_extension();
List<String> extensions; List<String> extensions;
if (p_for_type == String()) { if (p_for_type.is_empty()) {
get_recognized_extensions(&extensions); get_recognized_extensions(&extensions);
} else { } else {
get_recognized_extensions_for_type(p_for_type, &extensions); get_recognized_extensions_for_type(p_for_type, &extensions);
@ -96,7 +96,7 @@ ResourceUID::ID ResourceFormatLoader::get_resource_uid(const String &p_path) con
} }
void ResourceFormatLoader::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const { void ResourceFormatLoader::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const {
if (p_type == "" || handles_type(p_type)) { if (p_type.is_empty() || handles_type(p_type)) {
get_recognized_extensions(p_extensions); get_recognized_extensions(p_extensions);
} }
} }
@ -194,7 +194,7 @@ RES ResourceLoader::_load(const String &p_path, const String &p_original_path, c
continue; continue;
} }
found = true; found = true;
RES res = loader[i]->load(p_path, p_original_path != String() ? p_original_path : p_path, r_error, p_use_sub_threads, r_progress, p_cache_mode); RES res = loader[i]->load(p_path, !p_original_path.is_empty() ? p_original_path : p_path, r_error, p_use_sub_threads, r_progress, p_cache_mode);
if (res.is_null()) { if (res.is_null()) {
continue; continue;
} }
@ -289,7 +289,7 @@ Error ResourceLoader::load_threaded_request(const String &p_path, const String &
thread_load_mutex->lock(); thread_load_mutex->lock();
if (p_source_resource != String()) { if (!p_source_resource.is_empty()) {
//must be loading from this resource //must be loading from this resource
if (!thread_load_tasks.has(p_source_resource)) { if (!thread_load_tasks.has(p_source_resource)) {
thread_load_mutex->unlock(); thread_load_mutex->unlock();
@ -310,7 +310,7 @@ Error ResourceLoader::load_threaded_request(const String &p_path, const String &
if (thread_load_tasks.has(local_path)) { if (thread_load_tasks.has(local_path)) {
thread_load_tasks[local_path].requests++; thread_load_tasks[local_path].requests++;
if (p_source_resource != String()) { if (!p_source_resource.is_empty()) {
thread_load_tasks[p_source_resource].sub_tasks.insert(local_path); thread_load_tasks[p_source_resource].sub_tasks.insert(local_path);
} }
thread_load_mutex->unlock(); thread_load_mutex->unlock();
@ -354,7 +354,7 @@ Error ResourceLoader::load_threaded_request(const String &p_path, const String &
ResourceCache::lock.read_unlock(); ResourceCache::lock.read_unlock();
} }
if (p_source_resource != String()) { if (!p_source_resource.is_empty()) {
thread_load_tasks[p_source_resource].sub_tasks.insert(local_path); thread_load_tasks[p_source_resource].sub_tasks.insert(local_path);
} }
@ -574,7 +574,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, Resour
bool xl_remapped = false; bool xl_remapped = false;
String path = _path_remap(local_path, &xl_remapped); String path = _path_remap(local_path, &xl_remapped);
if (path == "") { if (path.is_empty()) {
ERR_FAIL_V_MSG(RES(), "Remapping '" + local_path + "' failed."); ERR_FAIL_V_MSG(RES(), "Remapping '" + local_path + "' failed.");
} }
@ -776,7 +776,7 @@ String ResourceLoader::get_resource_type(const String &p_path) {
for (int i = 0; i < loader_count; i++) { for (int i = 0; i < loader_count; i++) {
String result = loader[i]->get_resource_type(local_path); String result = loader[i]->get_resource_type(local_path);
if (result != "") { if (!result.is_empty()) {
return result; return result;
} }
} }

View file

@ -87,7 +87,7 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error) {
// In PO file, "msgctxt" appears before "msgid". If we encounter a "msgctxt", we add what we have read // In PO file, "msgctxt" appears before "msgid". If we encounter a "msgctxt", we add what we have read
// and set "entered_context" to true to prevent adding twice. // and set "entered_context" to true to prevent adding twice.
if (!skip_this && msg_id != "") { if (!skip_this && !msg_id.is_empty()) {
if (status == STATUS_READING_STRING) { if (status == STATUS_READING_STRING) {
translation->add_message(msg_id, msg_str, msg_context); translation->add_message(msg_id, msg_str, msg_context);
} else if (status == STATUS_READING_PLURAL) { } else if (status == STATUS_READING_PLURAL) {
@ -125,7 +125,7 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error) {
ERR_FAIL_V_MSG(RES(), "Unexpected 'msgid', was expecting 'msgstr' while parsing: " + path + ":" + itos(line)); ERR_FAIL_V_MSG(RES(), "Unexpected 'msgid', was expecting 'msgstr' while parsing: " + path + ":" + itos(line));
} }
if (msg_id != "") { if (!msg_id.is_empty()) {
if (!skip_this && !entered_context) { if (!skip_this && !entered_context) {
if (status == STATUS_READING_STRING) { if (status == STATUS_READING_STRING) {
translation->add_message(msg_id, msg_str, msg_context); translation->add_message(msg_id, msg_str, msg_context);
@ -137,7 +137,7 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error) {
translation->add_plural_message(msg_id, msgs_plural, msg_context); translation->add_plural_message(msg_id, msgs_plural, msg_context);
} }
} }
} else if (config == "") { } else if (config.is_empty()) {
config = msg_str; config = msg_str;
// Record plural rule. // Record plural rule.
int p_start = config.find("Plural-Forms"); int p_start = config.find("Plural-Forms");
@ -178,7 +178,7 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error) {
status = STATUS_READING_STRING; status = STATUS_READING_STRING;
} }
if (l == "" || l.begins_with("#")) { if (l.is_empty() || l.begins_with("#")) {
if (l.find("fuzzy") != -1) { if (l.find("fuzzy") != -1) {
skip_next = true; skip_next = true;
} }
@ -236,15 +236,15 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error) {
// Add the last set of data from last iteration. // Add the last set of data from last iteration.
if (status == STATUS_READING_STRING) { if (status == STATUS_READING_STRING) {
if (msg_id != "") { if (!msg_id.is_empty()) {
if (!skip_this) { if (!skip_this) {
translation->add_message(msg_id, msg_str, msg_context); translation->add_message(msg_id, msg_str, msg_context);
} }
} else if (config == "") { } else if (config.is_empty()) {
config = msg_str; config = msg_str;
} }
} else if (status == STATUS_READING_PLURAL) { } else if (status == STATUS_READING_PLURAL) {
if (!skip_this && msg_id != "") { if (!skip_this && !msg_id.is_empty()) {
if (plural_index != plural_forms - 1) { if (plural_index != plural_forms - 1) {
memdelete(f); memdelete(f);
ERR_FAIL_V_MSG(RES(), "Number of 'msgstr[]' doesn't match with number of plural forms: " + path + ":" + itos(line)); ERR_FAIL_V_MSG(RES(), "Number of 'msgstr[]' doesn't match with number of plural forms: " + path + ":" + itos(line));
@ -253,7 +253,7 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error) {
} }
} }
ERR_FAIL_COND_V_MSG(config == "", RES(), "No config found in file: " + path + "."); ERR_FAIL_COND_V_MSG(config.is_empty(), RES(), "No config found in file: " + path + ".");
Vector<String> configs = config.split("\n"); Vector<String> configs = config.split("\n");
for (int i = 0; i < configs.size(); i++) { for (int i = 0; i < configs.size(); i++) {

View file

@ -731,7 +731,7 @@ void ClassDB::bind_integer_constant(const StringName &p_class, const StringName
type->constant_map[p_name] = p_constant; type->constant_map[p_name] = p_constant;
String enum_name = p_enum; String enum_name = p_enum;
if (enum_name != String()) { if (!enum_name.is_empty()) {
if (enum_name.find(".") != -1) { if (enum_name.find(".") != -1) {
enum_name = enum_name.get_slicec('.', 1); enum_name = enum_name.get_slicec('.', 1);
} }

View file

@ -990,7 +990,7 @@ void Object::get_meta_list(List<StringName> *p_list) const {
} }
void Object::add_user_signal(const MethodInfo &p_signal) { void Object::add_user_signal(const MethodInfo &p_signal) {
ERR_FAIL_COND_MSG(p_signal.name == "", "Signal name cannot be empty."); ERR_FAIL_COND_MSG(p_signal.name.is_empty(), "Signal name cannot be empty.");
ERR_FAIL_COND_MSG(ClassDB::has_signal(get_class_name(), p_signal.name), "User signal's name conflicts with a built-in signal of '" + get_class_name() + "'."); ERR_FAIL_COND_MSG(ClassDB::has_signal(get_class_name(), p_signal.name), "User signal's name conflicts with a built-in signal of '" + get_class_name() + "'.");
ERR_FAIL_COND_MSG(signal_map.has(p_signal.name), "Trying to add already existing signal '" + p_signal.name + "'."); ERR_FAIL_COND_MSG(signal_map.has(p_signal.name), "Trying to add already existing signal '" + p_signal.name + "'.");
SignalData s; SignalData s;
@ -1253,7 +1253,7 @@ void Object::get_signal_list(List<MethodInfo> *p_signals) const {
const StringName *S = nullptr; const StringName *S = nullptr;
while ((S = signal_map.next(S))) { while ((S = signal_map.next(S))) {
if (signal_map[*S].user.name != "") { if (!signal_map[*S].user.name.is_empty()) {
//user signal //user signal
p_signals->push_back(signal_map[*S].user); p_signals->push_back(signal_map[*S].user);
} }
@ -1680,7 +1680,7 @@ void Object::get_translatable_strings(List<String> *p_strings) const {
String text = get(E.name); String text = get(E.name);
if (text == "") { if (text.is_empty()) {
continue; continue;
} }

View file

@ -352,7 +352,7 @@ public:
static String get_category_static() { \ static String get_category_static() { \
String category = m_inherits::get_category_static(); \ String category = m_inherits::get_category_static(); \
if (_get_category != m_inherits::_get_category) { \ if (_get_category != m_inherits::_get_category) { \
if (category != "") { \ if (!category.is_empty()) { \
category += "/"; \ category += "/"; \
} \ } \
category += _get_category(); \ category += _get_category(); \

View file

@ -190,8 +190,8 @@ static void _OS_printres(Object *p_obj) {
} }
void OS::print_all_resources(String p_to_file) { void OS::print_all_resources(String p_to_file) {
ERR_FAIL_COND(p_to_file != "" && _OSPRF); ERR_FAIL_COND(!p_to_file.is_empty() && _OSPRF);
if (p_to_file != "") { if (!p_to_file.is_empty()) {
Error err; Error err;
_OSPRF = FileAccess::open(p_to_file, FileAccess::WRITE, &err); _OSPRF = FileAccess::open(p_to_file, FileAccess::WRITE, &err);
if (err != OK) { if (err != OK) {
@ -202,7 +202,7 @@ void OS::print_all_resources(String p_to_file) {
ObjectDB::debug_objects(_OS_printres); ObjectDB::debug_objects(_OS_printres);
if (p_to_file != "") { if (!p_to_file.is_empty()) {
if (_OSPRF) { if (_OSPRF) {
memdelete(_OSPRF); memdelete(_OSPRF);
} }

View file

@ -368,7 +368,7 @@ NodePath::NodePath(const String &p_path) {
for (int i = from; i <= path.length(); i++) { for (int i = from; i <= path.length(); i++) {
if (path[i] == ':' || path[i] == 0) { if (path[i] == ':' || path[i] == 0) {
String str = path.substr(from, i - from); String str = path.substr(from, i - from);
if (str == "") { if (str.is_empty()) {
if (path[i] == 0) { if (path[i] == 0) {
continue; // Allow end-of-path : continue; // Allow end-of-path :
} }

View file

@ -33,7 +33,7 @@
#include <string.h> #include <string.h>
StringBuilder &StringBuilder::append(const String &p_string) { StringBuilder &StringBuilder::append(const String &p_string) {
if (p_string == String()) { if (p_string.is_empty()) {
return *this; return *this;
} }

View file

@ -310,7 +310,7 @@ StringName::StringName(const String &p_name, bool p_static) {
ERR_FAIL_COND(!configured); ERR_FAIL_COND(!configured);
if (p_name == String()) { if (p_name.is_empty()) {
return; return;
} }
@ -434,7 +434,7 @@ StringName StringName::search(const char32_t *p_name) {
} }
StringName StringName::search(const String &p_name) { StringName StringName::search(const String &p_name) {
ERR_FAIL_COND_V(p_name == "", StringName()); ERR_FAIL_COND_V(p_name.is_empty(), StringName());
MutexLock lock(mutex); MutexLock lock(mutex);

View file

@ -1287,7 +1287,7 @@ bool TranslationServer::_load_translations(const String &p_from) {
void TranslationServer::setup() { void TranslationServer::setup() {
String test = GLOBAL_DEF("internationalization/locale/test", ""); String test = GLOBAL_DEF("internationalization/locale/test", "");
test = test.strip_edges(); test = test.strip_edges();
if (test != "") { if (!test.is_empty()) {
set_locale(test); set_locale(test);
} else { } else {
set_locale(OS::get_singleton()->get_locale()); set_locale(OS::get_singleton()->get_locale());

View file

@ -4283,7 +4283,7 @@ bool String::is_valid_filename() const {
return false; return false;
} }
if (stripped == String()) { if (stripped.is_empty()) {
return false; return false;
} }
@ -4902,7 +4902,7 @@ String DTRN(const String &p_text, const String &p_text_plural, int p_n, const St
String RTR(const String &p_text, const String &p_context) { String RTR(const String &p_text, const String &p_context) {
if (TranslationServer::get_singleton()) { if (TranslationServer::get_singleton()) {
String rtr = TranslationServer::get_singleton()->tool_translate(p_text, p_context); String rtr = TranslationServer::get_singleton()->tool_translate(p_text, p_context);
if (rtr == String() || rtr == p_text) { if (rtr.is_empty() || rtr == p_text) {
return TranslationServer::get_singleton()->translate(p_text, p_context); return TranslationServer::get_singleton()->translate(p_text, p_context);
} else { } else {
return rtr; return rtr;
@ -4915,7 +4915,7 @@ String RTR(const String &p_text, const String &p_context) {
String RTRN(const String &p_text, const String &p_text_plural, int p_n, const String &p_context) { String RTRN(const String &p_text, const String &p_text_plural, int p_n, const String &p_context) {
if (TranslationServer::get_singleton()) { if (TranslationServer::get_singleton()) {
String rtr = TranslationServer::get_singleton()->tool_translate_plural(p_text, p_text_plural, p_n, p_context); String rtr = TranslationServer::get_singleton()->tool_translate_plural(p_text, p_text_plural, p_n, p_context);
if (rtr == String() || rtr == p_text || rtr == p_text_plural) { if (rtr.is_empty() || rtr == p_text || rtr == p_text_plural) {
return TranslationServer::get_singleton()->translate_plural(p_text, p_text_plural, p_n, p_context); return TranslationServer::get_singleton()->translate_plural(p_text, p_text_plural, p_n, p_context);
} else { } else {
return rtr; return rtr;

View file

@ -1598,14 +1598,14 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
} }
//try path because it's a file //try path because it's a file
if (res_text == String() && res->get_path().is_resource_file()) { if (res_text.is_empty() && res->get_path().is_resource_file()) {
//external resource //external resource
String path = res->get_path(); String path = res->get_path();
res_text = "Resource(\"" + path + "\")"; res_text = "Resource(\"" + path + "\")";
} }
//could come up with some sort of text //could come up with some sort of text
if (res_text != String()) { if (!res_text.is_empty()) {
p_store_string_func(p_store_string_ud, res_text); p_store_string_func(p_store_string_ud, res_text);
break; break;
} }

View file

@ -1555,7 +1555,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
p_shader->uniforms.clear(); p_shader->uniforms.clear();
if (p_shader->code == String()) { if (p_shader->code.is_empty()) {
return; //just invalid, but no error return; //just invalid, but no error
} }

View file

@ -342,7 +342,7 @@ Error DirAccessUnix::change_dir(String p_dir) {
} }
String base = _get_root_path(); String base = _get_root_path();
if (base != String() && !try_dir.begins_with(base)) { if (!base.is_empty() && !try_dir.begins_with(base)) {
ERR_FAIL_COND_V(getcwd(real_current_dir_name, 2048) == nullptr, ERR_BUG); ERR_FAIL_COND_V(getcwd(real_current_dir_name, 2048) == nullptr, ERR_BUG);
String new_dir; String new_dir;
new_dir.parse_utf8(real_current_dir_name); new_dir.parse_utf8(real_current_dir_name);
@ -360,7 +360,7 @@ Error DirAccessUnix::change_dir(String p_dir) {
String DirAccessUnix::get_current_dir(bool p_include_drive) { String DirAccessUnix::get_current_dir(bool p_include_drive) {
String base = _get_root_path(); String base = _get_root_path();
if (base != "") { if (!base.is_empty()) {
String bd = current_dir.replace_first(base, ""); String bd = current_dir.replace_first(base, "");
if (bd.begins_with("/")) { if (bd.begins_with("/")) {
return _get_root_string() + bd.substr(1, bd.length()); return _get_root_string() + bd.substr(1, bd.length());

View file

@ -160,7 +160,7 @@ void FileAccessUnix::close() {
close_notification_func(path, flags); close_notification_func(path, flags);
} }
if (save_path != "") { if (!save_path.is_empty()) {
int rename_error = rename((save_path + ".tmp").utf8().get_data(), save_path.utf8().get_data()); int rename_error = rename((save_path + ".tmp").utf8().get_data(), save_path.utf8().get_data());
if (rename_error && close_fail_notify) { if (rename_error && close_fail_notify) {

View file

@ -460,11 +460,11 @@ int OS_Unix::get_processor_count() const {
String OS_Unix::get_user_data_dir() const { String OS_Unix::get_user_data_dir() const {
String appname = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/name")); String appname = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/name"));
if (appname != "") { if (!appname.is_empty()) {
bool use_custom_dir = ProjectSettings::get_singleton()->get("application/config/use_custom_user_dir"); bool use_custom_dir = ProjectSettings::get_singleton()->get("application/config/use_custom_user_dir");
if (use_custom_dir) { if (use_custom_dir) {
String custom_dir = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/custom_user_dir_name"), true); String custom_dir = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/custom_user_dir_name"), true);
if (custom_dir == "") { if (custom_dir.is_empty()) {
custom_dir = appname; custom_dir = appname;
} }
return get_data_path().plus_file(custom_dir); return get_data_path().plus_file(custom_dir);
@ -486,7 +486,7 @@ String OS_Unix::get_executable_path() const {
if (len > 0) { if (len > 0) {
b.parse_utf8(buf, len); b.parse_utf8(buf, len);
} }
if (b == "") { if (b.is_empty()) {
WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]"); WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]");
return OS::get_executable_path(); return OS::get_executable_path();
} }

View file

@ -4249,7 +4249,7 @@ String RenderingDeviceVulkan::_shader_uniform_debug(RID p_shader, int p_set) {
} }
for (int j = 0; j < shader->sets[i].uniform_info.size(); j++) { for (int j = 0; j < shader->sets[i].uniform_info.size(); j++) {
const UniformInfo &ui = shader->sets[i].uniform_info[j]; const UniformInfo &ui = shader->sets[i].uniform_info[j];
if (ret != String()) { if (!ret.is_empty()) {
ret += "\n"; ret += "\n";
} }
ret += "Set: " + itos(i) + " Binding: " + itos(ui.binding) + " Type: " + shader_uniform_names[ui.type] + " Length: " + itos(ui.length); ret += "Set: " + itos(i) + " Binding: " + itos(ui.binding) + " Type: " + shader_uniform_names[ui.type] + " Length: " + itos(ui.length);

View file

@ -133,7 +133,7 @@ Error DirAccessWindows::change_dir(String p_dir) {
bool worked = (SetCurrentDirectoryW((LPCWSTR)(p_dir.utf16().get_data())) != 0); bool worked = (SetCurrentDirectoryW((LPCWSTR)(p_dir.utf16().get_data())) != 0);
String base = _get_root_path(); String base = _get_root_path();
if (base != "") { if (!base.is_empty()) {
GetCurrentDirectoryW(2048, real_current_dir_name); GetCurrentDirectoryW(2048, real_current_dir_name);
String new_dir = String::utf16((const char16_t *)real_current_dir_name).replace("\\", "/"); String new_dir = String::utf16((const char16_t *)real_current_dir_name).replace("\\", "/");
if (!new_dir.begins_with(base)) { if (!new_dir.begins_with(base)) {
@ -184,7 +184,7 @@ Error DirAccessWindows::make_dir(String p_dir) {
String DirAccessWindows::get_current_dir(bool p_include_drive) { String DirAccessWindows::get_current_dir(bool p_include_drive) {
String base = _get_root_path(); String base = _get_root_path();
if (base != "") { if (!base.is_empty()) {
String bd = current_dir.replace("\\", "/").replace_first(base, ""); String bd = current_dir.replace("\\", "/").replace_first(base, "");
if (bd.begins_with("/")) { if (bd.begins_with("/")) {
return _get_root_string() + bd.substr(1, bd.length()); return _get_root_string() + bd.substr(1, bd.length());
@ -196,7 +196,7 @@ String DirAccessWindows::get_current_dir(bool p_include_drive) {
if (p_include_drive) { if (p_include_drive) {
return current_dir; return current_dir;
} else { } else {
if (_get_root_string() == "") { if (_get_root_string().is_empty()) {
int p = current_dir.find(":"); int p = current_dir.find(":");
if (p != -1) { if (p != -1) {
return current_dir.substr(p + 1); return current_dir.substr(p + 1);

View file

@ -99,7 +99,7 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
HANDLE f = FindFirstFileW((LPCWSTR)(path.utf16().get_data()), &d); HANDLE f = FindFirstFileW((LPCWSTR)(path.utf16().get_data()), &d);
if (f != INVALID_HANDLE_VALUE) { if (f != INVALID_HANDLE_VALUE) {
String fname = String::utf16((const char16_t *)(d.cFileName)); String fname = String::utf16((const char16_t *)(d.cFileName));
if (fname != String()) { if (!fname.is_empty()) {
String base_file = path.get_file(); String base_file = path.get_file();
if (base_file != fname && base_file.findn(fname) == 0) { if (base_file != fname && base_file.findn(fname) == 0) {
WARN_PRINT("Case mismatch opening requested file '" + base_file + "', stored as '" + fname + "' in the filesystem. This file will not open when exported to other case-sensitive platforms."); WARN_PRINT("Case mismatch opening requested file '" + base_file + "', stored as '" + fname + "' in the filesystem. This file will not open when exported to other case-sensitive platforms.");
@ -142,7 +142,7 @@ void FileAccessWindows::close() {
fclose(f); fclose(f);
f = nullptr; f = nullptr;
if (save_path != "") { if (!save_path.is_empty()) {
bool rename_error = true; bool rename_error = true;
int attempts = 4; int attempts = 4;
while (rename_error && attempts) { while (rename_error && attempts) {

View file

@ -761,7 +761,7 @@ void ActionMapEditor::_add_action_pressed() {
} }
void ActionMapEditor::_add_action(const String &p_name) { void ActionMapEditor::_add_action(const String &p_name) {
if (p_name == "" || !_is_action_name_valid(p_name)) { if (p_name.is_empty() || !_is_action_name_valid(p_name)) {
show_message(TTR("Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or '\"'")); show_message(TTR("Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or '\"'"));
return; return;
} }
@ -785,7 +785,7 @@ void ActionMapEditor::_action_edited() {
return; return;
} }
if (new_name == "" || !_is_action_name_valid(new_name)) { if (new_name.is_empty() || !_is_action_name_valid(new_name)) {
ti->set_text(0, old_name); ti->set_text(0, old_name);
show_message(TTR("Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or '\"'")); show_message(TTR("Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or '\"'"));
return; return;

View file

@ -650,7 +650,7 @@ public:
List<StringName> anims; List<StringName> anims;
ap->get_animation_list(&anims); ap->get_animation_list(&anims);
for (const StringName &E : anims) { for (const StringName &E : anims) {
if (animations != String()) { if (!animations.is_empty()) {
animations += ","; animations += ",";
} }
@ -659,7 +659,7 @@ public:
} }
} }
if (animations != String()) { if (!animations.is_empty()) {
animations += ","; animations += ",";
} }
animations += "[stop]"; animations += "[stop]";
@ -1332,7 +1332,7 @@ public:
List<StringName> anims; List<StringName> anims;
ap->get_animation_list(&anims); ap->get_animation_list(&anims);
for (List<StringName>::Element *G = anims.front(); G; G = G->next()) { for (List<StringName>::Element *G = anims.front(); G; G = G->next()) {
if (animations != String()) { if (!animations.is_empty()) {
animations += ","; animations += ",";
} }
@ -1341,7 +1341,7 @@ public:
} }
} }
if (animations != String()) { if (!animations.is_empty()) {
animations += ","; animations += ",";
} }
animations += "[stop]"; animations += "[stop]";
@ -2665,7 +2665,7 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
if (stream.is_valid()) { if (stream.is_valid()) {
if (stream->get_path().is_resource_file()) { if (stream->get_path().is_resource_file()) {
stream_name = stream->get_path().get_file(); stream_name = stream->get_path().get_file();
} else if (stream->get_name() != "") { } else if (!stream->get_name().is_empty()) {
stream_name = stream->get_name(); stream_name = stream->get_name();
} else { } else {
stream_name = stream->get_class(); stream_name = stream->get_class();
@ -3657,7 +3657,7 @@ void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_
// Let's build a node path. // Let's build a node path.
String path = root->get_path_to(p_node); String path = root->get_path_to(p_node);
if (p_sub != "") { if (!p_sub.is_empty()) {
path += ":" + p_sub; path += ":" + p_sub;
} }
@ -3697,7 +3697,7 @@ bool AnimationTrackEditor::has_track(Node3D *p_node, const String &p_sub, const
// Let's build a node path. // Let's build a node path.
String path = root->get_path_to(p_node); String path = root->get_path_to(p_node);
if (p_sub != "") { if (!p_sub.is_empty()) {
path += ":" + p_sub; path += ":" + p_sub;
} }
@ -3762,7 +3762,7 @@ void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_p
EditorHistory *history = EditorNode::get_singleton()->get_editor_history(); EditorHistory *history = EditorNode::get_singleton()->get_editor_history();
for (int i = 1; i < history->get_path_size(); i++) { for (int i = 1; i < history->get_path_size(); i++) {
String prop = history->get_path_property(i); String prop = history->get_path_property(i);
ERR_FAIL_COND(prop == ""); ERR_FAIL_COND(prop.is_empty());
path += ":" + prop; path += ":" + prop;
} }
@ -3862,7 +3862,7 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari
for (int i = 1; i < history->get_path_size(); i++) { for (int i = 1; i < history->get_path_size(); i++) {
String prop = history->get_path_property(i); String prop = history->get_path_property(i);
ERR_FAIL_COND(prop == ""); ERR_FAIL_COND(prop.is_empty());
path += ":" + prop; path += ":" + prop;
} }
@ -6021,7 +6021,7 @@ void AnimationTrackEditor::_pick_track_select_recursive(TreeItem *p_item, const
NodePath np = p_item->get_metadata(0); NodePath np = p_item->get_metadata(0);
Node *node = get_node(np); Node *node = get_node(np);
if (p_filter != String() && ((String)node->get_name()).findn(p_filter) != -1) { if (!p_filter.is_empty() && ((String)node->get_name()).findn(p_filter) != -1) {
p_select_candidates.push_back(node); p_select_candidates.push_back(node);
} }

View file

@ -1534,7 +1534,7 @@ void CodeTextEditor::set_edit_state(const Variant &p_state) {
void CodeTextEditor::set_error(const String &p_error) { void CodeTextEditor::set_error(const String &p_error) {
error->set_text(p_error); error->set_text(p_error);
if (p_error != "") { if (!p_error.is_empty()) {
error->set_default_cursor_shape(CURSOR_POINTING_HAND); error->set_default_cursor_shape(CURSOR_POINTING_HAND);
} else { } else {
error->set_default_cursor_shape(CURSOR_ARROW); error->set_default_cursor_shape(CURSOR_ARROW);
@ -1547,7 +1547,7 @@ void CodeTextEditor::set_error_pos(int p_line, int p_column) {
} }
void CodeTextEditor::goto_error() { void CodeTextEditor::goto_error() {
if (error->get_text() != "") { if (!error->get_text().is_empty()) {
text_editor->unfold_line(error_line); text_editor->unfold_line(error_line);
text_editor->set_caret_line(error_line); text_editor->set_caret_line(error_line);
text_editor->set_caret_column(error_column); text_editor->set_caret_column(error_column);

View file

@ -111,7 +111,7 @@ public:
void ConnectDialog::ok_pressed() { void ConnectDialog::ok_pressed() {
String method_name = dst_method->get_text(); String method_name = dst_method->get_text();
if (method_name == "") { if (method_name.is_empty()) {
error->set_text(TTR("Method in target node must be specified.")); error->set_text(TTR("Method in target node must be specified."));
error->popup_centered(); error->popup_centered();
return; return;
@ -234,7 +234,7 @@ void ConnectDialog::_add_bind() {
*/ */
void ConnectDialog::_remove_bind() { void ConnectDialog::_remove_bind() {
String st = bind_editor->get_selected_path(); String st = bind_editor->get_selected_path();
if (st == "") { if (st.is_empty()) {
return; return;
} }
int idx = st.get_slice("/", 1).to_int() - 1; int idx = st.get_slice("/", 1).to_int() - 1;
@ -969,7 +969,7 @@ void ConnectionsDock::update_tree() {
} else if (pi.type != Variant::NIL) { } else if (pi.type != Variant::NIL) {
tname = Variant::get_type_name(pi.type); tname = Variant::get_type_name(pi.type);
} }
signaldesc += (pi.name == "" ? String("arg " + itos(i)) : pi.name) + ": " + tname; signaldesc += (pi.name.is_empty() ? String("arg " + itos(i)) : pi.name) + ": " + tname;
argnames.push_back(pi.name + ":" + tname); argnames.push_back(pi.name + ":" + tname);
} }
} }
@ -1001,7 +1001,7 @@ void ConnectionsDock::update_tree() {
if (!found) { if (!found) {
DocTools *dd = EditorHelp::get_doc_data(); DocTools *dd = EditorHelp::get_doc_data();
Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(base); Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(base);
while (F && descr == String()) { while (F && descr.is_empty()) {
for (int i = 0; i < F->get().signals.size(); i++) { for (int i = 0; i < F->get().signals.size(); i++) {
if (F->get().signals[i].name == signal_name.operator String()) { if (F->get().signals[i].name == signal_name.operator String()) {
descr = DTR(F->get().signals[i].description); descr = DTR(F->get().signals[i].description);

View file

@ -173,7 +173,7 @@ void CreateDialog::_update_search() {
_configure_search_option_item(root, base_type, ClassDB::class_exists(base_type)); _configure_search_option_item(root, base_type, ClassDB::class_exists(base_type));
const String search_text = search_box->get_text(); const String search_text = search_box->get_text();
bool empty_search = search_text == ""; bool empty_search = search_text.is_empty();
// Filter all candidate results. // Filter all candidate results.
Vector<String> candidates; Vector<String> candidates;
@ -244,7 +244,7 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const String
r_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type, icon_fallback)); r_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type, icon_fallback));
} }
if (search_box->get_text() != "") { if (!search_box->get_text().is_empty()) {
r_item->set_collapsed(false); r_item->set_collapsed(false);
} else { } else {
// Don't collapse the root node or an abstract node on the first tree level. // Don't collapse the root node or an abstract node on the first tree level.
@ -322,7 +322,7 @@ void CreateDialog::_cleanup() {
void CreateDialog::_confirmed() { void CreateDialog::_confirmed() {
String selected_item = get_selected_type(); String selected_item = get_selected_type();
if (selected_item == String()) { if (selected_item.is_empty()) {
return; return;
} }
@ -642,7 +642,7 @@ void CreateDialog::_load_favorites_and_history() {
while (!f->eof_reached()) { while (!f->eof_reached()) {
String l = f->get_line().strip_edges(); String l = f->get_line().strip_edges();
if (l != String()) { if (!l.is_empty()) {
favorite_list.push_back(l); favorite_list.push_back(l);
} }
} }

View file

@ -79,7 +79,7 @@ void ScriptEditorDebugger::_put_msg(String p_message, Array p_data) {
void ScriptEditorDebugger::debug_copy() { void ScriptEditorDebugger::debug_copy() {
String msg = reason->get_text(); String msg = reason->get_text();
if (msg == "") { if (msg.is_empty()) {
return; return;
} }
DisplayServer::get_singleton()->clipboard_set(msg); DisplayServer::get_singleton()->clipboard_set(msg);
@ -312,7 +312,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
if (is_move_to_foreground()) { if (is_move_to_foreground()) {
DisplayServer::get_singleton()->window_move_to_foreground(); DisplayServer::get_singleton()->window_move_to_foreground();
} }
if (error != "") { if (!error.is_empty()) {
tabs->set_current_tab(0); tabs->set_current_tab(0);
} }
profiler->set_enabled(false); profiler->set_enabled(false);
@ -1083,7 +1083,7 @@ void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_n
Resource *res = Object::cast_to<Resource>(p_base); Resource *res = Object::cast_to<Resource>(p_base);
if (res && res->get_path() != String()) { if (res && !res->get_path().is_empty()) {
String respath = res->get_path(); String respath = res->get_path();
int pathid = _get_res_path_cache(respath); int pathid = _get_res_path_cache(respath);
@ -1113,7 +1113,7 @@ void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p
if (p_value.is_ref()) { if (p_value.is_ref()) {
Ref<Resource> res = p_value; Ref<Resource> res = p_value;
if (res.is_valid() && res->get_path() != String()) { if (res.is_valid() && !res->get_path().is_empty()) {
Array msg; Array msg;
msg.push_back(pathid); msg.push_back(pathid);
msg.push_back(p_property); msg.push_back(p_property);
@ -1133,13 +1133,13 @@ void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p
Resource *res = Object::cast_to<Resource>(p_base); Resource *res = Object::cast_to<Resource>(p_base);
if (res && res->get_path() != String()) { if (res && !res->get_path().is_empty()) {
String respath = res->get_path(); String respath = res->get_path();
int pathid = _get_res_path_cache(respath); int pathid = _get_res_path_cache(respath);
if (p_value.is_ref()) { if (p_value.is_ref()) {
Ref<Resource> res2 = p_value; Ref<Resource> res2 = p_value;
if (res2.is_valid() && res2->get_path() != String()) { if (res2.is_valid() && !res2->get_path().is_empty()) {
Array msg; Array msg;
msg.push_back(pathid); msg.push_back(pathid);
msg.push_back(p_property); msg.push_back(p_property);

View file

@ -75,7 +75,7 @@ void DependencyEditor::_fix_and_find(EditorFileSystemDirectory *efsd, Map<String
String path = efsd->get_file_path(i); String path = efsd->get_file_path(i);
for (KeyValue<String, String> &E : candidates[file]) { for (KeyValue<String, String> &E : candidates[file]) {
if (E.value == String()) { if (E.value.is_empty()) {
E.value = path; E.value = path;
continue; continue;
} }
@ -135,7 +135,7 @@ void DependencyEditor::_fix_all() {
for (KeyValue<String, Map<String, String>> &E : candidates) { for (KeyValue<String, Map<String, String>> &E : candidates) {
for (const KeyValue<String, String> &F : E.value) { for (const KeyValue<String, String> &F : E.value) {
if (F.value != String()) { if (!F.value.is_empty()) {
remaps[F.key] = F.value; remaps[F.key] = F.value;
} }
} }

View file

@ -252,17 +252,17 @@ void DocTools::remove_from(const DocTools &p_data) {
} }
void DocTools::add_doc(const DocData::ClassDoc &p_class_doc) { void DocTools::add_doc(const DocData::ClassDoc &p_class_doc) {
ERR_FAIL_COND(p_class_doc.name == ""); ERR_FAIL_COND(p_class_doc.name.is_empty());
class_list[p_class_doc.name] = p_class_doc; class_list[p_class_doc.name] = p_class_doc;
} }
void DocTools::remove_doc(const String &p_class_name) { void DocTools::remove_doc(const String &p_class_name) {
ERR_FAIL_COND(p_class_name == "" || !class_list.has(p_class_name)); ERR_FAIL_COND(p_class_name.is_empty() || !class_list.has(p_class_name));
class_list.erase(p_class_name); class_list.erase(p_class_name);
} }
bool DocTools::has_doc(const String &p_class_name) { bool DocTools::has_doc(const String &p_class_name) {
if (p_class_name == "") { if (p_class_name.is_empty()) {
return false; return false;
} }
return class_list.has(p_class_name); return class_list.has(p_class_name);
@ -437,7 +437,7 @@ void DocTools::generate(bool p_basic_types) {
method_list.sort(); method_list.sort();
for (const MethodInfo &E : method_list) { for (const MethodInfo &E : method_list) {
if (E.name == "" || (E.name[0] == '_' && !(E.flags & METHOD_FLAG_VIRTUAL))) { if (E.name.is_empty() || (E.name[0] == '_' && !(E.flags & METHOD_FLAG_VIRTUAL))) {
continue; //hidden, don't count continue; //hidden, don't count
} }
@ -459,21 +459,21 @@ void DocTools::generate(bool p_basic_types) {
} }
if (E.flags & METHOD_FLAG_CONST) { if (E.flags & METHOD_FLAG_CONST) {
if (method.qualifiers != "") { if (!method.qualifiers.is_empty()) {
method.qualifiers += " "; method.qualifiers += " ";
} }
method.qualifiers += "const"; method.qualifiers += "const";
} }
if (E.flags & METHOD_FLAG_VARARG) { if (E.flags & METHOD_FLAG_VARARG) {
if (method.qualifiers != "") { if (!method.qualifiers.is_empty()) {
method.qualifiers += " "; method.qualifiers += " ";
} }
method.qualifiers += "vararg"; method.qualifiers += "vararg";
} }
if (E.flags & METHOD_FLAG_STATIC) { if (E.flags & METHOD_FLAG_STATIC) {
if (method.qualifiers != "") { if (!method.qualifiers.is_empty()) {
method.qualifiers += " "; method.qualifiers += " ";
} }
method.qualifiers += "static"; method.qualifiers += "static";
@ -736,21 +736,21 @@ void DocTools::generate(bool p_basic_types) {
DocData::return_doc_from_retinfo(method, mi.return_val); DocData::return_doc_from_retinfo(method, mi.return_val);
if (mi.flags & METHOD_FLAG_VARARG) { if (mi.flags & METHOD_FLAG_VARARG) {
if (method.qualifiers != "") { if (!method.qualifiers.is_empty()) {
method.qualifiers += " "; method.qualifiers += " ";
} }
method.qualifiers += "vararg"; method.qualifiers += "vararg";
} }
if (mi.flags & METHOD_FLAG_CONST) { if (mi.flags & METHOD_FLAG_CONST) {
if (method.qualifiers != "") { if (!method.qualifiers.is_empty()) {
method.qualifiers += " "; method.qualifiers += " ";
} }
method.qualifiers += "const"; method.qualifiers += "const";
} }
if (mi.flags & METHOD_FLAG_STATIC) { if (mi.flags & METHOD_FLAG_STATIC) {
if (method.qualifiers != "") { if (!method.qualifiers.is_empty()) {
method.qualifiers += " "; method.qualifiers += " ";
} }
method.qualifiers += "static"; method.qualifiers += "static";
@ -885,7 +885,7 @@ void DocTools::generate(bool p_basic_types) {
md.name = mi.name; md.name = mi.name;
if (mi.flags & METHOD_FLAG_VARARG) { if (mi.flags & METHOD_FLAG_VARARG) {
if (md.qualifiers != "") { if (!md.qualifiers.is_empty()) {
md.qualifiers += " "; md.qualifiers += " ";
} }
md.qualifiers += "vararg"; md.qualifiers += "vararg";
@ -1005,7 +1005,7 @@ Error DocTools::load_classes(const String &p_dir) {
da->list_dir_begin(); da->list_dir_begin();
String path; String path;
path = da->get_next(); path = da->get_next();
while (path != String()) { while (!path.is_empty()) {
if (!da->current_is_dir() && path.ends_with("xml")) { if (!da->current_is_dir() && path.ends_with("xml")) {
Ref<XMLParser> parser = memnew(XMLParser); Ref<XMLParser> parser = memnew(XMLParser);
Error err2 = parser->open(p_dir.plus_file(path)); Error err2 = parser->open(p_dir.plus_file(path));
@ -1035,7 +1035,7 @@ Error DocTools::erase_classes(const String &p_dir) {
da->list_dir_begin(); da->list_dir_begin();
String path; String path;
path = da->get_next(); path = da->get_next();
while (path != String()) { while (!path.is_empty()) {
if (!da->current_is_dir() && path.ends_with("xml")) { if (!da->current_is_dir() && path.ends_with("xml")) {
to_erase.push_back(path); to_erase.push_back(path);
} }
@ -1236,7 +1236,7 @@ Error DocTools::_load(Ref<XMLParser> parser) {
} }
static void _write_string(FileAccess *f, int p_tablevel, const String &p_string) { static void _write_string(FileAccess *f, int p_tablevel, const String &p_string) {
if (p_string == "") { if (p_string.is_empty()) {
return; return;
} }
String tab; String tab;
@ -1254,15 +1254,15 @@ static void _write_method_doc(FileAccess *f, const String &p_name, Vector<DocDat
const DocData::MethodDoc &m = p_method_docs[i]; const DocData::MethodDoc &m = p_method_docs[i];
String qualifiers; String qualifiers;
if (m.qualifiers != "") { if (!m.qualifiers.is_empty()) {
qualifiers += " qualifiers=\"" + m.qualifiers.xml_escape() + "\""; qualifiers += " qualifiers=\"" + m.qualifiers.xml_escape() + "\"";
} }
_write_string(f, 2, "<" + p_name + " name=\"" + m.name.xml_escape() + "\"" + qualifiers + ">"); _write_string(f, 2, "<" + p_name + " name=\"" + m.name.xml_escape() + "\"" + qualifiers + ">");
if (m.return_type != "") { if (!m.return_type.is_empty()) {
String enum_text; String enum_text;
if (m.return_enum != String()) { if (!m.return_enum.is_empty()) {
enum_text = " enum=\"" + m.return_enum + "\""; enum_text = " enum=\"" + m.return_enum + "\"";
} }
_write_string(f, 3, "<return type=\"" + m.return_type + "\"" + enum_text + " />"); _write_string(f, 3, "<return type=\"" + m.return_type + "\"" + enum_text + " />");
@ -1277,11 +1277,11 @@ static void _write_method_doc(FileAccess *f, const String &p_name, Vector<DocDat
const DocData::ArgumentDoc &a = m.arguments[j]; const DocData::ArgumentDoc &a = m.arguments[j];
String enum_text; String enum_text;
if (a.enumeration != String()) { if (!a.enumeration.is_empty()) {
enum_text = " enum=\"" + a.enumeration + "\""; enum_text = " enum=\"" + a.enumeration + "\"";
} }
if (a.default_value != "") { if (!a.default_value.is_empty()) {
_write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " default=\"" + a.default_value.xml_escape(true) + "\" />"); _write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " default=\"" + a.default_value.xml_escape(true) + "\" />");
} else { } else {
_write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " />"); _write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " />");
@ -1319,7 +1319,7 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
_write_string(f, 0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); _write_string(f, 0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
String header = "<class name=\"" + c.name + "\""; String header = "<class name=\"" + c.name + "\"";
if (c.inherits != "") { if (!c.inherits.is_empty()) {
header += " inherits=\"" + c.inherits + "\""; header += " inherits=\"" + c.inherits + "\"";
} }
header += String(" version=\"") + VERSION_BRANCH + "\""; header += String(" version=\"") + VERSION_BRANCH + "\"";
@ -1353,10 +1353,10 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
for (int i = 0; i < c.properties.size(); i++) { for (int i = 0; i < c.properties.size(); i++) {
String additional_attributes; String additional_attributes;
if (c.properties[i].enumeration != String()) { if (!c.properties[i].enumeration.is_empty()) {
additional_attributes += " enum=\"" + c.properties[i].enumeration + "\""; additional_attributes += " enum=\"" + c.properties[i].enumeration + "\"";
} }
if (c.properties[i].default_value != String()) { if (!c.properties[i].default_value.is_empty()) {
additional_attributes += " default=\"" + c.properties[i].default_value.xml_escape(true) + "\""; additional_attributes += " default=\"" + c.properties[i].default_value.xml_escape(true) + "\"";
} }
@ -1380,13 +1380,13 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
for (int i = 0; i < c.constants.size(); i++) { for (int i = 0; i < c.constants.size(); i++) {
const DocData::ConstantDoc &k = c.constants[i]; const DocData::ConstantDoc &k = c.constants[i];
if (k.is_value_valid) { if (k.is_value_valid) {
if (k.enumeration != String()) { if (!k.enumeration.is_empty()) {
_write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\" enum=\"" + k.enumeration + "\">"); _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\" enum=\"" + k.enumeration + "\">");
} else { } else {
_write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\">"); _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\">");
} }
} else { } else {
if (k.enumeration != String()) { if (!k.enumeration.is_empty()) {
_write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"platform-dependent\" enum=\"" + k.enumeration + "\">"); _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"platform-dependent\" enum=\"" + k.enumeration + "\">");
} else { } else {
_write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"platform-dependent\">"); _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"platform-dependent\">");
@ -1406,7 +1406,7 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
for (int i = 0; i < c.theme_properties.size(); i++) { for (int i = 0; i < c.theme_properties.size(); i++) {
const DocData::ThemeItemDoc &ti = c.theme_properties[i]; const DocData::ThemeItemDoc &ti = c.theme_properties[i];
if (ti.default_value != "") { if (!ti.default_value.is_empty()) {
_write_string(f, 2, "<theme_item name=\"" + ti.name + "\" data_type=\"" + ti.data_type + "\" type=\"" + ti.type + "\" default=\"" + ti.default_value.xml_escape(true) + "\">"); _write_string(f, 2, "<theme_item name=\"" + ti.name + "\" data_type=\"" + ti.data_type + "\" type=\"" + ti.type + "\" default=\"" + ti.default_value.xml_escape(true) + "\">");
} else { } else {
_write_string(f, 2, "<theme_item name=\"" + ti.name + "\" data_type=\"" + ti.data_type + "\" type=\"" + ti.type + "\">"); _write_string(f, 2, "<theme_item name=\"" + ti.name + "\" data_type=\"" + ti.data_type + "\" type=\"" + ti.type + "\">");

View file

@ -88,7 +88,7 @@ void EditorAssetInstaller::_item_edited() {
String path = item->get_metadata(0); String path = item->get_metadata(0);
updating = true; updating = true;
if (path == String() || item == tree->get_root()) { //a dir or root if (path.is_empty() || item == tree->get_root()) { //a dir or root
_update_subitems(item, item->is_checked(0), true); _update_subitems(item, item->is_checked(0), true);
} }
@ -212,7 +212,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
depth--; depth--;
} }
if (skip || path == String()) { if (skip || path.is_empty()) {
continue; continue;
} }
@ -307,7 +307,7 @@ void EditorAssetInstaller::ok_pressed() {
if (status_map.has(name) && status_map[name]->is_checked(0)) { if (status_map.has(name) && status_map[name]->is_checked(0)) {
String path = status_map[name]->get_metadata(0); String path = status_map[name]->get_metadata(0);
if (path == String()) { // a dir if (path.is_empty()) { // a dir
String dirpath; String dirpath;
TreeItem *t = status_map[name]; TreeItem *t = status_map[name];

View file

@ -340,22 +340,22 @@ void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) {
} }
void EditorAutoloadSettings::_autoload_text_submitted(const String p_name) { void EditorAutoloadSettings::_autoload_text_submitted(const String p_name) {
if (autoload_add_path->get_text() != "" && _autoload_name_is_valid(p_name, nullptr)) { if (!autoload_add_path->get_text().is_empty() && _autoload_name_is_valid(p_name, nullptr)) {
_autoload_add(); _autoload_add();
} }
} }
void EditorAutoloadSettings::_autoload_path_text_changed(const String p_path) { void EditorAutoloadSettings::_autoload_path_text_changed(const String p_path) {
add_autoload->set_disabled( add_autoload->set_disabled(
p_path == "" || !_autoload_name_is_valid(autoload_add_name->get_text(), nullptr)); p_path.is_empty() || !_autoload_name_is_valid(autoload_add_name->get_text(), nullptr));
} }
void EditorAutoloadSettings::_autoload_text_changed(const String p_name) { void EditorAutoloadSettings::_autoload_text_changed(const String p_name) {
String error_string; String error_string;
bool is_name_valid = _autoload_name_is_valid(p_name, &error_string); bool is_name_valid = _autoload_name_is_valid(p_name, &error_string);
add_autoload->set_disabled(autoload_add_path->get_text() == "" || !is_name_valid); add_autoload->set_disabled(autoload_add_path->get_text().is_empty() || !is_name_valid);
error_message->set_text(error_string); error_message->set_text(error_string);
error_message->set_visible(autoload_add_name->get_text() != "" && !is_name_valid); error_message->set_visible(!autoload_add_name->get_text().is_empty() && !is_name_valid);
} }
Node *EditorAutoloadSettings::_create_autoload(const String &p_path) { Node *EditorAutoloadSettings::_create_autoload(const String &p_path) {

View file

@ -164,7 +164,7 @@ void EditorCommandPalette::_sbox_input(const Ref<InputEvent> &p_ie) {
void EditorCommandPalette::_confirmed() { void EditorCommandPalette::_confirmed() {
TreeItem *selected_option = search_options->get_selected(); TreeItem *selected_option = search_options->get_selected();
String command_key = selected_option != nullptr ? selected_option->get_metadata(0) : ""; String command_key = selected_option != nullptr ? selected_option->get_metadata(0) : "";
if (command_key != "") { if (!command_key.is_empty()) {
hide(); hide();
execute_command(command_key); execute_command(command_key);
} }

View file

@ -100,7 +100,7 @@ void EditorHistory::_add_object(ObjectID p_object, const String &p_property, int
history.resize(current + 1); //clip history to next history.resize(current + 1); //clip history to next
} }
if (p_property != "" && has_prev) { if (!p_property.is_empty() && has_prev) {
//add a sub property //add a sub property
History &pr = history.write[current]; History &pr = history.write[current];
h = pr; h = pr;
@ -566,7 +566,7 @@ void EditorData::remove_scene(int p_idx) {
current_edited_scene--; current_edited_scene--;
} }
if (edited_scene[p_idx].path != String()) { if (!edited_scene[p_idx].path.is_empty()) {
ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(edited_scene[p_idx].path); ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(edited_scene[p_idx].path);
} }
@ -583,7 +583,7 @@ bool EditorData::_find_updated_instances(Node *p_root, Node *p_node, Set<String>
if (p_node == p_root) { if (p_node == p_root) {
ss = p_node->get_scene_inherited_state(); ss = p_node->get_scene_inherited_state();
} else if (p_node->get_scene_file_path() != String()) { } else if (!p_node->get_scene_file_path().is_empty()) {
ss = p_node->get_scene_instance_state(); ss = p_node->get_scene_instance_state();
} }
@ -647,7 +647,7 @@ bool EditorData::check_and_update_scene(int p_idx) {
memdelete(edited_scene[p_idx].root); memdelete(edited_scene[p_idx].root);
edited_scene.write[p_idx].root = new_scene; edited_scene.write[p_idx].root = new_scene;
if (new_scene->get_scene_file_path() != "") { if (!new_scene->get_scene_file_path().is_empty()) {
edited_scene.write[p_idx].path = new_scene->get_scene_file_path(); edited_scene.write[p_idx].path = new_scene->get_scene_file_path();
} }
edited_scene.write[p_idx].selection = new_selection; edited_scene.write[p_idx].selection = new_selection;
@ -682,14 +682,14 @@ void EditorData::set_edited_scene_root(Node *p_root) {
ERR_FAIL_INDEX(current_edited_scene, edited_scene.size()); ERR_FAIL_INDEX(current_edited_scene, edited_scene.size());
edited_scene.write[current_edited_scene].root = p_root; edited_scene.write[current_edited_scene].root = p_root;
if (p_root) { if (p_root) {
if (p_root->get_scene_file_path() != "") { if (!p_root->get_scene_file_path().is_empty()) {
edited_scene.write[current_edited_scene].path = p_root->get_scene_file_path(); edited_scene.write[current_edited_scene].path = p_root->get_scene_file_path();
} else { } else {
p_root->set_scene_file_path(edited_scene[current_edited_scene].path); p_root->set_scene_file_path(edited_scene[current_edited_scene].path);
} }
} }
if (edited_scene[current_edited_scene].path != "") { if (!edited_scene[current_edited_scene].path.is_empty()) {
edited_scene.write[current_edited_scene].file_modified_time = FileAccess::get_modified_time(edited_scene[current_edited_scene].path); edited_scene.write[current_edited_scene].file_modified_time = FileAccess::get_modified_time(edited_scene[current_edited_scene].path);
} }
} }
@ -764,7 +764,7 @@ Ref<Script> EditorData::get_scene_root_script(int p_idx) const {
Ref<Script> s = edited_scene[p_idx].root->get_script(); Ref<Script> s = edited_scene[p_idx].root->get_script();
if (!s.is_valid() && edited_scene[p_idx].root->get_child_count()) { if (!s.is_valid() && edited_scene[p_idx].root->get_child_count()) {
Node *n = edited_scene[p_idx].root->get_child(0); Node *n = edited_scene[p_idx].root->get_child(0);
while (!s.is_valid() && n && n->get_scene_file_path() == String()) { while (!s.is_valid() && n && n->get_scene_file_path().is_empty()) {
s = n->get_script(); s = n->get_script();
n = n->get_parent(); n = n->get_parent();
} }
@ -777,7 +777,7 @@ String EditorData::get_scene_title(int p_idx, bool p_always_strip_extension) con
if (!edited_scene[p_idx].root) { if (!edited_scene[p_idx].root) {
return TTR("[empty]"); return TTR("[empty]");
} }
if (edited_scene[p_idx].root->get_scene_file_path() == "") { if (edited_scene[p_idx].root->get_scene_file_path().is_empty()) {
return TTR("[unsaved]"); return TTR("[unsaved]");
} }
@ -818,7 +818,7 @@ String EditorData::get_scene_path(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), String()); ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), String());
if (edited_scene[p_idx].root) { if (edited_scene[p_idx].root) {
if (edited_scene[p_idx].root->get_scene_file_path() == "") { if (edited_scene[p_idx].root->get_scene_file_path().is_empty()) {
edited_scene[p_idx].root->set_scene_file_path(edited_scene[p_idx].path); edited_scene[p_idx].root->set_scene_file_path(edited_scene[p_idx].path);
} else { } else {
return edited_scene[p_idx].root->get_scene_file_path(); return edited_scene[p_idx].root->get_scene_file_path();

View file

@ -49,7 +49,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p
if (!p_item->get_parent()) { if (!p_item->get_parent()) {
p_item->set_text(0, "res://"); p_item->set_text(0, "res://");
} else { } else {
if (!opened_paths.has(path) && (p_select_path == String() || !p_select_path.begins_with(path))) { if (!opened_paths.has(path) && (p_select_path.is_empty() || !p_select_path.begins_with(path))) {
p_item->set_collapsed(true); p_item->set_collapsed(true);
} }

View file

@ -264,7 +264,7 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
r_flags.push_back("--remote-fs"); r_flags.push_back("--remote-fs");
r_flags.push_back(host + ":" + itos(port)); r_flags.push_back(host + ":" + itos(port));
if (passwd != "") { if (!passwd.is_empty()) {
r_flags.push_back("--remote-fs-password"); r_flags.push_back("--remote-fs-password");
r_flags.push_back(passwd); r_flags.push_back(passwd);
} }
@ -528,7 +528,7 @@ void EditorExportPlatform::_edit_files_with_filter(DirAccess *da, const Vector<S
} }
void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String &p_filter, bool exclude) { void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String &p_filter, bool exclude) {
if (p_filter == "") { if (p_filter.is_empty()) {
return; return;
} }
Vector<String> split = p_filter.split(","); Vector<String> split = p_filter.split(",");
@ -683,12 +683,12 @@ EditorExportPlatform::FeatureContainers EditorExportPlatform::get_feature_contai
result.features_pv.push_back(E); result.features_pv.push_back(E);
} }
if (p_preset->get_custom_features() != String()) { if (!p_preset->get_custom_features().is_empty()) {
Vector<String> tmp_custom_list = p_preset->get_custom_features().split(","); Vector<String> tmp_custom_list = p_preset->get_custom_features().split(",");
for (int i = 0; i < tmp_custom_list.size(); i++) { for (int i = 0; i < tmp_custom_list.size(); i++) {
String f = tmp_custom_list[i].strip_edges(); String f = tmp_custom_list[i].strip_edges();
if (f != String()) { if (!f.is_empty()) {
result.features.insert(f); result.features.insert(f);
result.features_pv.push_back(f); result.features_pv.push_back(f);
} }
@ -994,12 +994,12 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
Vector<String> custom_list; Vector<String> custom_list;
if (p_preset->get_custom_features() != String()) { if (!p_preset->get_custom_features().is_empty()) {
Vector<String> tmp_custom_list = p_preset->get_custom_features().split(","); Vector<String> tmp_custom_list = p_preset->get_custom_features().split(",");
for (int i = 0; i < tmp_custom_list.size(); i++) { for (int i = 0; i < tmp_custom_list.size(); i++) {
String f = tmp_custom_list[i].strip_edges(); String f = tmp_custom_list[i].strip_edges();
if (f != String()) { if (!f.is_empty()) {
custom_list.push_back(f); custom_list.push_back(f);
} }
} }
@ -1033,14 +1033,14 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
// Store icon and splash images directly, they need to bypass the import system and be loaded as images // Store icon and splash images directly, they need to bypass the import system and be loaded as images
String icon = ProjectSettings::get_singleton()->get("application/config/icon"); String icon = ProjectSettings::get_singleton()->get("application/config/icon");
String splash = ProjectSettings::get_singleton()->get("application/boot_splash/image"); String splash = ProjectSettings::get_singleton()->get("application/boot_splash/image");
if (icon != String() && FileAccess::exists(icon)) { if (!icon.is_empty() && FileAccess::exists(icon)) {
Vector<uint8_t> array = FileAccess::get_file_as_array(icon); Vector<uint8_t> array = FileAccess::get_file_as_array(icon);
err = p_func(p_udata, icon, array, idx, total, enc_in_filters, enc_ex_filters, key); err = p_func(p_udata, icon, array, idx, total, enc_in_filters, enc_ex_filters, key);
if (err != OK) { if (err != OK) {
return err; return err;
} }
} }
if (splash != String() && FileAccess::exists(splash) && icon != splash) { if (!splash.is_empty() && FileAccess::exists(splash) && icon != splash) {
Vector<uint8_t> array = FileAccess::get_file_as_array(splash); Vector<uint8_t> array = FileAccess::get_file_as_array(splash);
err = p_func(p_udata, splash, array, idx, total, enc_in_filters, enc_ex_filters, key); err = p_func(p_udata, splash, array, idx, total, enc_in_filters, enc_ex_filters, key);
if (err != OK) { if (err != OK) {
@ -1359,7 +1359,7 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
r_flags.push_back("--remote-fs"); r_flags.push_back("--remote-fs");
r_flags.push_back(host + ":" + itos(port)); r_flags.push_back(host + ":" + itos(port));
if (passwd != "") { if (!passwd.is_empty()) {
r_flags.push_back("--remote-fs-password"); r_flags.push_back("--remote-fs-password");
r_flags.push_back(passwd); r_flags.push_back(passwd);
} }
@ -1855,7 +1855,7 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
template_path = template_path.strip_edges(); template_path = template_path.strip_edges();
if (template_path == String()) { if (template_path.is_empty()) {
if (p_preset->get("binary_format/64_bits")) { if (p_preset->get("binary_format/64_bits")) {
if (p_debug) { if (p_debug) {
template_path = find_export_template(debug_file_64); template_path = find_export_template(debug_file_64);
@ -1871,7 +1871,7 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
} }
} }
if (template_path != String() && !FileAccess::exists(template_path)) { if (!template_path.is_empty() && !FileAccess::exists(template_path)) {
EditorNode::get_singleton()->show_warning(TTR("Template file not found:") + "\n" + template_path); EditorNode::get_singleton()->show_warning(TTR("Template file not found:") + "\n" + template_path);
return ERR_FILE_NOT_FOUND; return ERR_FILE_NOT_FOUND;
} }

View file

@ -310,7 +310,7 @@ EditorFeatureProfile::EditorFeatureProfile() {}
void EditorFeatureProfileManager::_notification(int p_what) { void EditorFeatureProfileManager::_notification(int p_what) {
if (p_what == NOTIFICATION_READY) { if (p_what == NOTIFICATION_READY) {
current_profile = EDITOR_GET("_default_feature_profile"); current_profile = EDITOR_GET("_default_feature_profile");
if (current_profile != String()) { if (!current_profile.is_empty()) {
current.instantiate(); current.instantiate();
Error err = current->load_from_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(current_profile + ".profile")); Error err = current->load_from_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(current_profile + ".profile"));
if (err != OK) { if (err != OK) {
@ -334,7 +334,7 @@ String EditorFeatureProfileManager::_get_selected_profile() {
void EditorFeatureProfileManager::_update_profile_list(const String &p_select_profile) { void EditorFeatureProfileManager::_update_profile_list(const String &p_select_profile) {
String selected_profile; String selected_profile;
if (p_select_profile == String()) { //default, keep if (p_select_profile.is_empty()) { //default, keep
if (profile_list->get_selected() >= 0) { if (profile_list->get_selected() >= 0) {
selected_profile = profile_list->get_item_metadata(profile_list->get_selected()); selected_profile = profile_list->get_item_metadata(profile_list->get_selected());
if (!FileAccess::exists(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(selected_profile + ".profile"))) { if (!FileAccess::exists(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(selected_profile + ".profile"))) {
@ -352,7 +352,7 @@ void EditorFeatureProfileManager::_update_profile_list(const String &p_select_pr
d->list_dir_begin(); d->list_dir_begin();
while (true) { while (true) {
String f = d->get_next(); String f = d->get_next();
if (f == String()) { if (f.is_empty()) {
break; break;
} }
@ -371,7 +371,7 @@ void EditorFeatureProfileManager::_update_profile_list(const String &p_select_pr
for (int i = 0; i < profiles.size(); i++) { for (int i = 0; i < profiles.size(); i++) {
String name = profiles[i]; String name = profiles[i];
if (i == 0 && selected_profile == String()) { if (i == 0 && selected_profile.is_empty()) {
selected_profile = name; selected_profile = name;
} }
@ -386,15 +386,15 @@ void EditorFeatureProfileManager::_update_profile_list(const String &p_select_pr
} }
} }
class_list_vbc->set_visible(selected_profile != String()); class_list_vbc->set_visible(!selected_profile.is_empty());
property_list_vbc->set_visible(selected_profile != String()); property_list_vbc->set_visible(!selected_profile.is_empty());
no_profile_selected_help->set_visible(selected_profile == String()); no_profile_selected_help->set_visible(selected_profile.is_empty());
profile_actions[PROFILE_CLEAR]->set_disabled(current_profile == String()); profile_actions[PROFILE_CLEAR]->set_disabled(current_profile.is_empty());
profile_actions[PROFILE_ERASE]->set_disabled(selected_profile == String()); profile_actions[PROFILE_ERASE]->set_disabled(selected_profile.is_empty());
profile_actions[PROFILE_EXPORT]->set_disabled(selected_profile == String()); profile_actions[PROFILE_EXPORT]->set_disabled(selected_profile.is_empty());
profile_actions[PROFILE_SET]->set_disabled(selected_profile == String()); profile_actions[PROFILE_SET]->set_disabled(selected_profile.is_empty());
current_profile_name->set_text(current_profile != String() ? current_profile : TTR("(none)")); current_profile_name->set_text(!current_profile.is_empty() ? current_profile : TTR("(none)"));
_update_selected_profile(); _update_selected_profile();
} }
@ -412,7 +412,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) {
} break; } break;
case PROFILE_SET: { case PROFILE_SET: {
String selected = _get_selected_profile(); String selected = _get_selected_profile();
ERR_FAIL_COND(selected == String()); ERR_FAIL_COND(selected.is_empty());
if (selected == current_profile) { if (selected == current_profile) {
return; // Nothing to do here. return; // Nothing to do here.
} }
@ -438,7 +438,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) {
} break; } break;
case PROFILE_ERASE: { case PROFILE_ERASE: {
String selected = _get_selected_profile(); String selected = _get_selected_profile();
ERR_FAIL_COND(selected == String()); ERR_FAIL_COND(selected.is_empty());
erase_profile_dialog->set_text(vformat(TTR("Remove currently selected profile, '%s'? Cannot be undone."), selected)); erase_profile_dialog->set_text(vformat(TTR("Remove currently selected profile, '%s'? Cannot be undone."), selected));
erase_profile_dialog->popup_centered(Size2(240, 60) * EDSCALE); erase_profile_dialog->popup_centered(Size2(240, 60) * EDSCALE);
@ -448,7 +448,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) {
void EditorFeatureProfileManager::_erase_selected_profile() { void EditorFeatureProfileManager::_erase_selected_profile() {
String selected = _get_selected_profile(); String selected = _get_selected_profile();
ERR_FAIL_COND(selected == String()); ERR_FAIL_COND(selected.is_empty());
DirAccessRef da = DirAccess::open(EditorSettings::get_singleton()->get_feature_profiles_dir()); DirAccessRef da = DirAccess::open(EditorSettings::get_singleton()->get_feature_profiles_dir());
ERR_FAIL_COND_MSG(!da, "Cannot open directory '" + EditorSettings::get_singleton()->get_feature_profiles_dir() + "'."); ERR_FAIL_COND_MSG(!da, "Cannot open directory '" + EditorSettings::get_singleton()->get_feature_profiles_dir() + "'.");
@ -718,7 +718,7 @@ void EditorFeatureProfileManager::_update_selected_profile() {
class_list->clear(); class_list->clear();
String profile = _get_selected_profile(); String profile = _get_selected_profile();
if (profile == String()) { //nothing selected, nothing edited if (profile.is_empty()) { //nothing selected, nothing edited
property_list->clear(); property_list->clear();
edited.unref(); edited.unref();
return; return;
@ -822,7 +822,7 @@ void EditorFeatureProfileManager::_export_profile(const String &p_path) {
void EditorFeatureProfileManager::_save_and_update() { void EditorFeatureProfileManager::_save_and_update() {
String edited_path = _get_selected_profile(); String edited_path = _get_selected_profile();
ERR_FAIL_COND(edited_path == String()); ERR_FAIL_COND(edited_path.is_empty());
ERR_FAIL_COND(edited.is_null()); ERR_FAIL_COND(edited.is_null());
edited->save_to_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(edited_path + ".profile")); edited->save_to_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(edited_path + ".profile"));

View file

@ -274,7 +274,7 @@ void EditorFileDialog::_post_popup() {
file_box->set_visible(true); file_box->set_visible(true);
} }
if (is_visible() && get_current_file() != "") { if (is_visible() && !get_current_file().is_empty()) {
_request_single_thumbnail(get_current_dir().plus_file(get_current_file())); _request_single_thumbnail(get_current_dir().plus_file(get_current_file()));
} }

View file

@ -241,7 +241,7 @@ void EditorFileSystem::_scan_filesystem() {
first = false; first = false;
continue; continue;
} }
if (l == String()) { if (l.is_empty()) {
continue; continue;
} }
@ -295,7 +295,7 @@ void EditorFileSystem::_scan_filesystem() {
{ {
FileAccessRef f2 = FileAccess::open(update_cache, FileAccess::READ); FileAccessRef f2 = FileAccess::open(update_cache, FileAccess::READ);
String l = f2->get_line().strip_edges(); String l = f2->get_line().strip_edges();
while (l != String()) { while (!l.is_empty()) {
file_cache.erase(l); //erase cache for this, so it gets updated file_cache.erase(l); //erase cache for this, so it gets updated
l = f2->get_line().strip_edges(); l = f2->get_line().strip_edges();
} }
@ -405,7 +405,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
return false; //parse error, try reimport manually (Avoid reimport loop on broken file) return false; //parse error, try reimport manually (Avoid reimport loop on broken file)
} }
if (assign != String()) { if (!assign.is_empty()) {
if (assign.begins_with("path")) { if (assign.begins_with("path")) {
to_check.push_back(value); to_check.push_back(value);
} else if (assign == "files") { } else if (assign == "files") {
@ -476,7 +476,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
memdelete(md5s); memdelete(md5s);
return false; // parse error return false; // parse error
} }
if (assign != String()) { if (!assign.is_empty()) {
if (!p_only_imported_files) { if (!p_only_imported_files) {
if (assign == "source_md5") { if (assign == "source_md5") {
source_md5 = value; source_md5 = value;
@ -497,11 +497,11 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
//check source md5 matching //check source md5 matching
if (!p_only_imported_files) { if (!p_only_imported_files) {
if (source_file != String() && source_file != p_path) { if (!source_file.is_empty() && source_file != p_path) {
return true; //file was moved, reimport return true; //file was moved, reimport
} }
if (source_md5 == String()) { if (source_md5.is_empty()) {
return true; //lacks md5, so just reimport return true; //lacks md5, so just reimport
} }
@ -510,7 +510,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
return true; return true;
} }
if (dest_files.size() && dest_md5 != String()) { if (dest_files.size() && !dest_md5.is_empty()) {
md5 = FileAccess::get_multiple_md5(dest_files); md5 = FileAccess::get_multiple_md5(dest_files);
if (md5 != dest_md5) { if (md5 != dest_md5) {
return true; return true;
@ -710,7 +710,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
da->list_dir_begin(); da->list_dir_begin();
while (true) { while (true) {
String f = da->get_next(); String f = da->get_next();
if (f == "") { if (f.is_empty()) {
break; break;
} }
@ -820,7 +820,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
scan_actions.push_back(ia); scan_actions.push_back(ia);
} }
if (fc->type == String()) { if (fc->type.is_empty()) {
fi->type = ResourceLoader::get_resource_type(path); fi->type = ResourceLoader::get_resource_type(path);
fi->import_group_file = ResourceLoader::get_import_group_file(path); fi->import_group_file = ResourceLoader::get_import_group_file(path);
//there is also the chance that file type changed due to reimport, must probably check this somehow here (or kind of note it for next time in another file?) //there is also the chance that file type changed due to reimport, must probably check this somehow here (or kind of note it for next time in another file?)
@ -932,7 +932,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const
da->list_dir_begin(); da->list_dir_begin();
while (true) { while (true) {
String f = da->get_next(); String f = da->get_next();
if (f == "") { if (f.is_empty()) {
break; break;
} }
@ -1246,7 +1246,7 @@ void EditorFileSystem::_save_filesystem_cache(EditorFileSystemDirectory *p_dir,
p_file->store_line("::" + p_dir->get_path() + "::" + String::num(p_dir->modified_time)); p_file->store_line("::" + p_dir->get_path() + "::" + String::num(p_dir->modified_time));
for (int i = 0; i < p_dir->files.size(); i++) { for (int i = 0; i < p_dir->files.size(); i++) {
if (p_dir->files[i]->import_group_file != String()) { if (!p_dir->files[i]->import_group_file.is_empty()) {
group_file_cache.insert(p_dir->files[i]->import_group_file); group_file_cache.insert(p_dir->files[i]->import_group_file);
} }
String s = p_dir->files[i]->file + "::" + p_dir->files[i]->type + "::" + itos(p_dir->files[i]->uid) + "::" + itos(p_dir->files[i]->modified_time) + "::" + itos(p_dir->files[i]->import_modified_time) + "::" + itos(p_dir->files[i]->import_valid) + "::" + p_dir->files[i]->import_group_file + "::" + p_dir->files[i]->script_class_name + "<>" + p_dir->files[i]->script_class_extends + "<>" + p_dir->files[i]->script_class_icon_path; String s = p_dir->files[i]->file + "::" + p_dir->files[i]->type + "::" + itos(p_dir->files[i]->uid) + "::" + itos(p_dir->files[i]->modified_time) + "::" + itos(p_dir->files[i]->import_modified_time) + "::" + itos(p_dir->files[i]->import_valid) + "::" + p_dir->files[i]->import_group_file + "::" + p_dir->files[i]->script_class_name + "<>" + p_dir->files[i]->script_class_extends + "<>" + p_dir->files[i]->script_class_icon_path;
@ -1386,7 +1386,7 @@ EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String &p
f = f.substr(6, f.length()); f = f.substr(6, f.length());
f = f.replace("\\", "/"); f = f.replace("\\", "/");
if (f == String()) { if (f.is_empty()) {
return filesystem; return filesystem;
} }
@ -1465,7 +1465,7 @@ void EditorFileSystem::_scan_script_classes(EditorFileSystemDirectory *p_dir) {
int filecount = p_dir->files.size(); int filecount = p_dir->files.size();
const EditorFileSystemDirectory::FileInfo *const *files = p_dir->files.ptr(); const EditorFileSystemDirectory::FileInfo *const *files = p_dir->files.ptr();
for (int i = 0; i < filecount; i++) { for (int i = 0; i < filecount; i++) {
if (files[i]->script_class_name == String()) { if (files[i]->script_class_name.is_empty()) {
continue; continue;
} }
@ -1545,7 +1545,7 @@ void EditorFileSystem::update_file(const String &p_file) {
} }
String type = ResourceLoader::get_resource_type(p_file); String type = ResourceLoader::get_resource_type(p_file);
if (type == "" && textfile_extensions.has(p_file.get_extension())) { if (type.is_empty() && textfile_extensions.has(p_file.get_extension())) {
type = "TextFile"; type = "TextFile";
} }
ResourceUID::ID uid = ResourceLoader::get_resource_uid(p_file); ResourceUID::ID uid = ResourceLoader::get_resource_uid(p_file);
@ -1616,9 +1616,9 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
ERR_CONTINUE(err != OK); ERR_CONTINUE(err != OK);
ERR_CONTINUE(!config->has_section_key("remap", "importer")); ERR_CONTINUE(!config->has_section_key("remap", "importer"));
String file_importer_name = config->get_value("remap", "importer"); String file_importer_name = config->get_value("remap", "importer");
ERR_CONTINUE(file_importer_name == String()); ERR_CONTINUE(file_importer_name.is_empty());
if (importer_name != String() && importer_name != file_importer_name) { if (!importer_name.is_empty() && importer_name != file_importer_name) {
EditorNode::get_singleton()->show_warning(vformat(TTR("There are multiple importers for different types pointing to file %s, import aborted"), p_group_file)); EditorNode::get_singleton()->show_warning(vformat(TTR("There are multiple importers for different types pointing to file %s, import aborted"), p_group_file));
ERR_FAIL_V(ERR_FILE_CORRUPT); ERR_FAIL_V(ERR_FILE_CORRUPT);
} }
@ -1656,7 +1656,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
return OK; // (do nothing) return OK; // (do nothing)
} }
ERR_FAIL_COND_V(importer_name == String(), ERR_UNCONFIGURED); ERR_FAIL_COND_V(importer_name.is_empty(), ERR_UNCONFIGURED);
Ref<ResourceImporter> importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(importer_name); Ref<ResourceImporter> importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(importer_name);
@ -1677,7 +1677,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
if (version > 0) { if (version > 0) {
f->store_line("importer_version=" + itos(version)); f->store_line("importer_version=" + itos(version));
} }
if (importer->get_resource_type() != "") { if (!importer->get_resource_type().is_empty()) {
f->store_line("type=\"" + importer->get_resource_type() + "\""); f->store_line("type=\"" + importer->get_resource_type() + "\"");
} }
@ -1759,7 +1759,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
if (ResourceCache::has(file)) { if (ResourceCache::has(file)) {
Resource *r = ResourceCache::get(file); Resource *r = ResourceCache::get(file);
if (r->get_import_path() != String()) { if (!r->get_import_path().is_empty()) {
String dst_path = ResourceFormatImporter::get_singleton()->get_internal_resource_path(file); String dst_path = ResourceFormatImporter::get_singleton()->get_internal_resource_path(file);
r->set_import_path(dst_path); r->set_import_path(dst_path);
r->set_import_last_modified_time(0); r->set_import_last_modified_time(0);
@ -1783,7 +1783,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
Map<StringName, Variant> params; Map<StringName, Variant> params;
String importer_name; //empty by default though String importer_name; //empty by default though
if (p_custom_importer != String()) { if (!p_custom_importer.is_empty()) {
importer_name = p_custom_importer; importer_name = p_custom_importer;
} }
if (p_custom_options != nullptr) { if (p_custom_options != nullptr) {
@ -1808,7 +1808,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
} }
if (cf->has_section("remap")) { if (cf->has_section("remap")) {
if (p_custom_importer == String()) { if (p_custom_importer.is_empty()) {
importer_name = cf->get_value("remap", "importer"); importer_name = cf->get_value("remap", "importer");
} }
@ -1834,7 +1834,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
Ref<ResourceImporter> importer; Ref<ResourceImporter> importer;
bool load_default = false; bool load_default = false;
//find the importer //find the importer
if (importer_name != "") { if (!importer_name.is_empty()) {
importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(importer_name); importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(importer_name);
} }
@ -1894,7 +1894,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
if (version > 0) { if (version > 0) {
f->store_line("importer_version=" + itos(version)); f->store_line("importer_version=" + itos(version));
} }
if (importer->get_resource_type() != "") { if (!importer->get_resource_type().is_empty()) {
f->store_line("type=\"" + importer->get_resource_type() + "\""); f->store_line("type=\"" + importer->get_resource_type() + "\"");
} }
@ -1907,7 +1907,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
Vector<String> dest_paths; Vector<String> dest_paths;
if (err == OK) { if (err == OK) {
if (importer->get_save_extension() == "") { if (importer->get_save_extension().is_empty()) {
//no path //no path
} else if (import_variants.size()) { } else if (import_variants.size()) {
//import with variants //import with variants
@ -2003,7 +2003,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const Map<StringName
if (ResourceCache::has(p_file)) { if (ResourceCache::has(p_file)) {
Resource *r = ResourceCache::get(p_file); Resource *r = ResourceCache::get(p_file);
if (r->get_import_path() != String()) { if (!r->get_import_path().is_empty()) {
String dst_path = ResourceFormatImporter::get_singleton()->get_internal_resource_path(p_file); String dst_path = ResourceFormatImporter::get_singleton()->get_internal_resource_path(p_file);
r->set_import_path(dst_path); r->set_import_path(dst_path);
r->set_import_last_modified_time(0); r->set_import_last_modified_time(0);
@ -2062,7 +2062,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
groups_to_reimport.insert(file); groups_to_reimport.insert(file);
//groups do not belong to grups //groups do not belong to grups
group_file = String(); group_file = String();
} else if (group_file != String()) { } else if (!group_file.is_empty()) {
//it's a group file, add group to import and skip this file //it's a group file, add group to import and skip this file
groups_to_reimport.insert(group_file); groups_to_reimport.insert(group_file);
} else { } else {

View file

@ -113,7 +113,7 @@ void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p
if (E.usage & PROPERTY_USAGE_EDITOR) { if (E.usage & PROPERTY_USAGE_EDITOR) {
if (E.type == Variant::OBJECT) { if (E.type == Variant::OBJECT) {
RES res = p_node->get(E.name); RES res = p_node->get(E.name);
if (res.is_valid() && !resources.has(res) && res->get_path() != String() && !res->get_path().is_resource_file()) { if (res.is_valid() && !resources.has(res) && !res->get_path().is_empty() && !res->get_path().is_resource_file()) {
Vector<String> res_unfolds = _get_unfolds(res.ptr()); Vector<String> res_unfolds = _get_unfolds(res.ptr());
resource_folds.push_back(res->get_path()); resource_folds.push_back(res->get_path());
resource_folds.push_back(res_unfolds); resource_folds.push_back(res_unfolds);
@ -243,8 +243,8 @@ void EditorFolding::_do_object_unfolds(Object *p_object, Set<RES> &resources) {
//can unfold //can unfold
if (E.usage & PROPERTY_USAGE_EDITOR) { if (E.usage & PROPERTY_USAGE_EDITOR) {
if (group != "") { //group if (!group.is_empty()) { //group
if (group_base == String() || E.name.begins_with(group_base)) { if (group_base.is_empty() || E.name.begins_with(group_base)) {
bool can_revert = EditorPropertyRevert::can_property_revert(p_object, E.name); bool can_revert = EditorPropertyRevert::can_property_revert(p_object, E.name);
if (can_revert) { if (can_revert) {
unfold_group.insert(group); unfold_group.insert(group);
@ -262,7 +262,7 @@ void EditorFolding::_do_object_unfolds(Object *p_object, Set<RES> &resources) {
if (E.type == Variant::OBJECT) { if (E.type == Variant::OBJECT) {
RES res = p_object->get(E.name); RES res = p_object->get(E.name);
if (res.is_valid() && !resources.has(res) && res->get_path() != String() && !res->get_path().is_resource_file()) { if (res.is_valid() && !resources.has(res) && !res->get_path().is_empty() && !res->get_path().is_resource_file()) {
resources.insert(res); resources.insert(res);
_do_object_unfolds(res.ptr(), resources); _do_object_unfolds(res.ptr(), resources);
} }

View file

@ -78,7 +78,7 @@
} \ } \
{ \ { \
Dictionary variations; \ Dictionary variations; \
if (m_variations != String()) { \ if (!m_variations.is_empty()) { \
Vector<String> variation_tags = m_variations.split(","); \ Vector<String> variation_tags = m_variations.split(","); \
for (int i = 0; i < variation_tags.size(); i++) { \ for (int i = 0; i < variation_tags.size(); i++) { \
Vector<String> tokens = variation_tags[i].split("="); \ Vector<String> tokens = variation_tags[i].split("="); \
@ -104,7 +104,7 @@
} \ } \
{ \ { \
Dictionary variations; \ Dictionary variations; \
if (m_variations != String()) { \ if (!m_variations.is_empty()) { \
Vector<String> variation_tags = m_variations.split(","); \ Vector<String> variation_tags = m_variations.split(","); \
for (int i = 0; i < variation_tags.size(); i++) { \ for (int i = 0; i < variation_tags.size(); i++) { \
Vector<String> tokens = variation_tags[i].split("="); \ Vector<String> tokens = variation_tags[i].split("="); \
@ -130,7 +130,7 @@
} \ } \
{ \ { \
Dictionary variations; \ Dictionary variations; \
if (m_variations != String()) { \ if (!m_variations.is_empty()) { \
Vector<String> variation_tags = m_variations.split(","); \ Vector<String> variation_tags = m_variations.split(","); \
for (int i = 0; i < variation_tags.size(); i++) { \ for (int i = 0; i < variation_tags.size(); i++) { \
Vector<String> tokens = variation_tags[i].split("="); \ Vector<String> tokens = variation_tags[i].split("="); \

View file

@ -250,7 +250,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
class_desc->add_text(" "); class_desc->add_text(" ");
} }
if (p_overview && p_method.description != "") { if (p_overview && !p_method.description.is_empty()) {
class_desc->push_meta("@method " + p_method.name); class_desc->push_meta("@method " + p_method.name);
} }
@ -258,7 +258,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
_add_text(p_method.name); _add_text(p_method.name);
class_desc->pop(); class_desc->pop();
if (p_overview && p_method.description != "") { if (p_overview && !p_method.description.is_empty()) {
class_desc->pop(); //meta class_desc->pop(); //meta
} }
@ -275,7 +275,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
_add_text(p_method.arguments[j].name); _add_text(p_method.arguments[j].name);
class_desc->add_text(": "); class_desc->add_text(": ");
_add_type(p_method.arguments[j].type, p_method.arguments[j].enumeration); _add_type(p_method.arguments[j].type, p_method.arguments[j].enumeration);
if (p_method.arguments[j].default_value != "") { if (!p_method.arguments[j].default_value.is_empty()) {
class_desc->push_color(symbol_color); class_desc->push_color(symbol_color);
class_desc->add_text(" = "); class_desc->add_text(" = ");
class_desc->pop(); class_desc->pop();
@ -301,7 +301,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
class_desc->push_color(symbol_color); class_desc->push_color(symbol_color);
class_desc->add_text(")"); class_desc->add_text(")");
class_desc->pop(); class_desc->pop();
if (p_method.qualifiers != "") { if (!p_method.qualifiers.is_empty()) {
class_desc->push_color(qualifier_color); class_desc->push_color(qualifier_color);
class_desc->add_text(" "); class_desc->add_text(" ");
_add_text(p_method.qualifiers); _add_text(p_method.qualifiers);
@ -375,7 +375,7 @@ void EditorHelp::_update_method_list(const Vector<DocData::MethodDoc> p_methods,
if (i < m.size() - 1 && new_prefix == m[i + 1].name.substr(0, 3) && new_prefix != group_prefix) { if (i < m.size() - 1 && new_prefix == m[i + 1].name.substr(0, 3) && new_prefix != group_prefix) {
is_new_group = i > 0; is_new_group = i > 0;
group_prefix = new_prefix; group_prefix = new_prefix;
} else if (group_prefix != "" && new_prefix != group_prefix) { } else if (!group_prefix.is_empty() && new_prefix != group_prefix) {
is_new_group = true; is_new_group = true;
group_prefix = ""; group_prefix = "";
} }
@ -387,7 +387,7 @@ void EditorHelp::_update_method_list(const Vector<DocData::MethodDoc> p_methods,
class_desc->pop(); //cell class_desc->pop(); //cell
} }
if (m[i].description != "" || m[i].errors_returned.size() > 0) { if (!m[i].description.is_empty() || m[i].errors_returned.size() > 0) {
r_method_descrpitons = true; r_method_descrpitons = true;
} }
@ -521,19 +521,19 @@ void EditorHelp::_update_doc() {
// Inheritance tree // Inheritance tree
// Ascendents // Ascendents
if (cd.inherits != "") { if (!cd.inherits.is_empty()) {
class_desc->push_color(title_color); class_desc->push_color(title_color);
class_desc->push_font(doc_font); class_desc->push_font(doc_font);
class_desc->add_text(TTR("Inherits:") + " "); class_desc->add_text(TTR("Inherits:") + " ");
String inherits = cd.inherits; String inherits = cd.inherits;
while (inherits != "") { while (!inherits.is_empty()) {
_add_type(inherits); _add_type(inherits);
inherits = doc->class_list[inherits].inherits; inherits = doc->class_list[inherits].inherits;
if (inherits != "") { if (!inherits.is_empty()) {
class_desc->add_text(" < "); class_desc->add_text(" < ");
} }
} }
@ -577,7 +577,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline(); class_desc->add_newline();
// Brief description // Brief description
if (cd.brief_description != "") { if (!cd.brief_description.is_empty()) {
class_desc->push_color(text_color); class_desc->push_color(text_color);
class_desc->push_font(doc_bold_font); class_desc->push_font(doc_bold_font);
class_desc->push_indent(1); class_desc->push_indent(1);
@ -591,7 +591,7 @@ void EditorHelp::_update_doc() {
} }
// Class description // Class description
if (cd.description != "") { if (!cd.description.is_empty()) {
section_line.push_back(Pair<String, int>(TTR("Description"), class_desc->get_line_count() - 2)); section_line.push_back(Pair<String, int>(TTR("Description"), class_desc->get_line_count() - 2));
description_line = class_desc->get_line_count() - 2; description_line = class_desc->get_line_count() - 2;
class_desc->push_color(title_color); class_desc->push_color(title_color);
@ -694,16 +694,16 @@ void EditorHelp::_update_doc() {
bool describe = false; bool describe = false;
if (cd.properties[i].setter != "") { if (!cd.properties[i].setter.is_empty()) {
skip_methods.insert(cd.properties[i].setter); skip_methods.insert(cd.properties[i].setter);
describe = true; describe = true;
} }
if (cd.properties[i].getter != "") { if (!cd.properties[i].getter.is_empty()) {
skip_methods.insert(cd.properties[i].getter); skip_methods.insert(cd.properties[i].getter);
describe = true; describe = true;
} }
if (cd.properties[i].description != "") { if (!cd.properties[i].description.is_empty()) {
describe = true; describe = true;
} }
@ -735,7 +735,7 @@ void EditorHelp::_update_doc() {
class_desc->push_cell(); class_desc->push_cell();
class_desc->push_font(doc_code_font); class_desc->push_font(doc_code_font);
if (cd.properties[i].default_value != "") { if (!cd.properties[i].default_value.is_empty()) {
class_desc->push_color(symbol_color); class_desc->push_color(symbol_color);
if (cd.properties[i].overridden) { if (cd.properties[i].overridden) {
class_desc->add_text(" ["); class_desc->add_text(" [");
@ -764,18 +764,18 @@ void EditorHelp::_update_doc() {
class_desc->push_cell(); class_desc->push_cell();
class_desc->push_font(doc_code_font); class_desc->push_font(doc_code_font);
if (cd.is_script_doc && (cd.properties[i].setter != "" || cd.properties[i].getter != "")) { if (cd.is_script_doc && (!cd.properties[i].setter.is_empty() || !cd.properties[i].getter.is_empty())) {
class_desc->push_color(symbol_color); class_desc->push_color(symbol_color);
class_desc->add_text(" [" + TTR("property:") + " "); class_desc->add_text(" [" + TTR("property:") + " ");
class_desc->pop(); // color class_desc->pop(); // color
if (cd.properties[i].setter != "") { if (!cd.properties[i].setter.is_empty()) {
class_desc->push_color(value_color); class_desc->push_color(value_color);
class_desc->add_text("setter"); class_desc->add_text("setter");
class_desc->pop(); // color class_desc->pop(); // color
} }
if (cd.properties[i].getter != "") { if (!cd.properties[i].getter.is_empty()) {
if (cd.properties[i].setter != "") { if (!cd.properties[i].setter.is_empty()) {
class_desc->push_color(symbol_color); class_desc->push_color(symbol_color);
class_desc->add_text(", "); class_desc->add_text(", ");
class_desc->pop(); // color class_desc->pop(); // color
@ -914,7 +914,7 @@ void EditorHelp::_update_doc() {
class_desc->pop(); class_desc->pop();
// Theme item default value. // Theme item default value.
if (cd.theme_properties[i].default_value != "") { if (!cd.theme_properties[i].default_value.is_empty()) {
class_desc->push_color(symbol_color); class_desc->push_color(symbol_color);
class_desc->add_text(" [" + TTR("default:") + " "); class_desc->add_text(" [" + TTR("default:") + " ");
class_desc->pop(); class_desc->pop();
@ -929,7 +929,7 @@ void EditorHelp::_update_doc() {
class_desc->pop(); // monofont class_desc->pop(); // monofont
// Theme item description. // Theme item description.
if (cd.theme_properties[i].description != "") { if (!cd.theme_properties[i].description.is_empty()) {
class_desc->push_font(doc_font); class_desc->push_font(doc_font);
class_desc->push_color(comment_color); class_desc->push_color(comment_color);
class_desc->push_indent(1); class_desc->push_indent(1);
@ -985,7 +985,7 @@ void EditorHelp::_update_doc() {
_add_text(cd.signals[i].arguments[j].name); _add_text(cd.signals[i].arguments[j].name);
class_desc->add_text(": "); class_desc->add_text(": ");
_add_type(cd.signals[i].arguments[j].type); _add_type(cd.signals[i].arguments[j].type);
if (cd.signals[i].arguments[j].default_value != "") { if (!cd.signals[i].arguments[j].default_value.is_empty()) {
class_desc->push_color(symbol_color); class_desc->push_color(symbol_color);
class_desc->add_text(" = "); class_desc->add_text(" = ");
class_desc->pop(); class_desc->pop();
@ -999,7 +999,7 @@ void EditorHelp::_update_doc() {
class_desc->add_text(")"); class_desc->add_text(")");
class_desc->pop(); class_desc->pop();
class_desc->pop(); // end monofont class_desc->pop(); // end monofont
if (cd.signals[i].description != "") { if (!cd.signals[i].description.is_empty()) {
class_desc->push_font(doc_font); class_desc->push_font(doc_font);
class_desc->push_color(comment_color); class_desc->push_color(comment_color);
class_desc->push_indent(1); class_desc->push_indent(1);
@ -1114,7 +1114,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline(); class_desc->add_newline();
if (enum_list[i].description.strip_edges() != "") { if (!enum_list[i].description.strip_edges().is_empty()) {
class_desc->push_font(doc_font); class_desc->push_font(doc_font);
class_desc->push_color(comment_color); class_desc->push_color(comment_color);
_add_text(DTR(enum_list[i].description)); _add_text(DTR(enum_list[i].description));
@ -1183,7 +1183,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline(); class_desc->add_newline();
if (constants[i].description != "") { if (!constants[i].description.is_empty()) {
class_desc->push_font(doc_font); class_desc->push_font(doc_font);
class_desc->push_color(comment_color); class_desc->push_color(comment_color);
_add_text(DTR(constants[i].description)); _add_text(DTR(constants[i].description));
@ -1239,7 +1239,7 @@ void EditorHelp::_update_doc() {
_add_text(cd.properties[i].name); _add_text(cd.properties[i].name);
class_desc->pop(); // color class_desc->pop(); // color
if (cd.properties[i].default_value != "") { if (!cd.properties[i].default_value.is_empty()) {
class_desc->push_color(symbol_color); class_desc->push_color(symbol_color);
class_desc->add_text(" [" + TTR("default:") + " "); class_desc->add_text(" [" + TTR("default:") + " ");
class_desc->pop(); // color class_desc->pop(); // color
@ -1253,18 +1253,18 @@ void EditorHelp::_update_doc() {
class_desc->pop(); // color class_desc->pop(); // color
} }
if (cd.is_script_doc && (cd.properties[i].setter != "" || cd.properties[i].getter != "")) { if (cd.is_script_doc && (!cd.properties[i].setter.is_empty() || !cd.properties[i].getter.is_empty())) {
class_desc->push_color(symbol_color); class_desc->push_color(symbol_color);
class_desc->add_text(" [" + TTR("property:") + " "); class_desc->add_text(" [" + TTR("property:") + " ");
class_desc->pop(); // color class_desc->pop(); // color
if (cd.properties[i].setter != "") { if (!cd.properties[i].setter.is_empty()) {
class_desc->push_color(value_color); class_desc->push_color(value_color);
class_desc->add_text("setter"); class_desc->add_text("setter");
class_desc->pop(); // color class_desc->pop(); // color
} }
if (cd.properties[i].getter != "") { if (!cd.properties[i].getter.is_empty()) {
if (cd.properties[i].setter != "") { if (!cd.properties[i].setter.is_empty()) {
class_desc->push_color(symbol_color); class_desc->push_color(symbol_color);
class_desc->add_text(", "); class_desc->add_text(", ");
class_desc->pop(); // color class_desc->pop(); // color
@ -1289,7 +1289,7 @@ void EditorHelp::_update_doc() {
method_map[methods[j].name] = methods[j]; method_map[methods[j].name] = methods[j];
} }
if (cd.properties[i].setter != "") { if (!cd.properties[i].setter.is_empty()) {
class_desc->push_cell(); class_desc->push_cell();
class_desc->pop(); // cell class_desc->pop(); // cell
@ -1313,7 +1313,7 @@ void EditorHelp::_update_doc() {
method_line[cd.properties[i].setter] = property_line[cd.properties[i].name]; method_line[cd.properties[i].setter] = property_line[cd.properties[i].name];
} }
if (cd.properties[i].getter != "") { if (!cd.properties[i].getter.is_empty()) {
class_desc->push_cell(); class_desc->push_cell();
class_desc->pop(); // cell class_desc->pop(); // cell

View file

@ -161,7 +161,7 @@ void EditorHelpSearch::popup_dialog(const String &p_term) {
popup_centered_ratio(0.5F); popup_centered_ratio(0.5F);
} }
if (p_term == "") { if (p_term.is_empty()) {
search_box->clear(); search_box->clear();
} else { } else {
if (old_term == p_term) { if (old_term == p_term) {
@ -331,7 +331,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes() {
// Match class name. // Match class name.
if (search_flags & SEARCH_CLASSES) { if (search_flags & SEARCH_CLASSES) {
match.name = term == "" || _match_string(term, class_doc.name); match.name = term.is_empty() || _match_string(term, class_doc.name);
} }
// Match members if the term is long enough. // Match members if the term is long enough.
@ -513,7 +513,7 @@ TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_
// Ensure parent nodes are created first. // Ensure parent nodes are created first.
TreeItem *parent = root_item; TreeItem *parent = root_item;
if (p_match.doc->inherits != "") { if (!p_match.doc->inherits.is_empty()) {
if (class_items.has(p_match.doc->inherits)) { if (class_items.has(p_match.doc->inherits)) {
parent = class_items[p_match.doc->inherits]; parent = class_items[p_match.doc->inherits];
} else { } else {
@ -558,7 +558,7 @@ TreeItem *EditorHelpSearch::Runner::_create_method_item(TreeItem *p_parent, cons
for (int i = 0; i < p_doc->arguments.size(); i++) { for (int i = 0; i < p_doc->arguments.size(); i++) {
const DocData::ArgumentDoc &arg = p_doc->arguments[i]; const DocData::ArgumentDoc &arg = p_doc->arguments[i];
tooltip += arg.type + " " + arg.name; tooltip += arg.type + " " + arg.name;
if (arg.default_value != "") { if (!arg.default_value.is_empty()) {
tooltip += " = " + arg.default_value; tooltip += " = " + arg.default_value;
} }
if (i < p_doc->arguments.size() - 1) { if (i < p_doc->arguments.size() - 1) {
@ -574,7 +574,7 @@ TreeItem *EditorHelpSearch::Runner::_create_signal_item(TreeItem *p_parent, cons
for (int i = 0; i < p_doc->arguments.size(); i++) { for (int i = 0; i < p_doc->arguments.size(); i++) {
const DocData::ArgumentDoc &arg = p_doc->arguments[i]; const DocData::ArgumentDoc &arg = p_doc->arguments[i];
tooltip += arg.type + " " + arg.name; tooltip += arg.type + " " + arg.name;
if (arg.default_value != "") { if (!arg.default_value.is_empty()) {
tooltip += " = " + arg.default_value; tooltip += " = " + arg.default_value;
} }
if (i < p_doc->arguments.size() - 1) { if (i < p_doc->arguments.size() - 1) {

View file

@ -2239,7 +2239,7 @@ void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Ref<Edit
ep->property_usage = 0; ep->property_usage = 0;
} }
if (F.label != String()) { if (!F.label.is_empty()) {
ep->set_label(F.label); ep->set_label(F.label);
} }
@ -2438,7 +2438,7 @@ void EditorInspector::update_tree() {
} }
} }
if (category->icon.is_null()) { if (category->icon.is_null()) {
if (type != String()) { // Can happen for built-in scripts. if (!type.is_empty()) { // Can happen for built-in scripts.
category->icon = EditorNode::get_singleton()->get_class_icon(type, "Object"); category->icon = EditorNode::get_singleton()->get_class_icon(type, "Object");
} }
} }
@ -2459,7 +2459,7 @@ void EditorInspector::update_tree() {
class_descr_cache[type2] = descr; class_descr_cache[type2] = descr;
} }
category->set_tooltip(p.name + "::" + (class_descr_cache[type2] == "" ? "" : class_descr_cache[type2])); category->set_tooltip(p.name + "::" + (class_descr_cache[type2].is_empty() ? "" : class_descr_cache[type2]));
} }
// Add editors at the start of a category. // Add editors at the start of a category.
@ -2529,7 +2529,7 @@ void EditorInspector::update_tree() {
} }
} else { } else {
// Check if we exit or not a subgroup. If there is a prefix, remove it from the property label string. // Check if we exit or not a subgroup. If there is a prefix, remove it from the property label string.
if (subgroup != "" && subgroup_base != "") { if (!subgroup.is_empty() && !subgroup_base.is_empty()) {
if (path.begins_with(subgroup_base)) { if (path.begins_with(subgroup_base)) {
path = path.trim_prefix(subgroup_base); path = path.trim_prefix(subgroup_base);
} else if (subgroup_base.begins_with(path)) { } else if (subgroup_base.begins_with(path)) {
@ -2540,7 +2540,7 @@ void EditorInspector::update_tree() {
} }
// Check if we exit or not a group. If there is a prefix, remove it from the property label string. // Check if we exit or not a group. If there is a prefix, remove it from the property label string.
if (group != "" && group_base != "" && subgroup == "") { if (!group.is_empty() && !group_base.is_empty() && subgroup.is_empty()) {
if (path.begins_with(group_base)) { if (path.begins_with(group_base)) {
path = path.trim_prefix(group_base); path = path.trim_prefix(group_base);
} else if (group_base.begins_with(path)) { } else if (group_base.begins_with(path)) {
@ -2552,10 +2552,10 @@ void EditorInspector::update_tree() {
} }
// Add the group and subgroup to the path. // Add the group and subgroup to the path.
if (subgroup != "") { if (!subgroup.is_empty()) {
path = subgroup + "/" + path; path = subgroup + "/" + path;
} }
if (group != "") { if (!group.is_empty()) {
path = group + "/" + path; path = group + "/" + path;
} }
} }
@ -2584,7 +2584,7 @@ void EditorInspector::update_tree() {
} }
// Ignore properties that do not fit the filter. // Ignore properties that do not fit the filter.
if (use_filter && filter != "") { if (use_filter && !filter.is_empty()) {
if (!filter.is_subsequence_ofi(path) && !filter.is_subsequence_ofi(property_label_string) && property_prefix.to_lower().find(filter.to_lower()) == -1) { if (!filter.is_subsequence_ofi(path) && !filter.is_subsequence_ofi(property_label_string) && property_prefix.to_lower().find(filter.to_lower()) == -1) {
continue; continue;
} }
@ -2707,7 +2707,7 @@ void EditorInspector::update_tree() {
// Get the class name. // Get the class name.
StringName classname = object->get_class_name(); StringName classname = object->get_class_name();
if (object_class != String()) { if (!object_class.is_empty()) {
classname = object_class; classname = object_class;
} }
@ -2729,7 +2729,7 @@ void EditorInspector::update_tree() {
// Build the property description String and add it to the cache. // Build the property description String and add it to the cache.
DocTools *dd = EditorHelp::get_doc_data(); DocTools *dd = EditorHelp::get_doc_data();
Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(classname); Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(classname);
while (F && descr == String()) { while (F && descr.is_empty()) {
for (int i = 0; i < F->get().properties.size(); i++) { for (int i = 0; i < F->get().properties.size(); i++) {
if (F->get().properties[i].name == propname.operator String()) { if (F->get().properties[i].name == propname.operator String()) {
descr = DTR(F->get().properties[i].description); descr = DTR(F->get().properties[i].description);
@ -2781,7 +2781,7 @@ void EditorInspector::update_tree() {
//and set label? //and set label?
} }
if (F.label != String()) { if (!F.label.is_empty()) {
ep->set_label(F.label); ep->set_label(F.label);
} else { } else {
// Use the existing one. // Use the existing one.
@ -2820,7 +2820,7 @@ void EditorInspector::update_tree() {
ep->connect("multiple_properties_changed", callable_mp(this, &EditorInspector::_multiple_properties_changed)); ep->connect("multiple_properties_changed", callable_mp(this, &EditorInspector::_multiple_properties_changed));
ep->connect("resource_selected", callable_mp(this, &EditorInspector::_resource_selected), varray(), CONNECT_DEFERRED); ep->connect("resource_selected", callable_mp(this, &EditorInspector::_resource_selected), varray(), CONNECT_DEFERRED);
ep->connect("object_id_selected", callable_mp(this, &EditorInspector::_object_id_selected), varray(), CONNECT_DEFERRED); ep->connect("object_id_selected", callable_mp(this, &EditorInspector::_object_id_selected), varray(), CONNECT_DEFERRED);
if (doc_hint != String()) { if (!doc_hint.is_empty()) {
ep->set_tooltip(property_prefix + p.name + "::" + doc_hint); ep->set_tooltip(property_prefix + p.name + "::" + doc_hint);
} else { } else {
ep->set_tooltip(property_prefix + p.name); ep->set_tooltip(property_prefix + p.name);
@ -3050,7 +3050,7 @@ void EditorInspector::_edit_request_change(Object *p_object, const String &p_pro
return; return;
} }
if (p_property == String()) { if (p_property.is_empty()) {
update_tree_pending = true; update_tree_pending = true;
} else { } else {
pending.insert(p_property); pending.insert(p_property);

View file

@ -74,7 +74,7 @@ void EditorLayoutsDialog::ok_pressed() {
for (int i = 0; i < selected_items.size(); ++i) { for (int i = 0; i < selected_items.size(); ++i) {
emit_signal(SNAME("name_confirmed"), layout_names->get_item_text(selected_items[i])); emit_signal(SNAME("name_confirmed"), layout_names->get_item_text(selected_items[i]));
} }
} else if (name->is_visible() && name->get_text() != "") { } else if (name->is_visible() && !name->get_text().is_empty()) {
emit_signal(SNAME("name_confirmed"), name->get_text()); emit_signal(SNAME("name_confirmed"), name->get_text());
} }
} }

View file

@ -162,11 +162,11 @@ void EditorLog::_clear_request() {
void EditorLog::_copy_request() { void EditorLog::_copy_request() {
String text = log->get_selected_text(); String text = log->get_selected_text();
if (text == "") { if (text.is_empty()) {
text = log->get_text(); text = log->get_text();
} }
if (text != "") { if (!text.is_empty()) {
DisplayServer::get_singleton()->clipboard_set(text); DisplayServer::get_singleton()->clipboard_set(text);
} }
} }
@ -237,7 +237,7 @@ void EditorLog::_add_log_line(LogMessage &p_message, bool p_replace_previous) {
// Only add the message to the log if it passes the filters. // Only add the message to the log if it passes the filters.
bool filter_active = type_filter_map[p_message.type]->is_active(); bool filter_active = type_filter_map[p_message.type]->is_active();
String search_text = search_box->get_text(); String search_text = search_box->get_text();
bool search_match = search_text == String() || p_message.text.findn(search_text) > -1; bool search_match = search_text.is_empty() || p_message.text.findn(search_text) > -1;
if (!filter_active || !search_match) { if (!filter_active || !search_match) {
return; return;

View file

@ -858,7 +858,7 @@ void EditorNode::_resources_changed(const Vector<String> &p_resources) {
continue; continue;
} }
if (res->get_import_path() != String()) { if (!res->get_import_path().is_empty()) {
// this is an imported resource, will be reloaded if reimported via the _resources_reimported() callback // this is an imported resource, will be reloaded if reimported via the _resources_reimported() callback
continue; continue;
} }
@ -886,7 +886,7 @@ void EditorNode::_fs_changed() {
// FIXME: Move this to a cleaner location, it's hacky to do this is _fs_changed. // FIXME: Move this to a cleaner location, it's hacky to do this is _fs_changed.
String export_error; String export_error;
if (export_defer.preset != "" && !EditorFileSystem::get_singleton()->is_scanning()) { if (!export_defer.preset.is_empty() && !EditorFileSystem::get_singleton()->is_scanning()) {
String preset_name = export_defer.preset; String preset_name = export_defer.preset;
// Ensures export_project does not loop infinitely, because notifications may // Ensures export_project does not loop infinitely, because notifications may
// come during the export. // come during the export.
@ -1006,7 +1006,7 @@ void EditorNode::_sources_changed(bool p_exist) {
_load_docks(); _load_docks();
if (defer_load_scene != "") { if (!defer_load_scene.is_empty()) {
load_scene(defer_load_scene); load_scene(defer_load_scene);
defer_load_scene = ""; defer_load_scene = "";
} }
@ -1242,7 +1242,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
preferred.move_to_front(tres_element); preferred.move_to_front(tres_element);
} }
if (p_at_path != String()) { if (!p_at_path.is_empty()) {
file->set_current_dir(p_at_path); file->set_current_dir(p_at_path);
if (p_resource->get_path().is_resource_file()) { if (p_resource->get_path().is_resource_file()) {
file->set_current_file(p_resource->get_path().get_file()); file->set_current_file(p_resource->get_path().get_file());
@ -1254,7 +1254,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
file->set_current_file(String()); file->set_current_file(String());
} }
} }
} else if (p_resource->get_path() != "") { } else if (!p_resource->get_path().is_empty()) {
file->set_current_path(p_resource->get_path()); file->set_current_path(p_resource->get_path());
if (extensions.size()) { if (extensions.size()) {
String ext = p_resource->get_path().get_extension().to_lower(); String ext = p_resource->get_path().get_extension().to_lower();
@ -1676,7 +1676,7 @@ void EditorNode::_save_scene(String p_file, int idx) {
return; return;
} }
if (scene->get_scene_file_path() != String() && _validate_scene_recursive(scene->get_scene_file_path(), scene)) { if (!scene->get_scene_file_path().is_empty() && _validate_scene_recursive(scene->get_scene_file_path(), scene)) {
show_accept(TTR("This scene can't be saved because there is a cyclic instancing inclusion.\nPlease resolve it and then attempt to save again."), TTR("OK")); show_accept(TTR("This scene can't be saved because there is a cyclic instancing inclusion.\nPlease resolve it and then attempt to save again."), TTR("OK"));
return; return;
} }
@ -1780,7 +1780,7 @@ void EditorNode::restart_editor() {
args.push_back("--path"); args.push_back("--path");
args.push_back(ProjectSettings::get_singleton()->get_resource_path()); args.push_back(ProjectSettings::get_singleton()->get_resource_path());
args.push_back("-e"); args.push_back("-e");
if (to_reopen != String()) { if (!to_reopen.is_empty()) {
args.push_back(to_reopen); args.push_back(to_reopen);
} }
@ -1792,13 +1792,13 @@ void EditorNode::_save_all_scenes() {
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
Node *scene = editor_data.get_edited_scene_root(i); Node *scene = editor_data.get_edited_scene_root(i);
if (scene) { if (scene) {
if (scene->get_scene_file_path() != "" && DirAccess::exists(scene->get_scene_file_path().get_base_dir())) { if (!scene->get_scene_file_path().is_empty() && DirAccess::exists(scene->get_scene_file_path().get_base_dir())) {
if (i != editor_data.get_edited_scene()) { if (i != editor_data.get_edited_scene()) {
_save_scene(scene->get_scene_file_path(), i); _save_scene(scene->get_scene_file_path(), i);
} else { } else {
_save_scene_with_preview(scene->get_scene_file_path()); _save_scene_with_preview(scene->get_scene_file_path());
} }
} else if (scene->get_scene_file_path() != "") { } else if (!scene->get_scene_file_path().is_empty()) {
all_saved = false; all_saved = false;
} }
} }
@ -1818,7 +1818,7 @@ void EditorNode::_mark_unsaved_scenes() {
} }
String path = node->get_scene_file_path(); String path = node->get_scene_file_path();
if (!(path == String() || FileAccess::exists(path))) { if (!(path.is_empty() || FileAccess::exists(path))) {
if (i == editor_data.get_edited_scene()) { if (i == editor_data.get_edited_scene()) {
set_current_version(-1); set_current_version(-1);
} else { } else {
@ -2080,7 +2080,7 @@ void EditorNode::push_item(Object *p_object, const String &p_property, bool p_in
if (id != editor_history.get_current()) { if (id != editor_history.get_current()) {
if (p_inspector_only) { if (p_inspector_only) {
editor_history.add_object_inspector_only(id); editor_history.add_object_inspector_only(id);
} else if (p_property == "") { } else if (p_property.is_empty()) {
editor_history.add_object(id); editor_history.add_object(id);
} else { } else {
editor_history.add_object(id, p_property); editor_history.add_object(id, p_property);
@ -2193,7 +2193,7 @@ void EditorNode::_edit_current() {
inspector_dock->update(nullptr); inspector_dock->update(nullptr);
} }
if (get_edited_scene() && get_edited_scene()->get_scene_file_path() != String()) { if (get_edited_scene() && !get_edited_scene()->get_scene_file_path().is_empty()) {
String source_scene = get_edited_scene()->get_scene_file_path(); String source_scene = get_edited_scene()->get_scene_file_path();
if (FileAccess::exists(source_scene + ".import")) { if (FileAccess::exists(source_scene + ".import")) {
editable_warning = TTR("This scene was imported, so changes to it won't be kept.\nInstancing it or inheriting will allow making changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow."); editable_warning = TTR("This scene was imported, so changes to it won't be kept.\nInstancing it or inheriting will allow making changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow.");
@ -2316,7 +2316,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
String run_filename; String run_filename;
if (p_current || (editor_data.get_edited_scene_root() && p_custom != String() && p_custom == editor_data.get_edited_scene_root()->get_scene_file_path())) { if (p_current || (editor_data.get_edited_scene_root() && !p_custom.is_empty() && p_custom == editor_data.get_edited_scene_root()->get_scene_file_path())) {
Node *scene = editor_data.get_edited_scene_root(); Node *scene = editor_data.get_edited_scene_root();
if (!scene) { if (!scene) {
@ -2324,7 +2324,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
return; return;
} }
if (scene->get_scene_file_path() == "") { if (scene->get_scene_file_path().is_empty()) {
current_option = -1; current_option = -1;
_menu_option(FILE_SAVE_AS_SCENE); _menu_option(FILE_SAVE_AS_SCENE);
// Set the option to save and run so when the dialog is accepted, the scene runs. // Set the option to save and run so when the dialog is accepted, the scene runs.
@ -2334,11 +2334,11 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
} }
run_filename = scene->get_scene_file_path(); run_filename = scene->get_scene_file_path();
} else if (p_custom != "") { } else if (!p_custom.is_empty()) {
run_filename = p_custom; run_filename = p_custom;
} }
if (run_filename == "") { if (run_filename.is_empty()) {
// evidently, run the scene // evidently, run the scene
if (!ensure_main_scene(false)) { if (!ensure_main_scene(false)) {
return; return;
@ -2349,7 +2349,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
if (unsaved_cache) { if (unsaved_cache) {
Node *scene = editor_data.get_edited_scene_root(); Node *scene = editor_data.get_edited_scene_root();
if (scene && scene->get_scene_file_path() != "") { // Only autosave if there is a scene and if it has a path. if (scene && !scene->get_scene_file_path().is_empty()) { // Only autosave if there is a scene and if it has a path.
_save_scene_with_preview(scene->get_scene_file_path()); _save_scene_with_preview(scene->get_scene_file_path());
} }
} }
@ -2381,7 +2381,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
if (p_current) { if (p_current) {
play_scene_button->set_pressed(true); play_scene_button->set_pressed(true);
play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")));
} else if (p_custom != "") { } else if (!p_custom.is_empty()) {
run_custom_filename = p_custom; run_custom_filename = p_custom;
play_custom_scene_button->set_pressed(true); play_custom_scene_button->set_pressed(true);
play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")));
@ -2501,7 +2501,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (scene_root) { if (scene_root) {
String scene_filename = scene_root->get_scene_file_path(); String scene_filename = scene_root->get_scene_file_path();
save_confirmation->get_ok_button()->set_text(TTR("Save & Close")); save_confirmation->get_ok_button()->set_text(TTR("Save & Close"));
save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene")); save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), !scene_filename.is_empty() ? scene_filename : "unsaved scene"));
save_confirmation->popup_centered(); save_confirmation->popup_centered();
break; break;
} }
@ -2519,7 +2519,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case FILE_SAVE_SCENE: { case FILE_SAVE_SCENE: {
int scene_idx = (p_option == FILE_SAVE_SCENE) ? -1 : tab_closing; int scene_idx = (p_option == FILE_SAVE_SCENE) ? -1 : tab_closing;
Node *scene = editor_data.get_edited_scene_root(scene_idx); Node *scene = editor_data.get_edited_scene_root(scene_idx);
if (scene && scene->get_scene_file_path() != "") { if (scene && !scene->get_scene_file_path().is_empty()) {
if (DirAccess::exists(scene->get_scene_file_path().get_base_dir())) { if (DirAccess::exists(scene->get_scene_file_path().get_base_dir())) {
if (scene_idx != editor_data.get_edited_scene()) { if (scene_idx != editor_data.get_edited_scene()) {
_save_scene_with_preview(scene->get_scene_file_path(), scene_idx); _save_scene_with_preview(scene->get_scene_file_path(), scene_idx);
@ -2575,7 +2575,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
} }
if (scene->get_scene_file_path() != "") { if (!scene->get_scene_file_path().is_empty()) {
String path = scene->get_scene_file_path(); String path = scene->get_scene_file_path();
file->set_current_path(path); file->set_current_path(path);
if (extensions.size()) { if (extensions.size()) {
@ -2649,7 +2649,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (!editor_data.get_undo_redo().undo()) { if (!editor_data.get_undo_redo().undo()) {
log->add_message(TTR("Nothing to undo."), EditorLog::MSG_TYPE_EDITOR); log->add_message(TTR("Nothing to undo."), EditorLog::MSG_TYPE_EDITOR);
} else if (action != "") { } else if (!action.is_empty()) {
log->add_message(vformat(TTR("Undo: %s"), action), EditorLog::MSG_TYPE_EDITOR); log->add_message(vformat(TTR("Undo: %s"), action), EditorLog::MSG_TYPE_EDITOR);
} }
} }
@ -2676,7 +2676,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
String filename = scene->get_scene_file_path(); String filename = scene->get_scene_file_path();
if (filename == String()) { if (filename.is_empty()) {
show_warning(TTR("Can't reload a scene that was never saved.")); show_warning(TTR("Can't reload a scene that was never saved."));
break; break;
} }
@ -2746,7 +2746,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case FILE_SHOW_IN_FILESYSTEM: { case FILE_SHOW_IN_FILESYSTEM: {
String path = editor_data.get_scene_path(editor_data.get_edited_scene()); String path = editor_data.get_scene_path(editor_data.get_edited_scene());
if (path != String()) { if (!path.is_empty()) {
filesystem_dock->navigate_to_path(path); filesystem_dock->navigate_to_path(path);
} }
} break; } break;
@ -3011,7 +3011,7 @@ void EditorNode::_discard_changes(const String &p_str) {
Node *scene = editor_data.get_edited_scene_root(tab_closing); Node *scene = editor_data.get_edited_scene_root(tab_closing);
if (scene != nullptr) { if (scene != nullptr) {
String scene_filename = scene->get_scene_file_path(); String scene_filename = scene->get_scene_file_path();
if (scene_filename != "") { if (!scene_filename.is_empty()) {
previous_scenes.push_back(scene_filename); previous_scenes.push_back(scene_filename);
} }
} }
@ -3138,7 +3138,7 @@ void EditorNode::_editor_select(int p_which) {
} }
void EditorNode::select_editor_by_name(const String &p_name) { void EditorNode::select_editor_by_name(const String &p_name) {
ERR_FAIL_COND(p_name == ""); ERR_FAIL_COND(p_name.is_empty());
for (int i = 0; i < main_editor_buttons.size(); i++) { for (int i = 0; i < main_editor_buttons.size(); i++) {
if (main_editor_buttons[i]->get_text() == p_name) { if (main_editor_buttons[i]->get_text() == p_name) {
@ -4491,13 +4491,13 @@ void EditorNode::_save_docks_to_config(Ref<ConfigFile> p_layout, const String &p
String names; String names;
for (int j = 0; j < dock_slot[i]->get_tab_count(); j++) { for (int j = 0; j < dock_slot[i]->get_tab_count(); j++) {
String name = dock_slot[i]->get_tab_control(j)->get_name(); String name = dock_slot[i]->get_tab_control(j)->get_name();
if (names != "") { if (!names.is_empty()) {
names += ","; names += ",";
} }
names += name; names += name;
} }
if (names != "") { if (!names.is_empty()) {
p_layout->set_value(p_section, "dock_" + itos(i + 1), names); p_layout->set_value(p_section, "dock_" + itos(i + 1), names);
} }
} }
@ -4522,7 +4522,7 @@ void EditorNode::_save_open_scenes_to_config(Ref<ConfigFile> p_layout, const Str
Array scenes; Array scenes;
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
String path = editor_data.get_scene_path(i); String path = editor_data.get_scene_path(i);
if (path == "") { if (path.is_empty()) {
continue; continue;
} }
scenes.push_back(path); scenes.push_back(path);
@ -4789,7 +4789,7 @@ bool EditorNode::ensure_main_scene(bool p_from_native) {
pick_main_scene->set_meta("from_native", p_from_native); // whether from play button or native run pick_main_scene->set_meta("from_native", p_from_native); // whether from play button or native run
String main_scene = GLOBAL_DEF("application/run/main_scene", ""); String main_scene = GLOBAL_DEF("application/run/main_scene", "");
if (main_scene == "") { if (main_scene.is_empty()) {
current_option = -1; current_option = -1;
pick_main_scene->set_text(TTR("No main scene has ever been defined, select one?\nYou can change it later in \"Project Settings\" under the 'application' category.")); pick_main_scene->set_text(TTR("No main scene has ever been defined, select one?\nYou can change it later in \"Project Settings\" under the 'application' category."));
pick_main_scene->popup_centered(); pick_main_scene->popup_centered();
@ -4852,7 +4852,7 @@ bool EditorNode::is_run_playing() const {
String EditorNode::get_run_playing_scene() const { String EditorNode::get_run_playing_scene() const {
String run_filename = editor_run.get_running_scene(); String run_filename = editor_run.get_running_scene();
if (run_filename == "" && is_run_playing()) { if (run_filename.is_empty() && is_run_playing()) {
run_filename = GLOBAL_DEF("application/run/main_scene", ""); // Must be the main scene then. run_filename = GLOBAL_DEF("application/run/main_scene", ""); // Must be the main scene then.
} }
@ -4978,7 +4978,7 @@ void EditorNode::_scene_tab_closed(int p_tab, int option) {
: editor_data.get_scene_version(p_tab) != 0; : editor_data.get_scene_version(p_tab) != 0;
if (unsaved) { if (unsaved) {
save_confirmation->get_ok_button()->set_text(TTR("Save & Close")); save_confirmation->get_ok_button()->set_text(TTR("Save & Close"));
save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene->get_scene_file_path() != "" ? scene->get_scene_file_path() : "unsaved scene")); save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), !scene->get_scene_file_path().is_empty() ? scene->get_scene_file_path() : "unsaved scene"));
save_confirmation->popup_centered(); save_confirmation->popup_centered();
} else { } else {
_discard_changes(); _discard_changes();
@ -4998,7 +4998,7 @@ void EditorNode::_scene_tab_hovered(int p_tab) {
tab_preview_panel->hide(); tab_preview_panel->hide();
} else { } else {
String path = editor_data.get_scene_path(p_tab); String path = editor_data.get_scene_path(p_tab);
if (path != String()) { if (!path.is_empty()) {
EditorResourcePreview::get_singleton()->queue_resource_preview(path, this, "_thumbnail_done", p_tab); EditorResourcePreview::get_singleton()->queue_resource_preview(path, this, "_thumbnail_done", p_tab);
} }
} }
@ -5307,7 +5307,7 @@ Variant EditorNode::drag_resource(const Ref<Resource> &p_res, Control *p_from) {
drag_control->add_child(drag_preview); drag_control->add_child(drag_preview);
if (p_res->get_path().is_resource_file()) { if (p_res->get_path().is_resource_file()) {
label->set_text(p_res->get_path().get_file()); label->set_text(p_res->get_path().get_file());
} else if (p_res->get_name() != "") { } else if (!p_res->get_name().is_empty()) {
label->set_text(p_res->get_name()); label->set_text(p_res->get_name());
} else { } else {
label->set_text(p_res->get_class()); label->set_text(p_res->get_class());
@ -5446,7 +5446,7 @@ void EditorNode::_add_dropped_files_recursive(const Vector<String> &p_files, Str
sub_dir->list_dir_begin(); sub_dir->list_dir_begin();
String next_file = sub_dir->get_next(); String next_file = sub_dir->get_next();
while (next_file != "") { while (!next_file.is_empty()) {
if (next_file == "." || next_file == "..") { if (next_file == "." || next_file == "..") {
next_file = sub_dir->get_next(); next_file = sub_dir->get_next();
continue; continue;

View file

@ -130,14 +130,14 @@ void EditorPath::update_path() {
name = r->get_name(); name = r->get_name();
} }
if (name == "") { if (name.is_empty()) {
name = r->get_class(); name = r->get_class();
} }
} else if (obj->is_class("EditorDebuggerRemoteObject")) { } else if (obj->is_class("EditorDebuggerRemoteObject")) {
name = obj->call("get_title"); name = obj->call("get_title");
} else if (Object::cast_to<Node>(obj)) { } else if (Object::cast_to<Node>(obj)) {
name = Object::cast_to<Node>(obj)->get_name(); name = Object::cast_to<Node>(obj)->get_name();
} else if (Object::cast_to<Resource>(obj) && Object::cast_to<Resource>(obj)->get_name() != "") { } else if (Object::cast_to<Resource>(obj) && !Object::cast_to<Resource>(obj)->get_name().is_empty()) {
name = Object::cast_to<Resource>(obj)->get_name(); name = Object::cast_to<Resource>(obj)->get_name();
} else { } else {
name = obj->get_class(); name = obj->get_class();

View file

@ -131,7 +131,7 @@ EditorPaths::EditorPaths() {
} }
} }
paths_valid = (data_path != "" && config_path != "" && cache_path != ""); paths_valid = (!data_path.is_empty() && !config_path.is_empty() && !cache_path.is_empty());
ERR_FAIL_COND_MSG(!paths_valid, "Editor data, config, or cache paths are invalid."); ERR_FAIL_COND_MSG(!paths_valid, "Editor data, config, or cache paths are invalid.");
// Validate or create each dir and its relevant subdirectories. // Validate or create each dir and its relevant subdirectories.

View file

@ -295,7 +295,7 @@ Error EditorInterface::save_scene() {
if (!get_edited_scene_root()) { if (!get_edited_scene_root()) {
return ERR_CANT_CREATE; return ERR_CANT_CREATE;
} }
if (get_edited_scene_root()->get_scene_file_path() == String()) { if (get_edited_scene_root()->get_scene_file_path().is_empty()) {
return ERR_CANT_CREATE; return ERR_CANT_CREATE;
} }

View file

@ -165,7 +165,7 @@ Vector<String> EditorPluginSettings::_get_plugins(const String &p_dir) {
Vector<String> plugins; Vector<String> plugins;
da->list_dir_begin(); da->list_dir_begin();
for (String path = da->get_next(); path != String(); path = da->get_next()) { for (String path = da->get_next(); !path.is_empty(); path = da->get_next()) {
if (path[0] == '.' || !da->current_is_dir()) { if (path[0] == '.' || !da->current_is_dir()) {
continue; continue;
} }

View file

@ -380,7 +380,7 @@ void EditorPropertyPath::_path_pressed() {
dialog->set_file_mode(save_mode ? EditorFileDialog::FILE_MODE_SAVE_FILE : EditorFileDialog::FILE_MODE_OPEN_FILE); dialog->set_file_mode(save_mode ? EditorFileDialog::FILE_MODE_SAVE_FILE : EditorFileDialog::FILE_MODE_OPEN_FILE);
for (int i = 0; i < extensions.size(); i++) { for (int i = 0; i < extensions.size(); i++) {
String e = extensions[i].strip_edges(); String e = extensions[i].strip_edges();
if (e != String()) { if (!e.is_empty()) {
dialog->add_filter(extensions[i].strip_edges()); dialog->add_filter(extensions[i].strip_edges());
} }
} }
@ -706,7 +706,7 @@ void EditorPropertyFlags::setup(const Vector<String> &p_options) {
bool first = true; bool first = true;
for (int i = 0; i < p_options.size(); i++) { for (int i = 0; i < p_options.size(); i++) {
String option = p_options[i].strip_edges(); String option = p_options[i].strip_edges();
if (option != "") { if (!option.is_empty()) {
CheckBox *cb = memnew(CheckBox); CheckBox *cb = memnew(CheckBox);
cb->set_text(option); cb->set_text(option);
cb->set_clip_text(true); cb->set_clip_text(true);
@ -1055,7 +1055,7 @@ void EditorPropertyLayers::setup(LayerType p_layer_type) {
name = ProjectSettings::get_singleton()->get(basename + vformat("/layer_%d", i + 1)); name = ProjectSettings::get_singleton()->get(basename + vformat("/layer_%d", i + 1));
} }
if (name == "") { if (name.is_empty()) {
name = vformat(TTR("Layer %d"), i + 1); name = vformat(TTR("Layer %d"), i + 1);
} }
@ -1186,7 +1186,7 @@ void EditorPropertyObjectID::_edit_pressed() {
void EditorPropertyObjectID::update_property() { void EditorPropertyObjectID::update_property() {
String type = base_type; String type = base_type;
if (type == "") { if (type.is_empty()) {
type = "Object"; type = "Object";
} }
@ -3229,7 +3229,7 @@ static EditorPropertyRangeHint _parse_range_hint(PropertyHint p_hint, const Stri
} }
} }
if ((hint.radians || degrees) && hint.suffix == String()) { if ((hint.radians || degrees) && hint.suffix.is_empty()) {
hint.suffix = U"\u00B0"; hint.suffix = U"\u00B0";
} }
@ -3514,10 +3514,10 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_
} break; } break;
case Variant::NODE_PATH: { case Variant::NODE_PATH: {
EditorPropertyNodePath *editor = memnew(EditorPropertyNodePath); EditorPropertyNodePath *editor = memnew(EditorPropertyNodePath);
if (p_hint == PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE && p_hint_text != String()) { if (p_hint == PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE && !p_hint_text.is_empty()) {
editor->setup(p_hint_text, Vector<StringName>(), (p_usage & PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT)); editor->setup(p_hint_text, Vector<StringName>(), (p_usage & PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT));
} }
if (p_hint == PROPERTY_HINT_NODE_PATH_VALID_TYPES && p_hint_text != String()) { if (p_hint == PROPERTY_HINT_NODE_PATH_VALID_TYPES && !p_hint_text.is_empty()) {
Vector<String> types = p_hint_text.split(",", false); Vector<String> types = p_hint_text.split(",", false);
Vector<StringName> sn = Variant(types); //convert via variant Vector<StringName> sn = Variant(types); //convert via variant
editor->setup(NodePath(), sn, (p_usage & PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT)); editor->setup(NodePath(), sn, (p_usage & PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT));

View file

@ -431,7 +431,7 @@ bool EditorPropertyArray::_is_drop_valid(const Dictionary &p_drag_data) const {
// When the subtype is of type Object, an additional subtype may be specified in the hint string // When the subtype is of type Object, an additional subtype may be specified in the hint string
// (e.g. Resource, Texture2D, ShaderMaterial, etc). We want the allowed type to be that, not just "Object". // (e.g. Resource, Texture2D, ShaderMaterial, etc). We want the allowed type to be that, not just "Object".
if (subtype == Variant::OBJECT && subtype_hint_string != "") { if (subtype == Variant::OBJECT && !subtype_hint_string.is_empty()) {
allowed_type = subtype_hint_string; allowed_type = subtype_hint_string;
} }

View file

@ -52,7 +52,7 @@ void EditorResourcePicker::_update_resource() {
} else { } else {
assign_button->set_icon(EditorNode::get_singleton()->get_object_icon(edited_resource.operator->(), "Object")); assign_button->set_icon(EditorNode::get_singleton()->get_object_icon(edited_resource.operator->(), "Object"));
if (edited_resource->get_name() != String()) { if (!edited_resource->get_name().is_empty()) {
assign_button->set_text(edited_resource->get_name()); assign_button->set_text(edited_resource->get_name());
} else if (edited_resource->get_path().is_resource_file()) { } else if (edited_resource->get_path().is_resource_file()) {
assign_button->set_text(edited_resource->get_path().get_file()); assign_button->set_text(edited_resource->get_path().get_file());
@ -113,7 +113,7 @@ void EditorResourcePicker::_file_selected(const String &p_path) {
RES loaded_resource = ResourceLoader::load(p_path); RES loaded_resource = ResourceLoader::load(p_path);
ERR_FAIL_COND_MSG(loaded_resource.is_null(), "Cannot load resource from path '" + p_path + "'."); ERR_FAIL_COND_MSG(loaded_resource.is_null(), "Cannot load resource from path '" + p_path + "'.");
if (base_type != "") { if (!base_type.is_empty()) {
bool any_type_matches = false; bool any_type_matches = false;
for (int i = 0; i < base_type.get_slice_count(","); i++) { for (int i = 0; i < base_type.get_slice_count(","); i++) {
@ -180,7 +180,7 @@ void EditorResourcePicker::_update_menu_items() {
RES cb = EditorSettings::get_singleton()->get_resource_clipboard(); RES cb = EditorSettings::get_singleton()->get_resource_clipboard();
bool paste_valid = false; bool paste_valid = false;
if (cb.is_valid()) { if (cb.is_valid()) {
if (base_type == "") { if (base_type.is_empty()) {
paste_valid = true; paste_valid = true;
} else { } else {
for (int i = 0; i < base_type.get_slice_count(","); i++) { for (int i = 0; i < base_type.get_slice_count(","); i++) {
@ -391,7 +391,7 @@ void EditorResourcePicker::set_create_options(Object *p_menu_node) {
} }
// By default provide generic "New ..." options. // By default provide generic "New ..." options.
if (base_type != "") { if (!base_type.is_empty()) {
int idx = 0; int idx = 0;
Set<String> allowed_types; Set<String> allowed_types;
@ -571,7 +571,7 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const {
String file = files[0]; String file = files[0];
String file_type = EditorFileSystem::get_singleton()->get_file_type(file); String file_type = EditorFileSystem::get_singleton()->get_file_type(file);
if (file_type != "" && _is_type_valid(file_type, allowed_types)) { if (!file_type.is_empty() && _is_type_valid(file_type, allowed_types)) {
return true; return true;
} }
} }

View file

@ -141,7 +141,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
type = ResourceLoader::get_resource_type(p_item.path); type = ResourceLoader::get_resource_type(p_item.path);
} }
if (type == "") { if (type.is_empty()) {
r_texture = Ref<ImageTexture>(); r_texture = Ref<ImageTexture>();
r_small_texture = Ref<ImageTexture>(); r_small_texture = Ref<ImageTexture>();
return; //could not guess type return; //could not guess type

View file

@ -180,7 +180,7 @@ Error EditorRun::run(const String &p_scene) {
args.push_back("--skip-breakpoints"); args.push_back("--skip-breakpoints");
} }
if (p_scene != "") { if (!p_scene.is_empty()) {
args.push_back(p_scene); args.push_back(p_scene);
} }
@ -244,7 +244,7 @@ Error EditorRun::run(const String &p_scene) {
} }
status = STATUS_PLAY; status = STATUS_PLAY;
if (p_scene != "") { if (!p_scene.is_empty()) {
running_scene = p_scene; running_scene = p_scene;
} }

View file

@ -45,7 +45,7 @@ class SectionedInspectorFilter : public Object {
} }
String name = p_name; String name = p_name;
if (section != "") { if (!section.is_empty()) {
name = section + "/" + name; name = section + "/" + name;
} }
@ -60,7 +60,7 @@ class SectionedInspectorFilter : public Object {
} }
String name = p_name; String name = p_name;
if (section != "") { if (!section.is_empty()) {
name = section + "/" + name; name = section + "/" + name;
} }
@ -155,7 +155,7 @@ String SectionedInspector::get_current_section() const {
String SectionedInspector::get_full_item_path(const String &p_item) { String SectionedInspector::get_full_item_path(const String &p_item) {
String base = get_current_section(); String base = get_current_section();
if (base != "") { if (!base.is_empty()) {
return base + "/" + p_item; return base + "/" + p_item;
} else { } else {
return p_item; return p_item;

View file

@ -389,14 +389,14 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
best = locale; best = locale;
} }
if (best == String() && host_lang.begins_with(locale)) { if (best.is_empty() && host_lang.begins_with(locale)) {
best = locale; best = locale;
} }
etl++; etl++;
} }
if (best == String()) { if (best.is_empty()) {
best = "en"; best = "en";
} }
@ -989,7 +989,7 @@ void EditorSettings::setup_network() {
if (ip == current) { if (ip == current) {
selected = ip; selected = ip;
} }
if (hint != "") { if (!hint.is_empty()) {
hint += ","; hint += ",";
} }
hint += ip; hint += ip;
@ -1008,7 +1008,7 @@ void EditorSettings::save() {
return; return;
} }
if (singleton->config_file_path == "") { if (singleton->config_file_path.is_empty()) {
ERR_PRINT("Cannot save EditorSettings config, no valid path"); ERR_PRINT("Cannot save EditorSettings config, no valid path");
return; return;
} }
@ -1218,7 +1218,7 @@ void EditorSettings::load_favorites() {
FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("favorites"), FileAccess::READ); FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("favorites"), FileAccess::READ);
if (f) { if (f) {
String line = f->get_line().strip_edges(); String line = f->get_line().strip_edges();
while (line != "") { while (!line.is_empty()) {
favorites.push_back(line); favorites.push_back(line);
line = f->get_line().strip_edges(); line = f->get_line().strip_edges();
} }
@ -1228,7 +1228,7 @@ void EditorSettings::load_favorites() {
f = FileAccess::open(get_project_settings_dir().plus_file("recent_dirs"), FileAccess::READ); f = FileAccess::open(get_project_settings_dir().plus_file("recent_dirs"), FileAccess::READ);
if (f) { if (f) {
String line = f->get_line().strip_edges(); String line = f->get_line().strip_edges();
while (line != "") { while (!line.is_empty()) {
recent_dirs.push_back(line); recent_dirs.push_back(line);
line = f->get_line().strip_edges(); line = f->get_line().strip_edges();
} }
@ -1252,7 +1252,7 @@ void EditorSettings::list_text_editor_themes() {
List<String> custom_themes; List<String> custom_themes;
d->list_dir_begin(); d->list_dir_begin();
String file = d->get_next(); String file = d->get_next();
while (file != String()) { while (!file.is_empty()) {
if (file.get_extension() == "tet" && !_is_default_text_editor_theme(file.get_basename().to_lower())) { if (file.get_extension() == "tet" && !_is_default_text_editor_theme(file.get_basename().to_lower())) {
custom_themes.push_back(file.get_basename()); custom_themes.push_back(file.get_basename());
} }
@ -1371,7 +1371,7 @@ Vector<String> EditorSettings::get_script_templates(const String &p_extension, c
if (d) { if (d) {
d->list_dir_begin(); d->list_dir_begin();
String file = d->get_next(); String file = d->get_next();
while (file != String()) { while (!file.is_empty()) {
if (file.get_extension() == p_extension) { if (file.get_extension() == p_extension) {
templates.push_back(file.get_basename()); templates.push_back(file.get_basename());
} }

View file

@ -262,9 +262,9 @@ void EditorSpinSlider::_update_value_input_stylebox() {
// The margin values below were determined by empirical testing. // The margin values below were determined by empirical testing.
if (is_layout_rtl()) { if (is_layout_rtl()) {
stylebox->set_default_margin(SIDE_LEFT, 0); stylebox->set_default_margin(SIDE_LEFT, 0);
stylebox->set_default_margin(SIDE_RIGHT, (get_label() != String() ? 23 : 16) * EDSCALE); stylebox->set_default_margin(SIDE_RIGHT, (!get_label().is_empty() ? 23 : 16) * EDSCALE);
} else { } else {
stylebox->set_default_margin(SIDE_LEFT, (get_label() != String() ? 23 : 16) * EDSCALE); stylebox->set_default_margin(SIDE_LEFT, (!get_label().is_empty() ? 23 : 16) * EDSCALE);
stylebox->set_default_margin(SIDE_RIGHT, 0); stylebox->set_default_margin(SIDE_RIGHT, 0);
} }
@ -308,7 +308,7 @@ void EditorSpinSlider::_draw_spin_slider() {
lc = fc; lc = fc;
} }
if (flat && label != String()) { if (flat && !label.is_empty()) {
Color label_bg_color = get_theme_color(SNAME("dark_color_3"), SNAME("Editor")); Color label_bg_color = get_theme_color(SNAME("dark_color_3"), SNAME("Editor"));
if (rtl) { if (rtl) {
draw_rect(Rect2(Vector2(size.width - (sb->get_offset().x * 2 + label_width), 0), Vector2(sb->get_offset().x * 2 + label_width, size.height)), label_bg_color); draw_rect(Rect2(Vector2(size.width - (sb->get_offset().x * 2 + label_width), 0), Vector2(sb->get_offset().x * 2 + label_width, size.height)), label_bg_color);

View file

@ -1553,7 +1553,7 @@ Ref<Theme> create_custom_theme(const Ref<Theme> p_theme) {
Ref<Theme> theme = create_editor_theme(p_theme); Ref<Theme> theme = create_editor_theme(p_theme);
const String custom_theme_path = EditorSettings::get_singleton()->get("interface/theme/custom_theme"); const String custom_theme_path = EditorSettings::get_singleton()->get("interface/theme/custom_theme");
if (custom_theme_path != "") { if (!custom_theme_path.is_empty()) {
Ref<Theme> custom_theme = ResourceLoader::load(custom_theme_path); Ref<Theme> custom_theme = ResourceLoader::load(custom_theme_path);
if (custom_theme.is_valid()) { if (custom_theme.is_valid()) {
theme->merge_with(custom_theme); theme->merge_with(custom_theme);

View file

@ -53,7 +53,7 @@ void ExportTemplateManager::_update_template_status() {
da->list_dir_begin(); da->list_dir_begin();
if (err == OK) { if (err == OK) {
String c = da->get_next(); String c = da->get_next();
while (c != String()) { while (!c.is_empty()) {
if (da->current_is_dir() && !c.begins_with(".")) { if (da->current_is_dir() && !c.begins_with(".")) {
templates.insert(c); templates.insert(c);
} }
@ -424,7 +424,7 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_
ret = unzGoToNextFile(pkg); ret = unzGoToNextFile(pkg);
} }
if (version == String()) { if (version.is_empty()) {
EditorNode::get_singleton()->show_warning(TTR("No version.txt found inside the export templates file.")); EditorNode::get_singleton()->show_warning(TTR("No version.txt found inside the export templates file."));
unzClose(pkg); unzClose(pkg);
return false; return false;

View file

@ -88,7 +88,7 @@ void EditorFileServer::_subthread_start(void *s) {
ERR_FAIL(); ERR_FAIL();
} }
} else { } else {
if (cd->efs->password != "") { if (!cd->efs->password.is_empty()) {
encode_uint32(ERR_INVALID_DATA, buf4); encode_uint32(ERR_INVALID_DATA, buf4);
cd->connection->put_data(buf4, 4); cd->connection->put_data(buf4, 4);
OS::get_singleton()->delay_usec(1000000); OS::get_singleton()->delay_usec(1000000);

View file

@ -64,7 +64,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
// Create a tree item for the subdirectory. // Create a tree item for the subdirectory.
TreeItem *subdirectory_item = tree->create_item(p_parent); TreeItem *subdirectory_item = tree->create_item(p_parent);
String dname = p_dir->get_name(); String dname = p_dir->get_name();
if (dname == "") { if (dname.is_empty()) {
dname = "res://"; dname = "res://";
} }
@ -923,7 +923,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
files->select(item_index, false); files->select(item_index, false);
} }
if (!p_keep_selection && file != "" && fname == file) { if (!p_keep_selection && !file.is_empty() && fname == file) {
files->select(item_index, true); files->select(item_index, true);
files->ensure_current_is_visible(); files->ensure_current_is_visible();
} }
@ -1670,7 +1670,7 @@ Vector<String> FileSystemDock::_remove_self_included_paths(Vector<String> select
selected_strings.sort_custom<NaturalNoCaseComparator>(); selected_strings.sort_custom<NaturalNoCaseComparator>();
String last_path = ""; String last_path = "";
for (int i = 0; i < selected_strings.size(); i++) { for (int i = 0; i < selected_strings.size(); i++) {
if (last_path != "" && selected_strings[i].begins_with(last_path)) { if (!last_path.is_empty() && selected_strings[i].begins_with(last_path)) {
selected_strings.remove_at(i); selected_strings.remove_at(i);
i--; i--;
} }
@ -2016,7 +2016,7 @@ void FileSystemDock::_search_changed(const String &p_text, const Control *p_from
tree_search_box->set_text(searched_string); tree_search_box->set_text(searched_string);
} }
bool unfold_path = (p_text == String() && path != String()); bool unfold_path = (p_text.is_empty() && !path.is_empty());
switch (display_mode) { switch (display_mode) {
case DISPLAY_MODE_TREE_ONLY: { case DISPLAY_MODE_TREE_ONLY: {
_update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>(), false, false, unfold_path); _update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>(), false, false, unfold_path);
@ -2665,7 +2665,7 @@ void FileSystemDock::_get_imported_files(const String &p_path, Vector<String> &f
DirAccess *da = DirAccess::open(p_path); DirAccess *da = DirAccess::open(p_path);
da->list_dir_begin(); da->list_dir_begin();
String n = da->get_next(); String n = da->get_next();
while (n != String()) { while (!n.is_empty()) {
if (n != "." && n != ".." && !n.ends_with(".import")) { if (n != "." && n != ".." && !n.ends_with(".import")) {
String npath = p_path + n + (da->current_is_dir() ? "/" : ""); String npath = p_path + n + (da->current_is_dir() ? "/" : "");
_get_imported_files(npath, files); _get_imported_files(npath, files);
@ -2720,7 +2720,7 @@ void FileSystemDock::_update_import_dock() {
if (cf->has_section_key("remap", "type")) { if (cf->has_section_key("remap", "type")) {
type = cf->get_value("remap", "type"); type = cf->get_value("remap", "type");
} }
if (import_type == "") { if (import_type.is_empty()) {
import_type = type; import_type = type;
} else if (import_type != type) { } else if (import_type != type) {
// All should be the same type. // All should be the same type.

View file

@ -114,7 +114,7 @@ void FindInFiles::_notification(int p_notification) {
} }
void FindInFiles::start() { void FindInFiles::start() {
if (_pattern == "") { if (_pattern.is_empty()) {
print_verbose("Nothing to search, pattern is empty"); print_verbose("Nothing to search, pattern is empty");
emit_signal(SNAME(SIGNAL_FINISHED)); emit_signal(SNAME(SIGNAL_FINISHED));
return; return;
@ -224,7 +224,7 @@ void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders) {
for (int i = 0; i < 1000; ++i) { for (int i = 0; i < 1000; ++i) {
String file = dir->get_next(); String file = dir->get_next();
if (file == "") { if (file.is_empty()) {
break; break;
} }

View file

@ -227,7 +227,7 @@ void GroupDialog::_group_renamed() {
} }
} }
if (name == "") { if (name.is_empty()) {
renamed_group->set_text(0, selected_group); renamed_group->set_text(0, selected_group);
error->set_text(TTR("Invalid group name.")); error->set_text(TTR("Invalid group name."));
error->popup_centered(); error->popup_centered();

View file

@ -1362,7 +1362,7 @@ Collada::Node *Collada::_parse_visual_instance_geometry(XMLParser &parser) {
} else if (parser.get_node_name() == "skeleton") { } else if (parser.get_node_name() == "skeleton") {
parser.read(); parser.read();
String uri = _uri_to_id(parser.get_node_data()); String uri = _uri_to_id(parser.get_node_data());
if (uri != "") { if (!uri.is_empty()) {
geom->skeletons.push_back(uri); geom->skeletons.push_back(uri);
} }
} }
@ -1464,7 +1464,7 @@ Collada::Node *Collada::_parse_visual_scene_node(XMLParser &parser) {
bool found_name = false; bool found_name = false;
if (id == "") { if (id.is_empty()) {
id = "%NODEID%" + itos(Math::rand()); id = "%NODEID%" + itos(Math::rand());
} else { } else {
@ -1479,7 +1479,7 @@ Collada::Node *Collada::_parse_visual_scene_node(XMLParser &parser) {
Node *node = nullptr; Node *node = nullptr;
name = parser.has_attribute("name") ? parser.get_attribute_value_safe("name") : parser.get_attribute_value_safe("id"); name = parser.has_attribute("name") ? parser.get_attribute_value_safe("name") : parser.get_attribute_value_safe("id");
if (name == "") { if (name.is_empty()) {
name = id; name = id;
} else { } else {
found_name = true; found_name = true;
@ -1499,7 +1499,7 @@ Collada::Node *Collada::_parse_visual_scene_node(XMLParser &parser) {
joint->sid = parser.get_attribute_value_safe("name"); joint->sid = parser.get_attribute_value_safe("name");
} }
if (joint->sid != "") { if (!joint->sid.is_empty()) {
state.sid_to_node_map[joint->sid] = id; state.sid_to_node_map[joint->sid] = id;
} }
@ -1696,16 +1696,16 @@ void Collada::_parse_animation(XMLParser &parser) {
source_param_types[current_source] = Vector<String>(); source_param_types[current_source] = Vector<String>();
} else if (name == "float_array") { } else if (name == "float_array") {
if (current_source != "") { if (!current_source.is_empty()) {
float_sources[current_source] = _read_float_array(parser); float_sources[current_source] = _read_float_array(parser);
} }
} else if (name == "Name_array") { } else if (name == "Name_array") {
if (current_source != "") { if (!current_source.is_empty()) {
string_sources[current_source] = _read_string_array(parser); string_sources[current_source] = _read_string_array(parser);
} }
} else if (name == "accessor") { } else if (name == "accessor") {
if (current_source != "" && parser.has_attribute("stride")) { if (!current_source.is_empty() && parser.has_attribute("stride")) {
source_strides[current_source] = parser.get_attribute_value("stride").to_int(); source_strides[current_source] = parser.get_attribute_value("stride").to_int();
} }
} else if (name == "sampler") { } else if (name == "sampler") {
@ -1725,7 +1725,7 @@ void Collada::_parse_animation(XMLParser &parser) {
} }
} else if (name == "input") { } else if (name == "input") {
if (current_sampler != "") { if (!current_sampler.is_empty()) {
samplers[current_sampler][parser.get_attribute_value("semantic")] = parser.get_attribute_value("source"); samplers[current_sampler][parser.get_attribute_value("semantic")] = parser.get_attribute_value("source");
} }
@ -1838,7 +1838,7 @@ void Collada::_parse_animation(XMLParser &parser) {
track.component = track.param.get_slice(".", 1).to_upper(); track.component = track.param.get_slice(".", 1).to_upper();
} }
track.param = track.param.get_slice(".", 0); track.param = track.param.get_slice(".", 0);
if (names.size() > 1 && track.component == "") { if (names.size() > 1 && track.component.is_empty()) {
//this is a guess because the collada spec is ambiguous here... //this is a guess because the collada spec is ambiguous here...
//i suppose if you have many names (outputs) you can't use a component and i should abide to that. //i suppose if you have many names (outputs) you can't use a component and i should abide to that.
track.component = name; track.component = name;
@ -1855,7 +1855,7 @@ void Collada::_parse_animation(XMLParser &parser) {
state.referenced_tracks[target].push_back(state.animation_tracks.size() - 1); state.referenced_tracks[target].push_back(state.animation_tracks.size() - 1);
if (id != "") { if (!id.is_empty()) {
if (!state.by_id_tracks.has(id)) { if (!state.by_id_tracks.has(id)) {
state.by_id_tracks[id] = Vector<int>(); state.by_id_tracks[id] = Vector<int>();
} }
@ -1953,10 +1953,10 @@ void Collada::_parse_library(XMLParser &parser) {
while (parser.read() == OK) { while (parser.read() == OK) {
if (parser.get_node_type() == XMLParser::NODE_ELEMENT) { if (parser.get_node_type() == XMLParser::NODE_ELEMENT) {
if (parser.get_node_name() == "mesh") { if (parser.get_node_name() == "mesh") {
state.mesh_name_map[id] = (name2 != "") ? name2 : id; state.mesh_name_map[id] = (!name2.is_empty()) ? name2 : id;
_parse_mesh_geometry(parser, id, name2); _parse_mesh_geometry(parser, id, name2);
} else if (parser.get_node_name() == "spline") { } else if (parser.get_node_name() == "spline") {
state.mesh_name_map[id] = (name2 != "") ? name2 : id; state.mesh_name_map[id] = (!name2.is_empty()) ? name2 : id;
_parse_curve_geometry(parser, id, name2); _parse_curve_geometry(parser, id, name2);
} else if (!parser.is_empty()) { } else if (!parser.is_empty()) {
parser.skip_section(); parser.skip_section();
@ -2286,7 +2286,7 @@ void Collada::_find_morph_nodes(VisualScene *p_vscene, Node *p_node) {
if (nj->controller) { if (nj->controller) {
String base = nj->source; String base = nj->source;
while (base != "" && !state.mesh_data_map.has(base)) { while (!base.is_empty() && !state.mesh_data_map.has(base)) {
if (state.skin_controller_data_map.has(base)) { if (state.skin_controller_data_map.has(base)) {
SkinControllerData &sk = state.skin_controller_data_map[base]; SkinControllerData &sk = state.skin_controller_data_map[base];
base = sk.base; base = sk.base;

View file

@ -1597,7 +1597,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
menu_langs = memnew(PopupMenu); menu_langs = memnew(PopupMenu);
menu_langs->set_name("Language"); menu_langs->set_name("Language");
for (int i = 0; langs[i].name != String(); i++) { for (int i = 0; !langs[i].name.is_empty(); i++) {
if (langs[i].name == "-") { if (langs[i].name == "-") {
menu_langs->add_separator(); menu_langs->add_separator();
} else { } else {
@ -1609,7 +1609,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
menu_scripts = memnew(PopupMenu); menu_scripts = memnew(PopupMenu);
menu_scripts->set_name("Script"); menu_scripts->set_name("Script");
for (int i = 0; scripts[i].name != String(); i++) { for (int i = 0; !scripts[i].name.is_empty(); i++) {
if (scripts[i].name == "-") { if (scripts[i].name == "-") {
menu_scripts->add_separator(); menu_scripts->add_separator();
} else { } else {
@ -1826,7 +1826,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
glyph_tree->connect("item_selected", callable_mp(this, &DynamicFontImportSettings::_range_selected)); glyph_tree->connect("item_selected", callable_mp(this, &DynamicFontImportSettings::_range_selected));
glyph_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); glyph_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
glyph_root = glyph_tree->create_item(); glyph_root = glyph_tree->create_item();
for (int i = 0; unicode_ranges[i].name != String(); i++) { for (int i = 0; !unicode_ranges[i].name.is_empty(); i++) {
_add_glyph_range_item(unicode_ranges[i].start, unicode_ranges[i].end, unicode_ranges[i].name); _add_glyph_range_item(unicode_ranges[i].start, unicode_ranges[i].end, unicode_ranges[i].name);
} }

View file

@ -303,7 +303,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) {
} break; } break;
} }
if (p_node->name != "") { if (!p_node->name.is_empty()) {
node->set_name(p_node->name); node->set_name(p_node->name);
} }
NodeMap nm; NodeMap nm;
@ -317,7 +317,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) {
p_parent->add_child(node, true); p_parent->add_child(node, true);
node->set_owner(scene); node->set_owner(scene);
if (p_node->empty_draw_type != "") { if (!p_node->empty_draw_type.is_empty()) {
node->set_meta("empty_draw_type", Variant(p_node->empty_draw_type)); node->set_meta("empty_draw_type", Variant(p_node->empty_draw_type));
} }
@ -340,9 +340,9 @@ Error ColladaImport::_create_material(const String &p_target) {
Ref<StandardMaterial3D> material = memnew(StandardMaterial3D); Ref<StandardMaterial3D> material = memnew(StandardMaterial3D);
String base_name; String base_name;
if (src_mat.name != "") { if (!src_mat.name.is_empty()) {
base_name = src_mat.name; base_name = src_mat.name;
} else if (effect.name != "") { } else if (!effect.name.is_empty()) {
base_name = effect.name; base_name = effect.name;
} else { } else {
base_name = "Material"; base_name = "Material";
@ -360,9 +360,9 @@ Error ColladaImport::_create_material(const String &p_target) {
// DIFFUSE // DIFFUSE
if (effect.diffuse.texture != "") { if (!effect.diffuse.texture.is_empty()) {
String texfile = effect.get_texture_path(effect.diffuse.texture, collada); String texfile = effect.get_texture_path(effect.diffuse.texture, collada);
if (texfile != "") { if (!texfile.is_empty()) {
if (texfile.begins_with("/")) { if (texfile.begins_with("/")) {
texfile = texfile.replace_first("/", "res://"); texfile = texfile.replace_first("/", "res://");
} }
@ -381,9 +381,9 @@ Error ColladaImport::_create_material(const String &p_target) {
// SPECULAR // SPECULAR
if (effect.specular.texture != "") { if (!effect.specular.texture.is_empty()) {
String texfile = effect.get_texture_path(effect.specular.texture, collada); String texfile = effect.get_texture_path(effect.specular.texture, collada);
if (texfile != "") { if (!texfile.is_empty()) {
if (texfile.begins_with("/")) { if (texfile.begins_with("/")) {
texfile = texfile.replace_first("/", "res://"); texfile = texfile.replace_first("/", "res://");
} }
@ -406,9 +406,9 @@ Error ColladaImport::_create_material(const String &p_target) {
// EMISSION // EMISSION
if (effect.emission.texture != "") { if (!effect.emission.texture.is_empty()) {
String texfile = effect.get_texture_path(effect.emission.texture, collada); String texfile = effect.get_texture_path(effect.emission.texture, collada);
if (texfile != "") { if (!texfile.is_empty()) {
if (texfile.begins_with("/")) { if (texfile.begins_with("/")) {
texfile = texfile.replace_first("/", "res://"); texfile = texfile.replace_first("/", "res://");
} }
@ -433,9 +433,9 @@ Error ColladaImport::_create_material(const String &p_target) {
// NORMAL // NORMAL
if (effect.bump.texture != "") { if (!effect.bump.texture.is_empty()) {
String texfile = effect.get_texture_path(effect.bump.texture, collada); String texfile = effect.get_texture_path(effect.bump.texture, collada);
if (texfile != "") { if (!texfile.is_empty()) {
if (texfile.begins_with("/")) { if (texfile.begins_with("/")) {
texfile = texfile.replace_first("/", "res://"); texfile = texfile.replace_first("/", "res://");
} }
@ -525,7 +525,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
normal_ofs = vertex_ofs; normal_ofs = vertex_ofs;
} }
if (normal_source_id != "") { if (!normal_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(normal_source_id), ERR_INVALID_DATA); ERR_FAIL_COND_V(!meshdata.sources.has(normal_source_id), ERR_INVALID_DATA);
normal_src = &meshdata.sources[normal_source_id]; normal_src = &meshdata.sources[normal_source_id];
} }
@ -545,7 +545,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
binormal_ofs = vertex_ofs; binormal_ofs = vertex_ofs;
} }
if (binormal_source_id != "") { if (!binormal_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(binormal_source_id), ERR_INVALID_DATA); ERR_FAIL_COND_V(!meshdata.sources.has(binormal_source_id), ERR_INVALID_DATA);
binormal_src = &meshdata.sources[binormal_source_id]; binormal_src = &meshdata.sources[binormal_source_id];
} }
@ -565,7 +565,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
tangent_ofs = vertex_ofs; tangent_ofs = vertex_ofs;
} }
if (tangent_source_id != "") { if (!tangent_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(tangent_source_id), ERR_INVALID_DATA); ERR_FAIL_COND_V(!meshdata.sources.has(tangent_source_id), ERR_INVALID_DATA);
tangent_src = &meshdata.sources[tangent_source_id]; tangent_src = &meshdata.sources[tangent_source_id];
} }
@ -585,7 +585,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
uv_ofs = vertex_ofs; uv_ofs = vertex_ofs;
} }
if (uv_source_id != "") { if (!uv_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(uv_source_id), ERR_INVALID_DATA); ERR_FAIL_COND_V(!meshdata.sources.has(uv_source_id), ERR_INVALID_DATA);
uv_src = &meshdata.sources[uv_source_id]; uv_src = &meshdata.sources[uv_source_id];
} }
@ -605,7 +605,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
uv2_ofs = vertex_ofs; uv2_ofs = vertex_ofs;
} }
if (uv2_source_id != "") { if (!uv2_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(uv2_source_id), ERR_INVALID_DATA); ERR_FAIL_COND_V(!meshdata.sources.has(uv2_source_id), ERR_INVALID_DATA);
uv2_src = &meshdata.sources[uv2_source_id]; uv2_src = &meshdata.sources[uv2_source_id];
} }
@ -625,7 +625,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
color_ofs = vertex_ofs; color_ofs = vertex_ofs;
} }
if (color_source_id != "") { if (!color_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(color_source_id), ERR_INVALID_DATA); ERR_FAIL_COND_V(!meshdata.sources.has(color_source_id), ERR_INVALID_DATA);
color_src = &meshdata.sources[color_source_id]; color_src = &meshdata.sources[color_source_id];
} }
@ -914,7 +914,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
material = material_cache[target]; material = material_cache[target];
} }
} else if (p.material != "") { } else if (!p.material.is_empty()) {
WARN_PRINT("Collada: Unreferenced material in geometry instance: " + p.material); WARN_PRINT("Collada: Unreferenced material in geometry instance: " + p.material);
} }
} }
@ -1198,7 +1198,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
} }
} }
ERR_FAIL_COND_V_MSG(ngsource != "", ERR_INVALID_DATA, "Controller instance source '" + ngsource + "' is neither skin or morph!"); ERR_FAIL_COND_V_MSG(!ngsource.is_empty(), ERR_INVALID_DATA, "Controller instance source '" + ngsource + "' is neither skin or morph!");
} else { } else {
meshid = ng2->source; meshid = ng2->source;
@ -1215,13 +1215,13 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
mesh = Ref<ImporterMesh>(memnew(ImporterMesh)); mesh = Ref<ImporterMesh>(memnew(ImporterMesh));
const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid]; const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid];
String name = meshdata.name; String name = meshdata.name;
if (name == "") { if (name.is_empty()) {
name = "Mesh"; name = "Mesh";
} }
int counter = 2; int counter = 2;
while (mesh_unique_names.has(name)) { while (mesh_unique_names.has(name)) {
name = meshdata.name; name = meshdata.name;
if (name == "") { if (name.is_empty()) {
name = "Mesh"; name = "Mesh";
} }
name += itos(counter++); name += itos(counter++);
@ -1261,7 +1261,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
} }
mi->set_surface_material(i, material); mi->set_surface_material(i, material);
} else if (matname != "") { } else if (!matname.is_empty()) {
WARN_PRINT("Collada: Unreferenced material in geometry instance: " + matname); WARN_PRINT("Collada: Unreferenced material in geometry instance: " + matname);
} }
} }
@ -1343,7 +1343,7 @@ void ColladaImport::_fix_param_animation_tracks() {
// test source(s) // test source(s)
String source = ng->source; String source = ng->source;
while (source != "") { while (!source.is_empty()) {
if (collada.state.skin_controller_data_map.has(source)) { if (collada.state.skin_controller_data_map.has(source)) {
const Collada::SkinControllerData &skin = collada.state.skin_controller_data_map[source]; const Collada::SkinControllerData &skin = collada.state.skin_controller_data_map[source];
@ -1796,7 +1796,7 @@ Node *EditorSceneFormatImporterCollada::import_scene(const String &p_path, uint3
AnimationPlayer *ap = memnew(AnimationPlayer); AnimationPlayer *ap = memnew(AnimationPlayer);
for (int i = 0; i < state.animations.size(); i++) { for (int i = 0; i < state.animations.size(); i++) {
String name; String name;
if (state.animations[i]->get_name() == "") { if (state.animations[i]->get_name().is_empty()) {
name = "default"; name = "default";
} else { } else {
name = state.animations[i]->get_name(); name = state.animations[i]->get_name();

View file

@ -113,7 +113,7 @@ Error ResourceImporterCSVTranslation::import(const String &p_source_file, const
while (line.size() == locales.size() + 1) { while (line.size() == locales.size() + 1) {
String key = line[0]; String key = line[0];
if (key != "") { if (!key.is_empty()) {
for (int i = 1; i < line.size(); i++) { for (int i = 1; i < line.size(); i++) {
translations.write[i - 1]->add_message(key, line[i].c_unescape()); translations.write[i - 1]->add_message(key, line[i].c_unescape());
} }

View file

@ -235,7 +235,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
while (l.length() && l[l.length() - 1] == '\\') { while (l.length() && l[l.length() - 1] == '\\') {
String add = f->get_line().strip_edges(); String add = f->get_line().strip_edges();
l += add; l += add;
if (add == String()) { if (add.is_empty()) {
break; break;
} }
} }
@ -301,7 +301,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
surf_tool->set_normal(normals[norm]); surf_tool->set_normal(normals[norm]);
} }
if (face[idx].size() >= 2 && face[idx][1] != String()) { if (face[idx].size() >= 2 && !face[idx][1].is_empty()) {
int uv = face[idx][1].to_int() - 1; int uv = face[idx][1].to_int() - 1;
if (uv < 0) { if (uv < 0) {
uv += uvs.size() + 1; uv += uvs.size() + 1;
@ -363,9 +363,9 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
mesh = surf_tool->commit(mesh, mesh_flags); mesh = surf_tool->commit(mesh, mesh_flags);
if (current_material != String()) { if (!current_material.is_empty()) {
mesh->surface_set_name(mesh->get_surface_count() - 1, current_material.get_basename()); mesh->surface_set_name(mesh->get_surface_count() - 1, current_material.get_basename());
} else if (current_group != String()) { } else if (!current_group.is_empty()) {
mesh->surface_set_name(mesh->get_surface_count() - 1, current_group); mesh->surface_set_name(mesh->get_surface_count() - 1, current_group);
} }

View file

@ -481,7 +481,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<I
fixed_name = _fixstr(name, "convcolonly"); fixed_name = _fixstr(name, "convcolonly");
} }
ERR_FAIL_COND_V(fixed_name == String(), nullptr); ERR_FAIL_COND_V(fixed_name.is_empty(), nullptr);
if (shapes.size()) { if (shapes.size()) {
StaticBody3D *col = memnew(StaticBody3D); StaticBody3D *col = memnew(StaticBody3D);
@ -577,7 +577,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<I
fixed_name = _fixstr(name, "convcol"); fixed_name = _fixstr(name, "convcol");
} }
if (fixed_name != String()) { if (!fixed_name.is_empty()) {
if (mi->get_parent() && !mi->get_parent()->has_node(fixed_name)) { if (mi->get_parent() && !mi->get_parent()->has_node(fixed_name)) {
mi->set_name(fixed_name); mi->set_name(fixed_name);
} }
@ -710,7 +710,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref<
mat_id = mat->get_name(); mat_id = mat->get_name();
} }
if (mat_id != String() && p_material_data.has(mat_id)) { if (!mat_id.is_empty() && p_material_data.has(mat_id)) {
Dictionary matdata = p_material_data[mat_id]; Dictionary matdata = p_material_data[mat_id];
for (int j = 0; j < post_importer_plugins.size(); j++) { for (int j = 0; j < post_importer_plugins.size(); j++) {
@ -1433,7 +1433,7 @@ void ResourceImporterScene::get_import_options(const String &p_path, List<Import
String script_ext_hint; String script_ext_hint;
for (const String &E : script_extentions) { for (const String &E : script_extentions) {
if (script_ext_hint != "") { if (!script_ext_hint.is_empty()) {
script_ext_hint += ","; script_ext_hint += ",";
} }
script_ext_hint += "*." + E; script_ext_hint += "*." + E;
@ -1559,7 +1559,7 @@ void ResourceImporterScene::_generate_meshes(Node *p_node, const Dictionary &p_m
mesh_id = src_mesh_node->get_mesh()->get_name(); mesh_id = src_mesh_node->get_mesh()->get_name();
} }
if (mesh_id != String() && p_mesh_data.has(mesh_id)) { if (!mesh_id.is_empty() && p_mesh_data.has(mesh_id)) {
Dictionary mesh_settings = p_mesh_data[mesh_id]; Dictionary mesh_settings = p_mesh_data[mesh_id];
if (mesh_settings.has("generate/shadow_meshes")) { if (mesh_settings.has("generate/shadow_meshes")) {
@ -1649,7 +1649,7 @@ void ResourceImporterScene::_generate_meshes(Node *p_node, const Dictionary &p_m
} }
} }
if (save_to_file != String()) { if (!save_to_file.is_empty()) {
Ref<Mesh> existing = Ref<Resource>(ResourceCache::get(save_to_file)); Ref<Mesh> existing = Ref<Resource>(ResourceCache::get(save_to_file));
if (existing.is_valid()) { if (existing.is_valid()) {
//if somehow an existing one is useful, create //if somehow an existing one is useful, create
@ -2051,7 +2051,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
String post_import_script_path = p_options["import_script/path"]; String post_import_script_path = p_options["import_script/path"];
Ref<EditorScenePostImport> post_import_script; Ref<EditorScenePostImport> post_import_script;
if (post_import_script_path != "") { if (!post_import_script_path.is_empty()) {
Ref<Script> scr = ResourceLoader::load(post_import_script_path); Ref<Script> scr = ResourceLoader::load(post_import_script_path);
if (!scr.is_valid()) { if (!scr.is_valid()) {
EditorNode::add_io_error(TTR("Couldn't load post-import script:") + " " + post_import_script_path); EditorNode::add_io_error(TTR("Couldn't load post-import script:") + " " + post_import_script_path);

View file

@ -92,7 +92,7 @@ void SceneImportSettings::_fill_material(Tree *p_tree, const Ref<Material> &p_ma
if (p_material->has_meta("import_id")) { if (p_material->has_meta("import_id")) {
import_id = p_material->get_meta("import_id"); import_id = p_material->get_meta("import_id");
has_import_id = true; has_import_id = true;
} else if (p_material->get_name() != "") { } else if (!p_material->get_name().is_empty()) {
import_id = p_material->get_name(); import_id = p_material->get_name();
has_import_id = true; has_import_id = true;
} else { } else {
@ -148,7 +148,7 @@ void SceneImportSettings::_fill_mesh(Tree *p_tree, const Ref<Mesh> &p_mesh, Tree
if (p_mesh->has_meta("import_id")) { if (p_mesh->has_meta("import_id")) {
import_id = p_mesh->get_meta("import_id"); import_id = p_mesh->get_meta("import_id");
has_import_id = true; has_import_id = true;
} else if (p_mesh->get_name() != String()) { } else if (!p_mesh->get_name().is_empty()) {
import_id = p_mesh->get_name(); import_id = p_mesh->get_name();
has_import_id = true; has_import_id = true;
} else { } else {
@ -414,7 +414,7 @@ void SceneImportSettings::_update_camera() {
float rot_y = cam_rot_y; float rot_y = cam_rot_y;
float zoom = cam_zoom; float zoom = cam_zoom;
if (selected_type == "Node" || selected_type == "") { if (selected_type == "Node" || selected_type.is_empty()) {
camera_aabb = contents_aabb; camera_aabb = contents_aabb;
} else { } else {
if (mesh_preview->get_mesh().is_valid()) { if (mesh_preview->get_mesh().is_valid()) {

View file

@ -525,7 +525,7 @@ void ImportDock::_reimport() {
Ref<ResourceImporter> importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(importer_name); Ref<ResourceImporter> importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(importer_name);
ERR_CONTINUE(!importer.is_valid()); ERR_CONTINUE(!importer.is_valid());
String group_file_property = importer->get_option_group_file(); String group_file_property = importer->get_option_group_file();
if (group_file_property != String()) { if (!group_file_property.is_empty()) {
//can import from a group (as in, atlas) //can import from a group (as in, atlas)
ERR_CONTINUE(!params->values.has(group_file_property)); ERR_CONTINUE(!params->values.has(group_file_property));
String group_file = params->values[group_file_property]; String group_file = params->values[group_file_property];

View file

@ -312,7 +312,7 @@ void InspectorDock::_prepare_history() {
Resource *r = Object::cast_to<Resource>(obj); Resource *r = Object::cast_to<Resource>(obj);
if (r->get_path().is_resource_file()) { if (r->get_path().is_resource_file()) {
text = r->get_path().get_file(); text = r->get_path().get_file();
} else if (r->get_name() != String()) { } else if (!r->get_name().is_empty()) {
text = r->get_name(); text = r->get_name();
} else { } else {
text = r->get_class(); text = r->get_class();
@ -460,7 +460,7 @@ void InspectorDock::open_resource(const String &p_type) {
void InspectorDock::set_warning(const String &p_message) { void InspectorDock::set_warning(const String &p_message) {
warning->hide(); warning->hide();
if (p_message != String()) { if (!p_message.is_empty()) {
warning->show(); warning->show();
warning_dialog->set_text(p_message); warning_dialog->set_text(p_message);
} }

View file

@ -75,7 +75,7 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
ur->add_do_property(n, name, path); ur->add_do_property(n, name, path);
} else { } else {
Variant new_value; Variant new_value;
if (p_field == "") { if (p_field.is_empty()) {
// whole value // whole value
new_value = p_value; new_value = p_value;
} else { } else {

View file

@ -552,7 +552,7 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
if (error != error_label->get_text()) { if (error != error_label->get_text()) {
error_label->set_text(error); error_label->set_text(error);
if (error != String()) { if (!error.is_empty()) {
error_panel->show(); error_panel->show();
} else { } else {
error_panel->hide(); error_panel->hide();

View file

@ -761,7 +761,7 @@ void AnimationNodeBlendSpace2DEditor::_notification(int p_what) {
if (error != error_label->get_text()) { if (error != error_label->get_text()) {
error_label->set_text(error); error_label->set_text(error);
if (error != String()) { if (!error.is_empty()) {
error_panel->show(); error_panel->show();
} else { } else {
error_panel->hide(); error_panel->hide();

View file

@ -292,7 +292,7 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
anode = EditorSettings::get_singleton()->get_resource_clipboard(); anode = EditorSettings::get_singleton()->get_resource_clipboard();
ERR_FAIL_COND(!anode.is_valid()); ERR_FAIL_COND(!anode.is_valid());
base_name = anode->get_class(); base_name = anode->get_class();
} else if (add_options[p_idx].type != String()) { } else if (!add_options[p_idx].type.is_empty()) {
AnimationNode *an = Object::cast_to<AnimationNode>(ClassDB::instantiate(add_options[p_idx].type)); AnimationNode *an = Object::cast_to<AnimationNode>(ClassDB::instantiate(add_options[p_idx].type));
ERR_FAIL_COND(!an); ERR_FAIL_COND(!an);
anode = Ref<AnimationNode>(an); anode = Ref<AnimationNode>(an);
@ -600,7 +600,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
String accum; String accum;
for (int i = 0; i < path.get_name_count(); i++) { for (int i = 0; i < path.get_name_count(); i++) {
String name = path.get_name(i); String name = path.get_name(i);
if (accum != String()) { if (!accum.is_empty()) {
accum += "/"; accum += "/";
} }
accum += name; accum += name;
@ -752,7 +752,7 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
if (error != error_label->get_text()) { if (error != error_label->get_text()) {
error_label->set_text(error); error_label->set_text(error);
if (error != String()) { if (!error.is_empty()) {
error_panel->show(); error_panel->show();
} else { } else {
error_panel->hide(); error_panel->hide();
@ -821,13 +821,13 @@ AnimationNodeBlendTreeEditor *AnimationNodeBlendTreeEditor::singleton = nullptr;
void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<AnimationNode> p_node) { void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<AnimationNode> p_node) {
String prev_name = blend_tree->get_node_name(p_node); String prev_name = blend_tree->get_node_name(p_node);
ERR_FAIL_COND(prev_name == String()); ERR_FAIL_COND(prev_name.is_empty());
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node(prev_name)); GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node(prev_name));
ERR_FAIL_COND(!gn); ERR_FAIL_COND(!gn);
const String &new_name = p_text; const String &new_name = p_text;
ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1); ERR_FAIL_COND(new_name.is_empty() || new_name.find(".") != -1 || new_name.find("/") != -1);
if (new_name == prev_name) { if (new_name == prev_name) {
return; //nothing to do return; //nothing to do

View file

@ -190,7 +190,7 @@ void AnimationPlayerEditor::_play_pressed() {
current = animation->get_item_text(animation->get_selected()); current = animation->get_item_text(animation->get_selected());
} }
if (current != "") { if (!current.is_empty()) {
if (current == player->get_assigned_animation()) { if (current == player->get_assigned_animation()) {
player->stop(); //so it won't blend with itself player->stop(); //so it won't blend with itself
} }
@ -207,7 +207,7 @@ void AnimationPlayerEditor::_play_from_pressed() {
current = animation->get_item_text(animation->get_selected()); current = animation->get_item_text(animation->get_selected());
} }
if (current != "") { if (!current.is_empty()) {
float time = player->get_current_animation_position(); float time = player->get_current_animation_position();
if (current == player->get_assigned_animation() && player->is_playing()) { if (current == player->get_assigned_animation() && player->is_playing()) {
@ -228,7 +228,7 @@ void AnimationPlayerEditor::_play_bw_pressed() {
current = animation->get_item_text(animation->get_selected()); current = animation->get_item_text(animation->get_selected());
} }
if (current != "") { if (!current.is_empty()) {
if (current == player->get_assigned_animation()) { if (current == player->get_assigned_animation()) {
player->stop(); //so it won't blend with itself player->stop(); //so it won't blend with itself
} }
@ -245,7 +245,7 @@ void AnimationPlayerEditor::_play_bw_from_pressed() {
current = animation->get_item_text(animation->get_selected()); current = animation->get_item_text(animation->get_selected());
} }
if (current != "") { if (!current.is_empty()) {
float time = player->get_current_animation_position(); float time = player->get_current_animation_position();
if (current == player->get_assigned_animation()) { if (current == player->get_assigned_animation()) {
player->stop(); //so it won't blend with itself player->stop(); //so it won't blend with itself
@ -280,7 +280,7 @@ void AnimationPlayerEditor::_animation_selected(int p_which) {
current = animation->get_item_text(animation->get_selected()); current = animation->get_item_text(animation->get_selected());
} }
if (current != "") { if (!current.is_empty()) {
player->set_assigned_animation(current); player->set_assigned_animation(current);
Ref<Animation> anim = player->get_animation(current); Ref<Animation> anim = player->get_animation(current);
@ -397,7 +397,7 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource)
String path; String path;
//file->set_current_path(current_path); //file->set_current_path(current_path);
if (p_resource->get_path() != "") { if (!p_resource->get_path().is_empty()) {
path = p_resource->get_path(); path = p_resource->get_path();
if (extensions.size()) { if (extensions.size()) {
if (extensions.find(p_resource->get_path().get_extension().to_lower()) == nullptr) { if (extensions.find(p_resource->get_path().get_extension().to_lower()) == nullptr) {
@ -406,7 +406,7 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource)
} }
} else { } else {
if (extensions.size()) { if (extensions.size()) {
if (p_resource->get_name() != "") { if (!p_resource->get_name().is_empty()) {
path = p_resource->get_name() + "." + extensions.front()->get().to_lower(); path = p_resource->get_name() + "." + extensions.front()->get().to_lower();
} else { } else {
String resource_name_snake_case = p_resource->get_class().camelcase_to_underscore(); String resource_name_snake_case = p_resource->get_class().camelcase_to_underscore();
@ -486,7 +486,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
player->stop(); player->stop();
String new_name = name->get_text(); String new_name = name->get_text();
if (new_name == "" || new_name.find(":") != -1 || new_name.find("/") != -1) { if (new_name.is_empty() || new_name.find(":") != -1 || new_name.find("/") != -1) {
error_dialog->set_text(TTR("Invalid animation name!")); error_dialog->set_text(TTR("Invalid animation name!"));
error_dialog->popup_centered(); error_dialog->popup_centered();
return; return;
@ -720,7 +720,7 @@ void AnimationPlayerEditor::_animation_edit() {
void AnimationPlayerEditor::_save_animation(String p_file) { void AnimationPlayerEditor::_save_animation(String p_file) {
String current = animation->get_item_text(animation->get_selected()); String current = animation->get_item_text(animation->get_selected());
if (current != "") { if (!current.is_empty()) {
Ref<Animation> anim = player->get_animation(current); Ref<Animation> anim = player->get_animation(current);
ERR_FAIL_COND(!Object::cast_to<Resource>(*anim)); ERR_FAIL_COND(!Object::cast_to<Resource>(*anim));
@ -1007,7 +1007,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value, bool p_set, bool
updating = true; updating = true;
String current = player->get_assigned_animation(); String current = player->get_assigned_animation();
if (current == "" || !player->has_animation(current)) { if (current.is_empty() || !player->has_animation(current)) {
updating = false; updating = false;
current = ""; current = "";
return; return;
@ -1086,7 +1086,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
} }
Ref<Animation> anim; Ref<Animation> anim;
if (current != String()) { if (!current.is_empty()) {
anim = player->get_animation(current); anim = player->get_animation(current);
} }
@ -1141,7 +1141,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
} }
String name = anim2->get_name(); String name = anim2->get_name();
if (name == "") { if (name.is_empty()) {
name = TTR("Pasted Animation"); name = TTR("Pasted Animation");
} }

View file

@ -438,7 +438,7 @@ void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) {
return; return;
} }
if (base_name == String()) { if (base_name.is_empty()) {
base_name = node->get_class().replace_first("AnimationNode", ""); base_name = node->get_class().replace_first("AnimationNode", "");
} }
@ -927,7 +927,7 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
if (error != error_label->get_text()) { if (error != error_label->get_text()) {
error_label->set_text(error); error_label->set_text(error);
if (error != String()) { if (!error.is_empty()) {
error_panel->show(); error_panel->show();
} else { } else {
error_panel->hide(); error_panel->hide();
@ -1059,7 +1059,7 @@ void AnimationNodeStateMachineEditor::_removed_from_graph() {
void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) { void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
const String &new_name = p_text; const String &new_name = p_text;
ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1); ERR_FAIL_COND(new_name.is_empty() || new_name.find(".") != -1 || new_name.find("/") != -1);
if (new_name == prev_name) { if (new_name == prev_name) {
return; // Nothing to do. return; // Nothing to do.

View file

@ -343,7 +343,7 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
if (p_code != 200) { if (p_code != 200) {
error_text = TTR("Request failed, return code:") + " " + itos(p_code); error_text = TTR("Request failed, return code:") + " " + itos(p_code);
status->set_text(TTR("Failed:") + " " + itos(p_code)); status->set_text(TTR("Failed:") + " " + itos(p_code));
} else if (sha256 != "") { } else if (!sha256.is_empty()) {
String download_sha256 = FileAccess::get_sha256(download->get_download_file()); String download_sha256 = FileAccess::get_sha256(download->get_download_file());
if (sha256 != download_sha256) { if (sha256 != download_sha256) {
error_text = TTR("Bad download hash, assuming file has been tampered with.") + "\n"; error_text = TTR("Bad download hash, assuming file has been tampered with.") + "\n";
@ -354,7 +354,7 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
} break; } break;
} }
if (error_text != String()) { if (!error_text.is_empty()) {
download_error->set_text(TTR("Asset Download Error:") + "\n" + error_text); download_error->set_text(TTR("Asset Download Error:") + "\n" + error_text);
download_error->popup_centered(); download_error->popup_centered();
// Let the user retry the download. // Let the user retry the download.
@ -921,7 +921,7 @@ void EditorAssetLibrary::_search(int p_page) {
support_list += String(support_key[i]) + "+"; support_list += String(support_key[i]) + "+";
} }
} }
if (support_list != String()) { if (!support_list.is_empty()) {
args += "&support=" + support_list.substr(0, support_list.length() - 1); args += "&support=" + support_list.substr(0, support_list.length() - 1);
} }
@ -934,7 +934,7 @@ void EditorAssetLibrary::_search(int p_page) {
args += "&reverse=true"; args += "&reverse=true";
} }
if (filter->get_text() != String()) { if (!filter->get_text().is_empty()) {
args += "&filter=" + filter->get_text().uri_encode(); args += "&filter=" + filter->get_text().uri_encode();
} }
@ -1187,7 +1187,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
library_vb->add_child(asset_bottom_page); library_vb->add_child(asset_bottom_page);
if (result.is_empty()) { if (result.is_empty()) {
if (filter->get_text() != String()) { if (!filter->get_text().is_empty()) {
library_error->set_text( library_error->set_text(
vformat(TTR("No results for \"%s\"."), filter->get_text())); vformat(TTR("No results for \"%s\"."), filter->get_text()));
} else { } else {
@ -1218,7 +1218,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
item->connect("author_selected", callable_mp(this, &EditorAssetLibrary::_select_author)); item->connect("author_selected", callable_mp(this, &EditorAssetLibrary::_select_author));
item->connect("category_selected", callable_mp(this, &EditorAssetLibrary::_select_category)); item->connect("category_selected", callable_mp(this, &EditorAssetLibrary::_select_category));
if (r.has("icon_url") && r["icon_url"] != "") { if (r.has("icon_url") && !r["icon_url"].operator String().is_empty()) {
_request_image(item->get_instance_id(), r["icon_url"], IMAGE_QUEUE_ICON, 0); _request_image(item->get_instance_id(), r["icon_url"], IMAGE_QUEUE_ICON, 0);
} }
} }
@ -1255,7 +1255,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
description->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"], r["version"], r["version_string"], r["description"], r["download_url"], r["browse_url"], r["download_hash"]); description->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"], r["version"], r["version_string"], r["description"], r["download_url"], r["browse_url"], r["download_hash"]);
if (r.has("icon_url") && r["icon_url"] != "") { if (r.has("icon_url") && !r["icon_url"].operator String().is_empty()) {
_request_image(description->get_instance_id(), r["icon_url"], IMAGE_QUEUE_ICON, 0); _request_image(description->get_instance_id(), r["icon_url"], IMAGE_QUEUE_ICON, 0);
} }

View file

@ -1460,7 +1460,7 @@ bool CanvasItemEditor::_gui_input_open_scene_on_double_click(const Ref<InputEven
List<CanvasItem *> selection = _get_edited_canvas_items(); List<CanvasItem *> selection = _get_edited_canvas_items();
if (selection.size() == 1) { if (selection.size() == 1) {
CanvasItem *canvas_item = selection[0]; CanvasItem *canvas_item = selection[0];
if (canvas_item->get_scene_file_path() != "" && canvas_item != editor->get_edited_scene()) { if (!canvas_item->get_scene_file_path().is_empty() && canvas_item != editor->get_edited_scene()) {
editor->open_request(canvas_item->get_scene_file_path()); editor->open_request(canvas_item->get_scene_file_path());
return true; return true;
} }
@ -5843,7 +5843,7 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons
return false; return false;
} }
if (editor->get_edited_scene()->get_scene_file_path() != "") { // cyclical instancing if (!editor->get_edited_scene()->get_scene_file_path().is_empty()) { // cyclical instancing
if (_cyclical_dependency_exists(editor->get_edited_scene()->get_scene_file_path(), instantiated_scene)) { if (_cyclical_dependency_exists(editor->get_edited_scene()->get_scene_file_path(), instantiated_scene)) {
memdelete(instantiated_scene); memdelete(instantiated_scene);
return false; return false;

View file

@ -477,7 +477,7 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size
} }
String code = scr->get_source_code().strip_edges(); String code = scr->get_source_code().strip_edges();
if (code == "") { if (code.is_empty()) {
return Ref<Texture2D>(); return Ref<Texture2D>();
} }

View file

@ -34,7 +34,7 @@ void GPUParticlesCollisionSDF3DEditorPlugin::_bake() {
if (col_sdf) { if (col_sdf) {
if (col_sdf->get_texture().is_null() || !col_sdf->get_texture()->get_path().is_resource_file()) { if (col_sdf->get_texture().is_null() || !col_sdf->get_texture()->get_path().is_resource_file()) {
String path = get_tree()->get_edited_scene_root()->get_scene_file_path(); String path = get_tree()->get_edited_scene_root()->get_scene_file_path();
if (path == String()) { if (path.is_empty()) {
path = "res://" + col_sdf->get_name() + "_data.exr"; path = "res://" + col_sdf->get_name() + "_data.exr";
} else { } else {
String ext = path.get_extension(); String ext = path.get_extension();

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