summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorAnilforextra <anilforextra@gmail.com>2022-02-03 21:48:38 +0545
committerAnilforextra <anilforextra@gmail.com>2022-02-04 01:28:02 +0545
commitadbe948bda202209b55249198e1837324e703ddb (patch)
treea7f424318e1d944e0564edb6fc55e8eabf266bd0 /scene/resources
parentbf12719ccabcea9bf9b274f77511e02581678774 (diff)
String: Add contains().
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/resource_format_text.cpp4
-rw-r--r--scene/resources/theme.cpp4
-rw-r--r--scene/resources/visual_shader.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 1b81455d4c..6bb710b1d9 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -430,7 +430,7 @@ Error ResourceLoaderText::load() {
}
}
- if (path.find("://") == -1 && path.is_relative_path()) {
+ if (!path.contains("://") && path.is_relative_path()) {
// path is relative to file being loaded, so convert to a resource path
path = ProjectSettings::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
}
@@ -774,7 +774,7 @@ void ResourceLoaderText::get_dependencies(FileAccess *p_f, List<String> *p_depen
}
}
- if (!using_uid && path.find("://") == -1 && path.is_relative_path()) {
+ if (!using_uid && !path.contains("://") && path.is_relative_path()) {
// path is relative to file being loaded, so convert to a resource path
path = ProjectSettings::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
}
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 8da287042e..f962e55666 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -46,7 +46,7 @@ int Theme::fallback_font_size = 16;
bool Theme::_set(const StringName &p_name, const Variant &p_value) {
String sname = p_name;
- if (sname.find("/") != -1) {
+ if (sname.contains("/")) {
String type = sname.get_slicec('/', 1);
String theme_type = sname.get_slicec('/', 0);
String name = sname.get_slicec('/', 2);
@@ -78,7 +78,7 @@ bool Theme::_set(const StringName &p_name, const Variant &p_value) {
bool Theme::_get(const StringName &p_name, Variant &r_ret) const {
String sname = p_name;
- if (sname.find("/") != -1) {
+ if (sname.contains("/")) {
String type = sname.get_slicec('/', 1);
String theme_type = sname.get_slicec('/', 0);
String name = sname.get_slicec('/', 2);
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 4bc62e7617..303d3d65c1 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -3044,7 +3044,7 @@ String VisualShaderNodeOutput::generate_code(Shader::Mode p_mode, VisualShader::
if (ports[idx].mode == shader_mode && ports[idx].shader_type == shader_type) {
if (!p_input_vars[count].is_empty()) {
String s = ports[idx].string;
- if (s.find(":") != -1) {
+ if (s.contains(":")) {
code += " " + s.get_slicec(':', 0) + " = " + p_input_vars[count] + "." + s.get_slicec(':', 1) + ";\n";
} else {
code += " " + s + " = " + p_input_vars[count] + ";\n";