From 603be0dd2b1de2e6ba65db8ba79966e44ac7dc0b Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 28 Feb 2022 15:34:37 +0900 Subject: [PATCH] GltfExportSettings.AnimationExporter to gltfExporter argument --- .../Editor/UniGLTF/ExportDialog/GltfExportWindow.cs | 6 +++--- .../UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs | 2 -- Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs | 11 ++++++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/GltfExportWindow.cs b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/GltfExportWindow.cs index 9e789c59a..4e0387bcc 100644 --- a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/GltfExportWindow.cs +++ b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/GltfExportWindow.cs @@ -103,10 +103,10 @@ namespace UniGLTF EditorUtility.DisplayProgressBar("export gltf", path, progress); try { - var data = new ExportingGltfData(); - Settings.AnimationExporter = new EditorAnimationExporter(); - using (var exporter = new gltfExporter(data, Settings, new EditorProgress())) + using (var exporter = new gltfExporter(data, Settings, + progress: new EditorProgress(), + animationExporter: new EditorAnimationExporter())) { exporter.Prepare(State.ExportRoot); exporter.Export(new EditorTextureSerializer()); diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs index c9a7bba27..b29f85d82 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs @@ -45,7 +45,5 @@ namespace UniGLTF /// Keep VertexColor /// public bool KeepVertexColor; - - public IAnimationExporter AnimationExporter; } } diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs index 4e70a09ed..03db82d3c 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs @@ -79,7 +79,10 @@ namespace UniGLTF m_progress.Report(new ExportProgress("gltfExporter", msg, progress)); } - public gltfExporter(ExportingGltfData data, GltfExportSettings settings, IProgress progress = null) + IAnimationExporter m_animationExporter; + + public gltfExporter(ExportingGltfData data, GltfExportSettings settings, IProgress progress = null, + IAnimationExporter animationExporter = null) { _data = data; @@ -97,6 +100,8 @@ namespace UniGLTF // default m_settings = new GltfExportSettings(); } + + m_animationExporter = animationExporter; } GameObject m_tmpParent = null; @@ -328,10 +333,10 @@ namespace UniGLTF } #endregion - if (m_settings.AnimationExporter != null) + if (m_animationExporter != null) { ReportProgress("Animations", 0.9f); - m_settings.AnimationExporter.Export(_data, Copy, Nodes); + m_animationExporter.Export(_data, Copy, Nodes); } ExportExtensions(textureSerializer);