From c18bbc4150027f8dd676d04600f3253cb6b8e4f2 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 6 Aug 2019 17:17:42 +0900 Subject: [PATCH] add attribute check --- .../VRM/UniGLTF/Editor/SerializerGenerator.cs | 12 ++++++++++++ .../Scripts/IO/FormatterExtensionsGltf.g.cs | 18 +++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Assets/VRM/UniGLTF/Editor/SerializerGenerator.cs b/Assets/VRM/UniGLTF/Editor/SerializerGenerator.cs index 1dbfdaab7..b0da0f38a 100644 --- a/Assets/VRM/UniGLTF/Editor/SerializerGenerator.cs +++ b/Assets/VRM/UniGLTF/Editor/SerializerGenerator.cs @@ -53,7 +53,19 @@ namespace UniGLTF {"gltf/animations[]/channels[]/target", "if(value!=null)" }, {"gltf/accessors[]/sparse", "if(value.sparse!=null && value.sparse.count>0)"}, {"gltf/meshes[]/primitives[]/targets", "if(value.targets.Count>0)" }, + + {"gltf/meshes[]/primitives[]/targets[]/POSITION", "if(value.POSITION!=-1)" }, + {"gltf/meshes[]/primitives[]/targets[]/NORMAL", "if(value.NORMAL!=-1)" }, + {"gltf/meshes[]/primitives[]/targets[]/TANGENT", "if(value.TANGENT!=-1)" }, + + {"gltf/meshes[]/primitives[]/attributes/POSITION", "if(value.POSITION!=-1)"}, + {"gltf/meshes[]/primitives[]/attributes/NORMAL", "if(value.NORMAL!=-1)"}, + {"gltf/meshes[]/primitives[]/attributes/TANGENT", "if(value.TANGENT!=-1)"}, + {"gltf/meshes[]/primitives[]/attributes/TEXCOORD_0", "if(value.TEXCOORD_0!=-1)"}, {"gltf/meshes[]/primitives[]/attributes/COLOR_0", "if(value.COLOR_0!=-1)"}, + {"gltf/meshes[]/primitives[]/attributes/JOINTS_0", "if(value.JOINTS_0!=-1)"}, + {"gltf/meshes[]/primitives[]/attributes/WEIGHTS_0", "if(value.WEIGHTS_0!=-1)"}, + {"gltf/meshes[]/primitives[]/extras", "if(value.extras!=null && value.extras.targetNames!=null && value.extras.targetNames.Count>0)"}, {"gltf/materials[]/alphaCutoff", "if(!string.IsNullOrEmpty(value.alphaMode))" }, {"gltf/nodes[]/camera", "if(value.camera!=-1)"}, diff --git a/Assets/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs b/Assets/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs index 61a14137f..e1174d347 100644 --- a/Assets/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs +++ b/Assets/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs @@ -827,22 +827,22 @@ namespace UniGLTF { { f.BeginMap(0); // dummy - + if(value.POSITION!=-1) { f.Key("POSITION"); f.GenSerialize(value.POSITION); } - + if(value.NORMAL!=-1) { f.Key("NORMAL"); f.GenSerialize(value.NORMAL); } - + if(value.TANGENT!=-1) { f.Key("TANGENT"); f.GenSerialize(value.TANGENT); } - + if(value.TEXCOORD_0!=-1) { f.Key("TEXCOORD_0"); f.GenSerialize(value.TEXCOORD_0); } @@ -852,12 +852,12 @@ namespace UniGLTF { f.Key("COLOR_0"); f.GenSerialize(value.COLOR_0); } - + if(value.JOINTS_0!=-1) { f.Key("JOINTS_0"); f.GenSerialize(value.JOINTS_0); } - + if(value.WEIGHTS_0!=-1) { f.Key("WEIGHTS_0"); f.GenSerialize(value.WEIGHTS_0); } @@ -881,17 +881,17 @@ namespace UniGLTF { { f.BeginMap(0); // dummy - + if(value.POSITION!=-1) { f.Key("POSITION"); f.GenSerialize(value.POSITION); } - + if(value.NORMAL!=-1) { f.Key("NORMAL"); f.GenSerialize(value.NORMAL); } - + if(value.TANGENT!=-1) { f.Key("TANGENT"); f.GenSerialize(value.TANGENT); }