From 23f7bdf4a9462574bd8c5f4e3edb9505dee10a4e Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 28 Feb 2023 17:28:03 +0900 Subject: [PATCH 01/10] update spec --- vrm-specification | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vrm-specification b/vrm-specification index 993a90a5b..29195d565 160000 --- a/vrm-specification +++ b/vrm-specification @@ -1 +1 @@ -Subproject commit 993a90a5bda9025f3d9e2923ad6dea7506f88553 +Subproject commit 29195d5659d4af3d936204ac1bda4d784ce406a8 From 061c7e9acc3699bc180af92c740c12c1519c57b4 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 28 Feb 2023 17:29:21 +0900 Subject: [PATCH 02/10] generate --- .../VRM10/Editor/Vrm10SerializerGenerator.cs | 6 + Assets/VRM10/Runtime/Format/Animation.meta | 8 + .../Format/Animation/Deserializer.g.cs | 2477 +++++++++++++++++ .../Format/Animation/Deserializer.g.cs.meta | 11 + .../Runtime/Format/Animation/Format.g.cs | 307 ++ .../Runtime/Format/Animation/Format.g.cs.meta | 11 + .../Runtime/Format/Animation/Serializer.g.cs | 2171 +++++++++++++++ .../Format/Animation/Serializer.g.cs.meta | 11 + 8 files changed, 5002 insertions(+) create mode 100644 Assets/VRM10/Runtime/Format/Animation.meta create mode 100644 Assets/VRM10/Runtime/Format/Animation/Deserializer.g.cs create mode 100644 Assets/VRM10/Runtime/Format/Animation/Deserializer.g.cs.meta create mode 100644 Assets/VRM10/Runtime/Format/Animation/Format.g.cs create mode 100644 Assets/VRM10/Runtime/Format/Animation/Format.g.cs.meta create mode 100644 Assets/VRM10/Runtime/Format/Animation/Serializer.g.cs create mode 100644 Assets/VRM10/Runtime/Format/Animation/Serializer.g.cs.meta diff --git a/Assets/VRM10/Editor/Vrm10SerializerGenerator.cs b/Assets/VRM10/Editor/Vrm10SerializerGenerator.cs index 84a3214b4..f22a16105 100644 --- a/Assets/VRM10/Editor/Vrm10SerializerGenerator.cs +++ b/Assets/VRM10/Editor/Vrm10SerializerGenerator.cs @@ -73,6 +73,12 @@ namespace UniVRM10 $"{SPEC_DIR}/VRMC_node_constraint-1.0/schema/VRMC_node_constraint.schema.json", "Assets/VRM10/Runtime/Format/Constraints" ), + + // VRMC_animation + new GenerateInfo( + $"{SPEC_DIR}/VRMC_vrm_animation-1.0/schema/VRMC_vrm_animation.schema.json", + "Assets/VRM10/Runtime/Format/Animation" + ), }; foreach (var arg in args) diff --git a/Assets/VRM10/Runtime/Format/Animation.meta b/Assets/VRM10/Runtime/Format/Animation.meta new file mode 100644 index 000000000..4503b5bf7 --- /dev/null +++ b/Assets/VRM10/Runtime/Format/Animation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8d15d1d42c630e94faaf48208777a17a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10/Runtime/Format/Animation/Deserializer.g.cs b/Assets/VRM10/Runtime/Format/Animation/Deserializer.g.cs new file mode 100644 index 000000000..ce629ef61 --- /dev/null +++ b/Assets/VRM10/Runtime/Format/Animation/Deserializer.g.cs @@ -0,0 +1,2477 @@ +// This file is generated from JsonSchema. Don't modify this source code. +using UniJSON; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace UniGLTF.Extensions.VRMC_vrm_animation { + +public static class GltfDeserializer +{ + public static readonly Utf8String ExtensionNameUtf8 = Utf8String.From(VRMC_vrm_animation.ExtensionName); + +public static bool TryGet(UniGLTF.glTFExtension src, out VRMC_vrm_animation extension) +{ + if(src is UniGLTF.glTFExtensionImport extensions) + { + foreach(var kv in extensions.ObjectItems()) + { + if(kv.Key.GetUtf8String() == ExtensionNameUtf8) + { + extension = Deserialize(kv.Value); + return true; + } + } + } + + extension = default; + return false; +} + + +public static VRMC_vrm_animation Deserialize(JsonNode parsed) +{ + var value = new VRMC_vrm_animation(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="specVersion"){ + value.SpecVersion = kv.Value.GetString(); + continue; + } + + if(key=="humanoid"){ + value.Humanoid = Deserialize_Humanoid(kv.Value); + continue; + } + + if(key=="expressions"){ + value.Expressions = Deserialize_Expressions(kv.Value); + continue; + } + + if(key=="lookAt"){ + value.LookAt = Deserialize_LookAt(kv.Value); + continue; + } + + } + return value; +} + +public static Humanoid Deserialize_Humanoid(JsonNode parsed) +{ + var value = new Humanoid(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="hips"){ + value.Hips = __humanoid_Deserialize_Hips(kv.Value); + continue; + } + + if(key=="spine"){ + value.Spine = __humanoid_Deserialize_Spine(kv.Value); + continue; + } + + if(key=="chest"){ + value.Chest = __humanoid_Deserialize_Chest(kv.Value); + continue; + } + + if(key=="upperChest"){ + value.UpperChest = __humanoid_Deserialize_UpperChest(kv.Value); + continue; + } + + if(key=="neck"){ + value.Neck = __humanoid_Deserialize_Neck(kv.Value); + continue; + } + + if(key=="head"){ + value.Head = __humanoid_Deserialize_Head(kv.Value); + continue; + } + + if(key=="jaw"){ + value.Jaw = __humanoid_Deserialize_Jaw(kv.Value); + continue; + } + + if(key=="leftUpperLeg"){ + value.LeftUpperLeg = __humanoid_Deserialize_LeftUpperLeg(kv.Value); + continue; + } + + if(key=="leftLowerLeg"){ + value.LeftLowerLeg = __humanoid_Deserialize_LeftLowerLeg(kv.Value); + continue; + } + + if(key=="leftFoot"){ + value.LeftFoot = __humanoid_Deserialize_LeftFoot(kv.Value); + continue; + } + + if(key=="leftToes"){ + value.LeftToes = __humanoid_Deserialize_LeftToes(kv.Value); + continue; + } + + if(key=="rightUpperLeg"){ + value.RightUpperLeg = __humanoid_Deserialize_RightUpperLeg(kv.Value); + continue; + } + + if(key=="rightLowerLeg"){ + value.RightLowerLeg = __humanoid_Deserialize_RightLowerLeg(kv.Value); + continue; + } + + if(key=="rightFoot"){ + value.RightFoot = __humanoid_Deserialize_RightFoot(kv.Value); + continue; + } + + if(key=="rightToes"){ + value.RightToes = __humanoid_Deserialize_RightToes(kv.Value); + continue; + } + + if(key=="leftShoulder"){ + value.LeftShoulder = __humanoid_Deserialize_LeftShoulder(kv.Value); + continue; + } + + if(key=="leftUpperArm"){ + value.LeftUpperArm = __humanoid_Deserialize_LeftUpperArm(kv.Value); + continue; + } + + if(key=="leftLowerArm"){ + value.LeftLowerArm = __humanoid_Deserialize_LeftLowerArm(kv.Value); + continue; + } + + if(key=="leftHand"){ + value.LeftHand = __humanoid_Deserialize_LeftHand(kv.Value); + continue; + } + + if(key=="rightShoulder"){ + value.RightShoulder = __humanoid_Deserialize_RightShoulder(kv.Value); + continue; + } + + if(key=="rightUpperArm"){ + value.RightUpperArm = __humanoid_Deserialize_RightUpperArm(kv.Value); + continue; + } + + if(key=="rightLowerArm"){ + value.RightLowerArm = __humanoid_Deserialize_RightLowerArm(kv.Value); + continue; + } + + if(key=="rightHand"){ + value.RightHand = __humanoid_Deserialize_RightHand(kv.Value); + continue; + } + + if(key=="leftThumbMetacarpal"){ + value.LeftThumbMetacarpal = __humanoid_Deserialize_LeftThumbMetacarpal(kv.Value); + continue; + } + + if(key=="leftThumbProximal"){ + value.LeftThumbProximal = __humanoid_Deserialize_LeftThumbProximal(kv.Value); + continue; + } + + if(key=="leftThumbDistal"){ + value.LeftThumbDistal = __humanoid_Deserialize_LeftThumbDistal(kv.Value); + continue; + } + + if(key=="leftIndexProximal"){ + value.LeftIndexProximal = __humanoid_Deserialize_LeftIndexProximal(kv.Value); + continue; + } + + if(key=="leftIndexIntermediate"){ + value.LeftIndexIntermediate = __humanoid_Deserialize_LeftIndexIntermediate(kv.Value); + continue; + } + + if(key=="leftIndexDistal"){ + value.LeftIndexDistal = __humanoid_Deserialize_LeftIndexDistal(kv.Value); + continue; + } + + if(key=="leftMiddleProximal"){ + value.LeftMiddleProximal = __humanoid_Deserialize_LeftMiddleProximal(kv.Value); + continue; + } + + if(key=="leftMiddleIntermediate"){ + value.LeftMiddleIntermediate = __humanoid_Deserialize_LeftMiddleIntermediate(kv.Value); + continue; + } + + if(key=="leftMiddleDistal"){ + value.LeftMiddleDistal = __humanoid_Deserialize_LeftMiddleDistal(kv.Value); + continue; + } + + if(key=="leftRingProximal"){ + value.LeftRingProximal = __humanoid_Deserialize_LeftRingProximal(kv.Value); + continue; + } + + if(key=="leftRingIntermediate"){ + value.LeftRingIntermediate = __humanoid_Deserialize_LeftRingIntermediate(kv.Value); + continue; + } + + if(key=="leftRingDistal"){ + value.LeftRingDistal = __humanoid_Deserialize_LeftRingDistal(kv.Value); + continue; + } + + if(key=="leftLittleProximal"){ + value.LeftLittleProximal = __humanoid_Deserialize_LeftLittleProximal(kv.Value); + continue; + } + + if(key=="leftLittleIntermediate"){ + value.LeftLittleIntermediate = __humanoid_Deserialize_LeftLittleIntermediate(kv.Value); + continue; + } + + if(key=="leftLittleDistal"){ + value.LeftLittleDistal = __humanoid_Deserialize_LeftLittleDistal(kv.Value); + continue; + } + + if(key=="rightThumbMetacarpal"){ + value.RightThumbMetacarpal = __humanoid_Deserialize_RightThumbMetacarpal(kv.Value); + continue; + } + + if(key=="rightThumbProximal"){ + value.RightThumbProximal = __humanoid_Deserialize_RightThumbProximal(kv.Value); + continue; + } + + if(key=="rightThumbDistal"){ + value.RightThumbDistal = __humanoid_Deserialize_RightThumbDistal(kv.Value); + continue; + } + + if(key=="rightIndexProximal"){ + value.RightIndexProximal = __humanoid_Deserialize_RightIndexProximal(kv.Value); + continue; + } + + if(key=="rightIndexIntermediate"){ + value.RightIndexIntermediate = __humanoid_Deserialize_RightIndexIntermediate(kv.Value); + continue; + } + + if(key=="rightIndexDistal"){ + value.RightIndexDistal = __humanoid_Deserialize_RightIndexDistal(kv.Value); + continue; + } + + if(key=="rightMiddleProximal"){ + value.RightMiddleProximal = __humanoid_Deserialize_RightMiddleProximal(kv.Value); + continue; + } + + if(key=="rightMiddleIntermediate"){ + value.RightMiddleIntermediate = __humanoid_Deserialize_RightMiddleIntermediate(kv.Value); + continue; + } + + if(key=="rightMiddleDistal"){ + value.RightMiddleDistal = __humanoid_Deserialize_RightMiddleDistal(kv.Value); + continue; + } + + if(key=="rightRingProximal"){ + value.RightRingProximal = __humanoid_Deserialize_RightRingProximal(kv.Value); + continue; + } + + if(key=="rightRingIntermediate"){ + value.RightRingIntermediate = __humanoid_Deserialize_RightRingIntermediate(kv.Value); + continue; + } + + if(key=="rightRingDistal"){ + value.RightRingDistal = __humanoid_Deserialize_RightRingDistal(kv.Value); + continue; + } + + if(key=="rightLittleProximal"){ + value.RightLittleProximal = __humanoid_Deserialize_RightLittleProximal(kv.Value); + continue; + } + + if(key=="rightLittleIntermediate"){ + value.RightLittleIntermediate = __humanoid_Deserialize_RightLittleIntermediate(kv.Value); + continue; + } + + if(key=="rightLittleDistal"){ + value.RightLittleDistal = __humanoid_Deserialize_RightLittleDistal(kv.Value); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_Hips(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_Spine(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_Chest(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_UpperChest(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_Neck(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_Head(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_Jaw(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftUpperLeg(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftLowerLeg(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftFoot(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftToes(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightUpperLeg(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightLowerLeg(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightFoot(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightToes(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftShoulder(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftUpperArm(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftLowerArm(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftHand(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightShoulder(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightUpperArm(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightLowerArm(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightHand(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftThumbMetacarpal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftThumbProximal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftThumbDistal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftIndexProximal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftIndexIntermediate(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftIndexDistal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftMiddleProximal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftMiddleIntermediate(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftMiddleDistal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftRingProximal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftRingIntermediate(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftRingDistal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftLittleProximal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftLittleIntermediate(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_LeftLittleDistal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightThumbMetacarpal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightThumbProximal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightThumbDistal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightIndexProximal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightIndexIntermediate(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightIndexDistal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightMiddleProximal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightMiddleIntermediate(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightMiddleDistal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightRingProximal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightRingIntermediate(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightRingDistal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightLittleProximal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightLittleIntermediate(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static HumanBone __humanoid_Deserialize_RightLittleDistal(JsonNode parsed) +{ + var value = new HumanBone(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expressions Deserialize_Expressions(JsonNode parsed) +{ + var value = new Expressions(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="preset"){ + value.Preset = __expressions_Deserialize_Preset(kv.Value); + continue; + } + + if(key=="custom"){ + value.Custom = __expressions_Deserialize_Custom(kv.Value); + continue; + } + + } + return value; +} + +public static Preset __expressions_Deserialize_Preset(JsonNode parsed) +{ + var value = new Preset(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="happy"){ + value.Happy = __expressions__preset_Deserialize_Happy(kv.Value); + continue; + } + + if(key=="angry"){ + value.Angry = __expressions__preset_Deserialize_Angry(kv.Value); + continue; + } + + if(key=="sad"){ + value.Sad = __expressions__preset_Deserialize_Sad(kv.Value); + continue; + } + + if(key=="relaxed"){ + value.Relaxed = __expressions__preset_Deserialize_Relaxed(kv.Value); + continue; + } + + if(key=="surprised"){ + value.Surprised = __expressions__preset_Deserialize_Surprised(kv.Value); + continue; + } + + if(key=="aa"){ + value.Aa = __expressions__preset_Deserialize_Aa(kv.Value); + continue; + } + + if(key=="ih"){ + value.Ih = __expressions__preset_Deserialize_Ih(kv.Value); + continue; + } + + if(key=="ou"){ + value.Ou = __expressions__preset_Deserialize_Ou(kv.Value); + continue; + } + + if(key=="ee"){ + value.Ee = __expressions__preset_Deserialize_Ee(kv.Value); + continue; + } + + if(key=="oh"){ + value.Oh = __expressions__preset_Deserialize_Oh(kv.Value); + continue; + } + + if(key=="blink"){ + value.Blink = __expressions__preset_Deserialize_Blink(kv.Value); + continue; + } + + if(key=="blinkLeft"){ + value.BlinkLeft = __expressions__preset_Deserialize_BlinkLeft(kv.Value); + continue; + } + + if(key=="blinkRight"){ + value.BlinkRight = __expressions__preset_Deserialize_BlinkRight(kv.Value); + continue; + } + + if(key=="lookUp"){ + value.LookUp = __expressions__preset_Deserialize_LookUp(kv.Value); + continue; + } + + if(key=="lookDown"){ + value.LookDown = __expressions__preset_Deserialize_LookDown(kv.Value); + continue; + } + + if(key=="lookLeft"){ + value.LookLeft = __expressions__preset_Deserialize_LookLeft(kv.Value); + continue; + } + + if(key=="lookRight"){ + value.LookRight = __expressions__preset_Deserialize_LookRight(kv.Value); + continue; + } + + if(key=="neutral"){ + value.Neutral = __expressions__preset_Deserialize_Neutral(kv.Value); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Happy(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Angry(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Sad(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Relaxed(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Surprised(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Aa(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Ih(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Ou(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Ee(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Oh(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Blink(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_BlinkLeft(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_BlinkRight(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_LookUp(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_LookDown(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_LookLeft(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_LookRight(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Expression __expressions__preset_Deserialize_Neutral(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static Dictionary __expressions_Deserialize_Custom(JsonNode parsed) +{ + var value = new Dictionary(); + foreach(var kv in parsed.ObjectItems()) + { + value.Add(kv.Key.GetString(), __expressions_Deserialize_Custom_ITEM(kv.Value)); + } + return value; +} + +public static Expression __expressions_Deserialize_Custom_ITEM(JsonNode parsed) +{ + var value = new Expression(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +public static LookAt Deserialize_LookAt(JsonNode parsed) +{ + var value = new LookAt(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="extensions"){ + value.Extensions = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="extras"){ + value.Extras = new glTFExtensionImport(kv.Value); + continue; + } + + if(key=="node"){ + value.Node = kv.Value.GetInt32(); + continue; + } + + } + return value; +} + +} // GltfDeserializer +} // UniGLTF diff --git a/Assets/VRM10/Runtime/Format/Animation/Deserializer.g.cs.meta b/Assets/VRM10/Runtime/Format/Animation/Deserializer.g.cs.meta new file mode 100644 index 000000000..f86f0263b --- /dev/null +++ b/Assets/VRM10/Runtime/Format/Animation/Deserializer.g.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4496eacf38a3897479cfb145617739ac +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10/Runtime/Format/Animation/Format.g.cs b/Assets/VRM10/Runtime/Format/Animation/Format.g.cs new file mode 100644 index 000000000..2ecde1a0b --- /dev/null +++ b/Assets/VRM10/Runtime/Format/Animation/Format.g.cs @@ -0,0 +1,307 @@ +// This file is generated from JsonSchema. Don't modify this source code. +using System; +using System.Collections.Generic; + + +namespace UniGLTF.Extensions.VRMC_vrm_animation +{ + + public class HumanBone + { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + + // Represents a single glTF node mapped to this humanBone. + public int? Node; + } + + public class Humanoid + { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + + // Represents a single bone of a Humanoid. + public HumanBone Hips; + + // Represents a single bone of a Humanoid. + public HumanBone Spine; + + // Represents a single bone of a Humanoid. + public HumanBone Chest; + + // Represents a single bone of a Humanoid. + public HumanBone UpperChest; + + // Represents a single bone of a Humanoid. + public HumanBone Neck; + + // Represents a single bone of a Humanoid. + public HumanBone Head; + + // Represents a single bone of a Humanoid. + public HumanBone Jaw; + + // Represents a single bone of a Humanoid. + public HumanBone LeftUpperLeg; + + // Represents a single bone of a Humanoid. + public HumanBone LeftLowerLeg; + + // Represents a single bone of a Humanoid. + public HumanBone LeftFoot; + + // Represents a single bone of a Humanoid. + public HumanBone LeftToes; + + // Represents a single bone of a Humanoid. + public HumanBone RightUpperLeg; + + // Represents a single bone of a Humanoid. + public HumanBone RightLowerLeg; + + // Represents a single bone of a Humanoid. + public HumanBone RightFoot; + + // Represents a single bone of a Humanoid. + public HumanBone RightToes; + + // Represents a single bone of a Humanoid. + public HumanBone LeftShoulder; + + // Represents a single bone of a Humanoid. + public HumanBone LeftUpperArm; + + // Represents a single bone of a Humanoid. + public HumanBone LeftLowerArm; + + // Represents a single bone of a Humanoid. + public HumanBone LeftHand; + + // Represents a single bone of a Humanoid. + public HumanBone RightShoulder; + + // Represents a single bone of a Humanoid. + public HumanBone RightUpperArm; + + // Represents a single bone of a Humanoid. + public HumanBone RightLowerArm; + + // Represents a single bone of a Humanoid. + public HumanBone RightHand; + + // Represents a single bone of a Humanoid. + public HumanBone LeftThumbMetacarpal; + + // Represents a single bone of a Humanoid. + public HumanBone LeftThumbProximal; + + // Represents a single bone of a Humanoid. + public HumanBone LeftThumbDistal; + + // Represents a single bone of a Humanoid. + public HumanBone LeftIndexProximal; + + // Represents a single bone of a Humanoid. + public HumanBone LeftIndexIntermediate; + + // Represents a single bone of a Humanoid. + public HumanBone LeftIndexDistal; + + // Represents a single bone of a Humanoid. + public HumanBone LeftMiddleProximal; + + // Represents a single bone of a Humanoid. + public HumanBone LeftMiddleIntermediate; + + // Represents a single bone of a Humanoid. + public HumanBone LeftMiddleDistal; + + // Represents a single bone of a Humanoid. + public HumanBone LeftRingProximal; + + // Represents a single bone of a Humanoid. + public HumanBone LeftRingIntermediate; + + // Represents a single bone of a Humanoid. + public HumanBone LeftRingDistal; + + // Represents a single bone of a Humanoid. + public HumanBone LeftLittleProximal; + + // Represents a single bone of a Humanoid. + public HumanBone LeftLittleIntermediate; + + // Represents a single bone of a Humanoid. + public HumanBone LeftLittleDistal; + + // Represents a single bone of a Humanoid. + public HumanBone RightThumbMetacarpal; + + // Represents a single bone of a Humanoid. + public HumanBone RightThumbProximal; + + // Represents a single bone of a Humanoid. + public HumanBone RightThumbDistal; + + // Represents a single bone of a Humanoid. + public HumanBone RightIndexProximal; + + // Represents a single bone of a Humanoid. + public HumanBone RightIndexIntermediate; + + // Represents a single bone of a Humanoid. + public HumanBone RightIndexDistal; + + // Represents a single bone of a Humanoid. + public HumanBone RightMiddleProximal; + + // Represents a single bone of a Humanoid. + public HumanBone RightMiddleIntermediate; + + // Represents a single bone of a Humanoid. + public HumanBone RightMiddleDistal; + + // Represents a single bone of a Humanoid. + public HumanBone RightRingProximal; + + // Represents a single bone of a Humanoid. + public HumanBone RightRingIntermediate; + + // Represents a single bone of a Humanoid. + public HumanBone RightRingDistal; + + // Represents a single bone of a Humanoid. + public HumanBone RightLittleProximal; + + // Represents a single bone of a Humanoid. + public HumanBone RightLittleIntermediate; + + // Represents a single bone of a Humanoid. + public HumanBone RightLittleDistal; + } + + public class Expression + { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + + // Represents a single glTF node mapped to this expression. + public int? Node; + } + + public class Preset + { + // Represents a single expression. + public Expression Happy; + + // Represents a single expression. + public Expression Angry; + + // Represents a single expression. + public Expression Sad; + + // Represents a single expression. + public Expression Relaxed; + + // Represents a single expression. + public Expression Surprised; + + // Represents a single expression. + public Expression Aa; + + // Represents a single expression. + public Expression Ih; + + // Represents a single expression. + public Expression Ou; + + // Represents a single expression. + public Expression Ee; + + // Represents a single expression. + public Expression Oh; + + // Represents a single expression. + public Expression Blink; + + // Represents a single expression. + public Expression BlinkLeft; + + // Represents a single expression. + public Expression BlinkRight; + + // Represents a single expression. + public Expression LookUp; + + // Represents a single expression. + public Expression LookDown; + + // Represents a single expression. + public Expression LookLeft; + + // Represents a single expression. + public Expression LookRight; + + // Represents a single expression. + public Expression Neutral; + } + + public class Expressions + { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + + // An object that contains definitions of preset expressions. + public Preset Preset; + + // An object that contains definitions of custom expressions. + public Dictionary Custom; + } + + public class LookAt + { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + + // Represents a single glTF node represents the eye gaze point. + public int? Node; + } + + public class VRMC_vrm_animation + { + public const string ExtensionName = "VRMC_vrm_animation"; + + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + + // Specification version of VRMC_vrm_animation + public string SpecVersion; + + // An object which maps humanoid bones to nodes. + public Humanoid Humanoid; + + // An object which maps expressions to nodes. + public Expressions Expressions; + + // An object which maps a eye gaze point to a node. + public LookAt LookAt; + } +} diff --git a/Assets/VRM10/Runtime/Format/Animation/Format.g.cs.meta b/Assets/VRM10/Runtime/Format/Animation/Format.g.cs.meta new file mode 100644 index 000000000..9e67b39b4 --- /dev/null +++ b/Assets/VRM10/Runtime/Format/Animation/Format.g.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f595db5658d457449b2fa63cfdc29c6d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10/Runtime/Format/Animation/Serializer.g.cs b/Assets/VRM10/Runtime/Format/Animation/Serializer.g.cs new file mode 100644 index 000000000..23f4b8e47 --- /dev/null +++ b/Assets/VRM10/Runtime/Format/Animation/Serializer.g.cs @@ -0,0 +1,2171 @@ +// This file is generated from JsonSchema. Don't modify this source code. +using System; +using System.Collections.Generic; +using System.Linq; +using UniJSON; + +namespace UniGLTF.Extensions.VRMC_vrm_animation { + + static public class GltfSerializer + { + + public static void SerializeTo(ref UniGLTF.glTFExtension dst, VRMC_vrm_animation extension) + { + if (dst is glTFExtensionImport) + { + throw new NotImplementedException(); + } + + if (!(dst is glTFExtensionExport extensions)) + { + extensions = new glTFExtensionExport(); + dst = extensions; + } + + var f = new JsonFormatter(); + Serialize(f, extension); + extensions.Add(VRMC_vrm_animation.ExtensionName, f.GetStoreBytes()); + } + + +public static void Serialize(JsonFormatter f, VRMC_vrm_animation value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(!string.IsNullOrEmpty(value.SpecVersion)){ + f.Key("specVersion"); + f.Value(value.SpecVersion); + } + + if(value.Humanoid!=null){ + f.Key("humanoid"); + Serialize_Humanoid(f, value.Humanoid); + } + + if(value.Expressions!=null){ + f.Key("expressions"); + Serialize_Expressions(f, value.Expressions); + } + + if(value.LookAt!=null){ + f.Key("lookAt"); + Serialize_LookAt(f, value.LookAt); + } + + f.EndMap(); +} + +public static void Serialize_Humanoid(JsonFormatter f, Humanoid value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Hips!=null){ + f.Key("hips"); + __humanoid_Serialize_Hips(f, value.Hips); + } + + if(value.Spine!=null){ + f.Key("spine"); + __humanoid_Serialize_Spine(f, value.Spine); + } + + if(value.Chest!=null){ + f.Key("chest"); + __humanoid_Serialize_Chest(f, value.Chest); + } + + if(value.UpperChest!=null){ + f.Key("upperChest"); + __humanoid_Serialize_UpperChest(f, value.UpperChest); + } + + if(value.Neck!=null){ + f.Key("neck"); + __humanoid_Serialize_Neck(f, value.Neck); + } + + if(value.Head!=null){ + f.Key("head"); + __humanoid_Serialize_Head(f, value.Head); + } + + if(value.Jaw!=null){ + f.Key("jaw"); + __humanoid_Serialize_Jaw(f, value.Jaw); + } + + if(value.LeftUpperLeg!=null){ + f.Key("leftUpperLeg"); + __humanoid_Serialize_LeftUpperLeg(f, value.LeftUpperLeg); + } + + if(value.LeftLowerLeg!=null){ + f.Key("leftLowerLeg"); + __humanoid_Serialize_LeftLowerLeg(f, value.LeftLowerLeg); + } + + if(value.LeftFoot!=null){ + f.Key("leftFoot"); + __humanoid_Serialize_LeftFoot(f, value.LeftFoot); + } + + if(value.LeftToes!=null){ + f.Key("leftToes"); + __humanoid_Serialize_LeftToes(f, value.LeftToes); + } + + if(value.RightUpperLeg!=null){ + f.Key("rightUpperLeg"); + __humanoid_Serialize_RightUpperLeg(f, value.RightUpperLeg); + } + + if(value.RightLowerLeg!=null){ + f.Key("rightLowerLeg"); + __humanoid_Serialize_RightLowerLeg(f, value.RightLowerLeg); + } + + if(value.RightFoot!=null){ + f.Key("rightFoot"); + __humanoid_Serialize_RightFoot(f, value.RightFoot); + } + + if(value.RightToes!=null){ + f.Key("rightToes"); + __humanoid_Serialize_RightToes(f, value.RightToes); + } + + if(value.LeftShoulder!=null){ + f.Key("leftShoulder"); + __humanoid_Serialize_LeftShoulder(f, value.LeftShoulder); + } + + if(value.LeftUpperArm!=null){ + f.Key("leftUpperArm"); + __humanoid_Serialize_LeftUpperArm(f, value.LeftUpperArm); + } + + if(value.LeftLowerArm!=null){ + f.Key("leftLowerArm"); + __humanoid_Serialize_LeftLowerArm(f, value.LeftLowerArm); + } + + if(value.LeftHand!=null){ + f.Key("leftHand"); + __humanoid_Serialize_LeftHand(f, value.LeftHand); + } + + if(value.RightShoulder!=null){ + f.Key("rightShoulder"); + __humanoid_Serialize_RightShoulder(f, value.RightShoulder); + } + + if(value.RightUpperArm!=null){ + f.Key("rightUpperArm"); + __humanoid_Serialize_RightUpperArm(f, value.RightUpperArm); + } + + if(value.RightLowerArm!=null){ + f.Key("rightLowerArm"); + __humanoid_Serialize_RightLowerArm(f, value.RightLowerArm); + } + + if(value.RightHand!=null){ + f.Key("rightHand"); + __humanoid_Serialize_RightHand(f, value.RightHand); + } + + if(value.LeftThumbMetacarpal!=null){ + f.Key("leftThumbMetacarpal"); + __humanoid_Serialize_LeftThumbMetacarpal(f, value.LeftThumbMetacarpal); + } + + if(value.LeftThumbProximal!=null){ + f.Key("leftThumbProximal"); + __humanoid_Serialize_LeftThumbProximal(f, value.LeftThumbProximal); + } + + if(value.LeftThumbDistal!=null){ + f.Key("leftThumbDistal"); + __humanoid_Serialize_LeftThumbDistal(f, value.LeftThumbDistal); + } + + if(value.LeftIndexProximal!=null){ + f.Key("leftIndexProximal"); + __humanoid_Serialize_LeftIndexProximal(f, value.LeftIndexProximal); + } + + if(value.LeftIndexIntermediate!=null){ + f.Key("leftIndexIntermediate"); + __humanoid_Serialize_LeftIndexIntermediate(f, value.LeftIndexIntermediate); + } + + if(value.LeftIndexDistal!=null){ + f.Key("leftIndexDistal"); + __humanoid_Serialize_LeftIndexDistal(f, value.LeftIndexDistal); + } + + if(value.LeftMiddleProximal!=null){ + f.Key("leftMiddleProximal"); + __humanoid_Serialize_LeftMiddleProximal(f, value.LeftMiddleProximal); + } + + if(value.LeftMiddleIntermediate!=null){ + f.Key("leftMiddleIntermediate"); + __humanoid_Serialize_LeftMiddleIntermediate(f, value.LeftMiddleIntermediate); + } + + if(value.LeftMiddleDistal!=null){ + f.Key("leftMiddleDistal"); + __humanoid_Serialize_LeftMiddleDistal(f, value.LeftMiddleDistal); + } + + if(value.LeftRingProximal!=null){ + f.Key("leftRingProximal"); + __humanoid_Serialize_LeftRingProximal(f, value.LeftRingProximal); + } + + if(value.LeftRingIntermediate!=null){ + f.Key("leftRingIntermediate"); + __humanoid_Serialize_LeftRingIntermediate(f, value.LeftRingIntermediate); + } + + if(value.LeftRingDistal!=null){ + f.Key("leftRingDistal"); + __humanoid_Serialize_LeftRingDistal(f, value.LeftRingDistal); + } + + if(value.LeftLittleProximal!=null){ + f.Key("leftLittleProximal"); + __humanoid_Serialize_LeftLittleProximal(f, value.LeftLittleProximal); + } + + if(value.LeftLittleIntermediate!=null){ + f.Key("leftLittleIntermediate"); + __humanoid_Serialize_LeftLittleIntermediate(f, value.LeftLittleIntermediate); + } + + if(value.LeftLittleDistal!=null){ + f.Key("leftLittleDistal"); + __humanoid_Serialize_LeftLittleDistal(f, value.LeftLittleDistal); + } + + if(value.RightThumbMetacarpal!=null){ + f.Key("rightThumbMetacarpal"); + __humanoid_Serialize_RightThumbMetacarpal(f, value.RightThumbMetacarpal); + } + + if(value.RightThumbProximal!=null){ + f.Key("rightThumbProximal"); + __humanoid_Serialize_RightThumbProximal(f, value.RightThumbProximal); + } + + if(value.RightThumbDistal!=null){ + f.Key("rightThumbDistal"); + __humanoid_Serialize_RightThumbDistal(f, value.RightThumbDistal); + } + + if(value.RightIndexProximal!=null){ + f.Key("rightIndexProximal"); + __humanoid_Serialize_RightIndexProximal(f, value.RightIndexProximal); + } + + if(value.RightIndexIntermediate!=null){ + f.Key("rightIndexIntermediate"); + __humanoid_Serialize_RightIndexIntermediate(f, value.RightIndexIntermediate); + } + + if(value.RightIndexDistal!=null){ + f.Key("rightIndexDistal"); + __humanoid_Serialize_RightIndexDistal(f, value.RightIndexDistal); + } + + if(value.RightMiddleProximal!=null){ + f.Key("rightMiddleProximal"); + __humanoid_Serialize_RightMiddleProximal(f, value.RightMiddleProximal); + } + + if(value.RightMiddleIntermediate!=null){ + f.Key("rightMiddleIntermediate"); + __humanoid_Serialize_RightMiddleIntermediate(f, value.RightMiddleIntermediate); + } + + if(value.RightMiddleDistal!=null){ + f.Key("rightMiddleDistal"); + __humanoid_Serialize_RightMiddleDistal(f, value.RightMiddleDistal); + } + + if(value.RightRingProximal!=null){ + f.Key("rightRingProximal"); + __humanoid_Serialize_RightRingProximal(f, value.RightRingProximal); + } + + if(value.RightRingIntermediate!=null){ + f.Key("rightRingIntermediate"); + __humanoid_Serialize_RightRingIntermediate(f, value.RightRingIntermediate); + } + + if(value.RightRingDistal!=null){ + f.Key("rightRingDistal"); + __humanoid_Serialize_RightRingDistal(f, value.RightRingDistal); + } + + if(value.RightLittleProximal!=null){ + f.Key("rightLittleProximal"); + __humanoid_Serialize_RightLittleProximal(f, value.RightLittleProximal); + } + + if(value.RightLittleIntermediate!=null){ + f.Key("rightLittleIntermediate"); + __humanoid_Serialize_RightLittleIntermediate(f, value.RightLittleIntermediate); + } + + if(value.RightLittleDistal!=null){ + f.Key("rightLittleDistal"); + __humanoid_Serialize_RightLittleDistal(f, value.RightLittleDistal); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_Hips(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_Spine(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_Chest(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_UpperChest(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_Neck(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_Head(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_Jaw(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftUpperLeg(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftLowerLeg(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftFoot(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftToes(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightUpperLeg(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightLowerLeg(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightFoot(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightToes(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftShoulder(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftUpperArm(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftLowerArm(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftHand(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightShoulder(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightUpperArm(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightLowerArm(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightHand(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftThumbMetacarpal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftThumbProximal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftThumbDistal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftIndexProximal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftIndexIntermediate(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftIndexDistal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftMiddleProximal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftMiddleIntermediate(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftMiddleDistal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftRingProximal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftRingIntermediate(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftRingDistal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftLittleProximal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftLittleIntermediate(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_LeftLittleDistal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightThumbMetacarpal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightThumbProximal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightThumbDistal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightIndexProximal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightIndexIntermediate(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightIndexDistal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightMiddleProximal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightMiddleIntermediate(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightMiddleDistal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightRingProximal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightRingIntermediate(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightRingDistal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightLittleProximal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightLittleIntermediate(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __humanoid_Serialize_RightLittleDistal(JsonFormatter f, HumanBone value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void Serialize_Expressions(JsonFormatter f, Expressions value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Preset!=null){ + f.Key("preset"); + __expressions_Serialize_Preset(f, value.Preset); + } + + if(value.Custom!=null&&value.Custom.Count()>0){ + f.Key("custom"); + __expressions_Serialize_Custom(f, value.Custom); + } + + f.EndMap(); +} + +public static void __expressions_Serialize_Preset(JsonFormatter f, Preset value) +{ + f.BeginMap(); + + + if(value.Happy!=null){ + f.Key("happy"); + __expressions__preset_Serialize_Happy(f, value.Happy); + } + + if(value.Angry!=null){ + f.Key("angry"); + __expressions__preset_Serialize_Angry(f, value.Angry); + } + + if(value.Sad!=null){ + f.Key("sad"); + __expressions__preset_Serialize_Sad(f, value.Sad); + } + + if(value.Relaxed!=null){ + f.Key("relaxed"); + __expressions__preset_Serialize_Relaxed(f, value.Relaxed); + } + + if(value.Surprised!=null){ + f.Key("surprised"); + __expressions__preset_Serialize_Surprised(f, value.Surprised); + } + + if(value.Aa!=null){ + f.Key("aa"); + __expressions__preset_Serialize_Aa(f, value.Aa); + } + + if(value.Ih!=null){ + f.Key("ih"); + __expressions__preset_Serialize_Ih(f, value.Ih); + } + + if(value.Ou!=null){ + f.Key("ou"); + __expressions__preset_Serialize_Ou(f, value.Ou); + } + + if(value.Ee!=null){ + f.Key("ee"); + __expressions__preset_Serialize_Ee(f, value.Ee); + } + + if(value.Oh!=null){ + f.Key("oh"); + __expressions__preset_Serialize_Oh(f, value.Oh); + } + + if(value.Blink!=null){ + f.Key("blink"); + __expressions__preset_Serialize_Blink(f, value.Blink); + } + + if(value.BlinkLeft!=null){ + f.Key("blinkLeft"); + __expressions__preset_Serialize_BlinkLeft(f, value.BlinkLeft); + } + + if(value.BlinkRight!=null){ + f.Key("blinkRight"); + __expressions__preset_Serialize_BlinkRight(f, value.BlinkRight); + } + + if(value.LookUp!=null){ + f.Key("lookUp"); + __expressions__preset_Serialize_LookUp(f, value.LookUp); + } + + if(value.LookDown!=null){ + f.Key("lookDown"); + __expressions__preset_Serialize_LookDown(f, value.LookDown); + } + + if(value.LookLeft!=null){ + f.Key("lookLeft"); + __expressions__preset_Serialize_LookLeft(f, value.LookLeft); + } + + if(value.LookRight!=null){ + f.Key("lookRight"); + __expressions__preset_Serialize_LookRight(f, value.LookRight); + } + + if(value.Neutral!=null){ + f.Key("neutral"); + __expressions__preset_Serialize_Neutral(f, value.Neutral); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Happy(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Angry(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Sad(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Relaxed(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Surprised(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Aa(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Ih(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Ou(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Ee(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Oh(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Blink(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_BlinkLeft(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_BlinkRight(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_LookUp(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_LookDown(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_LookLeft(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_LookRight(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions__preset_Serialize_Neutral(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __expressions_Serialize_Custom(JsonFormatter f, Dictionary value) +{ + f.BeginMap(); + + foreach(var kv in value) + { + f.Key(kv.Key); + __expressions_Serialize_Custom_ITEM(f, kv.Value); + + } + f.EndMap(); +} + +public static void __expressions_Serialize_Custom_ITEM(JsonFormatter f, Expression value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void Serialize_LookAt(JsonFormatter f, LookAt value) +{ + f.BeginMap(); + + + if(value.Extensions!=null){ + f.Key("extensions"); + (value.Extensions as glTFExtension).Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + (value.Extras as glTFExtension).Serialize(f); + } + + if(value.Node.HasValue){ + f.Key("node"); + f.Value(value.Node.GetValueOrDefault()); + } + + f.EndMap(); +} + + } // class +} // namespace diff --git a/Assets/VRM10/Runtime/Format/Animation/Serializer.g.cs.meta b/Assets/VRM10/Runtime/Format/Animation/Serializer.g.cs.meta new file mode 100644 index 000000000..02d691857 --- /dev/null +++ b/Assets/VRM10/Runtime/Format/Animation/Serializer.g.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b1cc771337f6bbf4b932505a7847455a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 29e885c0d7719f74eeeb3c39de312545e5c2c3f4 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 28 Feb 2023 19:21:56 +0900 Subject: [PATCH 03/10] =?UTF-8?q?=E7=94=9F=E6=88=90=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=89=20UniGLTF.Extensions.VRMC=5Fvrm=5Fanimation.GltfDeser?= =?UTF-8?q?ializer.Deserialize=20=E5=8B=95=E3=81=84=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ControlRig/InitialRotationPoseProvider.cs | 2 +- .../VRM10_Samples/VRM10Viewer/VRM10Motion.cs | 134 +++++++++ .../VRM10Viewer/VRM10Viewer.unity | 264 ++++++++++++++++-- .../VRM10Viewer/VRM10ViewerUI.cs | 95 +++++-- 4 files changed, 448 insertions(+), 47 deletions(-) diff --git a/Assets/VRM10/Runtime/ControlRig/InitialRotationPoseProvider.cs b/Assets/VRM10/Runtime/ControlRig/InitialRotationPoseProvider.cs index e87769866..486432692 100644 --- a/Assets/VRM10/Runtime/ControlRig/InitialRotationPoseProvider.cs +++ b/Assets/VRM10/Runtime/ControlRig/InitialRotationPoseProvider.cs @@ -25,11 +25,11 @@ namespace UniVRM10 public InitRotationPoseProvider(Transform root, UniHumanoid.Humanoid humanoid) { m_root = root; - m_hips = m_bones[HumanBodyBones.Hips].Transform; foreach (var (t, bone) in humanoid.BoneMap) { m_bones.Add(bone, new BoneInitialRotation(t)); } + m_hips = m_bones[HumanBodyBones.Hips].Transform; } Quaternion INormalizedPoseProvider.GetNormalizedLocalRotation(HumanBodyBones bone, HumanBodyBones parentBone) diff --git a/Assets/VRM10_Samples/VRM10Viewer/VRM10Motion.cs b/Assets/VRM10_Samples/VRM10Viewer/VRM10Motion.cs index b165fd69f..89ae35c64 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/VRM10Motion.cs +++ b/Assets/VRM10_Samples/VRM10Viewer/VRM10Motion.cs @@ -68,5 +68,139 @@ namespace UniVRM10.VRM10Viewer } } } + + static int? GetNodeIndex(UniGLTF.Extensions.VRMC_vrm_animation.Humanoid humanoid, HumanBodyBones bone) + { + switch (bone) + { + case HumanBodyBones.Hips: return humanoid.Hips?.Node; + case HumanBodyBones.LeftUpperLeg: return humanoid.LeftUpperLeg?.Node; + case HumanBodyBones.RightUpperLeg: return humanoid.RightUpperLeg?.Node; + case HumanBodyBones.LeftLowerLeg: return humanoid.LeftLowerLeg?.Node; + case HumanBodyBones.RightLowerLeg: return humanoid.RightLowerLeg?.Node; + case HumanBodyBones.LeftFoot: return humanoid.LeftFoot?.Node; + case HumanBodyBones.RightFoot: return humanoid.RightFoot?.Node; + case HumanBodyBones.Spine: return humanoid.Spine?.Node; + case HumanBodyBones.Chest: return humanoid.Chest?.Node; + case HumanBodyBones.Neck: return humanoid.Neck?.Node; + case HumanBodyBones.Head: return humanoid.Head?.Node; + case HumanBodyBones.LeftShoulder: return humanoid.LeftShoulder?.Node; + case HumanBodyBones.RightShoulder: return humanoid.RightShoulder?.Node; + case HumanBodyBones.LeftUpperArm: return humanoid.LeftUpperArm?.Node; + case HumanBodyBones.RightUpperArm: return humanoid.RightUpperArm?.Node; + case HumanBodyBones.LeftLowerArm: return humanoid.LeftLowerArm?.Node; + case HumanBodyBones.RightLowerArm: return humanoid.RightLowerArm?.Node; + case HumanBodyBones.LeftHand: return humanoid.LeftHand?.Node; + case HumanBodyBones.RightHand: return humanoid.RightHand?.Node; + case HumanBodyBones.LeftToes: return humanoid.LeftToes?.Node; + case HumanBodyBones.RightToes: return humanoid.RightToes?.Node; + // case HumanBodyBones.LeftEye: return humanoid.LeftEye?.Node; + // case HumanBodyBones.RightEye: return humanoid.RightEye?.Node; + case HumanBodyBones.Jaw: return humanoid.Jaw?.Node; + case HumanBodyBones.LeftThumbProximal: return humanoid.LeftThumbMetacarpal?.Node; // Metacarpal + case HumanBodyBones.LeftThumbIntermediate: return humanoid.LeftThumbProximal?.Node; // Proximal + case HumanBodyBones.LeftThumbDistal: return humanoid.LeftThumbDistal?.Node; + case HumanBodyBones.LeftIndexProximal: return humanoid.LeftIndexProximal?.Node; + case HumanBodyBones.LeftIndexIntermediate: return humanoid.LeftIndexIntermediate?.Node; + case HumanBodyBones.LeftIndexDistal: return humanoid.LeftIndexDistal?.Node; + case HumanBodyBones.LeftMiddleProximal: return humanoid.LeftMiddleProximal?.Node; + case HumanBodyBones.LeftMiddleIntermediate: return humanoid.LeftMiddleIntermediate?.Node; + case HumanBodyBones.LeftMiddleDistal: return humanoid.LeftMiddleDistal?.Node; + case HumanBodyBones.LeftRingProximal: return humanoid.LeftRingProximal?.Node; + case HumanBodyBones.LeftRingIntermediate: return humanoid.LeftRingIntermediate?.Node; + case HumanBodyBones.LeftRingDistal: return humanoid.LeftRingDistal?.Node; + case HumanBodyBones.LeftLittleProximal: return humanoid.LeftLittleProximal?.Node; + case HumanBodyBones.LeftLittleIntermediate: return humanoid.LeftLittleIntermediate?.Node; + case HumanBodyBones.LeftLittleDistal: return humanoid.LeftLittleDistal?.Node; + case HumanBodyBones.RightThumbProximal: return humanoid.RightThumbMetacarpal?.Node; // Metacarpal + case HumanBodyBones.RightThumbIntermediate: return humanoid.RightThumbProximal?.Node; // Proximal + case HumanBodyBones.RightThumbDistal: return humanoid.RightThumbDistal?.Node; + case HumanBodyBones.RightIndexProximal: return humanoid.RightIndexProximal?.Node; + case HumanBodyBones.RightIndexIntermediate: return humanoid.RightIndexIntermediate?.Node; + case HumanBodyBones.RightIndexDistal: return humanoid.RightIndexDistal?.Node; + case HumanBodyBones.RightMiddleProximal: return humanoid.RightMiddleProximal?.Node; + case HumanBodyBones.RightMiddleIntermediate: return humanoid.RightMiddleIntermediate?.Node; + case HumanBodyBones.RightMiddleDistal: return humanoid.RightMiddleDistal?.Node; + case HumanBodyBones.RightRingProximal: return humanoid.RightRingProximal?.Node; + case HumanBodyBones.RightRingIntermediate: return humanoid.RightRingIntermediate?.Node; + case HumanBodyBones.RightRingDistal: return humanoid.RightRingDistal?.Node; + case HumanBodyBones.RightLittleProximal: return humanoid.RightLittleProximal?.Node; + case HumanBodyBones.RightLittleIntermediate: return humanoid.RightLittleIntermediate?.Node; + case HumanBodyBones.RightLittleDistal: return humanoid.RightLittleDistal?.Node; + case HumanBodyBones.UpperChest: return humanoid.UpperChest?.Node; + } + return default; + } + + static Dictionary GetHumanMap(GltfData data, IReadOnlyList nodes) + { + var humanMap = new Dictionary(); + + + if (data.GLTF.extensions is UniGLTF.glTFExtensionImport extensions) + { + foreach (var kv in extensions.ObjectItems()) + { + if (kv.Key.GetString() == "VRMC_vrm_animation") + { + var animation = UniGLTF.Extensions.VRMC_vrm_animation.GltfDeserializer.Deserialize(kv.Value); + foreach (HumanBodyBones bone in UniGLTF.Utils.CachedEnum.GetValues()) + { + // Debug.Log($"{bone} => {index}"); + var node = GetNodeIndex(animation.Humanoid, bone); + if (node.HasValue) + { + humanMap.Add(bone, nodes[node.Value]); + } + } + } + } + } + return humanMap; + } + + public static async Task LoadVrmAnimationFromPathAsync(string path) + { + // + // GetHumanoid Mapping + // + using (GltfData data = new AutoGltfFileParser(path).Parse()) + using (var loader = new UniGLTF.ImporterContext(data)) + { + loader.InvertAxis = Axes.X; + // loader.PositionScaling = 0.01f; + var instance = await loader.LoadAsync(new ImmediateCaller()); + var humanMap = GetHumanMap(data, loader.Nodes); + if (humanMap.Count == 0) + { + throw new ArgumentException("fail to load VRMC_vrm_animation"); + } + + var description = AvatarDescription.Create(humanMap); + + // + // avatar + // + var avatar = description.CreateAvatar(instance.Root.transform); + avatar.name = "Avatar"; + // AvatarDescription = description; + var animator = instance.gameObject.AddComponent(); + animator.avatar = avatar; + + // create SkinnedMesh for bone visualize + var renderer = SkeletonMeshUtility.CreateRenderer(animator); + var material = new Material(Shader.Find("Standard")); + renderer.sharedMaterial = material; + var mesh = renderer.sharedMesh; + mesh.name = "box-man"; + + var humanoid = instance.gameObject.AddComponent(); + humanoid.AssignBonesFromAnimator(); + var motion = new VRM10Motion(instance); + var provider = new InitRotationPoseProvider(instance.transform, humanoid); + motion.ControlRig = (provider, provider); + return motion; + } + } } } diff --git a/Assets/VRM10_Samples/VRM10Viewer/VRM10Viewer.unity b/Assets/VRM10_Samples/VRM10Viewer/VRM10Viewer.unity index 15284a929..b6a73865f 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/VRM10Viewer.unity +++ b/Assets/VRM10_Samples/VRM10Viewer/VRM10Viewer.unity @@ -230,7 +230,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 339774397} - m_RootOrder: 11 + m_RootOrder: 12 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -394,6 +394,127 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 154330167} m_CullTransparentMesh: 0 +--- !u!1 &168425994 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 168425995} + - component: {fileID: 168425998} + - component: {fileID: 168425997} + - component: {fileID: 168425996} + m_Layer: 5 + m_Name: OpenMotion + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &168425995 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168425994} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1923525315} + m_Father: {fileID: 339774397} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &168425996 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168425994} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 168425997} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &168425997 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168425994} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &168425998 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168425994} + m_CullTransparentMesh: 0 --- !u!1 &175751362 GameObject: m_ObjectHideFlags: 0 @@ -642,7 +763,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 339774397} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1097,6 +1218,7 @@ RectTransform: m_Children: - {fileID: 1621794411} - {fileID: 2009818432} + - {fileID: 168425995} - {fileID: 1557052150} - {fileID: 224350191} - {fileID: 1791103379} @@ -1595,7 +1717,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 339774397} - m_RootOrder: 7 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1675,7 +1797,7 @@ RectTransform: - {fileID: 154330168} - {fileID: 1954133885} m_Father: {fileID: 339774397} - m_RootOrder: 13 + m_RootOrder: 14 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1761,7 +1883,7 @@ RectTransform: - {fileID: 2010083454} - {fileID: 1081455630} m_Father: {fileID: 339774397} - m_RootOrder: 9 + m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2914,7 +3036,7 @@ RectTransform: - {fileID: 175751363} - {fileID: 1904789319} m_Father: {fileID: 339774397} - m_RootOrder: 8 + m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2951,7 +3073,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 339774397} - m_RootOrder: 6 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -4114,7 +4236,7 @@ GameObject: - component: {fileID: 1268276257} - component: {fileID: 1268276256} m_Layer: 5 - m_Name: Version + m_Name: VrmVersion m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -4441,7 +4563,7 @@ RectTransform: - {fileID: 1866921958} - {fileID: 1767669911} m_Father: {fileID: 339774397} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -4654,7 +4776,7 @@ RectTransform: - {fileID: 452923209} - {fileID: 2090837017} m_Father: {fileID: 339774397} - m_RootOrder: 12 + m_RootOrder: 13 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -4818,7 +4940,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 339774397} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -5394,7 +5516,7 @@ RectTransform: - {fileID: 62367395} - {fileID: 1037763549} m_Father: {fileID: 339774397} - m_RootOrder: 10 + m_RootOrder: 11 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -5563,30 +5685,29 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_version: {fileID: 1268276256} - m_open: {fileID: 2009818433} + m_openModel: {fileID: 2009818433} + m_openMotion: {fileID: 168425996} m_enableLipSync: {fileID: 935566650} m_enableAutoBlink: {fileID: 634488422} m_enableAutoExpression: {fileID: 1767738855} m_useUrpMaterial: {fileID: 1438613465} m_useAsync: {fileID: 602093299} - m_src: {fileID: 0} m_target: {fileID: 802105000} - Root: {fileID: 0} m_motion: {fileID: 4900000, guid: 08df5151e71aed748b13547492fb8b9a, type: 3} m_texts: - m_textModelTitle: {fileID: 1111491925} - m_textModelVersion: {fileID: 1045380263} - m_textModelAuthor: {fileID: 854014595} - m_textModelContact: {fileID: 587234270} - m_textModelReference: {fileID: 1181308133} + m_textModelTitle: {fileID: 1636340565} + m_textModelVersion: {fileID: 2105159133} + m_textModelAuthor: {fileID: 827174942} + m_textModelContact: {fileID: 1922159877} + m_textModelReference: {fileID: 806723450} m_thumbnail: {fileID: 800895694} - m_textPermissionAllowed: {fileID: 1322834811} - m_textPermissionViolent: {fileID: 1242458544} - m_textPermissionSexual: {fileID: 933018279} - m_textPermissionCommercial: {fileID: 852999696} - m_textPermissionOther: {fileID: 1289294209} - m_textDistributionLicense: {fileID: 1476033062} - m_textDistributionOther: {fileID: 1104290798} + m_textPermissionAllowed: {fileID: 1633219309} + m_textPermissionViolent: {fileID: 935554082} + m_textPermissionSexual: {fileID: 928757302} + m_textPermissionCommercial: {fileID: 773923920} + m_textPermissionOther: {fileID: 1172469240} + m_textDistributionLicense: {fileID: 1007924637} + m_textDistributionOther: {fileID: 1199975014} m_ui: ToggleMotionTPose: {fileID: 1791103380} ToggleMotionBVH: {fileID: 1311520910} @@ -5622,7 +5743,7 @@ RectTransform: - {fileID: 1166391799} - {fileID: 1140410864} m_Father: {fileID: 339774397} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -5912,6 +6033,87 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1922159875} m_CullTransparentMesh: 0 +--- !u!1 &1923525314 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1923525315} + - component: {fileID: 1923525317} + - component: {fileID: 1923525316} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1923525315 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1923525314} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 168425995} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1923525316 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1923525314} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 'Open Motion + +' +--- !u!222 &1923525317 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1923525314} + m_CullTransparentMesh: 0 --- !u!1 &1954133884 GameObject: m_ObjectHideFlags: 0 @@ -6061,7 +6263,9 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: Open + m_Text: 'Open Model + +' --- !u!222 &1963417401 CanvasRenderer: m_ObjectHideFlags: 0 @@ -6083,7 +6287,7 @@ GameObject: - component: {fileID: 2009818434} - component: {fileID: 2009818433} m_Layer: 5 - m_Name: Open + m_Name: OpenModel m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs b/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs index 2c8c9bf3a..aadfa0104 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs +++ b/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs @@ -11,12 +11,15 @@ namespace UniVRM10.VRM10Viewer { public class VRM10ViewerUI : MonoBehaviour { - [Header("UI")] [SerializeField] Text m_version = default; + [Header("UI")] [SerializeField] - Button m_open = default; + Button m_openModel = default; + + [SerializeField] + Button m_openMotion = default; [SerializeField] Toggle m_enableLipSync = default; @@ -48,7 +51,7 @@ namespace UniVRM10.VRM10Viewer [Serializable] class TextFields { - [SerializeField, Header("Info")] + [SerializeField] Text m_textModelTitle = default; [SerializeField] Text m_textModelVersion = default; @@ -77,6 +80,28 @@ namespace UniVRM10.VRM10Viewer [SerializeField] Text m_textDistributionOther = default; + public void Reset() + { + var texts = GameObject.FindObjectsOfType(); + m_textModelTitle = texts.First(x => x.name == "Title"); + m_textModelVersion = texts.First(x => x.name == "Version"); + m_textModelAuthor = texts.First(x => x.name == "Author"); + m_textModelContact = texts.First(x => x.name == "Contact"); + m_textModelReference = texts.First(x => x.name == "Reference"); + + m_textPermissionAllowed = texts.First(x => x.name == "AllowedUser"); + m_textPermissionViolent = texts.First(x => x.name == "Violent"); + m_textPermissionSexual = texts.First(x => x.name == "Sexual"); + m_textPermissionCommercial = texts.First(x => x.name == "Commercial"); + m_textPermissionOther = texts.First(x => x.name == "Other"); + + m_textDistributionLicense = texts.First(x => x.name == "LicenseType"); + m_textDistributionOther = texts.First(x => x.name == "OtherLicense"); + + var images = GameObject.FindObjectsOfType(); + m_thumbnail = images.First(x => x.name == "RawImage"); + } + public void Start() { m_textModelTitle.text = ""; @@ -151,6 +176,16 @@ namespace UniVRM10.VRM10Viewer [SerializeField] ToggleGroup ToggleMotion = default; + public void Reset() + { + var toggles = GameObject.FindObjectsOfType(); + ToggleMotionTPose = toggles.First(x => x.name == "TPose"); + ToggleMotionBVH = toggles.First(x => x.name == "BVH"); + + var groups = GameObject.FindObjectsOfType(); + ToggleMotion = groups.First(x => x.name == "_Motion_"); + } + public bool IsBvhEnabled { get => ToggleMotion.ActiveToggles().FirstOrDefault() == ToggleMotionBVH; @@ -167,15 +202,21 @@ namespace UniVRM10.VRM10Viewer private void Reset() { var buttons = GameObject.FindObjectsOfType