mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-11 21:14:19 -05:00
Set 'ExplicitIgnorableItemLength = 0' to glTF elements to export models without errors
This commit is contained in:
parent
28562ec3f1
commit
1d0c2d8840
|
|
@ -575,6 +575,26 @@ namespace UniGLTF
|
|||
Assert.AreEqual("[version.String] null", ex.Message);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GLTFTest()
|
||||
{
|
||||
var model = new glTF()
|
||||
{
|
||||
asset = new glTFAssets()
|
||||
{
|
||||
version = "0.49",
|
||||
},
|
||||
extensions = null,
|
||||
};
|
||||
|
||||
var c = new JsonSchemaValidationContext("")
|
||||
{
|
||||
EnableDiagnosisForNotRequiredFields = true,
|
||||
};
|
||||
var json2 = JsonSchema.FromType<glTF>().Serialize(model, c);
|
||||
Assert.AreEqual(@"{""asset"":{""version"":""0.49""},""extras"":{}}", json2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SameMeshButDifferentMaterialExport()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace UniGLTF
|
|||
public glTFAssets asset = new glTFAssets();
|
||||
|
||||
#region Buffer
|
||||
[JsonSchema(MinItems = 1)]
|
||||
[JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
|
||||
public List<glTFBuffer> buffers = new List<glTFBuffer>();
|
||||
public int AddBuffer(IBytesBuffer bytesBuffer)
|
||||
{
|
||||
|
|
@ -40,7 +40,7 @@ namespace UniGLTF
|
|||
return index;
|
||||
}
|
||||
|
||||
[JsonSchema(MinItems = 1)]
|
||||
[JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
|
||||
public List<glTFBufferView> bufferViews = new List<glTFBufferView>();
|
||||
public int AddBufferView(glTFBufferView view)
|
||||
{
|
||||
|
|
@ -49,7 +49,7 @@ namespace UniGLTF
|
|||
return index;
|
||||
}
|
||||
|
||||
[JsonSchema(MinItems = 1)]
|
||||
[JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
|
||||
public List<glTFAccessor> accessors = new List<glTFAccessor>();
|
||||
|
||||
T[] GetAttrib<T>(glTFAccessor accessor, glTFBufferView view) where T : struct
|
||||
|
|
@ -212,7 +212,7 @@ namespace UniGLTF
|
|||
return samplers[index];
|
||||
}
|
||||
|
||||
[JsonSchema(MinItems = 1)]
|
||||
[JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
|
||||
public List<glTFImage> images = new List<glTFImage>();
|
||||
|
||||
public int GetImageIndexFromTextureIndex(int textureIndex)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user