From da2f7b8490299a9b3a67a5ceb78f72fafb67bb05 Mon Sep 17 00:00:00 2001 From: yutopp Date: Tue, 15 Jan 2019 17:56:44 +0900 Subject: [PATCH] Add experimental expoter option. Enable error checks for glTF --- Assets/VRM/UniGLTF/Scripts/Format/glTF.cs | 3 ++- Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Assets/VRM/UniGLTF/Scripts/Format/glTF.cs b/Assets/VRM/UniGLTF/Scripts/Format/glTF.cs index 79fbaad53..2e0e4648a 100644 --- a/Assets/VRM/UniGLTF/Scripts/Format/glTF.cs +++ b/Assets/VRM/UniGLTF/Scripts/Format/glTF.cs @@ -503,7 +503,8 @@ namespace UniGLTF string json; if (UseUniJSONSerializer) { - json = JsonSchema.FromType(GetType()).Serialize(this); + var c = new JsonSchemaValidationContext(this); + json = JsonSchema.FromType(GetType()).Serialize(this, c); } else { diff --git a/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs b/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs index df919da7b..953ec0f78 100644 --- a/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs +++ b/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs @@ -24,6 +24,8 @@ namespace VRM public bool PoseFreeze = true; + public bool UseExperimentalExporter = true; + public IEnumerable CanExport() { if (Source == null) @@ -250,7 +252,7 @@ namespace VRM } void Export(string path, List destroy) - { + { var target = Source; if (IsPrefab(target)) { @@ -277,7 +279,7 @@ namespace VRM vrm.extensions.VRM.meta.title = Title; vrm.extensions.VRM.meta.author = Author; - var bytes = vrm.ToGlbBytes(); + var bytes = vrm.ToGlbBytes(UseExperimentalExporter); File.WriteAllBytes(path, bytes); Debug.LogFormat("Export elapsed {0}", sw.Elapsed); }