mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-15 12:35:25 +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 {
|
class AvatarExporter : MonoBehaviour {
|
||||||
// update version number for every PR that changes this file, also set updated version in README file
|
// 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_GROUND_MIN_Y = 0.01f;
|
||||||
static readonly float HIPS_SPINE_CHEST_MIN_SEPARATION = 0.001f;
|
static readonly float HIPS_SPINE_CHEST_MIN_SEPARATION = 0.001f;
|
||||||
|
@ -630,12 +630,14 @@ class AvatarExporter : MonoBehaviour {
|
||||||
string boneName = modelBone.name;
|
string boneName = modelBone.name;
|
||||||
if (modelBone.parent == null) {
|
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"
|
// 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
|
userBoneTree = new BoneTreeNode(boneName); // initialize root of tree
|
||||||
userBoneInfo.parentName = "root";
|
userBoneInfo.parentName = "root";
|
||||||
userBoneInfo.boneTreeNode = userBoneTree;
|
userBoneInfo.boneTreeNode = userBoneTree;
|
||||||
} else {
|
} else {
|
||||||
// otherwise add this bone node as a child to it's parent's children list
|
// 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);
|
BoneTreeNode boneTreeNode = new BoneTreeNode(boneName);
|
||||||
userBoneInfos[parentName].boneTreeNode.children.Add(boneTreeNode);
|
userBoneInfos[parentName].boneTreeNode.children.Add(boneTreeNode);
|
||||||
userBoneInfo.parentName = parentName;
|
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() {
|
static void SetFailedBoneRules() {
|
||||||
failedBoneRules.Clear();
|
failedBoneRules.Clear();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
High Fidelity, Inc.
|
High Fidelity, Inc.
|
||||||
Avatar Exporter
|
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.
|
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