From 797435f39876bdbb1bd8419e3d75c8a8a5920292 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 8 Jan 2021 13:12:25 +0900 Subject: [PATCH] export empty dictionary. version 0.63.2 --- .../Serialization/StringKeyDictionarySerialization.cs | 6 +++++- Assets/VRM/Editor/VRMSerializerGenerator.cs | 2 +- Assets/VRM/Runtime/Format/VRMSerializer.g.cs | 10 +++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Assets/UniGLTF/Editor/UniGLTF/Serialization/StringKeyDictionarySerialization.cs b/Assets/UniGLTF/Editor/UniGLTF/Serialization/StringKeyDictionarySerialization.cs index e09987807..c102d0de2 100644 --- a/Assets/UniGLTF/Editor/UniGLTF/Serialization/StringKeyDictionarySerialization.cs +++ b/Assets/UniGLTF/Editor/UniGLTF/Serialization/StringKeyDictionarySerialization.cs @@ -42,7 +42,11 @@ public static $0 $2(ListTreeNode parsed) public override string CreateSerializationCondition(string argName, JsonSchemaAttribute t) { - return $"{argName}!=null&&{argName}.Count>0"; + // return $"{argName}!=null&&{argName}.Count>0"; + + // this check is only /extensions/VRM/materialProperties/* + // should export empty dictionary. + return $"{argName}!=null"; } public override void GenerateSerializer(StreamWriter writer, string callName) diff --git a/Assets/VRM/Editor/VRMSerializerGenerator.cs b/Assets/VRM/Editor/VRMSerializerGenerator.cs index 75be56bc4..29e4e9733 100644 --- a/Assets/VRM/Editor/VRMSerializerGenerator.cs +++ b/Assets/VRM/Editor/VRMSerializerGenerator.cs @@ -16,7 +16,7 @@ namespace VRM get { return Path.Combine(UnityEngine.Application.dataPath, - "VRM/UniVRM/Scripts/Format/VRMSerializer.g.cs"); + "VRM/Runtime/Format/VRMSerializer.g.cs"); } } diff --git a/Assets/VRM/Runtime/Format/VRMSerializer.g.cs b/Assets/VRM/Runtime/Format/VRMSerializer.g.cs index ec49f1e3e..b603ebb48 100644 --- a/Assets/VRM/Runtime/Format/VRMSerializer.g.cs +++ b/Assets/VRM/Runtime/Format/VRMSerializer.g.cs @@ -935,27 +935,27 @@ public static void Serialize_vrm_materialProperties_ITEM(JsonFormatter f, glTF_V f.Value(value.renderQueue); } - if(value.floatProperties!=null&&value.floatProperties.Count>0){ + if(value.floatProperties!=null){ f.Key("floatProperties"); Serialize_vrm_materialProperties__floatProperties(f, value.floatProperties); } - if(value.vectorProperties!=null&&value.vectorProperties.Count>0){ + if(value.vectorProperties!=null){ f.Key("vectorProperties"); Serialize_vrm_materialProperties__vectorProperties(f, value.vectorProperties); } - if(value.textureProperties!=null&&value.textureProperties.Count>0){ + if(value.textureProperties!=null){ f.Key("textureProperties"); Serialize_vrm_materialProperties__textureProperties(f, value.textureProperties); } - if(value.keywordMap!=null&&value.keywordMap.Count>0){ + if(value.keywordMap!=null){ f.Key("keywordMap"); Serialize_vrm_materialProperties__keywordMap(f, value.keywordMap); } - if(value.tagMap!=null&&value.tagMap.Count>0){ + if(value.tagMap!=null){ f.Key("tagMap"); Serialize_vrm_materialProperties__tagMap(f, value.tagMap); }