Skip to content

Commit 797f5ea

Browse files
committed
Merge remote-tracking branch 'remotes/origin/dominique/movie-recorder'
# Conflicts: # source/FrameRecorder/Core/Editor/RecorderEditor.cs # source/FrameRecorder/Inputs/CBRenderTexture/Editor/CBRenderTextureInputSettingsEditor.cs # source/FrameRecorder/Recorders/ImageRecorder/Editor/ImageRecorderEditor.cs
2 parents 4040641 + f833b29 commit 797f5ea

27 files changed

+840
-41
lines changed

source/FrameRecorder/Core/Editor/RecorderEditor.cs

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public enum EFieldDisplayState
1414
public abstract class RecorderEditor : Editor
1515
{
1616
protected SerializedProperty m_Inputs;
17+
bool[] m_ShowInputEditor;
1718
SerializedProperty m_Verbose;
1819
SerializedProperty m_FrameRateMode;
1920
SerializedProperty m_FrameRate;
@@ -39,6 +40,9 @@ protected virtual void OnEnable()
3940

4041
var pf = new PropertyFinder<RecorderSettings>(serializedObject);
4142
m_Inputs = pf.Find(x => x.m_SourceSettings);
43+
m_ShowInputEditor = new bool[m_Inputs.arraySize];
44+
for (int i = 0; i < m_ShowInputEditor.Length; ++i)
45+
m_ShowInputEditor[i] = true;
4246
m_Verbose = pf.Find(x => x.m_Verbose);
4347
m_FrameRateMode = pf.Find(x => x.m_FrameRateMode);
4448
m_FrameRate = pf.Find(x => x.m_FrameRate);
@@ -137,43 +141,29 @@ protected virtual void OnInputGui()
137141
if (multiInputs)
138142
{
139143
EditorGUI.indentLevel++;
140-
EditorGUILayout.Foldout(true, "Input " + (i + 1));
144+
m_ShowInputEditor[i] =
145+
EditorGUILayout.Foldout(m_ShowInputEditor[i], "Input " + (i + 1));
141146
}
142147
var arrItem = m_Inputs.GetArrayElementAtIndex(i);
143-
var editor = Editor.CreateEditor( arrItem.objectReferenceValue );
144-
if (editor != null)
148+
if (m_ShowInputEditor[i])
145149
{
146-
if (editor is InputEditor)
147-
(editor as InputEditor).IsFieldAvailableForHost = GetFieldDisplayState;
148-
editor.OnInspectorGUI();
150+
var editor = Editor.CreateEditor(arrItem.objectReferenceValue);
151+
if (editor != null)
152+
{
153+
if (editor is InputEditor)
154+
(editor as InputEditor).IsFieldAvailableForHost = GetFieldDisplayState;
155+
editor.OnInspectorGUI();
156+
}
149157
}
150-
151158
if (multiInputs)
152159
EditorGUI.indentLevel--;
153160
}
154161
}
155162

156163
protected virtual void OnOutputGui()
157164
{
158-
AddProperty(m_DestinationPath, () =>
159-
{
160-
EditorGUILayout.PropertyField(m_DestinationPath, new GUIContent("Output path"));
161-
});
162-
AddProperty(m_BaseFileName, () =>
163-
{
164-
EditorGUILayout.PropertyField(m_BaseFileName, new GUIContent("File name"));
165-
/*
166-
EditorGUILayout.BeginHorizontal();
167-
EditorGUILayout.PropertyField(m_BaseFileName, new GUIContent("File name"));
168-
169-
int value = EditorGUILayout.Popup( 0, m_FileNameTags);
170-
if (value != 0)
171-
m_BaseFileName.stringValue = FileNameGenerator.AddTag((FileNameGenerator.ETags)(value - 1), m_BaseFileName.stringValue);
172-
173-
EditorGUILayout.EndHorizontal();
174-
*/
175-
});
176-
165+
AddProperty(m_DestinationPath, () => { EditorGUILayout.PropertyField(m_DestinationPath, new GUIContent("Output path")); });
166+
AddProperty(m_BaseFileName, () => { EditorGUILayout.PropertyField(m_BaseFileName, new GUIContent("File name")); });
177167
AddProperty( m_CaptureEveryNthFrame, () => EditorGUILayout.PropertyField(m_CaptureEveryNthFrame, new GUIContent("Every n'th frame")));
178168
}
179169

