summaryrefslogtreecommitdiff
path: root/scene/main/node.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 /scene/main/node.cpp
parent18bb36707fb7e2d940e3698a7ffa097be23cb69b (diff)
parent61cc1c8624cdf2ef56b807c70f76dd96cc0ebcb7 (diff)
Merge pull request #45545 from abaire/relaxes_gltf_name_sanitization
Relaxes node name sanitization in gltf documents.
Diffstat (limited to 'scene/main/node.cpp')
-rw-r--r--scene/main/node.cpp16
1 files changed, 1 insertions, 15 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 9d8c7981e6..137e1726f9 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1021,22 +1021,8 @@ void Node::_set_name_nocheck(const StringName &p_name) {
data.name = p_name;
}
-String Node::invalid_character = ". : @ / \"";
-
-bool Node::_validate_node_name(String &p_name) {
- String name = p_name;
- Vector<String> chars = Node::invalid_character.split(" ");
- for (int i = 0; i < chars.size(); i++) {
- name = name.replace(chars[i], "");
- }
- bool is_valid = name == p_name;
- p_name = name;
- return is_valid;
-}
-
void Node::set_name(const String &p_name) {
- String name = p_name;
- _validate_node_name(name);
+ String name = p_name.validate_node_name();
ERR_FAIL_COND(name == "");
data.name = name;