Skip to content

Commit

Permalink
Use the skin node name when there's no unambiguous root bone.
Browse files Browse the repository at this point in the history
  • Loading branch information
kythyria committed Aug 4, 2021
1 parent 29cdc9e commit cd119b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion PD2ModelParser/Importers/GltfImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,9 @@ void ImportSkin(GLTF.Node node, DM.Model model)
skinBones = new DM.SkinBones();

skinBones.global_skin_transform = Matrix4x4.Identity;
var rootBoneName = node.Skin.Skeleton?.Name ?? node.Skin.Name;
var parent = data.SectionsOfType<DM.Object3D>()
.FirstOrDefault(i => i.Name == node.Skin.Skeleton.Name);
.FirstOrDefault(i => i.Name == rootBoneName);
skinBones.ProbablyRootBone = parent;
// I have no idea if this is universal. It looks like it might be.
// TODO: For skinned meshes, does mesh.Parent == mesh.SkinBones.probably_root_bone?
Expand Down

0 comments on commit cd119b9

Please sign in to comment.