diff --git a/vrm/config.go b/vrm/config.go index 7d21c17..d359268 100644 --- a/vrm/config.go +++ b/vrm/config.go @@ -80,10 +80,12 @@ func ApplyConfig(doc *VRMDocument, conf *Config) { } } + found := map[string]bool{} ext.Humanoid.Bones = []*Bone{} for _, mapping := range conf.BoneMappings { if id, ok := nodeMap[mapping.NodeName]; ok { var b = mapping.Bone + found[mapping.Bone.Bone] = true b.Node = id b.UseDefaultValues = b.UseDefaultValues || b.Min == nil && b.Max == nil && b.Center == nil ext.Humanoid.Bones = append(ext.Humanoid.Bones, &b) @@ -91,6 +93,11 @@ func ApplyConfig(doc *VRMDocument, conf *Config) { log.Println("Bone node not found:", mapping.NodeName) } } + for _, name := range RequiredBones { + if id, ok := nodeMap[name]; ok && !found[name] { + ext.Humanoid.Bones = append(ext.Humanoid.Bones, &Bone{Bone: name, Node: id, UseDefaultValues: true}) + } + } for _, boneGroup := range conf.AnimationBoneGroups { var b = boneGroup.SecondaryAnimationBoneGroup