Merge pull request #45545 from abaire/relaxes_gltf_name_sanitization

Relaxes node name sanitization in gltf documents.
This commit is contained in:
Rémi Verschelde 2021-03-09 14:54:33 +01:00 committed by GitHub
commit 83b1acdc60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 99 additions and 34 deletions

View file

@ -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("\\"))) {