Merge pull request #15118 from dback2/avatarExporterDuplicateJointNames

Case 21060: Avatar Exporter v0.3.2 - New jointRotationOffset field
This commit is contained in:
John Conklin II 2019-03-08 14:13:44 -08:00 committed by GitHub
commit b80421ccf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 10 deletions

View file

@ -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.3.1";
static readonly string AVATAR_EXPORTER_VERSION = "0.3.2";
static readonly float HIPS_GROUND_MIN_Y = 0.01f;
static readonly float HIPS_SPINE_CHEST_MIN_SEPARATION = 0.001f;
@ -621,13 +621,10 @@ class AvatarExporter : MonoBehaviour {
// generate joint rotation offsets for both humanoid-mapped bones as well as extra unmapped bones
Quaternion jointOffset = new Quaternion();
string outputJointName = "";
if (userBoneInfo.HasHumanMapping()) {
outputJointName = HUMANOID_TO_HIFI_JOINT_NAME[userBoneInfo.humanName];
Quaternion rotation = REFERENCE_ROTATIONS[userBoneInfo.humanName];
jointOffset = Quaternion.Inverse(userBoneInfo.rotation) * rotation;
} else {
outputJointName = userBoneName;
jointOffset = Quaternion.Inverse(userBoneInfo.rotation);
string lastRequiredParent = FindLastRequiredAncestorBone(userBoneName);
if (lastRequiredParent != "root") {
@ -639,11 +636,9 @@ class AvatarExporter : MonoBehaviour {
}
// swap from left-handed (Unity) to right-handed (HiFi) coordinates and write out joint rotation offset to fst
if (!string.IsNullOrEmpty(outputJointName)) {
jointOffset = new Quaternion(-jointOffset.x, jointOffset.y, jointOffset.z, -jointOffset.w);
File.AppendAllText(exportFstPath, "jointRotationOffset = " + outputJointName + " = (" + jointOffset.x + ", " +
jointOffset.y + ", " + jointOffset.z + ", " + jointOffset.w + ")\n");
}
jointOffset = new Quaternion(-jointOffset.x, jointOffset.y, jointOffset.z, -jointOffset.w);
File.AppendAllText(exportFstPath, "jointRotationOffset2 = " + userBoneName + " = (" + jointOffset.x + ", " +
jointOffset.y + ", " + jointOffset.z + ", " + jointOffset.w + ")\n");
}
// if there is any material data to save then write out all materials in JSON material format to the materialMap field

View file

@ -1,6 +1,6 @@
High Fidelity, Inc.
Avatar Exporter
Version 0.3.1
Version 0.3.2
Note: It is recommended to use Unity versions between 2017.4.17f1 and 2018.2.12f1 for this Avatar Exporter.