From c523b1c7ea79e5b00c3e4a10ec1230463667a9e7 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 11 Jun 2021 16:38:22 +0900 Subject: [PATCH] =?UTF-8?q?JsonSchema=20=E3=82=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Format/SpringBone/Deserializer.g.cs | 317 +++++---- .../Runtime/Format/SpringBone/Format.g.cs | 9 +- .../Runtime/Format/SpringBone/Serializer.g.cs | 292 ++++---- .../Runtime/Format/Vrm/Deserializer.g.cs | 655 ++++++++++++++++++ Assets/VRM10/Runtime/Format/Vrm/Format.g.cs | 77 +- .../VRM10/Runtime/Format/Vrm/Serializer.g.cs | 655 ++++++++++++++++++ Assets/VRM10/Runtime/IO/Vrm10Exporter.cs | 44 +- Assets/VRM10/Runtime/IO/Vrm10Importer.cs | 108 +-- .../Runtime/Migration/MigrationVrmMeta.cs | 2 +- .../Migration/MigrationVrmSpringBone.cs | 32 +- Assets/VRM10/Tests/MigrationTests.cs | 16 +- vrm-specification | 2 +- 12 files changed, 1817 insertions(+), 392 deletions(-) diff --git a/Assets/VRM10/Runtime/Format/SpringBone/Deserializer.g.cs b/Assets/VRM10/Runtime/Format/SpringBone/Deserializer.g.cs index d2537dfbe..4134cd996 100644 --- a/Assets/VRM10/Runtime/Format/SpringBone/Deserializer.g.cs +++ b/Assets/VRM10/Runtime/Format/SpringBone/Deserializer.g.cs @@ -47,6 +47,11 @@ public static VRMC_springBone Deserialize(JsonNode parsed) continue; } + if(key=="colliders"){ + value.Colliders = Deserialize_Colliders(kv.Value); + continue; + } + if(key=="colliderGroups"){ value.ColliderGroups = Deserialize_ColliderGroups(kv.Value); continue; @@ -61,6 +66,162 @@ public static VRMC_springBone Deserialize(JsonNode parsed) return value; } +public static List Deserialize_Colliders(JsonNode parsed) +{ + var value = new List(); + foreach(var x in parsed.ArrayItems()) + { + value.Add(Deserialize_Colliders_ITEM(x)); + } + return value; +} + +public static Collider Deserialize_Colliders_ITEM(JsonNode parsed) +{ + var value = new Collider(); + + 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; + } + + if(key=="shape"){ + value.Shape = __colliders_ITEM_Deserialize_Shape(kv.Value); + continue; + } + + } + return value; +} + +public static ColliderShape __colliders_ITEM_Deserialize_Shape(JsonNode parsed) +{ + var value = new ColliderShape(); + + 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=="sphere"){ + value.Sphere = __colliders_ITEM__shape_Deserialize_Sphere(kv.Value); + continue; + } + + if(key=="capsule"){ + value.Capsule = __colliders_ITEM__shape_Deserialize_Capsule(kv.Value); + continue; + } + + } + return value; +} + +public static ColliderShapeSphere __colliders_ITEM__shape_Deserialize_Sphere(JsonNode parsed) +{ + var value = new ColliderShapeSphere(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="offset"){ + value.Offset = __colliders_ITEM__shape__sphere_Deserialize_Offset(kv.Value); + continue; + } + + if(key=="radius"){ + value.Radius = kv.Value.GetSingle(); + continue; + } + + } + return value; +} + +public static float[] __colliders_ITEM__shape__sphere_Deserialize_Offset(JsonNode parsed) +{ + var value = new float[parsed.GetArrayCount()]; + int i=0; + foreach(var x in parsed.ArrayItems()) + { + value[i++] = x.GetSingle(); + } + return value; +} + +public static ColliderShapeCapsule __colliders_ITEM__shape_Deserialize_Capsule(JsonNode parsed) +{ + var value = new ColliderShapeCapsule(); + + foreach(var kv in parsed.ObjectItems()) + { + var key = kv.Key.GetString(); + + if(key=="offset"){ + value.Offset = __colliders_ITEM__shape__capsule_Deserialize_Offset(kv.Value); + continue; + } + + if(key=="radius"){ + value.Radius = kv.Value.GetSingle(); + continue; + } + + if(key=="tail"){ + value.Tail = __colliders_ITEM__shape__capsule_Deserialize_Tail(kv.Value); + continue; + } + + } + return value; +} + +public static float[] __colliders_ITEM__shape__capsule_Deserialize_Offset(JsonNode parsed) +{ + var value = new float[parsed.GetArrayCount()]; + int i=0; + foreach(var x in parsed.ArrayItems()) + { + value[i++] = x.GetSingle(); + } + return value; +} + +public static float[] __colliders_ITEM__shape__capsule_Deserialize_Tail(JsonNode parsed) +{ + var value = new float[parsed.GetArrayCount()]; + int i=0; + foreach(var x in parsed.ArrayItems()) + { + value[i++] = x.GetSingle(); + } + return value; +} + public static List Deserialize_ColliderGroups(JsonNode parsed) { var value = new List(); @@ -89,6 +250,11 @@ public static ColliderGroup Deserialize_ColliderGroups_ITEM(JsonNode parsed) continue; } + if(key=="name"){ + value.Name = kv.Value.GetString(); + continue; + } + if(key=="colliders"){ value.Colliders = __colliderGroups_ITEM_Deserialize_Colliders(kv.Value); continue; @@ -98,158 +264,13 @@ public static ColliderGroup Deserialize_ColliderGroups_ITEM(JsonNode parsed) return value; } -public static List __colliderGroups_ITEM_Deserialize_Colliders(JsonNode parsed) +public static int[] __colliderGroups_ITEM_Deserialize_Colliders(JsonNode parsed) { - var value = new List(); - foreach(var x in parsed.ArrayItems()) - { - value.Add(__colliderGroups_ITEM_Deserialize_Colliders_ITEM(x)); - } - return value; -} - -public static Collider __colliderGroups_ITEM_Deserialize_Colliders_ITEM(JsonNode parsed) -{ - var value = new Collider(); - - 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; - } - - if(key=="shape"){ - value.Shape = __colliderGroups_ITEM__colliders_ITEM_Deserialize_Shape(kv.Value); - continue; - } - - } - return value; -} - -public static ColliderShape __colliderGroups_ITEM__colliders_ITEM_Deserialize_Shape(JsonNode parsed) -{ - var value = new ColliderShape(); - - 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=="sphere"){ - value.Sphere = __colliderGroups_ITEM__colliders_ITEM__shape_Deserialize_Sphere(kv.Value); - continue; - } - - if(key=="capsule"){ - value.Capsule = __colliderGroups_ITEM__colliders_ITEM__shape_Deserialize_Capsule(kv.Value); - continue; - } - - } - return value; -} - -public static ColliderShapeSphere __colliderGroups_ITEM__colliders_ITEM__shape_Deserialize_Sphere(JsonNode parsed) -{ - var value = new ColliderShapeSphere(); - - foreach(var kv in parsed.ObjectItems()) - { - var key = kv.Key.GetString(); - - if(key=="offset"){ - value.Offset = __colliderGroups_ITEM__colliders_ITEM__shape__sphere_Deserialize_Offset(kv.Value); - continue; - } - - if(key=="radius"){ - value.Radius = kv.Value.GetSingle(); - continue; - } - - } - return value; -} - -public static float[] __colliderGroups_ITEM__colliders_ITEM__shape__sphere_Deserialize_Offset(JsonNode parsed) -{ - var value = new float[parsed.GetArrayCount()]; + var value = new int[parsed.GetArrayCount()]; int i=0; foreach(var x in parsed.ArrayItems()) { - value[i++] = x.GetSingle(); - } - return value; -} - -public static ColliderShapeCapsule __colliderGroups_ITEM__colliders_ITEM__shape_Deserialize_Capsule(JsonNode parsed) -{ - var value = new ColliderShapeCapsule(); - - foreach(var kv in parsed.ObjectItems()) - { - var key = kv.Key.GetString(); - - if(key=="offset"){ - value.Offset = __colliderGroups_ITEM__colliders_ITEM__shape__capsule_Deserialize_Offset(kv.Value); - continue; - } - - if(key=="radius"){ - value.Radius = kv.Value.GetSingle(); - continue; - } - - if(key=="tail"){ - value.Tail = __colliderGroups_ITEM__colliders_ITEM__shape__capsule_Deserialize_Tail(kv.Value); - continue; - } - - } - return value; -} - -public static float[] __colliderGroups_ITEM__colliders_ITEM__shape__capsule_Deserialize_Offset(JsonNode parsed) -{ - var value = new float[parsed.GetArrayCount()]; - int i=0; - foreach(var x in parsed.ArrayItems()) - { - value[i++] = x.GetSingle(); - } - return value; -} - -public static float[] __colliderGroups_ITEM__colliders_ITEM__shape__capsule_Deserialize_Tail(JsonNode parsed) -{ - var value = new float[parsed.GetArrayCount()]; - int i=0; - foreach(var x in parsed.ArrayItems()) - { - value[i++] = x.GetSingle(); + value[i++] = x.GetInt32(); } return value; } diff --git a/Assets/VRM10/Runtime/Format/SpringBone/Format.g.cs b/Assets/VRM10/Runtime/Format/SpringBone/Format.g.cs index e9695e407..0ec4b43f8 100644 --- a/Assets/VRM10/Runtime/Format/SpringBone/Format.g.cs +++ b/Assets/VRM10/Runtime/Format/SpringBone/Format.g.cs @@ -62,7 +62,11 @@ namespace UniGLTF.Extensions.VRMC_springBone // Application-specific data. public object Extras; - public List Colliders; + // Name of the ColliderGroup + public string Name; + + // An array of colliders. + public int[] Colliders; } public class SpringBoneJoint @@ -120,6 +124,9 @@ namespace UniGLTF.Extensions.VRMC_springBone // Application-specific data. public object Extras; + // An array of colliders. + public List Colliders; + // An array of colliderGroups. public List ColliderGroups; diff --git a/Assets/VRM10/Runtime/Format/SpringBone/Serializer.g.cs b/Assets/VRM10/Runtime/Format/SpringBone/Serializer.g.cs index 194b7c75d..e9398a13c 100644 --- a/Assets/VRM10/Runtime/Format/SpringBone/Serializer.g.cs +++ b/Assets/VRM10/Runtime/Format/SpringBone/Serializer.g.cs @@ -43,6 +43,11 @@ public static void Serialize(JsonFormatter f, VRMC_springBone value) (value.Extras as glTFExtension).Serialize(f); } + if(value.Colliders!=null&&value.Colliders.Count()>=0){ + f.Key("colliders"); + Serialize_Colliders(f, value.Colliders); + } + if(value.ColliderGroups!=null&&value.ColliderGroups.Count()>=0){ f.Key("colliderGroups"); Serialize_ColliderGroups(f, value.ColliderGroups); @@ -56,6 +61,151 @@ public static void Serialize(JsonFormatter f, VRMC_springBone value) f.EndMap(); } +public static void Serialize_Colliders(JsonFormatter f, List value) +{ + f.BeginList(); + + foreach(var item in value) + { + Serialize_Colliders_ITEM(f, item); + + } + f.EndList(); +} + +public static void Serialize_Colliders_ITEM(JsonFormatter f, Collider 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()); + } + + if(value.Shape!=null){ + f.Key("shape"); + __colliders_ITEM_Serialize_Shape(f, value.Shape); + } + + f.EndMap(); +} + +public static void __colliders_ITEM_Serialize_Shape(JsonFormatter f, ColliderShape 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.Sphere!=null){ + f.Key("sphere"); + __colliders_ITEM__shape_Serialize_Sphere(f, value.Sphere); + } + + if(value.Capsule!=null){ + f.Key("capsule"); + __colliders_ITEM__shape_Serialize_Capsule(f, value.Capsule); + } + + f.EndMap(); +} + +public static void __colliders_ITEM__shape_Serialize_Sphere(JsonFormatter f, ColliderShapeSphere value) +{ + f.BeginMap(); + + + if(value.Offset!=null&&value.Offset.Count()>=3){ + f.Key("offset"); + __colliders_ITEM__shape__sphere_Serialize_Offset(f, value.Offset); + } + + if(value.Radius.HasValue){ + f.Key("radius"); + f.Value(value.Radius.GetValueOrDefault()); + } + + f.EndMap(); +} + +public static void __colliders_ITEM__shape__sphere_Serialize_Offset(JsonFormatter f, float[] value) +{ + f.BeginList(); + + foreach(var item in value) + { + f.Value(item); + + } + f.EndList(); +} + +public static void __colliders_ITEM__shape_Serialize_Capsule(JsonFormatter f, ColliderShapeCapsule value) +{ + f.BeginMap(); + + + if(value.Offset!=null&&value.Offset.Count()>=3){ + f.Key("offset"); + __colliders_ITEM__shape__capsule_Serialize_Offset(f, value.Offset); + } + + if(value.Radius.HasValue){ + f.Key("radius"); + f.Value(value.Radius.GetValueOrDefault()); + } + + if(value.Tail!=null&&value.Tail.Count()>=3){ + f.Key("tail"); + __colliders_ITEM__shape__capsule_Serialize_Tail(f, value.Tail); + } + + f.EndMap(); +} + +public static void __colliders_ITEM__shape__capsule_Serialize_Offset(JsonFormatter f, float[] value) +{ + f.BeginList(); + + foreach(var item in value) + { + f.Value(item); + + } + f.EndList(); +} + +public static void __colliders_ITEM__shape__capsule_Serialize_Tail(JsonFormatter f, float[] value) +{ + f.BeginList(); + + foreach(var item in value) + { + f.Value(item); + + } + f.EndList(); +} + public static void Serialize_ColliderGroups(JsonFormatter f, List value) { f.BeginList(); @@ -83,7 +233,12 @@ public static void Serialize_ColliderGroups_ITEM(JsonFormatter f, ColliderGroup (value.Extras as glTFExtension).Serialize(f); } - if(value.Colliders!=null&&value.Colliders.Count()>=0){ + if(!string.IsNullOrEmpty(value.Name)){ + f.Key("name"); + f.Value(value.Name); + } + + if(value.Colliders!=null&&value.Colliders.Count()>=1){ f.Key("colliders"); __colliderGroups_ITEM_Serialize_Colliders(f, value.Colliders); } @@ -91,140 +246,7 @@ public static void Serialize_ColliderGroups_ITEM(JsonFormatter f, ColliderGroup f.EndMap(); } -public static void __colliderGroups_ITEM_Serialize_Colliders(JsonFormatter f, List value) -{ - f.BeginList(); - - foreach(var item in value) - { - __colliderGroups_ITEM_Serialize_Colliders_ITEM(f, item); - - } - f.EndList(); -} - -public static void __colliderGroups_ITEM_Serialize_Colliders_ITEM(JsonFormatter f, Collider 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()); - } - - if(value.Shape!=null){ - f.Key("shape"); - __colliderGroups_ITEM__colliders_ITEM_Serialize_Shape(f, value.Shape); - } - - f.EndMap(); -} - -public static void __colliderGroups_ITEM__colliders_ITEM_Serialize_Shape(JsonFormatter f, ColliderShape 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.Sphere!=null){ - f.Key("sphere"); - __colliderGroups_ITEM__colliders_ITEM__shape_Serialize_Sphere(f, value.Sphere); - } - - if(value.Capsule!=null){ - f.Key("capsule"); - __colliderGroups_ITEM__colliders_ITEM__shape_Serialize_Capsule(f, value.Capsule); - } - - f.EndMap(); -} - -public static void __colliderGroups_ITEM__colliders_ITEM__shape_Serialize_Sphere(JsonFormatter f, ColliderShapeSphere value) -{ - f.BeginMap(); - - - if(value.Offset!=null&&value.Offset.Count()>=3){ - f.Key("offset"); - __colliderGroups_ITEM__colliders_ITEM__shape__sphere_Serialize_Offset(f, value.Offset); - } - - if(value.Radius.HasValue){ - f.Key("radius"); - f.Value(value.Radius.GetValueOrDefault()); - } - - f.EndMap(); -} - -public static void __colliderGroups_ITEM__colliders_ITEM__shape__sphere_Serialize_Offset(JsonFormatter f, float[] value) -{ - f.BeginList(); - - foreach(var item in value) - { - f.Value(item); - - } - f.EndList(); -} - -public static void __colliderGroups_ITEM__colliders_ITEM__shape_Serialize_Capsule(JsonFormatter f, ColliderShapeCapsule value) -{ - f.BeginMap(); - - - if(value.Offset!=null&&value.Offset.Count()>=3){ - f.Key("offset"); - __colliderGroups_ITEM__colliders_ITEM__shape__capsule_Serialize_Offset(f, value.Offset); - } - - if(value.Radius.HasValue){ - f.Key("radius"); - f.Value(value.Radius.GetValueOrDefault()); - } - - if(value.Tail!=null&&value.Tail.Count()>=3){ - f.Key("tail"); - __colliderGroups_ITEM__colliders_ITEM__shape__capsule_Serialize_Tail(f, value.Tail); - } - - f.EndMap(); -} - -public static void __colliderGroups_ITEM__colliders_ITEM__shape__capsule_Serialize_Offset(JsonFormatter f, float[] value) -{ - f.BeginList(); - - foreach(var item in value) - { - f.Value(item); - - } - f.EndList(); -} - -public static void __colliderGroups_ITEM__colliders_ITEM__shape__capsule_Serialize_Tail(JsonFormatter f, float[] value) +public static void __colliderGroups_ITEM_Serialize_Colliders(JsonFormatter f, int[] value) { f.BeginList(); diff --git a/Assets/VRM10/Runtime/Format/Vrm/Deserializer.g.cs b/Assets/VRM10/Runtime/Format/Vrm/Deserializer.g.cs index 6fd912718..931e45c84 100644 --- a/Assets/VRM10/Runtime/Format/Vrm/Deserializer.g.cs +++ b/Assets/VRM10/Runtime/Format/Vrm/Deserializer.g.cs @@ -37,6 +37,16 @@ public static VRMC_vrm Deserialize(JsonNode parsed) { 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; @@ -79,6 +89,16 @@ public static Meta Deserialize_Meta(JsonNode parsed) { 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=="name"){ value.Name = kv.Value.GetString(); continue; @@ -144,6 +164,11 @@ public static Meta Deserialize_Meta(JsonNode parsed) continue; } + if(key=="allowAntisocialOrHateUsage"){ + value.AllowAntisocialOrHateUsage = kv.Value.GetBoolean(); + continue; + } + if(key=="creditNotation"){ value.CreditNotation = (CreditNotationType)Enum.Parse(typeof(CreditNotationType), kv.Value.GetString(), true); continue; @@ -196,6 +221,16 @@ public static Humanoid Deserialize_Humanoid(JsonNode parsed) { 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=="humanBones"){ value.HumanBones = __humanoid_Deserialize_HumanBones(kv.Value); continue; @@ -500,6 +535,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_Hips(JsonNode parsed) { 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; @@ -517,6 +562,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_Spine(JsonNode parsed { 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; @@ -534,6 +589,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_Chest(JsonNode parsed { 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; @@ -551,6 +616,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_UpperChest(JsonNode p { 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; @@ -568,6 +643,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_Neck(JsonNode parsed) { 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; @@ -585,6 +670,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_Head(JsonNode parsed) { 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; @@ -602,6 +697,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftEye(JsonNode pars { 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; @@ -619,6 +724,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightEye(JsonNode par { 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; @@ -636,6 +751,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_Jaw(JsonNode parsed) { 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; @@ -653,6 +778,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftUpperLeg(JsonNode { 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; @@ -670,6 +805,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftLowerLeg(JsonNode { 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; @@ -687,6 +832,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftFoot(JsonNode par { 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; @@ -704,6 +859,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftToes(JsonNode par { 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; @@ -721,6 +886,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightUpperLeg(JsonNod { 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; @@ -738,6 +913,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightLowerLeg(JsonNod { 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; @@ -755,6 +940,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightFoot(JsonNode pa { 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; @@ -772,6 +967,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightToes(JsonNode pa { 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; @@ -789,6 +994,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftShoulder(JsonNode { 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; @@ -806,6 +1021,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftUpperArm(JsonNode { 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; @@ -823,6 +1048,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftLowerArm(JsonNode { 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; @@ -840,6 +1075,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftHand(JsonNode par { 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; @@ -857,6 +1102,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightShoulder(JsonNod { 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; @@ -874,6 +1129,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightUpperArm(JsonNod { 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; @@ -891,6 +1156,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightLowerArm(JsonNod { 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; @@ -908,6 +1183,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightHand(JsonNode pa { 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; @@ -925,6 +1210,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftThumbProximal(Jso { 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; @@ -942,6 +1237,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftThumbIntermediate { 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; @@ -959,6 +1264,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftThumbDistal(JsonN { 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; @@ -976,6 +1291,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftIndexProximal(Jso { 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; @@ -993,6 +1318,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftIndexIntermediate { 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; @@ -1010,6 +1345,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftIndexDistal(JsonN { 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; @@ -1027,6 +1372,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftMiddleProximal(Js { 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; @@ -1044,6 +1399,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftMiddleIntermediat { 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; @@ -1061,6 +1426,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftMiddleDistal(Json { 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; @@ -1078,6 +1453,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftRingProximal(Json { 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; @@ -1095,6 +1480,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftRingIntermediate( { 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; @@ -1112,6 +1507,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftRingDistal(JsonNo { 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; @@ -1129,6 +1534,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftLittleProximal(Js { 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; @@ -1146,6 +1561,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftLittleIntermediat { 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; @@ -1163,6 +1588,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_LeftLittleDistal(Json { 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; @@ -1180,6 +1615,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightThumbProximal(Js { 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; @@ -1197,6 +1642,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightThumbIntermediat { 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; @@ -1214,6 +1669,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightThumbDistal(Json { 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; @@ -1231,6 +1696,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightIndexProximal(Js { 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; @@ -1248,6 +1723,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightIndexIntermediat { 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; @@ -1265,6 +1750,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightIndexDistal(Json { 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; @@ -1282,6 +1777,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightMiddleProximal(J { 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; @@ -1299,6 +1804,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightMiddleIntermedia { 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; @@ -1316,6 +1831,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightMiddleDistal(Jso { 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; @@ -1333,6 +1858,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightRingProximal(Jso { 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; @@ -1350,6 +1885,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightRingIntermediate { 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; @@ -1367,6 +1912,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightRingDistal(JsonN { 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; @@ -1384,6 +1939,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightLittleProximal(J { 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; @@ -1401,6 +1966,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightLittleIntermedia { 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; @@ -1418,6 +1993,16 @@ public static HumanBone __humanoid__humanBones_Deserialize_RightLittleDistal(Jso { 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; @@ -1435,6 +2020,16 @@ public static FirstPerson Deserialize_FirstPerson(JsonNode parsed) { 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=="meshAnnotations"){ value.MeshAnnotations = __firstPerson_Deserialize_MeshAnnotations(kv.Value); continue; @@ -1462,6 +2057,16 @@ public static MeshAnnotation __firstPerson_Deserialize_MeshAnnotations_ITEM(Json { 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; @@ -1484,6 +2089,16 @@ public static LookAt Deserialize_LookAt(JsonNode parsed) { 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=="offsetFromHeadBone"){ value.OffsetFromHeadBone = __lookAt_Deserialize_OffsetFromHeadBone(kv.Value); continue; @@ -1537,6 +2152,16 @@ public static LookAtRangeMap __lookAt_Deserialize_RangeMapHorizontalInner(JsonNo { 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=="inputMaxValue"){ value.InputMaxValue = kv.Value.GetSingle(); continue; @@ -1559,6 +2184,16 @@ public static LookAtRangeMap __lookAt_Deserialize_RangeMapHorizontalOuter(JsonNo { 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=="inputMaxValue"){ value.InputMaxValue = kv.Value.GetSingle(); continue; @@ -1581,6 +2216,16 @@ public static LookAtRangeMap __lookAt_Deserialize_RangeMapVerticalDown(JsonNode { 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=="inputMaxValue"){ value.InputMaxValue = kv.Value.GetSingle(); continue; @@ -1603,6 +2248,16 @@ public static LookAtRangeMap __lookAt_Deserialize_RangeMapVerticalUp(JsonNode pa { 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=="inputMaxValue"){ value.InputMaxValue = kv.Value.GetSingle(); continue; diff --git a/Assets/VRM10/Runtime/Format/Vrm/Format.g.cs b/Assets/VRM10/Runtime/Format/Vrm/Format.g.cs index 7b9be66fe..57db40157 100644 --- a/Assets/VRM10/Runtime/Format/Vrm/Format.g.cs +++ b/Assets/VRM10/Runtime/Format/Vrm/Format.g.cs @@ -9,7 +9,7 @@ namespace UniGLTF.Extensions.VRMC_vrm public enum AvatarPermissionType { onlyAuthor, - explicitlyLicensedPerson, + onlySeparatelyLicensedPerson, everyone, } @@ -26,20 +26,25 @@ namespace UniGLTF.Extensions.VRMC_vrm { required, unnecessary, - abandoned, } public enum ModificationType { prohibited, - inherited, - notInherited, + allowModification, + allowModificationRedistribution, } public class Meta { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + // The name of the model public string Name; @@ -61,31 +66,34 @@ namespace UniGLTF.Extensions.VRMC_vrm // Third party licenses of the model, if required. You can use line breaks public string ThirdPartyLicenses; - // The index to access the thumbnail image of the avatar model in gltf.images. The texture resolution of 1024x1024 is recommended. It must be square. Preferable resolution is 1024 x 1024. This is for the application to use as an icon. + // The index to the thumbnail image of the model in gltf.images public int? ThumbnailImage; - // A person who can perform with this avatars + // A person who can perform as an avatar with this model public AvatarPermissionType AvatarPermission; - // A flag that permits to use this avatar in excessively violent contents + // A flag that permits to use this model in excessively violent contents public bool? AllowExcessivelyViolentUsage; - // A flag that permits to use this avatar in excessively sexual contents + // A flag that permits to use this model in excessively sexual contents public bool? AllowExcessivelySexualUsage; - // An option that permits to use this avatar in commercial products + // An option that permits to use this model in commercial products public CommercialUsageType CommercialUsage; - // A flag that permits to use this avatar in political or religious contents + // A flag that permits to use this model in political or religious contents public bool? AllowPoliticalOrReligiousUsage; - // An option that forces or abandons to display the credit of this avatar + // A flag that permits to use this model in contents contain anti-social activities or hate speeches + public bool? AllowAntisocialOrHateUsage; + + // An option that forces or abandons to display the credit of this model public CreditNotationType CreditNotation; - // A flag that permits to redistribute this avatar + // A flag that permits to redistribute this model public bool? AllowRedistribution; - // An option that controls the condition to modify this avatar + // An option that controls the condition to modify this model public ModificationType Modification; // Describe the URL links of other license @@ -94,6 +102,12 @@ namespace UniGLTF.Extensions.VRMC_vrm public class HumanBone { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + // Represents a single glTF node tied to this humanBone. public int? Node; } @@ -268,6 +282,12 @@ namespace UniGLTF.Extensions.VRMC_vrm public class Humanoid { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + // Represents a set of humanBones of a humanoid. public HumanBones HumanBones; } @@ -283,6 +303,12 @@ namespace UniGLTF.Extensions.VRMC_vrm public class MeshAnnotation { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + // The index of the node that attached to target mesh. public int? Node; @@ -292,6 +318,12 @@ namespace UniGLTF.Extensions.VRMC_vrm public class FirstPerson { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + // Mesh rendering annotation for cameras. public List MeshAnnotations; } @@ -305,6 +337,12 @@ namespace UniGLTF.Extensions.VRMC_vrm public class LookAtRangeMap { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + // Yaw and pitch angles ( degrees ) between the head bone forward vector and the eye gaze LookAt vector public float? InputMaxValue; @@ -314,6 +352,12 @@ namespace UniGLTF.Extensions.VRMC_vrm public class LookAt { + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + // The origin of LookAt. Position offset from the head bone public float[] OffsetFromHeadBone; @@ -467,9 +511,16 @@ namespace UniGLTF.Extensions.VRMC_vrm { public const string ExtensionName = "VRMC_vrm"; + // Dictionary object with extension-specific objects. + public object Extensions; + + // Application-specific data. + public object Extras; + // Specification version of the VRM public string SpecVersion; + // Meta informations of the VRM model public Meta Meta; // Correspondence between nodes and human bones diff --git a/Assets/VRM10/Runtime/Format/Vrm/Serializer.g.cs b/Assets/VRM10/Runtime/Format/Vrm/Serializer.g.cs index 52b057516..a3a381091 100644 --- a/Assets/VRM10/Runtime/Format/Vrm/Serializer.g.cs +++ b/Assets/VRM10/Runtime/Format/Vrm/Serializer.g.cs @@ -33,6 +33,16 @@ public static void Serialize(JsonFormatter f, VRMC_vrm 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); @@ -71,6 +81,16 @@ public static void Serialize_Meta(JsonFormatter f, Meta 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.Name)){ f.Key("name"); f.Value(value.Name); @@ -136,6 +156,11 @@ public static void Serialize_Meta(JsonFormatter f, Meta value) f.Value(value.AllowPoliticalOrReligiousUsage.GetValueOrDefault()); } + if(value.AllowAntisocialOrHateUsage.HasValue){ + f.Key("allowAntisocialOrHateUsage"); + f.Value(value.AllowAntisocialOrHateUsage.GetValueOrDefault()); + } + if(true){ f.Key("creditNotation"); f.Value(value.CreditNotation.ToString()); @@ -188,6 +213,16 @@ 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.HumanBones!=null){ f.Key("humanBones"); __humanoid_Serialize_HumanBones(f, value.HumanBones); @@ -484,6 +519,16 @@ public static void __humanoid__humanBones_Serialize_Hips(JsonFormatter f, HumanB 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()); @@ -497,6 +542,16 @@ public static void __humanoid__humanBones_Serialize_Spine(JsonFormatter f, Human 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()); @@ -510,6 +565,16 @@ public static void __humanoid__humanBones_Serialize_Chest(JsonFormatter f, Human 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()); @@ -523,6 +588,16 @@ public static void __humanoid__humanBones_Serialize_UpperChest(JsonFormatter f, 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()); @@ -536,6 +611,16 @@ public static void __humanoid__humanBones_Serialize_Neck(JsonFormatter f, HumanB 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()); @@ -549,6 +634,16 @@ public static void __humanoid__humanBones_Serialize_Head(JsonFormatter f, HumanB 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()); @@ -562,6 +657,16 @@ public static void __humanoid__humanBones_Serialize_LeftEye(JsonFormatter f, Hum 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()); @@ -575,6 +680,16 @@ public static void __humanoid__humanBones_Serialize_RightEye(JsonFormatter f, Hu 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()); @@ -588,6 +703,16 @@ public static void __humanoid__humanBones_Serialize_Jaw(JsonFormatter f, HumanBo 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()); @@ -601,6 +726,16 @@ public static void __humanoid__humanBones_Serialize_LeftUpperLeg(JsonFormatter f 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()); @@ -614,6 +749,16 @@ public static void __humanoid__humanBones_Serialize_LeftLowerLeg(JsonFormatter f 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()); @@ -627,6 +772,16 @@ public static void __humanoid__humanBones_Serialize_LeftFoot(JsonFormatter f, Hu 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()); @@ -640,6 +795,16 @@ public static void __humanoid__humanBones_Serialize_LeftToes(JsonFormatter f, Hu 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()); @@ -653,6 +818,16 @@ public static void __humanoid__humanBones_Serialize_RightUpperLeg(JsonFormatter 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()); @@ -666,6 +841,16 @@ public static void __humanoid__humanBones_Serialize_RightLowerLeg(JsonFormatter 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()); @@ -679,6 +864,16 @@ public static void __humanoid__humanBones_Serialize_RightFoot(JsonFormatter f, H 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()); @@ -692,6 +887,16 @@ public static void __humanoid__humanBones_Serialize_RightToes(JsonFormatter f, H 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()); @@ -705,6 +910,16 @@ public static void __humanoid__humanBones_Serialize_LeftShoulder(JsonFormatter f 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()); @@ -718,6 +933,16 @@ public static void __humanoid__humanBones_Serialize_LeftUpperArm(JsonFormatter f 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()); @@ -731,6 +956,16 @@ public static void __humanoid__humanBones_Serialize_LeftLowerArm(JsonFormatter f 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()); @@ -744,6 +979,16 @@ public static void __humanoid__humanBones_Serialize_LeftHand(JsonFormatter f, Hu 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()); @@ -757,6 +1002,16 @@ public static void __humanoid__humanBones_Serialize_RightShoulder(JsonFormatter 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()); @@ -770,6 +1025,16 @@ public static void __humanoid__humanBones_Serialize_RightUpperArm(JsonFormatter 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()); @@ -783,6 +1048,16 @@ public static void __humanoid__humanBones_Serialize_RightLowerArm(JsonFormatter 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()); @@ -796,6 +1071,16 @@ public static void __humanoid__humanBones_Serialize_RightHand(JsonFormatter f, H 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()); @@ -809,6 +1094,16 @@ public static void __humanoid__humanBones_Serialize_LeftThumbProximal(JsonFormat 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()); @@ -822,6 +1117,16 @@ public static void __humanoid__humanBones_Serialize_LeftThumbIntermediate(JsonFo 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()); @@ -835,6 +1140,16 @@ public static void __humanoid__humanBones_Serialize_LeftThumbDistal(JsonFormatte 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()); @@ -848,6 +1163,16 @@ public static void __humanoid__humanBones_Serialize_LeftIndexProximal(JsonFormat 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()); @@ -861,6 +1186,16 @@ public static void __humanoid__humanBones_Serialize_LeftIndexIntermediate(JsonFo 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()); @@ -874,6 +1209,16 @@ public static void __humanoid__humanBones_Serialize_LeftIndexDistal(JsonFormatte 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()); @@ -887,6 +1232,16 @@ public static void __humanoid__humanBones_Serialize_LeftMiddleProximal(JsonForma 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()); @@ -900,6 +1255,16 @@ public static void __humanoid__humanBones_Serialize_LeftMiddleIntermediate(JsonF 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()); @@ -913,6 +1278,16 @@ public static void __humanoid__humanBones_Serialize_LeftMiddleDistal(JsonFormatt 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()); @@ -926,6 +1301,16 @@ public static void __humanoid__humanBones_Serialize_LeftRingProximal(JsonFormatt 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()); @@ -939,6 +1324,16 @@ public static void __humanoid__humanBones_Serialize_LeftRingIntermediate(JsonFor 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()); @@ -952,6 +1347,16 @@ public static void __humanoid__humanBones_Serialize_LeftRingDistal(JsonFormatter 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()); @@ -965,6 +1370,16 @@ public static void __humanoid__humanBones_Serialize_LeftLittleProximal(JsonForma 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()); @@ -978,6 +1393,16 @@ public static void __humanoid__humanBones_Serialize_LeftLittleIntermediate(JsonF 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()); @@ -991,6 +1416,16 @@ public static void __humanoid__humanBones_Serialize_LeftLittleDistal(JsonFormatt 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()); @@ -1004,6 +1439,16 @@ public static void __humanoid__humanBones_Serialize_RightThumbProximal(JsonForma 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()); @@ -1017,6 +1462,16 @@ public static void __humanoid__humanBones_Serialize_RightThumbIntermediate(JsonF 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()); @@ -1030,6 +1485,16 @@ public static void __humanoid__humanBones_Serialize_RightThumbDistal(JsonFormatt 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()); @@ -1043,6 +1508,16 @@ public static void __humanoid__humanBones_Serialize_RightIndexProximal(JsonForma 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()); @@ -1056,6 +1531,16 @@ public static void __humanoid__humanBones_Serialize_RightIndexIntermediate(JsonF 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()); @@ -1069,6 +1554,16 @@ public static void __humanoid__humanBones_Serialize_RightIndexDistal(JsonFormatt 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()); @@ -1082,6 +1577,16 @@ public static void __humanoid__humanBones_Serialize_RightMiddleProximal(JsonForm 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()); @@ -1095,6 +1600,16 @@ public static void __humanoid__humanBones_Serialize_RightMiddleIntermediate(Json 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()); @@ -1108,6 +1623,16 @@ public static void __humanoid__humanBones_Serialize_RightMiddleDistal(JsonFormat 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()); @@ -1121,6 +1646,16 @@ public static void __humanoid__humanBones_Serialize_RightRingProximal(JsonFormat 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()); @@ -1134,6 +1669,16 @@ public static void __humanoid__humanBones_Serialize_RightRingIntermediate(JsonFo 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()); @@ -1147,6 +1692,16 @@ public static void __humanoid__humanBones_Serialize_RightRingDistal(JsonFormatte 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()); @@ -1160,6 +1715,16 @@ public static void __humanoid__humanBones_Serialize_RightLittleProximal(JsonForm 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()); @@ -1173,6 +1738,16 @@ public static void __humanoid__humanBones_Serialize_RightLittleIntermediate(Json 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()); @@ -1186,6 +1761,16 @@ public static void __humanoid__humanBones_Serialize_RightLittleDistal(JsonFormat 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()); @@ -1199,6 +1784,16 @@ public static void Serialize_FirstPerson(JsonFormatter f, FirstPerson 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.MeshAnnotations!=null&&value.MeshAnnotations.Count()>=0){ f.Key("meshAnnotations"); __firstPerson_Serialize_MeshAnnotations(f, value.MeshAnnotations); @@ -1224,6 +1819,16 @@ public static void __firstPerson_Serialize_MeshAnnotations_ITEM(JsonFormatter f, 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()); @@ -1242,6 +1847,16 @@ 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.OffsetFromHeadBone!=null&&value.OffsetFromHeadBone.Count()>=0){ f.Key("offsetFromHeadBone"); __lookAt_Serialize_OffsetFromHeadBone(f, value.OffsetFromHeadBone); @@ -1292,6 +1907,16 @@ public static void __lookAt_Serialize_RangeMapHorizontalInner(JsonFormatter f, L 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.InputMaxValue.HasValue){ f.Key("inputMaxValue"); f.Value(value.InputMaxValue.GetValueOrDefault()); @@ -1310,6 +1935,16 @@ public static void __lookAt_Serialize_RangeMapHorizontalOuter(JsonFormatter f, L 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.InputMaxValue.HasValue){ f.Key("inputMaxValue"); f.Value(value.InputMaxValue.GetValueOrDefault()); @@ -1328,6 +1963,16 @@ public static void __lookAt_Serialize_RangeMapVerticalDown(JsonFormatter f, Look 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.InputMaxValue.HasValue){ f.Key("inputMaxValue"); f.Value(value.InputMaxValue.GetValueOrDefault()); @@ -1346,6 +1991,16 @@ public static void __lookAt_Serialize_RangeMapVerticalUp(JsonFormatter f, LookAt 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.InputMaxValue.HasValue){ f.Key("inputMaxValue"); f.Value(value.InputMaxValue.GetValueOrDefault()); diff --git a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs index a0032e254..5abdc14d9 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs @@ -263,7 +263,7 @@ namespace UniVRM10 ExportLookAt(vrm, vrmController); ExportFirstPerson(vrm, vrmController, model, converter); - vrmSpringBone = ExportSpringBone(vrmController.SpringBone, model, converter); + vrmSpringBone = ExportSpringBone(vrmController, model, converter); ExportConstraints(vrmController, model, converter); } @@ -313,49 +313,49 @@ namespace UniVRM10 return joint; } - UniGLTF.Extensions.VRMC_springBone.VRMC_springBone ExportSpringBone(VRM10ControllerSpringBone src, Model model, ModelExporter converter) + UniGLTF.Extensions.VRMC_springBone.VRMC_springBone ExportSpringBone(VRM10Controller controller, Model model, ModelExporter converter) { var springBone = new UniGLTF.Extensions.VRMC_springBone.VRMC_springBone { + Colliders = new List(), ColliderGroups = new List(), Springs = new List(), }; + // colliders Func getNodeIndexFromTransform = t => { var node = converter.Nodes[t.gameObject]; return model.Nodes.IndexOf(node); }; - foreach (var x in src.ColliderGroups) + var colliders = controller.GetComponentsInChildren(); + foreach (var c in colliders) { - var colliderGroup = new UniGLTF.Extensions.VRMC_springBone.ColliderGroup + springBone.Colliders.Add(new UniGLTF.Extensions.VRMC_springBone.Collider { - Colliders = new List(), - }; - springBone.ColliderGroups.Add(colliderGroup); - - foreach (var y in x.Colliders) - { - if (y == null) - { - continue; - } - colliderGroup.Colliders.Add(new UniGLTF.Extensions.VRMC_springBone.Collider - { - Node = getNodeIndexFromTransform(y.transform), - Shape = ExportShape(y), - }); - } + Node = getNodeIndexFromTransform(c.transform), + Shape = ExportShape(c), + }); } - foreach (var x in src.Springs) + // colliderGroups + foreach (var x in controller.SpringBone.ColliderGroups) + { + springBone.ColliderGroups.Add(new UniGLTF.Extensions.VRMC_springBone.ColliderGroup + { + Colliders = x.Colliders.Select(y => Array.IndexOf(colliders, y)).ToArray(), + }); + } + + // springs + foreach (var x in controller.SpringBone.Springs) { var spring = new UniGLTF.Extensions.VRMC_springBone.Spring { Name = x.Name, Joints = x.Joints.Select(y => ExportJoint(y, getNodeIndexFromTransform)).ToList(), - ColliderGroups = x.ColliderGroups.Select(y => src.ColliderGroups.IndexOf(y)).ToArray(), + ColliderGroups = x.ColliderGroups.Select(y => controller.SpringBone.ColliderGroups.IndexOf(y)).ToArray(), }; springBone.Springs.Add(spring); } diff --git a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs index b1ae1537f..7b7230e08 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs @@ -387,9 +387,33 @@ namespace UniVRM10 { await awaitCaller.NextFrame(); - // springs - if (gltfVrmSpringBone.Springs != null) + // colliders + var colliders = new List(); + if (gltfVrmSpringBone.Colliders != null) { + foreach (var c in gltfVrmSpringBone.Colliders) + { + var collider = Nodes[c.Node.Value].gameObject.AddComponent(); + colliders.Add(collider); + if (c.Shape.Capsule is UniGLTF.Extensions.VRMC_springBone.ColliderShapeCapsule capsule) + { + collider.ColliderType = VRM10SpringBoneColliderTypes.Capsule; + collider.Offset = Vector3InvertX(capsule.Offset); + collider.Tail = Vector3InvertX(capsule.Tail); + collider.Radius = capsule.Radius.Value; + } + else if (c.Shape.Sphere is UniGLTF.Extensions.VRMC_springBone.ColliderShapeSphere sphere) + { + collider.ColliderType = VRM10SpringBoneColliderTypes.Sphere; + collider.Offset = Vector3InvertX(sphere.Offset); + collider.Radius = sphere.Radius.Value; + } + else + { + throw new Vrm10Exception(); + } + } + var secondary = Root.transform.Find("secondary"); if (secondary == null) { @@ -407,66 +431,48 @@ namespace UniVRM10 foreach (var c in g.Colliders) { - var node = Nodes[c.Node.Value]; - - var collider = node.gameObject.AddComponent(); + var collider = colliders[c]; colliderGroup.Colliders.Add(collider); - - if (c.Shape.Sphere is UniGLTF.Extensions.VRMC_springBone.ColliderShapeSphere sphere) - { - collider.ColliderType = VRM10SpringBoneColliderTypes.Sphere; - collider.Radius = sphere.Radius.Value; - collider.Offset = Vector3InvertX(sphere.Offset); - } - else if (c.Shape.Capsule is UniGLTF.Extensions.VRMC_springBone.ColliderShapeCapsule capsule) - { - collider.ColliderType = VRM10SpringBoneColliderTypes.Capsule; - collider.Radius = capsule.Radius.Value; - collider.Offset = Vector3InvertX(capsule.Offset); - collider.Tail = Vector3InvertX(capsule.Tail); - } - else - { - throw new NotImplementedException(); - } } } } + } - if (gltfVrmSpringBone.Springs != null) + // springs + if (gltfVrmSpringBone.Springs != null) + { + // spring + foreach (var gltfSpring in gltfVrmSpringBone.Springs) { - foreach (var gltfSpring in gltfVrmSpringBone.Springs) + if (gltfSpring.Joints == null || gltfSpring.Joints.Count == 0) { - if (gltfSpring.Joints == null || gltfSpring.Joints.Count == 0) - { - continue; - } - var spring = new VRM10ControllerSpringBone.Spring(gltfSpring.Name); - controller.SpringBone.Springs.Add(spring); + continue; + } + var spring = new VRM10ControllerSpringBone.Spring(gltfSpring.Name); + controller.SpringBone.Springs.Add(spring); - if (gltfSpring.ColliderGroups != null) + if (gltfSpring.ColliderGroups != null) + { + spring.ColliderGroups = gltfSpring.ColliderGroups.Select(x => controller.SpringBone.ColliderGroups[x]).ToList(); + } + // joint + foreach (var gltfJoint in gltfSpring.Joints) + { + if (gltfJoint.Node.HasValue) { - spring.ColliderGroups = gltfSpring.ColliderGroups.Select(x => controller.SpringBone.ColliderGroups[x]).ToList(); - } - // joint - foreach (var gltfJoint in gltfSpring.Joints) - { - if (gltfJoint.Node.HasValue) + var index = gltfJoint.Node.Value; + if (index < 0 || index >= Nodes.Count) { - var index = gltfJoint.Node.Value; - if (index < 0 || index >= Nodes.Count) - { - throw new IndexOutOfRangeException($"{index} > {Nodes.Count}"); - } - var joint = Nodes[gltfJoint.Node.Value].gameObject.AddComponent(); - joint.m_jointRadius = gltfJoint.HitRadius.Value; - joint.m_dragForce = gltfJoint.DragForce.Value; - joint.m_gravityDir = Vector3InvertX(gltfJoint.GravityDir); - joint.m_gravityPower = gltfJoint.GravityPower.Value; - joint.m_stiffnessForce = gltfJoint.Stiffness.Value; - // joint.m_exclude = gltfJoint.Exclude.GetValueOrDefault(); - spring.Joints.Add(joint); + throw new IndexOutOfRangeException($"{index} > {Nodes.Count}"); } + var joint = Nodes[gltfJoint.Node.Value].gameObject.AddComponent(); + joint.m_jointRadius = gltfJoint.HitRadius.Value; + joint.m_dragForce = gltfJoint.DragForce.Value; + joint.m_gravityDir = Vector3InvertX(gltfJoint.GravityDir); + joint.m_gravityPower = gltfJoint.GravityPower.Value; + joint.m_stiffnessForce = gltfJoint.Stiffness.Value; + // joint.m_exclude = gltfJoint.Exclude.GetValueOrDefault(); + spring.Joints.Add(joint); } } } diff --git a/Assets/VRM10/Runtime/Migration/MigrationVrmMeta.cs b/Assets/VRM10/Runtime/Migration/MigrationVrmMeta.cs index 5ae09f173..db803c9ea 100644 --- a/Assets/VRM10/Runtime/Migration/MigrationVrmMeta.cs +++ b/Assets/VRM10/Runtime/Migration/MigrationVrmMeta.cs @@ -65,7 +65,7 @@ namespace UniVRM10 meta.AvatarPermission = UniGLTF.Extensions.VRMC_vrm.AvatarPermissionType.onlyAuthor; break; case "ExplicitlyLicensedPerson": - meta.AvatarPermission = UniGLTF.Extensions.VRMC_vrm.AvatarPermissionType.explicitlyLicensedPerson; + meta.AvatarPermission = UniGLTF.Extensions.VRMC_vrm.AvatarPermissionType.onlySeparatelyLicensedPerson; break; case "Everyone": meta.AvatarPermission = UniGLTF.Extensions.VRMC_vrm.AvatarPermissionType.everyone; diff --git a/Assets/VRM10/Runtime/Migration/MigrationVrmSpringBone.cs b/Assets/VRM10/Runtime/Migration/MigrationVrmSpringBone.cs index 47e02e07b..0a4760fc7 100644 --- a/Assets/VRM10/Runtime/Migration/MigrationVrmSpringBone.cs +++ b/Assets/VRM10/Runtime/Migration/MigrationVrmSpringBone.cs @@ -49,27 +49,28 @@ namespace UniVRM10 last.children = new[] { tail_index }; } + /// + /// { + /// "colliderGroups": [ + /// ], + /// "boneGroups": [ + /// ], + /// } + /// + /// + /// + /// public static UniGLTF.Extensions.VRMC_springBone.VRMC_springBone Migrate(UniGLTF.glTF gltf, JsonNode sa) { - var colliderNodes = new List(); - var springBone = new UniGLTF.Extensions.VRMC_springBone.VRMC_springBone { + Colliders = new List(), ColliderGroups = new List(), Springs = new List(), }; foreach (var x in sa["colliderGroups"].ArrayItems()) { - var node = x["node"].GetInt32(); - colliderNodes.Add(node); - - var colliderGroup = new UniGLTF.Extensions.VRMC_springBone.ColliderGroup() - { - Colliders = new List(), - }; - springBone.ColliderGroups.Add(colliderGroup); - // { // "node": 14, // "colliders": [ @@ -99,9 +100,11 @@ namespace UniVRM10 // } // ] // }, + var colliders = new List(); foreach (var y in x["colliders"].ArrayItems()) { - colliderGroup.Colliders.Add(new UniGLTF.Extensions.VRMC_springBone.Collider + colliders.Add(springBone.Colliders.Count); + springBone.Colliders.Add(new UniGLTF.Extensions.VRMC_springBone.Collider { Node = x["node"].GetInt32(), Shape = new UniGLTF.Extensions.VRMC_springBone.ColliderShape @@ -114,6 +117,11 @@ namespace UniVRM10 } }); } + var colliderGroup = new UniGLTF.Extensions.VRMC_springBone.ColliderGroup() + { + Colliders = colliders.ToArray(), + }; + springBone.ColliderGroups.Add(colliderGroup); } // https://github.com/vrm-c/vrm-specification/pull/255 diff --git a/Assets/VRM10/Tests/MigrationTests.cs b/Assets/VRM10/Tests/MigrationTests.cs index 5329888b6..7a45c9478 100644 --- a/Assets/VRM10/Tests/MigrationTests.cs +++ b/Assets/VRM10/Tests/MigrationTests.cs @@ -228,10 +228,10 @@ namespace UniVRM10 var bytes0 = File.ReadAllBytes(AliciaPath); parser0.Parse(AliciaPath, bytes0); var json0 = parser0.Json.ParseAsJson(); - var colliderIndex = json0["extensions"]["VRM"]["secondaryAnimation"]["boneGroups"][0]["colliderGroups"][0].GetInt32(); - var x = json0["extensions"]["VRM"]["secondaryAnimation"]["colliderGroups"][colliderIndex]["colliders"][0]["offset"]["x"].GetSingle(); - var y = json0["extensions"]["VRM"]["secondaryAnimation"]["colliderGroups"][colliderIndex]["colliders"][0]["offset"]["y"].GetSingle(); - var z = json0["extensions"]["VRM"]["secondaryAnimation"]["colliderGroups"][colliderIndex]["colliders"][0]["offset"]["z"].GetSingle(); + var groupIndex = json0["extensions"]["VRM"]["secondaryAnimation"]["boneGroups"][0]["colliderGroups"][0].GetInt32(); + var x = json0["extensions"]["VRM"]["secondaryAnimation"]["colliderGroups"][groupIndex]["colliders"][0]["offset"]["x"].GetSingle(); + var y = json0["extensions"]["VRM"]["secondaryAnimation"]["colliderGroups"][groupIndex]["colliders"][0]["offset"]["y"].GetSingle(); + var z = json0["extensions"]["VRM"]["secondaryAnimation"]["colliderGroups"][groupIndex]["colliders"][0]["offset"]["z"].GetSingle(); Assert.AreEqual(VALUE.x, x); Assert.AreEqual(VALUE.y, y); Assert.AreEqual(VALUE.z, z); @@ -244,11 +244,11 @@ namespace UniVRM10 parser1.Parse(AliciaPath, bytes1); Assert.True(UniGLTF.Extensions.VRMC_springBone.GltfDeserializer.TryGet(parser1.GLTF.extensions, out UniGLTF.Extensions.VRMC_springBone.VRMC_springBone springBone)); var spring = springBone.Springs[0]; - var colliderNodeIndex = spring.ColliderGroups[0]; + // var colliderNodeIndex = spring.ColliderGroups[0]; // x軸だけが反転する - Assert.AreEqual(-VALUE.x, springBone.ColliderGroups[colliderIndex].Colliders[0].Shape.Sphere.Offset[0]); - Assert.AreEqual(VALUE.y, springBone.ColliderGroups[colliderIndex].Colliders[0].Shape.Sphere.Offset[1]); - Assert.AreEqual(VALUE.z, springBone.ColliderGroups[colliderIndex].Colliders[0].Shape.Sphere.Offset[2]); + Assert.AreEqual(-VALUE.x, springBone.Colliders[groupIndex].Shape.Sphere.Offset[0]); + Assert.AreEqual(VALUE.y, springBone.Colliders[groupIndex].Shape.Sphere.Offset[1]); + Assert.AreEqual(VALUE.z, springBone.Colliders[groupIndex].Shape.Sphere.Offset[2]); } } } diff --git a/vrm-specification b/vrm-specification index 9a02cc230..a755e9ab6 160000 --- a/vrm-specification +++ b/vrm-specification @@ -1 +1 @@ -Subproject commit 9a02cc2302c4c656e404fc1d505e9d9c4895d04d +Subproject commit a755e9ab6ba9d0bda840e2d2d869c6ecd8e3a280