Skip to content

Commit

Permalink
use default bone name.
Browse files Browse the repository at this point in the history
  • Loading branch information
binzume committed Feb 1, 2020
1 parent e37ce29 commit a588431
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions vrm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,24 @@ 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)
} else {
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
Expand Down

0 comments on commit a588431

Please sign in to comment.