Exemplo n.º 1
0
        public override void OnEnable()
        {
            base.OnEnable();

            m_importer = target as ZipArchivedGltfScriptedImporter;
            m_data     = new AutoGltfFileParser(m_importer.assetPath).Parse();

            var materialGenerator = new GltfMaterialDescriptorGenerator();
            var materialKeys      = m_data.GLTF.materials.Select((_, i) => materialGenerator.Get(m_data, i).SubAssetKey);
            var textureKeys       = new GltfTextureDescriptorGenerator(m_data).Get().GetEnumerable().Select(x => x.SubAssetKey);

            m_materialEditor  = new RemapEditorMaterial(materialKeys.Concat(textureKeys), GetEditorMap, SetEditorMap);
            m_animationEditor = new RemapEditorAnimation(AnimationImporterUtil.EnumerateSubAssetKeys(m_data.GLTF), GetEditorMap, SetEditorMap);
        }
Exemplo n.º 2
0
        public virtual async Task LoadAnimationAsync(IAwaitCaller awaitCaller)
        {
            if (GLTF.animations != null && GLTF.animations.Any())
            {
                foreach (var(key, gltfAnimation) in Enumerable.Zip(AnimationImporterUtil.EnumerateSubAssetKeys(GLTF), GLTF.animations, (x, y) => (x, y)))
                {
                    await AnimationClipFactory.LoadAnimationClipAsync(key, async() =>
                    {
                        return(AnimationImporterUtil.ConvertAnimationClip(GLTF, gltfAnimation, InvertAxis.Create()));
                    });
                }

                await awaitCaller.NextFrame();
            }
        }