From bf480a600d8207fa041e463604ad7f5e287a746d Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 25 Feb 2021 12:53:30 +0900 Subject: [PATCH] AnimationClip --- .../ScriptedImporter/GltfScriptedImporter.cs | 6 ++++++ .../GltfScriptedImporterEditorGUI.cs | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporter.cs b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporter.cs index 2b6f98afc..a71aaf6eb 100644 --- a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporter.cs +++ b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporter.cs @@ -66,6 +66,12 @@ namespace UniGLTF ctx.AddObjectToAsset(mesh.name, mesh); } + // Animation + foreach (var clip in context.AnimationClips) + { + ctx.AddObjectToAsset(clip.name, clip); + } + // Root ctx.AddObjectToAsset(context.Root.name, context.Root); ctx.SetMainObject(context.Root); diff --git a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterEditorGUI.cs b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterEditorGUI.cs index bf8f474d7..9490944cc 100644 --- a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterEditorGUI.cs +++ b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterEditorGUI.cs @@ -22,6 +22,7 @@ namespace UniGLTF enum Tabs { Model, + Animation, Materials, } static Tabs s_currentTab; @@ -29,12 +30,18 @@ namespace UniGLTF public override void OnInspectorGUI() { s_currentTab = MeshUtility.TabBar.OnGUI(s_currentTab); + GUILayout.Space(10); + switch (s_currentTab) { case Tabs.Model: base.OnInspectorGUI(); break; + case Tabs.Animation: + OnGUIAnimation(m_importer, m_parser); + break; + case Tabs.Materials: OnGUIMaterial(m_importer, m_parser); break; @@ -103,5 +110,13 @@ namespace UniGLTF } EditorGUI.indentLevel--; } + + static void OnGUIAnimation(GltfScriptedImporter importer, GltfParser parser) + { + foreach (var a in parser.GLTF.animations) + { + GUILayout.Label(a.name); + } + } } }