diff --git a/Assets/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs b/Assets/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs index e1ea54345..a1d1c0130 100644 --- a/Assets/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs +++ b/Assets/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs @@ -44,13 +44,13 @@ namespace UniGLTF Stream m_s; StreamWriter m_w; - static Dictionary s_snipets = new Dictionary + static Dictionary s_snippets = new Dictionary { {"gltf/animations", "if(value.animations!=null && value.animations.Count>0)" }, {"gltf/cameras", "if(value.cameras!=null && value.cameras.Count>0)" }, {"gltf/buffers", "if(value.buffers!=null && value.buffers.Count>0)" }, {"gltf/bufferViews", "if(value.bufferViews!=null && value.bufferViews.Count>0)" }, - {"gltf/bufferViews[]/byteStride", "if(false)" }, + {"gltf/bufferViews[]/byteStride", "" }, {"gltf/bufferViews[]/target", "if(value.target!=0)" }, {"gltf/animations[]/channels", "if(value.channels!=null && value.channels.Count>0)" }, {"gltf/animations[]/channels[]/target", "if(value!=null)" }, @@ -276,7 +276,7 @@ namespace UniGLTF { { } - else if(fi.FieldType == typeof(glTF_KHR_materials_unlit)) + else if (fi.FieldType == typeof(glTF_KHR_materials_unlit)) { } @@ -287,20 +287,27 @@ namespace UniGLTF { var snipet = fi.FieldType.IsClass ? "if(value." + fi.Name + "!=null)" : ""; var value = default(string); - if (s_snipets.TryGetValue(path + "/" + fi.Name, out value)) + if (s_snippets.TryGetValue(path + "/" + fi.Name, out value)) { snipet = value; } - m_w.Write(@" + if (value == "") + { + // found, but empty + } + else + { + m_w.Write(@" $1 { f.Key(""$0""); f.GenSerialize(value.$0); } " -.Replace("$0", fi.Name) -.Replace("$1", snipet) -); + .Replace("$0", fi.Name) + .Replace("$1", snipet) + ); + } } m_w.Write(@" diff --git a/Assets/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs b/Assets/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs index 4a4065a66..11bdaf98d 100644 --- a/Assets/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs +++ b/Assets/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs @@ -212,11 +212,6 @@ namespace UniGLTF { f.Key("byteLength"); f.GenSerialize(value.byteLength); } - if(false) - { - f.Key("byteStride"); f.GenSerialize(value.byteStride); - } - if(value.target!=0) { f.Key("target"); f.GenSerialize(value.target);