Example #1
0
 private void OnAvailablePackageGUI(WorkflowStage stage, AssetDescriptor desc)
 {
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.LabelField(desc.name);
     if (GUILayout.Button("Add to Workflow Stage"))
     {
         stage.Add(desc);
     }
     EditorGUILayout.EndHorizontal();
 }
Example #2
0
 private void OnInstalledPackageGUI(WorkflowStage stage, AssetDescriptor desc)
 {
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.LabelField(desc.name);
     if (GUILayout.Button("Remove from Workflow Stage"))
     {
         stage.Remove(desc.name);
     }
     EditorGUILayout.EndHorizontal();
     desc.OnGUI();
 }
Example #3
0
        private void OnNewStageGUI()
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Stage Name");
            newWorkflowStageName = EditorGUILayout.TextField(newWorkflowStageName);

            EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(newWorkflowStageName));
            if (GUILayout.Button("Create New Workflow Stage"))
            {
                string path = WorkflowSettings.stagesDataDirectory + "/" + newWorkflowStageName + ".asset";
                newWorkflowStage = AssetDatabase.LoadAssetAtPath <WorkflowStage>(path);
                if (newWorkflowStage == null)
                {
                    newWorkflowStage = ScriptableObject.CreateInstance <WorkflowStage>();
                    AssetDatabase.CreateAsset(newWorkflowStage, path);
                    AssetDatabase.SaveAssets();
                }
                else
                {
                    if (workflow.ContainsStage(newWorkflowStage))
                    {
                        EditorUtility.DisplayDialog("Workflow Stage Already Exists", "There is already a Workflow Stage with the name '" + newWorkflowStageName + "' in your project.", "OK");
                    }
                    else
                    {
                        if (!EditorUtility.DisplayDialog("Use existing Workflow Stage?", "There is already a Workflow Stage with the name '" + newWorkflowStageName + "'.\nDo you want to add it to your Workflow?", "Yes", "No"))
                        {
                            newWorkflowStage = null;
                        }
                    }
                }
            }
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("New Stage");
            newWorkflowStage = EditorGUILayout.ObjectField(newWorkflowStage, typeof(WorkflowStage), false) as WorkflowStage;
            if (newWorkflowStage != null)
            {
                if (!workflow.stages.Contains(newWorkflowStage))
                {
                    workflow.stages.Add(newWorkflowStage);
                    workflow.expandPackageListInGUI.Add(false);
                    newWorkflowStage = null;

                    EditorUtility.SetDirty(workflow);
                }
            }
            EditorGUILayout.EndHorizontal();
        }
Example #4
0
        private void OnWorkflowStageGUI(int index)
        {
            WorkflowStage stage = workflow.stages[index];

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField("Package Set");
            workflow.stages[index] = EditorGUILayout.ObjectField(workflow.stages[index], typeof(WorkflowStage), false) as WorkflowStage;

            if (GUILayout.Button("Remove from project"))
            {
                workflow.stages.RemoveAt(index);
                workflow.expandPackageListInGUI.RemoveAt(index);
                newWorkflowStage = null;
            }

            if (index > workflow.stages.Count || workflow.stages[index] == null)
            {
                EditorGUILayout.EndHorizontal();
                return;
            }
            EditorGUILayout.EndHorizontal();

            workflow.stages[index].OnGUI();

            int count = workflow.stages[index].NotInstalledCount;

            if (count > 0)
            {
                if (GUILayout.Button("Install " + count + " missing", GUILayout.Height(180)))
                {
                    workflow.stages[index].InstallAllInPackage();
                }
            }

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Filter");
            filterText = EditorGUILayout.TextField(filterText);
            EditorGUILayout.EndHorizontal();

            if (CachedPackagesAndAssets != null)
            {
                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.LabelField("Installed", EditorStyles.boldLabel);
                installedPackageListScrollPos = EditorGUILayout.BeginScrollView(installedPackageListScrollPos);
                for (int i = 0; i < stage.installedPackagesCache.Count; i++)
                {
                    if (string.IsNullOrEmpty(filterText) || stage.installedPackagesCache[i].name.ToLower().Contains(filterText.ToLower()))
                    {
                        OnInstalledPackageGUI(stage, stage.installedPackagesCache[i]);
                    }
                }
                EditorGUILayout.EndScrollView();
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.LabelField("Not Installed", EditorStyles.boldLabel);
                notInstalledPackageListScrollPos = EditorGUILayout.BeginScrollView(notInstalledPackageListScrollPos);
                for (int i = 0; i < stage.notInstalledPackagesCache.Count; i++)
                {
                    if (string.IsNullOrEmpty(filterText) || stage.notInstalledPackagesCache[i].name.ToLower().Contains(filterText.ToLower()))
                    {
                        OnNotInstalledPackageGUI(stage, stage.notInstalledPackagesCache[i]);
                    }
                }
                EditorGUILayout.EndScrollView();
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.LabelField("Available", EditorStyles.boldLabel);
                availablePackageListScrollPos = EditorGUILayout.BeginScrollView(availablePackageListScrollPos, GUILayout.MaxHeight(200));
                for (int i = 0; i < stage.availablePackagesCache.Count; i++)
                {
                    if (string.IsNullOrEmpty(filterText) || stage.availablePackagesCache[i].name.ToLower().Contains(filterText.ToLower()))
                    {
                        OnAvailablePackageGUI(stage, stage.availablePackagesCache[i]);
                    }
                }
                EditorGUILayout.EndScrollView();
                EditorGUILayout.EndVertical();
            }
        }