internal static GameObject Import(AlembicImportMode importMode, AlembicImportSettings importSettings, AlembicDiagnosticSettings diagSettings, Action <AlembicStream, GameObject, AlembicStreamDescriptor> customAction)
        {
            var fileName = System.IO.Path.GetFileNameWithoutExtension(importSettings.m_pathToAbc);
            var go       = new GameObject(fileName);

            using (var abcStream = new AlembicStream(go, importSettings, new AlembicPlaybackSettings(), diagSettings))
            {
                abcStream.AbcLoad(true);

                AlembicStreamDescriptor streamDescr = null;
                if (importMode > AlembicImportMode.NoSupportForStreaming)
                {
                    streamDescr                  = ScriptableObject.CreateInstance <AlembicStreamDescriptor>();
                    streamDescr.name             = "AlembicStream: " + go.name;
                    streamDescr.m_ImportSettings = importSettings;
                    streamDescr.m_importMode     = importMode;
                }

                if (importMode == AlembicImportMode.AutomaticStreamingSetup)
                {
                    var dynStream = go.AddComponent <AlembicStreamPlayer>();
                    dynStream.m_PlaybackSettings = new AlembicPlaybackSettings()
                    {
                        m_startTime = abcStream.AbcStartTime,
                        m_endTime   = abcStream.AbcEndTime
                    };
                    dynStream.m_StreamDescriptor = streamDescr;
                    dynStream.enabled            = true;
                }

                customAction.Invoke(abcStream, go, streamDescr);
            }

            return(go);
        }
        public void OnGUI()
        {
            titleContent = new GUIContent("Alembic file importer");
            // File Path
            AlembicUI.AddHorzLine(() =>
            {
                EditorGUILayout.PrefixLabel("Alembic File:");
                m_ImportSettings.m_pathToAbc = EditorGUILayout.TextField(m_ImportSettings.m_pathToAbc);
                if (GUILayout.Button("..."))
                {
                    m_ImportSettings.m_pathToAbc = EditorUtility.OpenFilePanel("Select Alembic File", m_ImportSettings.m_pathToAbc,
                                                                               "abc");
                }
            });

            AlembicUI.AddHorzLine(() =>
            {
                m_GeneratePrefab = EditorGUILayout.Toggle("Generate prefab", m_GeneratePrefab);
            });

            // Import Mode
            AlembicUI.AddHorzLine(() =>
            {
                string[] enumNamesList = System.Enum.GetNames(typeof(AlembicImportMode));
                m_ImportMode           = (AlembicImportMode)EditorGUILayout.Popup("Mode", (int)m_ImportMode, enumNamesList);
            });

            AlembicUI.AddHorzLine(() =>
            {
                GUI.enabled = m_ImportMode > AlembicImportMode.NoSupportForStreaming;
                m_CopyIntoStreamingAssets = EditorGUILayout.Toggle("Copy localy", m_CopyIntoStreamingAssets);
                GUI.enabled = true;
            });

            //
            // Import Details
            AlembicUI.AddHorzLine(() =>
            {
                EditorGUILayout.LabelField("Details:", EditorStyles.boldLabel);
            });
            AlembicUI.AddHorzLine(() =>
            {
                m_ImportSettings.m_swapHandedness = EditorGUILayout.Toggle("Swap handedness", m_ImportSettings.m_swapHandedness);
            });
            AlembicUI.AddHorzLine(() =>
            {
                m_ImportSettings.m_swapFaceWinding = EditorGUILayout.Toggle("Swap face winding", m_ImportSettings.m_swapFaceWinding);
            });
            AlembicUI.AddHorzLine(() =>
            {
                m_ImportSettings.m_submeshPerUVTile = EditorGUILayout.Toggle("Submesh per UV tile",
                                                                             m_ImportSettings.m_submeshPerUVTile);
            });
            AlembicUI.AddHorzLine(() =>
            {
                string[] enumNamesList         = System.Enum.GetNames(typeof(AbcAPI.aiNormalsMode));
                m_ImportSettings.m_normalsMode =
                    (AbcAPI.aiNormalsMode)EditorGUILayout.Popup("Normals", (int)m_ImportSettings.m_normalsMode, enumNamesList);
            });
            AlembicUI.AddHorzLine(() =>
            {
                string[] enumNamesList          = System.Enum.GetNames(typeof(AbcAPI.aiTangentsMode));
                m_ImportSettings.m_tangentsMode =
                    (AbcAPI.aiTangentsMode)EditorGUILayout.Popup("Tangents", (int)m_ImportSettings.m_tangentsMode, enumNamesList);
            });
            AlembicUI.AddHorzLine(() =>
            {
                string[] enumNamesList             = System.Enum.GetNames(typeof(AbcAPI.aiAspectRatioMode));
                m_ImportSettings.m_aspectRatioMode =
                    (AbcAPI.aiAspectRatioMode)
                    EditorGUILayout.Popup("Aspect ration", (int)m_ImportSettings.m_aspectRatioMode, enumNamesList);
            });

            //
            // Advanced
            AlembicUI.AddHorzLine(() =>
            {
                EditorGUILayout.LabelField("Advanced:", EditorStyles.boldLabel);
            });

            AlembicUI.AddHorzLine(() =>
            {
                m_ImportSettings.m_useThreads = EditorGUILayout.Toggle("Use ABC threads", m_ImportSettings.m_useThreads);
            });
            AlembicUI.AddHorzLine(() =>
            {
                m_ImportSettings.m_sampleCacheSize = EditorGUILayout.IntField("Sample cache size",
                                                                              m_ImportSettings.m_sampleCacheSize);
            });


            GUI.enabled = m_ImportSettings.m_pathToAbc != "";

            if (GUILayout.Button("Import"))
            {
                ImportAsset();
                Close();
            }
        }