summaryrefslogtreecommitdiff
path: root/modules/gltf/gltf_document.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-03-16 23:31:34 +0100
committerGitHub <noreply@github.com>2021-03-16 23:31:34 +0100
commitd06a624a2d3278807dcd83f579fd67eb0463d3af (patch)
treef19a3a0fe7ee53f90fa9ec60bd3cfedec0c69cc5 /modules/gltf/gltf_document.cpp
parentfbba496db5bf904d54993145f5bb52a1709f7364 (diff)
parentc203fbfa8c4b4fe27cd29b03fa1d3ad068c9bef1 (diff)
Merge pull request #47074 from fire/unlock-bone-names
Expand bone name possibilities.
Diffstat (limited to 'modules/gltf/gltf_document.cpp')
-rw-r--r--modules/gltf/gltf_document.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index 0a4d4055b4..caf8e3f48f 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -63,7 +63,6 @@
#ifdef MODULE_GRIDMAP_ENABLED
#include "modules/gridmap/grid_map.h"
#endif // MODULE_GRIDMAP_ENABLED
-#include "modules/regex/regex.h"
#include "scene/2d/node_2d.h"
#include "scene/3d/bone_attachment_3d.h"
#include "scene/3d/camera_3d.h"
@@ -505,25 +504,11 @@ String GLTFDocument::_gen_unique_animation_name(Ref<GLTFState> state, const Stri
return name;
}
-String GLTFDocument::_sanitize_bone_name(const String &name) {
- String p_name = name.camelcase_to_underscore(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);
-
- RegEx pattern_multiple("_+");
- p_name = pattern_multiple.sub(p_name, "_", true);
-
- RegEx pattern_padded("0+(\\d+)");
- p_name = pattern_padded.sub(p_name, "$1", true);
-
- return p_name;
+String GLTFDocument::_sanitize_bone_name(const String &p_name) {
+ String name = p_name;
+ name = name.replace(":", "_");
+ name = name.replace("/", "_");
+ return name;
}
String GLTFDocument::_gen_unique_bone_name(Ref<GLTFState> state, const GLTFSkeletonIndex skel_i, const String &p_name) {