Example #1
0
        private void StartExportScene()
        {
            var activeScene = SceneManager.GetActiveScene();

            if (activeScene != null)
            {
                _engine = CreateEngine();
                EditorTaskScheduler.Default.ScheduleForegroundTask(() => { _engine.ExportScene(activeScene); },
                                                                   activeScene.path);
            }
        }
Example #2
0
        public void OnGUI()
        {
            _myCustomStyle = _myCustomStyle ?? new GUIStyle(GUI.skin.GetStyle("label"))
            {
                wordWrap = true
            };

            // if (string.IsNullOrWhiteSpace(_exportFolder)) {
            //    PickFolder();
            // }

            _exportFolder = EditorGUILayout.TextField("Export Folder", _exportFolder);
            if (GUILayout.Button("Pick"))
            {
                PickFolder();
            }

            _subfolder = EditorGUILayout.TextField("Subfolder", _subfolder);

            _exportUpdatedOnly = EditorGUILayout.Toggle("Export only updated resources", _exportUpdatedOnly);

            _exportSceneAsPrefab = EditorGUILayout.Toggle("Export scene as prefab", _exportSceneAsPrefab);

            _usePhysicalValues = EditorGUILayout.Toggle("Use physical values", _usePhysicalValues);

            _showExtraOptions = EditorGUILayout.Foldout(_showExtraOptions, "Content filter");

            if (_showExtraOptions)
            {
                _skipDisabled = EditorGUILayout.Toggle("Skip disabled entities", _skipDisabled);
                foreach (var flag in _extraFlags)
                {
                    flag.Toggle();
                }
            }

            //GUILayout.Label(EditorTaskScheduler.Default.CurrentReport.Message);

            EditorTaskScheduler.Default.DisplayProgressBar();

            {
                GUI.enabled = _engine == null && ValidateExportPath(_exportFolder);
                if (Selection.assetGUIDs.Length > 0)
                {
                    if (GUILayout.Button("Export selected (" + Selection.assetGUIDs.Length + ") assets"))
                    {
                        StartExportAssets(Selection.assetGUIDs, null);
                    }
                }
                else
                {
                    if (GUILayout.Button("Export all assets"))
                    {
                        StartExportAssets(AssetDatabase.FindAssets(""), null);
                    }
                }

                if (GUILayout.Button("Export active scene "))
                {
                    StartExportScene();
                }

                GUI.enabled = true;
            }
            {
                if (EditorTaskScheduler.Default.IsRunning)
                {
                    if (_cancellationTokenSource != null)
                    {
                        if (GUILayout.Button("Cancel"))
                        {
                            _cancellationTokenSource.Cancel();
                        }
                    }
                }
                else
                {
                    if (_engine != null)
                    {
                        _engine.Dispose();
                        _engine = null;
                        if (!_cancellationTokenSource.IsCancellationRequested)
                        {
                            _cancellationTokenSource.Cancel();
                        }
                        _cancellationTokenSource = null;
                    }
                }
            }



            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Before exporting content with the tool please check that you have an appropriate license for the assets you are exporting. You can find Asset Store Terms of Service and EULA at https://unity3d.com/legal/as_terms", _myCustomStyle);
        }
Example #3
0
 private void StartExportAssets(string[] assetGuiDs, PrefabContext prefabContext)
 {
     _engine = CreateEngine();
     EditorTaskScheduler.Default.ScheduleForegroundTask(() => _engine.ExportAssets(assetGuiDs, prefabContext));
 }