Exemplo n.º 1
0
        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {
            foreach (string path in importedAssets)
            {
                if (IsStreamingAsset(path))
                {
                    Debug.LogFormat("Skip StreamingAssets: {0}", path);
                    continue;
                }

                var ext = Path.GetExtension(path).ToLower();
                if (ext == ".bvh")
                {
                    Debug.LogFormat("ImportBvh: {0}", path);
                    var context = new BvhImporterContext();
                    try
                    {
                        context.Parse(path);
                        context.Load();
                        context.SaveAsAsset();
                        context.Destroy(false);
                    }
                    catch (Exception ex)
                    {
                        Debug.LogError(ex);
                        context.Destroy(true);
                    }
                }
            }
        }
        void Open(string path)
        {
            Debug.LogFormat("Open: {0}", path);
            if (m_context != null)
            {
                m_context.Destroy(true);
                m_context = null;
            }

            m_context = new BvhImporterContext();
            m_context.Parse(path);
            m_context.Load();

            var src = m_context.Root.AddComponent <HumanPoseTransfer>();

            if (m_dst != null)
            {
                m_dst.SourceType = HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer;
                m_dst.Source     = src;
            }
        }