mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-28 22:29:54 +02:00
Merge pull request #14967 from dback2/avatarExporterRootName
Case 21073: Avatar Exporter v0.3 - use root bone name from skeleton list
This commit is contained in:
commit
db4a33e24a
3 changed files with 19 additions and 9 deletions
|
@ -14,7 +14,7 @@ using System.Collections.Generic;
|
|||
|
||||
class AvatarExporter : MonoBehaviour {
|
||||
// update version number for every PR that changes this file, also set updated version in README file
|
||||
static readonly string AVATAR_EXPORTER_VERSION = "0.2";
|
||||
static readonly string AVATAR_EXPORTER_VERSION = "0.3";
|
||||
|
||||
static readonly float HIPS_GROUND_MIN_Y = 0.01f;
|
||||
static readonly float HIPS_SPINE_CHEST_MIN_SEPARATION = 0.001f;
|
||||
|
@ -630,12 +630,14 @@ class AvatarExporter : MonoBehaviour {
|
|||
string boneName = modelBone.name;
|
||||
if (modelBone.parent == null) {
|
||||
// if no parent then this is actual root bone node of the user avatar, so consider it's parent as "root"
|
||||
boneName = GetRootBoneName(); // ensure we use the root bone name from the skeleton list for consistency
|
||||
userBoneTree = new BoneTreeNode(boneName); // initialize root of tree
|
||||
userBoneInfo.parentName = "root";
|
||||
userBoneInfo.boneTreeNode = userBoneTree;
|
||||
} else {
|
||||
// otherwise add this bone node as a child to it's parent's children list
|
||||
string parentName = modelBone.parent.name;
|
||||
// if its a child of the root bone, use the root bone name from the skeleton list as the parent for consistency
|
||||
string parentName = modelBone.parent.parent == null ? GetRootBoneName() : modelBone.parent.name;
|
||||
BoneTreeNode boneTreeNode = new BoneTreeNode(boneName);
|
||||
userBoneInfos[parentName].boneTreeNode.children.Add(boneTreeNode);
|
||||
userBoneInfo.parentName = parentName;
|
||||
|
@ -682,6 +684,14 @@ class AvatarExporter : MonoBehaviour {
|
|||
}
|
||||
}
|
||||
|
||||
static string GetRootBoneName() {
|
||||
// the "root" bone is the first element in the human skeleton bone list
|
||||
if (humanDescription.skeleton.Length > 0) {
|
||||
return humanDescription.skeleton[0].name;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static void SetFailedBoneRules() {
|
||||
failedBoneRules.Clear();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
High Fidelity, Inc.
|
||||
Avatar Exporter
|
||||
Version 0.2
|
||||
Version 0.3
|
||||
|
||||
|
||||
Note: It is recommended to use Unity versions between 2017.4.17f1 and 2018.2.12f1 for this Avatar Exporter.
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue