void DrawScreenshot() { GUILayout.Space(5); RenderMonsterEditorGUIHelper.Header("Screenshot", Color.white); using (new AmazingAssets.EditorGUIUtility.EditorGUIIndentLevel(1)) { EditorGUILayout.LabelField("Hotkey"); Rect drawRect = GUILayoutUtility.GetLastRect(); if (GUI.Button(new Rect(drawRect.xMin + UnityEditor.EditorGUIUtility.labelWidth, drawRect.yMin, drawRect.width - UnityEditor.EditorGUIUtility.labelWidth - 54, drawRect.height), _target.screenshotHotkey.ToString(), EditorStyles.popup)) { RenderMonsterKeyCodeWindow.ShowWindow(GUIUtility.GUIToScreenPoint(new Vector2(drawRect.xMin, drawRect.yMax + 2)), UpdateScreenshotKeyCode); } drawRect = EditorGUILayout.GetControlRect(); if (GUI.Button(new Rect(drawRect.xMax - 50, drawRect.yMin - 18, 50, 33), new GUIContent(icon_screenshot, "Screenshot"))) { _target.CaptureScreenshot(); PlayShutterSound(); } } }
void DrawImageSequence() { GUILayout.Space(5); RenderMonsterEditorGUIHelper.Header("Image Sequence", Color.white); Rect drawRect; drawRect = GUILayoutUtility.GetLastRect(); using (new AmazingAssets.EditorGUIUtility.EditorGUIIndentLevel(1)) { using (new AmazingAssets.EditorGUIUtility.GUILayoutBeginHorizontal()) { EditorGUILayout.PropertyField(beginRecordingMode, new GUIContent("Begin Recording")); EditorGUILayout.LabelField(" ", GUILayout.MaxWidth(50)); } using (new AmazingAssets.EditorGUIUtility.GUILayoutBeginHorizontal()) { EditorGUILayout.PropertyField(stopRecordingMode, new GUIContent("Stop Recording")); EditorGUILayout.LabelField(" ", GUILayout.MaxWidth(50)); } drawRect = GUILayoutUtility.GetLastRect(); using (new AmazingAssets.EditorGUIUtility.GUIEnabled(Application.isPlaying ? true : false)) { using (new AmazingAssets.EditorGUIUtility.GUIBackgroundColor(_target.IsRecording() ? Color.red : Color.white)) { if (GUI.Button(new Rect(drawRect.xMax - 50, drawRect.yMin - 18, 50, 33), _target.IsRecording() ? iconPlayOn : iconPlayOff)) { if (_target.IsRecording()) { _target.StopRecording(); } else { _target.BeginRecording(); } } } } if ((beginRecordingMode.enumValueIndex == (int)RenderMonster.BEGIN_RECORDING.ByHotkey || stopRecordingMode.enumValueIndex == (int)RenderMonster.STOP_RECORDING.ByHotkey)) { EditorGUILayout.LabelField("Hotkey"); drawRect = GUILayoutUtility.GetLastRect(); drawRect.xMin += UnityEditor.EditorGUIUtility.labelWidth; if (GUI.Button(drawRect, _target.recordingHotkey.ToString(), EditorStyles.popup)) { RenderMonsterKeyCodeWindow.ShowWindow(GUIUtility.GUIToScreenPoint(new Vector2(drawRect.xMin, drawRect.yMax + 2)), UpdatePauseResumeKeyCode); } } if (stopRecordingMode.enumValueIndex == (int)RenderMonster.STOP_RECORDING.AfterNFrame) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(nFrame); if (EditorGUI.EndChangeCheck()) { if (nFrame.intValue < 1) { nFrame.intValue = 1; } } } if (stopRecordingMode.enumValueIndex == (int)RenderMonster.STOP_RECORDING.AfterNSec) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(nSec); if (EditorGUI.EndChangeCheck()) { if (nSec.intValue < 1) { nSec.intValue = 1; } } } EditorGUILayout.LabelField("FPS"); drawRect = GUILayoutUtility.GetLastRect(); drawRect.xMax -= 54; EditorGUI.BeginChangeCheck(); fPS.intValue = EditorGUI.IntField(drawRect, " ", fPS.intValue); if (EditorGUI.EndChangeCheck()) { if (fPS.intValue < 1) { fPS.intValue = 1; } } drawRect.xMin = drawRect.xMax + 4; drawRect.width = 50; if (GUI.Button(drawRect, "...", EditorStyles.popup)) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("1"), false, MenuCallback_FrameRate, 1); menu.AddItem(new GUIContent("5"), false, MenuCallback_FrameRate, 5); menu.AddItem(new GUIContent("10"), false, MenuCallback_FrameRate, 10); menu.AddItem(new GUIContent("15"), false, MenuCallback_FrameRate, 15); menu.AddItem(new GUIContent("25"), false, MenuCallback_FrameRate, 25); menu.AddItem(new GUIContent("30"), false, MenuCallback_FrameRate, 30); menu.AddItem(new GUIContent("60"), false, MenuCallback_FrameRate, 60); menu.AddItem(new GUIContent("120"), false, MenuCallback_FrameRate, 120); menu.ShowAsContext(); } } }
void DrawSettings() { GUILayout.Space(5); RenderMonsterEditorGUIHelper.Header("Output", Color.white); using (new AmazingAssets.EditorGUIUtility.EditorGUIIndentLevel(1)) { using (new AmazingAssets.EditorGUIUtility.EditorGUILayoutBeginHorizontal()) { using (new AmazingAssets.EditorGUIUtility.GUIBackgroundColor(IsOutputFolderValid() ? Color.white : Color.red)) { EditorGUILayout.PropertyField(outputPath, new GUIContent("Path")); } if (GUILayout.Button("Select", GUILayout.MaxWidth(50))) { if (IsOutputFolderValid() && Event.current.button == 1) { _target.OpenSaveFolder(); } else { string path = UnityEditor.EditorUtility.SaveFolderPanel("Save textures to directory", IsOutputFolderValid() ? outputPath.stringValue : "", ""); if (string.IsNullOrEmpty(path) == false) { if (HasDirectorySavePermition(path)) { outputPath.stringValue = path; } else { UnityEditor.EditorUtility.DisplayDialog("Destination Folder Access Denied", "You have no permission to save files in this folder.", "Ok"); } GUIUtility.keyboardControl = 0; Repaint(); } } } } using (new AmazingAssets.EditorGUIUtility.EditorGUILayoutBeginHorizontal()) { EditorGUILayout.PropertyField(filePrefix); if (GUILayout.Button("...", EditorStyles.popup, GUILayout.MaxWidth(50))) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("None"), false, MenuCallback_FilePrefix, string.Empty); menu.AddSeparator(string.Empty); string sceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; if (string.IsNullOrEmpty(sceneName)) { sceneName = "Untitled"; } menu.AddItem(new GUIContent("Scene Name (" + sceneName + ")"), false, MenuCallback_FilePrefix, sceneName); string objectName = Selection.activeGameObject == null ? string.Empty : Selection.activeGameObject.name; if (string.IsNullOrEmpty(objectName)) { menu.AddDisabledItem(new GUIContent("Object Name")); } else { menu.AddItem(new GUIContent("Object Name (" + objectName + ")"), false, MenuCallback_FilePrefix, objectName); } menu.ShowAsContext(); } } superSize.intValue = EditorGUILayout.IntSlider("Super Size", superSize.intValue, 1, 32); } }