Exemplo n.º 1
0
//----------------------------------------------------------------------------------------------------------------------
        public override void OnInspectorGUI()
        {
            //View resolution
            Vector2 res = ViewEditorUtility.GetMainGameViewSize();

            EditorGUILayout.LabelField("Resolution (Modify GameView size to change)");
            ++EditorGUI.indentLevel;
            EditorGUILayout.LabelField("Width", res.x.ToString(CultureInfo.InvariantCulture));
            EditorGUILayout.LabelField("Height", res.y.ToString(CultureInfo.InvariantCulture));
            --EditorGUI.indentLevel;
            EditorGUILayout.Space(15f);

            //Check if the asset is actually inspected
            if (null != TimelineEditor.selectedClip && TimelineEditor.selectedClip.asset != m_asset)
            {
                return;
            }

            ValidateAssetFolder();

            string prevFolder = m_asset.GetFolder();

            string newFolder = EditorGUIDrawerUtility.DrawFolderSelectorGUI("Cache Output Folder", "Select Folder",
                                                                            prevFolder, null
                                                                            );

            newFolder = AssetUtility.NormalizeAssetPath(newFolder);

            if (newFolder != prevFolder)
            {
                Undo.RecordObject(m_asset, "Change Output Folder");
                m_asset.SetFolder(AssetUtility.NormalizeAssetPath(newFolder));
                GUIUtility.ExitGUI();
            }

            //Output Format
            EditorGUIDrawerUtility.DrawUndoableGUI(m_asset, "RenderCache Output Format",
                                                   /*guiFunc=*/ () => (RenderCacheOutputFormat)EditorGUILayout.EnumPopup("Output Format:", m_asset.GetOutputFormat()),
                                                   /*updateFunc=*/ (RenderCacheOutputFormat newOutputFormat) => { m_asset.SetOutputFormat(newOutputFormat); }
                                                   );

            RenderCacheClipData clipData = m_asset.GetBoundClipData();

            if (null == clipData)
            {
                return;
            }

            GUILayout.Space(15);

            //Capture Selected Frames
            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                DrawCaptureSelectedFramesGUI(TimelineEditor.selectedClip, clipData);
                DrawLockFramesGUI(TimelineEditor.selectedClip, clipData);
            }

            GUILayout.Space(15);
            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                EditorGUILayout.LabelField("Background Colors");
                ++EditorGUI.indentLevel;

                RenderCachePlayableAssetEditorConfig editorConfig = m_asset.GetEditorConfig();

                EditorGUIDrawerUtility.DrawUndoableGUI(m_asset, "Change Update BG Color",
                                                       /*guiFunc=*/ () => EditorGUILayout.ColorField("In Game Window (Update)", editorConfig.GetUpdateBGColor()),
                                                       /*updateFunc=*/ (Color newColor) => { editorConfig.SetUpdateBGColor(newColor); }
                                                       );

                EditorGUIDrawerUtility.DrawUndoableGUI(m_asset, "Change Timeline BG Color",
                                                       /*guiFunc=*/ () => EditorGUILayout.ColorField("In Timeline Window", m_asset.GetTimelineBGColor()),
                                                       /*updateFunc=*/ (Color newColor) => { m_asset.SetTimelineBGColor(newColor); }
                                                       );

                --EditorGUI.indentLevel;
                GUILayout.Space(5);
            }
            GUILayout.Space(15);
            DrawUpdateRenderCacheGUI();
        }
Exemplo n.º 2
0
//----------------------------------------------------------------------------------------------------------------------
        public override void OnInspectorGUI()
        {
            //View resolution
            Vector2 res = ViewEditorUtility.GetMainGameViewSize();

            EditorGUILayout.LabelField("Resolution (Modify GameView size to change)");
            ++EditorGUI.indentLevel;
            EditorGUILayout.LabelField("Width", res.x.ToString(CultureInfo.InvariantCulture));
            EditorGUILayout.LabelField("Height", res.y.ToString(CultureInfo.InvariantCulture));
            --EditorGUI.indentLevel;
            EditorGUILayout.Space(15f);

            //Check if the asset is actually inspected
            if (null != TimelineEditor.selectedClip && TimelineEditor.selectedClip.asset != m_asset)
            {
                return;
            }

            ValidateAssetFolder();

            string prevFolder = m_asset.GetFolder();

            string newFolder = EditorGUIDrawerUtility.DrawFolderSelectorGUI("Cache Output Folder", "Select Folder",
                                                                            prevFolder,
                                                                            null,
                                                                            AssetUtility.NormalizeAssetPath
                                                                            );

            if (newFolder != prevFolder)
            {
                m_asset.SetFolder(AssetUtility.NormalizeAssetPath(newFolder));
                GUIUtility.ExitGUI();
            }

            TimelineClipSISData timelineClipSISData = m_asset.GetBoundTimelineClipSISData();

            if (null == timelineClipSISData)
            {
                return;
            }

            GUILayout.Space(15);

            //Capture Selected Frames
            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                DrawCaptureSelectedFramesGUI(TimelineEditor.selectedClip, timelineClipSISData);
                DrawLockFramesGUI(TimelineEditor.selectedClip, timelineClipSISData);
            }

            GUILayout.Space(15);
            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                EditorGUILayout.LabelField("Background Colors");
                ++EditorGUI.indentLevel;

                RenderCachePlayableAssetEditorConfig editorConfig = m_asset.GetEditorConfig();

                Color updateBGColor   = editorConfig.GetUpdateBGColor();
                Color timelineBgColor = m_asset.GetTimelineBGColor();
                editorConfig.SetUpdateBGColor(EditorGUILayout.ColorField("In Game Window (Update)", updateBGColor));
                m_asset.SetTimelineBGColor(EditorGUILayout.ColorField("In Timeline Window", timelineBgColor));
                --EditorGUI.indentLevel;
                GUILayout.Space(5);
            }
            GUILayout.Space(15);
            DrawUpdateRenderCacheGUI();
        }