diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-10-05 20:44:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 20:44:50 +0200 |
commit | 437e0be8112a81344fd9b2474644ab8cf0b60885 (patch) | |
tree | 3fd5c14fd46ee1f65f3308d6a2286230b0d1c09d /editor | |
parent | 437a9393b741e182d0ca6ecfb65d9f0c1430d955 (diff) | |
parent | 7b76f8783f438c381466108f7fd3150afcb9070a (diff) |
Merge pull request #42577 from fire/japanese-bone-name-gltf-master
Better non alphanumeric bone names.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/import/editor_scene_importer_gltf.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 0c67c769ef..266df78949 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -184,8 +184,11 @@ String EditorSceneImporterGLTF::_gen_unique_name(GLTFState &state, const String String EditorSceneImporterGLTF::_sanitize_bone_name(const String &name) { String p_name = name.camelcase_to_underscore(true); - RegEx pattern_del("([^a-zA-Z0-9_ ])+"); - p_name = pattern_del.sub(p_name, "", true); + RegEx pattern_nocolon(":"); + p_name = pattern_nocolon.sub(p_name, "_", true); + + RegEx pattern_noslash("/"); + p_name = pattern_noslash.sub(p_name, "_", true); RegEx pattern_nospace(" +"); p_name = pattern_nospace.sub(p_name, "_", true); @@ -200,8 +203,10 @@ String EditorSceneImporterGLTF::_sanitize_bone_name(const String &name) { } String EditorSceneImporterGLTF::_gen_unique_bone_name(GLTFState &state, const GLTFSkeletonIndex skel_i, const String &p_name) { - const String s_name = _sanitize_bone_name(p_name); - + String s_name = _sanitize_bone_name(p_name); + if (s_name.empty()) { + s_name = "bone"; + } String name; int index = 1; while (true) { |