diff options
author | abaire <erik.abair@gmail.com> | 2021-01-28 12:48:12 -0800 |
---|---|---|
committer | Erik Abair <erik.abair@gmail.com> | 2021-02-24 08:22:27 -0800 |
commit | 61cc1c8624cdf2ef56b807c70f76dd96cc0ebcb7 (patch) | |
tree | 6e941c9222b788269c31352afeda108254e918fb /core/string | |
parent | e5bb89cdd5e92fa6fdeff78aad08bf0cbfbcc692 (diff) |
Relaxes Node naming constraints in glTF documents to match the Editor.
Diffstat (limited to 'core/string')
-rw-r--r-- | core/string/ustring.cpp | 12 | ||||
-rw-r--r-- | core/string/ustring.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index 59fda65d43..5118adf3da 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -4364,6 +4364,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("\\"))) { diff --git a/core/string/ustring.h b/core/string/ustring.h index 821941036f..1e362d7683 100644 --- a/core/string/ustring.h +++ b/core/string/ustring.h @@ -419,6 +419,10 @@ public: String property_name_encode() const; + // node functions + static const String invalid_node_name_characters; + String validate_node_name() const; + bool is_valid_identifier() const; bool is_valid_integer() const; bool is_valid_float() const; |