Example #1
0
        /// <summary>
        /// do general project setup, make sure we're in linear space, create our toolbar config and switch to the proper editor layout
        /// </summary>
        public static void ConfigureProject()
        {
            Debug.Log("Configure project");

            // convert to Linear color space
            if (PlayerSettings.colorSpace == ColorSpace.Gamma)
            {
                PlayerSettings.colorSpace = ColorSpace.Linear;
            }

            // create our toolbar config
            EditorToolbarController.CreateToolbarConfig();
            // and switch to film layout
            LayoutLoader.LoadFilmLayout();
        }
Example #2
0
        private void OnGUI()
        {
            curWindowSize.x = position.width;
            curWindowSize.y = position.height;

            var colSceneLoader = new Color(0.75f, 1f, 1f, 1f);
            var colShortcuts   = new Color(1f, 0.75f, 1f, 1f);
            var colLayout      = new Color(1f, 1f, 0.75f, 1f);

            if (initialized)
            {
                // toolbar buttons
                GUILayout.BeginHorizontal(GUILayout.MinWidth(minWindowSize.x), GUILayout.MinHeight(minWindowSize.y));
                {
                    GUILayout.Space(10f);
                    if (config.showSceneLoader)
                    {
                        GUILayout.BeginVertical();
                        {
                            GUILayout.Label(EditorToolbarLoc.MAINTOOLBAR_EPISODES, EditorStyles.centeredGreyMiniLabel);
                            GUI.backgroundColor = colSceneLoader;
                            GUILayout.BeginHorizontal();
                            {
                                if (config != null)
                                {
                                    for (int i = 0; i < sceneNames.Count; i++)
                                    {
                                        if (config.sceneLoaderType == SceneLoaderType.Individual)
                                        {
                                            if (GUILayout.Button(sceneNames[i], GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                            {
                                                var sceneFullPath = AssetDatabase.GetAssetOrScenePath(config.sceneLoaderList[i]);

                                                EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(config.sceneLoaderList[i]), OpenSceneMode.Single);
                                            }
                                        }
                                        else
                                        {
                                            foreach (var item in config.sceneLoaderList)
                                            {
                                                var buttonName = item.name;
                                                if (GUILayout.Button(buttonName, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                                {
                                                    var path = AssetDatabase.GetAssetOrScenePath(item);
                                                    EditorUtilities.FindProjectLoader(path);
                                                }
                                            }
                                        }
                                    }
                                }
                                //if (GUILayout.Button(EditorToolbarLoc.MAINTOOLBAR_LOADER_SHERMANEP01, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                //{
                                //    var path = "Assets/Scenes/ProjectB/ProjectB Scene Loader.asset";
                                //    EditorToolbarController.FindProjectLoader(path);
                                //}
                                //if (GUILayout.Button(EditorToolbarLoc.MAINTOOLBAR_LOADER_CREATENEW, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                //{
                                //    var path = "Assets/Scenes/ProjectB/ProjectB Scene Loader.asset";
                                //    EditorToolbarController.FindProjectLoader(path);
                                //}
                            }
                            GUILayout.EndHorizontal();
                        }
                        GUILayout.EndVertical();
                    }
                    if (config.showSceneTools)
                    {
                        GUILayout.BeginVertical();
                        {
                            GUILayout.Label(EditorToolbarLoc.MAINTOOLBAR_HELPERS, EditorStyles.centeredGreyMiniLabel);

                            GUILayout.BeginHorizontal();
                            {
                                GUI.backgroundColor = colShortcuts;

                                if (GUILayout.Button(EditorToolbarLoc.MAINTOOLBAR_EDIT_SEARCHPROJECT, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    Shortcuts.ProjectSearch();
                                }
                                if (GUILayout.Button(EditorToolbarLoc.MAINTOOLBAR_EDIT_POPULATESCENE, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    NewContentWizardMenus.NewSceneFromTemplate();
                                }
                                if (GUILayout.Button(EditorToolbarLoc.MAINTOOLBAR_EDIT_POPULATEFOLDERS, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    NewContentWizardMenus.PopulateFolderStructure();
                                }
                                if (GUILayout.Button(EditorToolbarLoc.MAINTOOLBAR_EDIT_CREATEGROUP, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    Shortcuts.CreateGroup();
                                }
                                //if (GUILayout.Button(EditorToolbarLoc.MAINTOOLBAR_EDIT_CENTERGROUPONCHILDREN, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                //{
                                //    Shortcuts.CenterOnChildren();
                                //}
#if USING_FILMTOOLBOX
                                if (GUILayout.Button(EditorToolbarLoc.MAINTOOLBAR_EDIT_MATERIALREMAPPER, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    EditorToolbarController.OpenMaterialRemapper();
                                }
#endif
#if USING_MWU_HDRP
                                if (GUILayout.Button(EditorToolbarLoc.MAINTOOLBAR_RENDERWINDOW, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    EditorToolbarController.OpenRenderWindow();
                                }
#endif
                            }
                            GUILayout.EndHorizontal();
                        }
                        GUILayout.EndVertical();
                    }
                    if (config.showLayoutModes)
                    {
                        GUILayout.BeginVertical();
                        {
                            GUILayout.Label("Window Layout", EditorStyles.centeredGreyMiniLabel);
                            GUILayout.BeginHorizontal();
                            {
                                GUI.backgroundColor = colLayout;
                                if (GUILayout.Button("Load Film Layout", GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    LayoutLoader.LoadFilmLayout();
                                }
                            }
                            GUILayout.EndHorizontal();
                        }
                        GUILayout.EndVertical();
                    }
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.BeginHorizontal(GUILayout.MinWidth(minWindowSize.x), GUILayout.MinHeight(minWindowSize.y));
                {
                    GUILayout.Space(10f);
                    if (GUILayout.Button(EditorToolbarLoc.TOOLBAR_CREATE_CONFIG, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                    {
                        Debug.Log("Created new toolbar config");
                        EditorToolbarController.CreateToolbarConfig();
                        Configure();
                        LayoutLoader.LoadFilmLayout();
                    }
                }
                GUILayout.EndHorizontal();
            }
            // EditorGUILayout.EndScrollView();
        }
        private void OnGUI()
        {
            curWindowSize.x = position.width;
            curWindowSize.y = position.height;

            var colShortcuts   = new Color(1f, 0.75f, 1f, 1f);
            var colPerformance = new Color(1f, 1f, 0.75f, 1f);
            var colOverrides   = new Color(0.75f, 1f, 1f, 1f);
            var style          = EditorStyles.miniButton;

            //_scroll = EditorGUILayout.BeginScrollView(scrollPos, false, false, GUILayout.Width(width), GUILayout.Height(height));
            if (initialized)
            {
                GUILayout.BeginHorizontal(GUILayout.MinWidth(minWindowSize.x), GUILayout.MinHeight(minWindowSize.y));
                {
                    GUILayout.Space(10f);
                    if (config.showSceneTools)
                    {
                        // toolbar buttons
                        GUILayout.BeginVertical();
                        {
                            GUILayout.Label(EditorToolbarLoc.TIMELINETOOLBAR_SCENESHORTCUTS, EditorStyles.centeredGreyMiniLabel);

                            GUILayout.BeginHorizontal();
                            {
                                GUI.backgroundColor = colShortcuts;
                                var masterTimeline = new GUIContent(EditorToolbarLoc.TIMELINETOOLBAR_SHORTCUT_MASTERTIMELINE);
                                if (GUILayout.Button(masterTimeline, style, GUILayout.MaxWidth(style.CalcSize(masterTimeline).x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    EditorUtilities.FindSceneObject("MasterTimeline");
                                }
                                var sceneSettings = new GUIContent(EditorToolbarLoc.TIMELINETOOLBAR_SHORTCUT_SCENESETTINGS);
                                if (GUILayout.Button(sceneSettings, style, GUILayout.MaxWidth(style.CalcSize(sceneSettings).x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    EditorUtilities.FindSceneObject("SceneSettings");
                                }
                                var globalPost = new GUIContent(EditorToolbarLoc.TIMELINETOOLBAR_GLOBALPOST);
                                if (GUILayout.Button(globalPost, style, GUILayout.MaxWidth(style.CalcSize(globalPost).x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    EditorUtilities.FindSceneObject("PostVolume");
                                }
                            }
                            GUILayout.EndHorizontal();
                        }
                        GUILayout.EndVertical();
                    }
                    if (RenderSettings.FindRenderSettingsObject() != null && config.showRenderSettings)
                    {
                        GUILayout.BeginVertical();
                        {
                            GUILayout.Label(EditorToolbarLoc.TIMELINETOOLBAR_RENDERSETTINGS, EditorStyles.centeredGreyMiniLabel);
                            GUI.backgroundColor = colPerformance;

                            GUILayout.BeginHorizontal();
                            {
                                var detailSettings = RenderSettings.GetRenderSettings();
                                foreach (var setting in detailSettings)
                                {
                                    var settingLabel = new GUIContent(setting);
                                    if (GUILayout.Button(setting, style, GUILayout.MaxWidth(style.CalcSize(settingLabel).x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                    {
                                        RenderSettings.ActivateRenderSettings(setting);
                                    }
                                }
                                var editSettings = new GUIContent(EditorToolbarLoc.TIMELINETOOLBAR_EDITRENDERSETTINGS);
                                if (GUILayout.Button(EditorToolbarLoc.TIMELINETOOLBAR_EDITRENDERSETTINGS, style, GUILayout.MaxWidth(style.CalcSize(editSettings).x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    EditorUtilities.FindSceneObject("RenderSettings");
                                }
                            }
                            GUILayout.EndHorizontal();
                        }
                        GUILayout.EndVertical();
                    }
                    if (config.showPerformance)
                    {
                        GUILayout.BeginVertical();
                        {
                            GUILayout.Label(EditorToolbarLoc.TIMELINETOOLBAR_PERFORMANCE, EditorStyles.centeredGreyMiniLabel);
                            GUI.backgroundColor = colOverrides;
                            GUILayout.BeginHorizontal();
                            {
#if HDRP_FUR
                                GUILayout.BeginVertical();
                                GUILayout.Label(EditorToolbarLoc.TIMELINETOOLBAR_FURSHELLCOUNT);
                                RenderSettings.furShellCount = (int)EditorGUILayout.Slider(RenderSettings.furShellCount, RenderSettings.furMinCount, RenderSettings.furMaxCount, GUILayout.MinWidth(100f));
                                GUILayout.EndVertical();
                                if (GUILayout.Button(EditorToolbarLoc.TIMELINETOOLBAR_UDPATEFUR, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                                {
                                    RenderSettings.UpdateFur();
                                }
#endif
                            }
                            GUILayout.EndHorizontal();
                        }
                        GUILayout.EndVertical();
                    }
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.BeginHorizontal(GUILayout.MinWidth(minWindowSize.x), GUILayout.MinHeight(minWindowSize.y));
                {
                    GUILayout.Space(10f);
                    if (GUILayout.Button(EditorToolbarLoc.TOOLBAR_CREATE_CONFIG, GUILayout.MaxWidth(defaultButtonSize.x), GUILayout.MaxHeight(defaultButtonSize.y)))
                    {
                        Debug.Log("Create new scriptable toolbar config");
                        EditorToolbarController.CreateToolbarConfig();
                        Configure();
                        // refresh the layout
                        LayoutLoader.LoadFilmLayout();
                    }
                }
                GUILayout.EndHorizontal();
            }
            // EditorGUILayout.EndScrollView();
        }