Skip to content

Commit

Permalink
improving UI
Browse files Browse the repository at this point in the history
  • Loading branch information
i-saint committed May 14, 2017
1 parent 3733319 commit 6957097
Show file tree
Hide file tree
Showing 12 changed files with 351 additions and 535 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace UTJ.FrameCapturer
{
[CustomEditor(typeof(AudioRecorder))]
public class AudioRecorderEditor : Editor
public class AudioRecorderEditor : RecorderBaseEditor
{
public override void OnInspectorGUI()
{
Expand All @@ -19,33 +19,7 @@ public override void OnInspectorGUI()

EditorGUILayout.Space();

// capture control
EditorGUILayout.PropertyField(so.FindProperty("m_captureControl"), true);
EditorGUI.indentLevel++;
if (recorder.captureControl == AudioRecorder.CaptureControl.SpecifiedRange)
{
EditorGUILayout.PropertyField(so.FindProperty("m_startFrame"), true);
EditorGUILayout.PropertyField(so.FindProperty("m_endFrame"), true);
}
else if (recorder.captureControl == AudioRecorder.CaptureControl.Manual)
{
EditorGUILayout.Space();
if (!recorder.isRecording)
{
if (GUILayout.Button("Begin Recording"))
{
recorder.BeginRecording();
}
}
else
{
if (GUILayout.Button("End Recording"))
{
recorder.EndRecording();
}
}
}
EditorGUI.indentLevel--;
RecordingControl();

so.ApplyModifiedProperties();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace UTJ.FrameCapturer
{
[CustomEditor(typeof(GBufferRecorder))]
public class ImageSequenceRecorderEditor : Editor
public class ImageSequenceRecorderEditor : RecorderBaseEditor
{
public override void OnInspectorGUI()
{
Expand Down Expand Up @@ -53,38 +53,7 @@ public override void OnInspectorGUI()

EditorGUILayout.Space();

// capture control
EditorGUILayout.PropertyField(so.FindProperty("m_captureControl"), true);
EditorGUI.indentLevel++;
if (recorder.captureControl == GBufferRecorder.CaptureControl.SpecifiedRange)
{
EditorGUILayout.PropertyField(so.FindProperty("m_startFrame"), true);
EditorGUILayout.PropertyField(so.FindProperty("m_endFrame"), true);
}
else if (recorder.captureControl == GBufferRecorder.CaptureControl.Manual)
{
EditorGUILayout.Space();
if (!recorder.isRecording)
{
if (GUILayout.Button("Begin Recording"))
{
recorder.BeginRecording();
}
EditorGUILayout.Space();
if (GUILayout.Button("One Shot"))
{
recorder.OneShot();
}
}
else
{
if (GUILayout.Button("End Recording"))
{
recorder.EndRecording();
}
}
}
EditorGUI.indentLevel--;
RecordingControl();

so.ApplyModifiedProperties();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,8 @@
namespace UTJ.FrameCapturer
{
[CustomEditor(typeof(MovieRecorder))]
public class MovieRecorderEditor : Editor
public class MovieRecorderEditor : RecorderBaseEditor
{
protected bool m_videoAdvanced = false;
protected bool m_audioAdvanced = false;

public virtual void CommonConfig()
{
var so = serializedObject;
EditorGUILayout.PropertyField(so.FindProperty("m_outputDir"), true);
EditorGUILayout.PropertyField(so.FindProperty("m_encoderConfigs"), true);
}

public virtual void VideoConfig()
{
var recorder = target as MovieRecorder;
Expand Down Expand Up @@ -47,76 +37,6 @@ public virtual void AudioConfig()
{
}

public virtual void RecordingControl()
{
var recorder = target as MovieRecorder;
var so = serializedObject;

EditorGUILayout.Space();

// capture control
EditorGUILayout.PropertyField(so.FindProperty("m_captureControl"));
EditorGUI.indentLevel++;
if (recorder.captureControl == MovieRecorder.CaptureControl.FrameRange)
{
EditorGUILayout.PropertyField(so.FindProperty("m_startFrame"));
EditorGUILayout.PropertyField(so.FindProperty("m_endFrame"));
}
else if (recorder.captureControl == MovieRecorder.CaptureControl.TimeRange)
{
EditorGUILayout.PropertyField(so.FindProperty("m_startTime"));
EditorGUILayout.PropertyField(so.FindProperty("m_endTime"));
}

if( recorder.captureControl == MovieRecorder.CaptureControl.FrameRange ||
recorder.captureControl == MovieRecorder.CaptureControl.TimeRange)
{
if (!EditorApplication.isPlaying)
{
EditorGUILayout.Space();
if (GUILayout.Button("Play"))
{
EditorApplication.isPlaying = true;
}
}
else if(recorder.isRecording)
{
if (GUILayout.Button("Abort"))
{
recorder.EndRecording();
}
}
}
else if (recorder.captureControl == MovieRecorder.CaptureControl.Manual)
{
EditorGUILayout.Space();
if (!recorder.isRecording)
{
if (GUILayout.Button("Start Recording"))
{
if (!EditorApplication.isPlaying)
{
recorder.recordingOnStart = true;
EditorApplication.isPlaying = true;
}
else
{
recorder.BeginRecording();
}
}
}
else
{
if (GUILayout.Button("End Recording"))
{
recorder.EndRecording();
}
}
}
EditorGUI.indentLevel--;
}


public override void OnInspectorGUI()
{
//DrawDefaultInspector();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using UnityEditor;
using UnityEngine;

namespace UTJ.FrameCapturer
{
public class RecorderBaseEditor : Editor
{
public virtual void CommonConfig()
{
var so = serializedObject;
EditorGUILayout.PropertyField(so.FindProperty("m_outputDir"), true);
EditorGUILayout.PropertyField(so.FindProperty("m_encoderConfigs"), true);
}

public virtual void RecordingControl()
{
var recorder = target as RecorderBase;
var so = serializedObject;

// capture control
EditorGUILayout.PropertyField(so.FindProperty("m_captureControl"));
EditorGUI.indentLevel++;
if (recorder.captureControl == RecorderBase.CaptureControl.FrameRange)
{
EditorGUILayout.PropertyField(so.FindProperty("m_startFrame"));
EditorGUILayout.PropertyField(so.FindProperty("m_endFrame"));
}
else if (recorder.captureControl == RecorderBase.CaptureControl.TimeRange)
{
EditorGUILayout.PropertyField(so.FindProperty("m_startTime"));
EditorGUILayout.PropertyField(so.FindProperty("m_endTime"));
}

if (recorder.captureControl == RecorderBase.CaptureControl.FrameRange ||
recorder.captureControl == RecorderBase.CaptureControl.TimeRange)
{
if (!EditorApplication.isPlaying)
{
EditorGUILayout.Space();
if (GUILayout.Button("Play"))
{
EditorApplication.isPlaying = true;
}
}
else if (recorder.isRecording)
{
if (GUILayout.Button("Abort"))
{
recorder.EndRecording();
}
}
}
else if (recorder.captureControl == RecorderBase.CaptureControl.Manual)
{
EditorGUILayout.Space();
if (!recorder.isRecording)
{
if (GUILayout.Button("Start Recording"))
{
if (!EditorApplication.isPlaying)
{
recorder.recordOnStart = true;
EditorApplication.isPlaying = true;
}
else
{
recorder.BeginRecording();
}
}
}
else
{
if (GUILayout.Button("End Recording"))
{
recorder.EndRecording();
}
}
}
EditorGUI.indentLevel--;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6957097

Please sign in to comment.