mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-24 03:51:23 -05:00
Add schemaVersion field to VRM extensions
This commit is contained in:
parent
0b0e511100
commit
6c2da9704a
|
|
@ -617,6 +617,27 @@ namespace VRM
|
|||
Assert.AreEqual(json,json2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExtensionsTest()
|
||||
{
|
||||
var model = new glTF_VRM_extensions()
|
||||
{
|
||||
meta = null,
|
||||
humanoid = null,
|
||||
firstPerson = null,
|
||||
blendShapeMaster = null,
|
||||
secondaryAnimation = null,
|
||||
materialProperties = null,
|
||||
};
|
||||
|
||||
var c = new JsonSchemaValidationContext("")
|
||||
{
|
||||
EnableDiagnosisForNotRequiredFields = true,
|
||||
};
|
||||
var json2 = JsonSchema.FromType<glTF_VRM_extensions>().Serialize(model, c);
|
||||
Assert.AreEqual(@"{""exporterVersion"":""UniVRM-0.50"",""schemaVersion"":""0.0""}",json2);
|
||||
}
|
||||
|
||||
// TODO: Move to another suitable location
|
||||
T deserialize<T>(string json)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ VRM extension is for 3d humanoid avatars (and models) in VR applications.
|
|||
[JsonSchema(Description = @"Version of exporter that vrm created. " + VRMVersion.VRM_VERSION)]
|
||||
public string exporterVersion = "UniVRM-" + VRMVersion.VERSION;
|
||||
|
||||
[JsonSchema(Description = @"Version of JSON Schema for VRM")]
|
||||
public string schemaVersion = VRMSchemaVersion.Version;
|
||||
|
||||
public glTF_VRM_Meta meta = new glTF_VRM_Meta();
|
||||
public glTF_VRM_Humanoid humanoid = new glTF_VRM_Humanoid();
|
||||
public glTF_VRM_Firstperson firstPerson = new glTF_VRM_Firstperson();
|
||||
|
|
@ -47,6 +50,7 @@ VRM extension is for 3d humanoid avatars (and models) in VR applications.
|
|||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => exporterVersion);
|
||||
f.KeyValue(() => schemaVersion);
|
||||
f.Key("meta"); f.GLTFValue(meta);
|
||||
f.Key("humanoid"); f.GLTFValue(humanoid);
|
||||
f.Key("firstPerson"); f.GLTFValue(firstPerson);
|
||||
|
|
|
|||
18
Assets/VRM/UniVRM/Scripts/Format/VRMSchemaVersion.cs
Normal file
18
Assets/VRM/UniVRM/Scripts/Format/VRMSchemaVersion.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
|
||||
namespace VRM
|
||||
{
|
||||
public class VRMSchemaVersion
|
||||
{
|
||||
public const int Major = 0;
|
||||
public const int Minor = 0;
|
||||
|
||||
public static string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
return String.Format("{0}.{1}", Major, Minor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3c5b8467d0154d6da78a74ecae5f85e7
|
||||
timeCreated: 1549016543
|
||||
Loading…
Reference in New Issue
Block a user