source/FrameRecorder/Core/Editor/RecorderWindow.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void DelayedStartRecording()
235235
void StartRecording(bool autoExitPlayMode)
236236
{
237237
var settings = (RecorderSettings)m_Editor.target;
238-
var go = FrameRecorderGOControler.HookupRecorder();
238+
var go = FrameRecorderGOControler.HookupRecorder(!settings.m_Verbose);
239239
var session = new RecordingSession()
240240
{
241241
m_Recorder = RecordersInventory.GenerateNewRecorder(m_recorderSelector.selectedRecorder, settings),
@@ -246,9 +246,13 @@ void StartRecording(bool autoExitPlayMode)
246246
component.session = session;
247247
component.autoExitPlayMode = autoExitPlayMode;
248248

249-
session.SessionCreated();
250-
session.BeginRecording();
251-
m_State = EState.Recording;
249+
if (session.SessionCreated() && session.BeginRecording())
250+
m_State = EState.Recording;
251+
else
252+
{
253+
m_State = EState.Idle;
254+
StopRecording();
255+
}
252256
}
253257

254258
void StopRecording()

source/FrameRecorder/Core/Engine/FrameRecorderGOControler.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,25 @@ public class FrameRecorderGOControler
1212
{
1313
const string k_HostGoName = "UnityEngine-Recorder-FrameRecorder";
1414

15-
static GameObject GetGameObject(bool createIfAbsent)
15+
static GameObject GetGameObject(bool createIfAbsent, bool hide)
1616
{
1717
var go = GameObject.Find(k_HostGoName);
1818
if (go == null && createIfAbsent)
1919
{
2020
go = new GameObject(k_HostGoName);
21+
if (hide)
22+
go.hideFlags = HideFlags.HideInHierarchy;
2123
}
24+
2225
return go;
2326
}
2427

25-
static GameObject GetRecordingSessionsRoot( bool createIfAbsent )
28+
static GameObject GetRecordingSessionsRoot(bool createIfAbsent, bool hideGameObjects)
2629
{
27-
var root = GetGameObject(createIfAbsent);
30+
var root = GetGameObject(createIfAbsent, hideGameObjects);
2831
if (root == null)
2932
return null;
33+
3034
var settingsTr = root.transform.Find("RecordingSessions");
3135
GameObject settingsGO;
3236
if (settingsTr == null)
@@ -40,9 +44,9 @@ static GameObject GetRecordingSessionsRoot( bool createIfAbsent )
4044
return settingsGO;
4145
}
4246

43-
public static GameObject HookupRecorder()
47+
public static GameObject HookupRecorder(bool hideGameObjects)
4448
{
45-
var ctrl = GetRecordingSessionsRoot(true);
49+
var ctrl = GetRecordingSessionsRoot(true, hideGameObjects);
4650

4751
var recorderGO = new GameObject();
4852

@@ -53,7 +57,7 @@ public static GameObject HookupRecorder()
5357

5458
public static GameObject FindRecorder(RecorderSettings settings)
5559
{
56-
var ctrl = GetRecordingSessionsRoot(false);
60+
var ctrl = GetRecordingSessionsRoot(false, false);
5761
if (ctrl == null)
5862
return null;
5963

source/FrameRecorder/Core/Engine/RecordingSession.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ public bool SessionCreated()
5050
public bool BeginRecording()
5151
{
5252
m_RecordingStartTS = (Time.time / Time.timeScale);
53+
m_Recorder.SignalInputsOfStage(ERecordingSessionStage.BeginRecording, this);
5354

5455
if (!m_Recorder.BeginRecording(this))
5556
return false;
5657
m_InitialFrame = Time.renderedFrameCount;
5758
m_FPSTimeStart = Time.unscaledTime;
5859

59-
m_Recorder.SignalInputsOfStage(ERecordingSessionStage.BeginRecording, this);
6060
return true;
6161
}
6262

source/FrameRecorder/Core/Engine/Timeline/FrameRecorderClip.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
3434
behaviour.session = new RecordingSession()
3535
{
3636
m_Recorder = RecordersInventory.GenerateNewRecorder(recorderType, m_Settings),
37-
m_RecorderGO = FrameRecorderGOControler.HookupRecorder(),
37+
m_RecorderGO = FrameRecorderGOControler.HookupRecorder(!m_Settings.m_Verbose),
3838
};
3939
}
4040
return playable;

source/FrameRecorder/Inputs/Audio.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/FrameRecorder/Inputs/Audio/Editor.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
using UnityEditorInternal;
2+
using UnityEngine;
3+
using UnityEngine.FrameRecorder;
4+
using UnityEngine.FrameRecorder.Input;
5+
6+
namespace UnityEditor.FrameRecorder.Input
7+
{
8+
[CustomEditor(typeof(AudioInputSettings))]
9+
public class AudioInputSettingsEditor : Editor
10+
{
11+
SerializedProperty m_PreserveAudio;
12+
#if RECORD_AUDIO_MIXERS
13+
SerializedProperty m_AudioMixerGroups;
14+
ReorderableList m_AudioMixerGroupsList;
15+
#endif
16+
17+
protected void OnEnable()
18+
{
19+
if (target == null)
20+
return;
21+
22+
var pf = new PropertyFinder<AudioInputSettings>(serializedObject);
23+
m_PreserveAudio = pf.Find(w => w.m_PreserveAudio);
24+
25+
#if RECORD_AUDIO_MIXERS
26+
m_AudioMixerGroups = serializedObject.FindProperty<AudioInputSettings>(x => x.m_AudioMixerGroups);
27+
m_AudioMixerGroupsList = new ReorderableList(serializedObject, m_AudioMixerGroups, true, true, true, true);
28+
m_AudioMixerGroupsList.drawElementCallback =
29+
(Rect rect, int index, bool isActive, bool isFocused) =>
30+
{
31+
var element = m_AudioMixerGroupsList.serializedProperty.GetArrayElementAtIndex(index);
32+
rect.y += 2;
33+
EditorGUI.PropertyField(
34+
new Rect(rect.x - 25, rect.y, rect.width - 90, EditorGUIUtility.singleLineHeight),
35+
element.FindPropertyRelative("m_MixerGroup"), GUIContent.none);
36+
EditorGUI.PropertyField(
37+
new Rect(rect.x + rect.width - 85, rect.y, 20, EditorGUIUtility.singleLineHeight),
38+
element.FindPropertyRelative("m_Isolate"), GUIContent.none);
39+
EditorGUI.LabelField(
40+
new Rect(rect.x + rect.width - 65, rect.y, 60, EditorGUIUtility.singleLineHeight),
41+
new GUIContent ("Isolate", "Isolate group from mix"));
42+
};
43+
44+
m_AudioMixerGroupsList.drawHeaderCallback = (Rect rect) =>
45+
{
46+
EditorGUI.LabelField(rect, "Audio Mixer Groups");
47+
};
48+
#endif
49+
}
50+
51+
public override void OnInspectorGUI()
52+
{
53+
EditorGUILayout.PropertyField(m_PreserveAudio, new GUIContent("Preserve audio"));
54+
55+
#if RECORD_AUDIO_MIXERS
56+
if (m_AudioMixerGroups != null)
57+
{
58+
serializedObject.Update();
59+
m_AudioMixerGroupsList.DoLayoutList();
60+
}
61+
#endif
62+
63+
serializedObject.ApplyModifiedProperties();
64+
65+
if (!(target as AudioInputSettings).isValid)
66+
EditorGUILayout.HelpBox("Incomplete/Invalid settings", MessageType.Warning);
67+
}
68+
}
69+
}

source/FrameRecorder/Inputs/Audio/Editor/AudioInputSettingsEditor.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/FrameRecorder/Inputs/Audio/Engine.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)