fix(gltf): strip armature prefix from bone names in FurnitureGlbParser
Strip pipe-delimited armature prefixes (e.g., "MyRig|body" -> "body") from bone names in parseSeatSkeleton and remapSeatAnimations, matching the existing stripping already present in GlbParser. Without this, isKnownBone checks fail when Blender exports prefixed bone names.
This commit is contained in:
@@ -1216,6 +1216,10 @@ public final class FurnitureGlbParser {
|
|||||||
String name = node.has("name")
|
String name = node.has("name")
|
||||||
? node.get("name").getAsString()
|
? node.get("name").getAsString()
|
||||||
: "joint_" + j;
|
: "joint_" + j;
|
||||||
|
// Strip armature prefix (e.g., "MyRig|body" -> "body")
|
||||||
|
if (name.contains("|")) {
|
||||||
|
name = name.substring(name.lastIndexOf('|') + 1);
|
||||||
|
}
|
||||||
if (GltfBoneMapper.isKnownBone(name)) {
|
if (GltfBoneMapper.isKnownBone(name)) {
|
||||||
skinJointRemap[j] = filteredJointNodes.size();
|
skinJointRemap[j] = filteredJointNodes.size();
|
||||||
filteredJointNodes.add(nodeIdx);
|
filteredJointNodes.add(nodeIdx);
|
||||||
@@ -1257,9 +1261,13 @@ public final class FurnitureGlbParser {
|
|||||||
int nodeIdx = filteredJointNodes.get(j);
|
int nodeIdx = filteredJointNodes.get(j);
|
||||||
JsonObject node = nodes.get(nodeIdx).getAsJsonObject();
|
JsonObject node = nodes.get(nodeIdx).getAsJsonObject();
|
||||||
|
|
||||||
jointNames[j] = node.has("name")
|
String rawBoneName = node.has("name")
|
||||||
? node.get("name").getAsString()
|
? node.get("name").getAsString()
|
||||||
: "joint_" + j;
|
: "joint_" + j;
|
||||||
|
// Strip armature prefix consistently
|
||||||
|
jointNames[j] = rawBoneName.contains("|")
|
||||||
|
? rawBoneName.substring(rawBoneName.lastIndexOf('|') + 1)
|
||||||
|
: rawBoneName;
|
||||||
|
|
||||||
if (node.has("rotation")) {
|
if (node.has("rotation")) {
|
||||||
JsonArray r = node.getAsJsonArray("rotation");
|
JsonArray r = node.getAsJsonArray("rotation");
|
||||||
@@ -1432,6 +1440,10 @@ public final class FurnitureGlbParser {
|
|||||||
String name = node.has("name")
|
String name = node.has("name")
|
||||||
? node.get("name").getAsString()
|
? node.get("name").getAsString()
|
||||||
: "joint_" + j;
|
: "joint_" + j;
|
||||||
|
// Strip armature prefix (e.g., "MyRig|body" -> "body")
|
||||||
|
if (name.contains("|")) {
|
||||||
|
name = name.substring(name.lastIndexOf('|') + 1);
|
||||||
|
}
|
||||||
if (GltfBoneMapper.isKnownBone(name)) {
|
if (GltfBoneMapper.isKnownBone(name)) {
|
||||||
filteredJointNodes.add(nodeIdx);
|
filteredJointNodes.add(nodeIdx);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user