Remove draco related fields to ignore extensions field. Extensions are already checked by 'ExtentionsUsed' field, it is safe to remove

This commit is contained in:
yutopp 2019-01-17 20:58:58 +09:00
parent c0e2455e0e
commit 38a0a7a715
4 changed files with 4 additions and 23 deletions

View File

@ -29,7 +29,7 @@ namespace UniGLTF
{
var r = deserialize<glTFPrimitives_extensions>("{\"KHR_draco_mesh_compression\":{}}");
Assert.NotNull(r);
Assert.NotNull(r.KHR_draco_mesh_compression);
//Assert.NotNull(r.KHR_draco_mesh_compression);
}
}
}

View File

@ -173,7 +173,7 @@ namespace UniGLTF
EnableDiagnosisForNotRequiredFields = true,
};
var json2 = JsonSchema.FromType<glTFMesh>().Serialize(model, c);
Assert.AreEqual(@"{""name"":""mesh"",""primitives"":[{""mode"":0,""attributes"":{""POSITION"":0},""material"":0,""extensions"":{}}]}", json2);
Assert.AreEqual(@"{""name"":""mesh"",""primitives"":[{""mode"":0,""attributes"":{""POSITION"":0},""material"":0}]}", json2);
}
[Test]
@ -203,7 +203,7 @@ namespace UniGLTF
EnableDiagnosisForNotRequiredFields = true,
};
var json2 = JsonSchema.FromType<glTFPrimitives>().Serialize(model, c);
Assert.AreEqual(@"{""mode"":0,""attributes"":{""POSITION"":0},""material"":0,""extras"":{""targetNames"":[""aaa""]},""extensions"":{}}", json2);
Assert.AreEqual(@"{""mode"":0,""attributes"":{""POSITION"":0},""material"":0,""extras"":{""targetNames"":[""aaa""]}}", json2);
}
[Test]

View File

@ -4,24 +4,9 @@ using UniJSON;
namespace UniGLTF
{
[Serializable]
public class glTF_KHR_draco_mesh_compression : JsonSerializableBase
{
[JsonSchema(Required = true, Minimum = 0)]
public int bufferView = -1;
public glTFAttributes attributes;
protected override void SerializeMembers(GLTFJsonFormatter f)
{
//throw new NotImplementedException();
}
}
[Serializable]
public partial class glTFPrimitives_extensions : ExtensionsBase<glTFPrimitives_extensions>
{
public glTF_KHR_draco_mesh_compression KHR_draco_mesh_compression;
[JsonSerializeMembers]
void SerializeMembers_draco(GLTFJsonFormatter f)
{

View File

@ -116,7 +116,7 @@ namespace UniGLTF
public glTFPrimitives_extras extras = new glTFPrimitives_extras();
[JsonSchema(SkipSchemaComparison = true)]
public glTFPrimitives_extensions extensions = new glTFPrimitives_extensions();
public glTFPrimitives_extensions extensions = null;
protected override void SerializeMembers(GLTFJsonFormatter f)
{
@ -128,10 +128,6 @@ namespace UniGLTF
{
f.Key("targets"); f.GLTFValue(targets);
}
if (extensions.KHR_draco_mesh_compression != null)
{
f.Key("extensions"); f.GLTFValue(extensions);
}
if (extras.targetNames.Count > 0)
{
f.Key("extras"); f.GLTFValue(extras);