From 92bc2673b13b2eb156ac3ebc45db9fbf21c7e212 Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Thu, 18 Feb 2021 20:04:14 +0900 Subject: [PATCH 1/4] add glTF & VRM spec schema repository as submodule. --- .gitmodules | 6 ++++++ glTF | 1 + vrm-specification | 1 + 3 files changed, 8 insertions(+) create mode 160000 glTF create mode 160000 vrm-specification diff --git a/.gitmodules b/.gitmodules index 8d2978b71..5baa4e8b8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,9 @@ [submodule "MToon"] path = Assets/VRMShaders/MToon url = https://github.com/Santarh/MToon.git +[submodule "vrm-specification"] + path = vrm-specification + url = https://github.com/vrm-c/vrm-specification.git +[submodule "glTF"] + path = glTF + url = https://github.com/KhronosGroup/glTF.git diff --git a/glTF b/glTF new file mode 160000 index 000000000..838b60750 --- /dev/null +++ b/glTF @@ -0,0 +1 @@ +Subproject commit 838b6075051739d8c83064d3cd19c8111b576068 diff --git a/vrm-specification b/vrm-specification new file mode 160000 index 000000000..068254bdf --- /dev/null +++ b/vrm-specification @@ -0,0 +1 @@ +Subproject commit 068254bdf1ca0fb8473487073c82164cb97432d0 From cfa276c21128613ad164b3849574bd34dc28e1cc Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Thu, 18 Feb 2021 20:06:59 +0900 Subject: [PATCH 2/4] =?UTF-8?q?spec=20=E3=81=AE=E5=8F=82=E7=85=A7=E5=85=88?= =?UTF-8?q?=E3=82=92=20submodule=20=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/VRM10/Editor/GeneratorMenu.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Assets/VRM10/Editor/GeneratorMenu.cs b/Assets/VRM10/Editor/GeneratorMenu.cs index e491852bb..1fb52567f 100644 --- a/Assets/VRM10/Editor/GeneratorMenu.cs +++ b/Assets/VRM10/Editor/GeneratorMenu.cs @@ -22,37 +22,37 @@ namespace UniVRM10 [MenuItem(UniVRM10.VRMVersion.MENU + "/Generate from JsonSchema")] public static void Main() { - var root = new DirectoryInfo(Path.GetFullPath(Path.Combine(Application.dataPath, "../../"))); + var projectRoot = new DirectoryInfo(Path.GetFullPath(Path.Combine(Application.dataPath, "../"))); - var gltf = new FileInfo(Path.Combine(root.FullName, "glTF/specification/2.0/schema/glTF.schema.json")); + var gltf = new FileInfo(Path.Combine(projectRoot.FullName, "glTF/specification/2.0/schema/glTF.schema.json")); var args = new string[] { // VRMC_vrm "vrm-specification/specification/VRMC_vrm-1.0_draft/schema/VRMC_vrm.schema.json", - "UniVRM/Assets/VRM10/Runtime/Format/Vrm", // dst + "Assets/VRM10/Runtime/Format/Vrm", // dst // VRMC_constraints "vrm-specification/specification/VRMC_constraints-1.0_draft/schema/VRMC_constraints.schema.json", - "UniVRM/Assets/VRM10/Runtime/Format/Constraints", // dst + "Assets/VRM10/Runtime/Format/Constraints", // dst // "vrm-specification/specification/VRMC_materials_mtoon-1.0_draft/schema/VRMC_materials_mtoon.schema.json", - "UniVRM/Assets/VRM10/Runtime/Format/MaterialsMToon", // dst + "Assets/VRM10/Runtime/Format/MaterialsMToon", // dst // "vrm-specification/specification/VRMC_node_collider_1.0_draft/schema/VRMC_node_collider.json", - "UniVRM/Assets/VRM10/Runtime/Format/NodeCollider", // dst + "Assets/VRM10/Runtime/Format/NodeCollider", // dst // "vrm-specification/specification/VRMC_springBone-1.0_draft/schema/VRMC_springBone.schema.json", - "UniVRM/Assets/VRM10/Runtime/Format/SpringBone", // dst + "Assets/VRM10/Runtime/Format/SpringBone", // dst }; for (int i = 0; i < args.Length; i += 2) { - var extensionSchemaPath = new FileInfo(Path.Combine(root.FullName, args[i])); + var extensionSchemaPath = new FileInfo(Path.Combine(projectRoot.FullName, args[i])); var parser = new UniGLTF.JsonSchema.JsonSchemaParser(gltf.Directory, extensionSchemaPath.Directory); var extensionSchema = parser.Load(extensionSchemaPath, ""); // extensionSchema.Dump(); - var dst = new DirectoryInfo(Path.Combine(root.FullName, args[i + 1])); + var dst = new DirectoryInfo(Path.Combine(projectRoot.FullName, args[i + 1])); Debug.Log(dst); GenerateUniGLTFSerialization.Generator.GenerateTo(extensionSchema, dst, clearFolder: true); } From 9a2017c6f99fffef3eea20b051907adce3ce1c61 Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Thu, 18 Feb 2021 20:07:22 +0900 Subject: [PATCH 3/4] =?UTF-8?q?schema=20=E3=81=8B=E3=82=89=E3=82=B7?= =?UTF-8?q?=E3=83=AA=E3=82=A2=E3=83=A9=E3=82=A4=E3=82=B6=E3=82=92=E7=94=9F?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runtime/Format/SpringBone/Deserializer.g.cs | 15 ++++++++++----- .../VRM10/Runtime/Format/SpringBone/Format.g.cs | 13 ++++++++----- .../Runtime/Format/SpringBone/Serializer.g.cs | 15 ++++++++++----- Assets/VRM10/Runtime/Format/Vrm/Format.g.cs | 16 ++++++++-------- 4 files changed, 36 insertions(+), 23 deletions(-) diff --git a/Assets/VRM10/Runtime/Format/SpringBone/Deserializer.g.cs b/Assets/VRM10/Runtime/Format/SpringBone/Deserializer.g.cs index 0586970cf..3ebef6e81 100644 --- a/Assets/VRM10/Runtime/Format/SpringBone/Deserializer.g.cs +++ b/Assets/VRM10/Runtime/Format/SpringBone/Deserializer.g.cs @@ -73,6 +73,16 @@ public static Spring Deserialize_Springs_ITEM(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; @@ -150,11 +160,6 @@ public static SpringBoneJoint Deserialize_Joints_ITEM(JsonNode parsed) continue; } - if(key=="exclude"){ - value.Exclude = kv.Value.GetBoolean(); - continue; - } - } return value; } diff --git a/Assets/VRM10/Runtime/Format/SpringBone/Format.g.cs b/Assets/VRM10/Runtime/Format/SpringBone/Format.g.cs index 8febc816d..17405bf0e 100644 --- a/Assets/VRM10/Runtime/Format/SpringBone/Format.g.cs +++ b/Assets/VRM10/Runtime/Format/SpringBone/Format.g.cs @@ -32,20 +32,23 @@ namespace UniGLTF.Extensions.VRMC_springBone // Air resistance. Deceleration force. public float? DragForce; - - // When enabled, this joint will skip Spring processing. - public bool? Exclude; } public class Spring { + // Dictionary object with extension-specific objects. + public glTFExtension Extensions; + + // Application-specific data. + public glTFExtension Extras; + // Name of the Spring public string Name; - // Joints in this spring. Except for the first element, the parent of the element must be the previous element of the array + // Joints of the spring. Except for the first element, a previous joint of the array must be an ancestor of the joint. public List Joints; - // Colliders that detect collision with nodes start from springRoot + // Colliders that detect collision with this spring. public int[] Colliders; } diff --git a/Assets/VRM10/Runtime/Format/SpringBone/Serializer.g.cs b/Assets/VRM10/Runtime/Format/SpringBone/Serializer.g.cs index 8a87d1aef..c7b9fa404 100644 --- a/Assets/VRM10/Runtime/Format/SpringBone/Serializer.g.cs +++ b/Assets/VRM10/Runtime/Format/SpringBone/Serializer.g.cs @@ -68,6 +68,16 @@ public static void Serialize_Springs_ITEM(JsonFormatter f, Spring value) f.BeginMap(); + if(value.Extensions!=null){ + f.Key("extensions"); + value.Extensions.Serialize(f); + } + + if(value.Extras!=null){ + f.Key("extras"); + value.Extras.Serialize(f); + } + if(!string.IsNullOrEmpty(value.Name)){ f.Key("name"); f.Value(value.Name); @@ -143,11 +153,6 @@ public static void Serialize_Joints_ITEM(JsonFormatter f, SpringBoneJoint value) f.Value(value.DragForce.GetValueOrDefault()); } - if(value.Exclude.HasValue){ - f.Key("exclude"); - f.Value(value.Exclude.GetValueOrDefault()); - } - f.EndMap(); } diff --git a/Assets/VRM10/Runtime/Format/Vrm/Format.g.cs b/Assets/VRM10/Runtime/Format/Vrm/Format.g.cs index d2719fe49..039d50570 100644 --- a/Assets/VRM10/Runtime/Format/Vrm/Format.g.cs +++ b/Assets/VRM10/Runtime/Format/Vrm/Format.g.cs @@ -305,7 +305,7 @@ namespace UniGLTF.Extensions.VRMC_vrm public enum LookAtType { bone, - blendShape, + expression, } @@ -342,23 +342,23 @@ namespace UniGLTF.Extensions.VRMC_vrm public enum ExpressionPreset { custom, + happy, + angry, + sad, + relaxed, + surprised, aa, ih, ou, ee, oh, blink, - happy, - angry, - sad, - relaxed, + blinkLeft, + blinkRight, lookUp, - surprised, lookDown, lookLeft, lookRight, - blinkLeft, - blinkRight, neutral, } From 91418e0f7a5749dc80f537913ff8874c3db3e43b Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Thu, 18 Feb 2021 20:07:58 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E9=83=A8?= =?UTF-8?q?=E5=88=86=E3=82=92=E6=9A=AB=E5=AE=9A=E7=9A=84=E3=81=AB=E5=AF=BE?= =?UTF-8?q?=E5=87=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/VRM10/Runtime/IO/Vrm10Storage.cs | 1 - Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Assets/VRM10/Runtime/IO/Vrm10Storage.cs b/Assets/VRM10/Runtime/IO/Vrm10Storage.cs index e17aa7127..7faa0ea0c 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Storage.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Storage.cs @@ -737,7 +737,6 @@ namespace UniVRM10 joint.GravityDir = gltfJoint.GravityDir.ToVector3(); joint.GravityPower = gltfJoint.GravityPower.Value; joint.Stiffness = gltfJoint.Stiffness.Value; - joint.Exclude = gltfJoint.Exclude.GetValueOrDefault(); springBone.Joints.Add(joint); } diff --git a/Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs b/Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs index dc10876e5..843c21da8 100644 --- a/Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs +++ b/Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs @@ -19,7 +19,7 @@ namespace UniVRM10 switch (src) { case UniGLTF.Extensions.VRMC_vrm.LookAtType.bone: return LookAtType.Bone; - case UniGLTF.Extensions.VRMC_vrm.LookAtType.blendShape: return LookAtType.Expression; + case UniGLTF.Extensions.VRMC_vrm.LookAtType.expression: return LookAtType.Expression; } throw new NotImplementedException();