summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-21 09:21:32 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-21 09:21:32 +0100
commit4f3ec4121a4e1f45d64750c6b3bf66f1299ca501 (patch)
tree0f234f4b6376d51a031e332f8ed064d607910c30
parent6b4a01f99ab8978ee115c13b4900a222e7b4e449 (diff)
parent522d4243bfd2fcb5de7597e7829ad3b99df68244 (diff)
Merge pull request #70350 from Chaosus/stringname_operator
Add missing != operator to `StringName`
-rw-r--r--core/string/string_name.cpp4
-rw-r--r--core/string/string_name.h1
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp2
-rw-r--r--servers/rendering/shader_language.cpp2
4 files changed, 7 insertions, 2 deletions
diff --git a/core/string/string_name.cpp b/core/string/string_name.cpp
index 9c4fc4e1b7..64d49b8b93 100644
--- a/core/string/string_name.cpp
+++ b/core/string/string_name.cpp
@@ -169,6 +169,10 @@ bool StringName::operator!=(const String &p_name) const {
return !(operator==(p_name));
}
+bool StringName::operator!=(const char *p_name) const {
+ return !(operator==(p_name));
+}
+
bool StringName::operator!=(const StringName &p_name) const {
// the real magic of all this mess happens here.
// this is why path comparisons are very fast
diff --git a/core/string/string_name.h b/core/string/string_name.h
index ff4c41af94..6a2420e02a 100644
--- a/core/string/string_name.h
+++ b/core/string/string_name.h
@@ -102,6 +102,7 @@ public:
bool operator==(const String &p_name) const;
bool operator==(const char *p_name) const;
bool operator!=(const String &p_name) const;
+ bool operator!=(const char *p_name) const;
_FORCE_INLINE_ bool is_node_unique_name() const {
if (!_data) {
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index cf811067c9..c93b0019dc 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -1263,7 +1263,7 @@ Dictionary VisualShaderEditor::get_custom_node_data(Ref<VisualShaderNodeCustom>
void VisualShaderEditor::update_custom_type(const Ref<Resource> &p_resource) {
Ref<Script> scr = Ref<Script>(p_resource.ptr());
- if (scr.is_null() || scr->get_instance_base_type() != String("VisualShaderNodeCustom")) {
+ if (scr.is_null() || scr->get_instance_base_type() != "VisualShaderNodeCustom") {
return;
}
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index e451fb35c2..512995dd83 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -4417,7 +4417,7 @@ bool ShaderLanguage::_is_operator_assign(Operator p_op) const {
}
bool ShaderLanguage::_validate_varying_assign(ShaderNode::Varying &p_varying, String *r_message) {
- if (current_function != String("vertex") && current_function != String("fragment")) {
+ if (current_function != "vertex" && current_function != "fragment") {
*r_message = vformat(RTR("Varying may not be assigned in the '%s' function."), current_function);
return false;
}