You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
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:
@@ -510,7 +510,7 @@ bool SceneTree::process(double p_time) {
|
||||
cpath = fallback->get_path();
|
||||
}
|
||||
if (cpath != env_path) {
|
||||
if (env_path != String()) {
|
||||
if (!env_path.is_empty()) {
|
||||
fallback = ResourceLoader::load(env_path);
|
||||
if (fallback.is_null()) {
|
||||
//could not load fallback, set as empty
|
||||
@@ -1290,7 +1290,7 @@ void SceneTree::get_argument_options(const StringName &p_function, int p_idx, Li
|
||||
dir_access->list_dir_begin();
|
||||
String filename = dir_access->get_next();
|
||||
|
||||
while (filename != "") {
|
||||
while (!filename.is_empty()) {
|
||||
if (filename == "." || filename == "..") {
|
||||
filename = dir_access->get_next();
|
||||
continue;
|
||||
@@ -1400,7 +1400,7 @@ SceneTree::SceneTree() {
|
||||
ResourceLoader::get_recognized_extensions_for_type("Environment", &exts);
|
||||
String ext_hint;
|
||||
for (const String &E : exts) {
|
||||
if (ext_hint != String()) {
|
||||
if (!ext_hint.is_empty()) {
|
||||
ext_hint += ",";
|
||||
}
|
||||
ext_hint += "*." + E;
|
||||
@@ -1410,7 +1410,7 @@ SceneTree::SceneTree() {
|
||||
// Setup property.
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/environment/defaults/default_environment", PropertyInfo(Variant::STRING, "rendering/viewport/default_environment", PROPERTY_HINT_FILE, ext_hint));
|
||||
env_path = env_path.strip_edges();
|
||||
if (env_path != String()) {
|
||||
if (!env_path.is_empty()) {
|
||||
Ref<Environment> env = ResourceLoader::load(env_path);
|
||||
if (env.is_valid()) {
|
||||
root->get_world_3d()->set_fallback_environment(env);
|
||||
|
||||
Reference in New Issue
Block a user