From 5a31c777bbec55c057f52a266fc332cf110b847a Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 2 Nov 2018 22:17:13 +0900 Subject: [PATCH] IsBinary read/write --- Scripts/Format/VRMImporterContext.cs | 5 +++-- Scripts/Format/glTF_VRM_BlendShape.cs | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Scripts/Format/VRMImporterContext.cs b/Scripts/Format/VRMImporterContext.cs index 4be74a047..e73bcb11f 100644 --- a/Scripts/Format/VRMImporterContext.cs +++ b/Scripts/Format/VRMImporterContext.cs @@ -152,6 +152,7 @@ namespace VRM { asset.BlendShapeName = groupName; asset.Preset = EnumUtil.TryParseOrDefault(group.presetName); + asset.IsBinary = group.isBinary; if (asset.Preset == BlendShapePreset.Unknown) { // fallback @@ -250,7 +251,7 @@ namespace VRM AvatarDescription = GLTF.extensions.VRM.humanoid.ToDescription(Nodes); AvatarDescription.name = "AvatarDescription"; HumanoidAvatar = AvatarDescription.CreateAvatar(Root.transform); - if(!HumanoidAvatar.isValid || !HumanoidAvatar.isHuman) + if (!HumanoidAvatar.isValid || !HumanoidAvatar.isHuman) { throw new Exception("fail to create avatar"); } @@ -289,7 +290,7 @@ namespace VRM meta.Title = gltfMeta.title; var thumbnail = GetTexture(gltfMeta.texture); - if (thumbnail!=null) + if (thumbnail != null) { // ロード済み meta.Thumbnail = thumbnail.Texture; diff --git a/Scripts/Format/glTF_VRM_BlendShape.cs b/Scripts/Format/glTF_VRM_BlendShape.cs index 522051d6a..7338872c2 100644 --- a/Scripts/Format/glTF_VRM_BlendShape.cs +++ b/Scripts/Format/glTF_VRM_BlendShape.cs @@ -91,7 +91,7 @@ namespace VRM [JsonSchema(Description = "Expression name")] public string name; - [JsonSchema(Description = "Predefined Expression name", EnumValues =new object[] { + [JsonSchema(Description = "Predefined Expression name", EnumValues = new object[] { "unknown", "neutral", "a", @@ -119,10 +119,14 @@ namespace VRM [JsonSchema(Description = "Material animation references.")] public List materialValues = new List(); + [JsonSchema(Description = "0 or 1. Do not allow an intermediate value. Value should rounded")] + public bool isBinary; + protected override void SerializeMembers(GLTFJsonFormatter f) { f.KeyValue(() => name); f.KeyValue(() => presetName); + f.KeyValue(() => isBinary); f.KeyValue(() => binds); f.KeyValue(() => materialValues); } @@ -157,6 +161,7 @@ namespace VRM { name = clip.BlendShapeName, presetName = clip.Preset.ToString().ToLower(), + isBinary = clip.IsBinary, binds = list, materialValues = materialList, };