summaryrefslogtreecommitdiffstats
path: root/core/string/ustring.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-03-09 14:54:33 +0100
committerGitHub <noreply@github.com>2021-03-09 14:54:33 +0100
commit83b1acdc60028ba3368ae841800f5813a1f2e775 (patch)
tree7ece3c90c9925f2c9488f7514e84bcbbd6a2c35c /core/string/ustring.cpp
parent18bb36707fb7e2d940e3698a7ffa097be23cb69b (diff)
parent61cc1c8624cdf2ef56b807c70f76dd96cc0ebcb7 (diff)
downloadredot-engine-83b1acdc60028ba3368ae841800f5813a1f2e775.tar.gz
Merge pull request #45545 from abaire/relaxes_gltf_name_sanitization
Relaxes node name sanitization in gltf documents.
Diffstat (limited to 'core/string/ustring.cpp')
-rw-r--r--core/string/ustring.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index a57c7b2504..9f931ef30b 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -4394,6 +4394,18 @@ String String::property_name_encode() const {
return *this;
}
+// Changes made to the set of invalid characters must also be reflected in the String documentation.
+const String String::invalid_node_name_characters = ". : @ / \"";
+
+String String::validate_node_name() const {
+ Vector<String> chars = String::invalid_node_name_characters.split(" ");
+ String name = this->replace(chars[0], "");
+ for (int i = 1; i < chars.size(); i++) {
+ name = name.replace(chars[i], "");
+ }
+ return name;
+}
+
String String::get_basename() const {
int pos = rfind(".");
if (pos < 0 || pos < MAX(rfind("/"), rfind("\\"))) {