Skip to content

Commit 61ee3dc

Browse files
committed
minor refactoring and start of class comments
1 parent 5564513 commit 61ee3dc

27 files changed

+196
-41
lines changed

docs/Overview.vsdx

7.93 KB
Binary file not shown.

docs/~$$Overview.~vsdx

-4 KB
Binary file not shown.

docs/~$sign preview.docx

-162 Bytes
Binary file not shown.

source/Core/FrameRecorder/Core/Engine/BaseImageRecorder.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

source/Core/FrameRecorder/Core/Engine/FrameRecorderAttribute.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
namespace UnityEngine.FrameRecorder
44
{
5+
6+
/// <summary>
7+
/// What is this:
8+
/// Motivation :
9+
/// Notes:
10+
/// </summary>
511
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
612
public class FrameRecorderAttribute : Attribute
713
{

source/Core/FrameRecorder/Core/Engine/FrameRecorderGOControler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
namespace UnityEngine.FrameRecorder
44
{
5+
6+
/// <summary>
7+
/// What is this:
8+
/// Motivation :
9+
/// Notes:
10+
/// </summary>
511
public class FrameRecorderGOControler
612
{
713
const string k_HostGoName = "UnityEngine-Recorder-FrameRecorder";
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Collections.Generic;
2+
using UnityEngine.FrameRecorder.Input;
3+
#if UNITY_EDITOR
4+
using UnityEditor;
5+
#endif
6+
7+
namespace UnityEngine.FrameRecorder
8+
{
9+
/// <summary>
10+
/// What is it:
11+
/// Motivation:
12+
/// Notes:
13+
/// </summary>
14+
public abstract class GenericRecorder<TSettings> : Recorder where TSettings : RecorderSettings
15+
{
16+
[SerializeField]
17+
protected TSettings m_Settings;
18+
public override RecorderSettings settings
19+
{
20+
get { return m_Settings; }
21+
set { m_Settings = (TSettings)value; }
22+
}
23+
}
24+
}

source/Core/FrameRecorder/Core/Engine/InputSettings.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22

33
namespace UnityEngine.FrameRecorder
44
{
5+
/// <summary>
6+
/// What is this:
7+
/// Motivation :
8+
/// Notes:
9+
/// </summary>
510
public abstract class RecorderInputSetting : ScriptableObject
611
{
712
public abstract Type inputType { get; }
813
}
914

15+
/// <summary>
16+
/// What is this:
17+
/// Motivation :
18+
/// Notes:
19+
/// </summary>
1020
public class InputSettings<TInput> : RecorderInputSetting
1121
{
1222
public override Type inputType

source/Core/FrameRecorder/Core/Engine/Recorder.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ public enum ERecordingSessionStage
1212
EndRecording,
1313
}
1414

15+
/// <summary>
16+
/// What is this:
17+
/// Motivation :
18+
/// Notes:
19+
/// </summary>
1520
public abstract class Recorder : ScriptableObject
1621
{
1722
double m_OriginalCaptureFrameRate;

source/Core/FrameRecorder/Core/Engine/RecorderComponent.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
namespace UnityEngine.FrameRecorder
55
{
6+
7+
/// <summary>
8+
/// What is this:
9+
/// Motivation :
10+
/// Notes:
11+
/// </summary>
612
[ExecuteInEditMode]
713
public class RecorderComponent : MonoBehaviour
814
{

source/Core/FrameRecorder/Core/Engine/RecorderInput.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
namespace UnityEngine.FrameRecorder
44
{
5+
6+
/// <summary>
7+
/// What is this:
8+
/// Motivation :
9+
/// Notes:
10+
/// </summary>
511
public class RecorderInput : IDisposable
612
{
713
public int SourceID { get; set; }

source/Core/FrameRecorder/Core/Engine/RecorderSettings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ public enum DurationMode
2727
TimeInterval
2828
}
2929

30+
31+
/// <summary>
32+
/// What is this:
33+
/// Motivation :
34+
/// Notes:
35+
/// </summary>
3036
public abstract class RecorderSettings : ScriptableObject
3137
{
3238
[Range(1,10)]

source/Core/FrameRecorder/Core/Engine/RecordersInventory.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ public class RecorderInfo
1414
public string displayName;
1515
}
1616

17+
18+
/// <summary>
19+
/// What is this:
20+
/// Motivation :
21+
/// Notes:
22+
/// </summary>
23+
1724
// to be internal once inside unity code base
1825
public static class RecordersInventory
1926
{

source/Core/FrameRecorder/Core/Engine/RecordingSession.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
using System;
2-
using System.Collections.Generic;
32

43
namespace UnityEngine.FrameRecorder
54
{
5+
6+
/// <summary>
7+
/// What is this:
8+
/// Motivation :
9+
/// Notes:
10+
/// </summary>
611
public class RecordingSession : IDisposable
712
{
813
public Recorder m_Recorder;
914
public GameObject m_RecorderGO;
10-
public List<UnityEngine.Object> m_ObjsOfInterest;
1115
public int m_FrameIndex; // count starts at 0.
1216
public double m_CurrentFrameStartTS;
1317
public double m_RecordingStartTS;

source/Core/FrameRecorder/Core/Engine/RenderTextureInput.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
namespace UnityEngine.FrameRecorder
22
{
3+
4+
/// <summary>
5+
/// What is this:
6+
/// Motivation :
7+
/// Notes:
8+
/// </summary>
39
public abstract class RenderTextureInput : RecorderInput
410
{
511
public RenderTexture outputRT { get; set; }

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
namespace UnityEngine.FrameRecorder.Timeline
66
{
7+
/// <summary>
8+
/// What is it: Implements a Timeline Clip asset that can be inserted onto a timeline track to trigger a recording of something.
9+
/// Motivation: Allow Timeline to trigger recordings
10+
///
11+
/// Note: Instances of this call Own their associated Settings asset's lifetime.
12+
/// </summary>
713
public class FrameRecorderClip : PlayableAsset, ITimelineClipAsset
814
{
915
[SerializeField]

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@
22

33
namespace UnityEngine.FrameRecorder.Timeline
44
{
5+
6+
/// <summary>
7+
/// What is it: Declares a type of Timeline Track that can host Recording clips
8+
/// Motivation: Allow Timeline to trigger recordings
9+
///
10+
/// Note: Instances of this call Own their associated Settings asset's lifetime.
11+
/// </summary>
512
[System.Serializable]
613
[TrackClipType(typeof(FrameRecorderClip))]
714
[TrackMediaType(TimelineAsset.MediaType.Script)]
8-
[TrackColor(0.53f, 0.0f, 0.08f)]
15+
[TrackColor(0f, 0.53f, 0.08f)]
916
public class FrameRecorderTrack : TrackAsset
1017
{
1118
}
19+
1220
}

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
namespace UnityEngine.FrameRecorder.Timeline
44
{
55
/// <summary>
6-
/// Note: Totally ignores the time info comming from the playable infrastructure. Only conciders scaled time.
7-
/// </summary>
6+
/// What is it: Implements a playable that records something triggered by a Timeline Recorder Clip.
7+
/// Motivation: Allow Timeline to trigger recordings
8+
///
9+
/// Notes:
10+
/// - Totally ignores the time info comming from the playable infrastructure. Only conciders scaled time.
11+
/// - Does not support multiple OnGraphStart...
12+
/// - It relies on WaitForEndOfFrameComponent to inform the Session object that it's time to record to frame.
13+
/// </summary>
814
public class RecorderPlayableBehaviour : PlayableBehaviour
915
{
1016
PlayState m_PlayState = PlayState.Paused;
@@ -67,8 +73,13 @@ public override void OnBehaviourPause(Playable playable, FrameData info)
6773
{
6874
if (session == null)
6975
return;
76+
7077
if (session.recording && m_PlayState == PlayState.Playing)
78+
{
7179
session.EndRecording();
80+
session.Dispose();
81+
session = null;
82+
}
7283

7384
m_PlayState = PlayState.Paused;
7485
}

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,18 @@
33

44
namespace UnityEngine.FrameRecorder.Timeline
55
{
6-
// the purpose of this class is to signal the FrameRecorderPlayable when frame is done.
6+
7+
/// <summary>
8+
/// What is it: Signals RecorderPlayableBehaviour when frame is reached.
9+
/// Motivation: RecorderPlayableBehaviour does does not have a way to detect the end of frame,
10+
/// which is when the RecordFrame signal must be given to the Recording session. Using this component,
11+
/// we can use MonoBehaviour coroutines to inform the Recorder of the end of frame.
12+
///
13+
/// Notes:
14+
/// - There is a 1-to-1 instance count between RecorderPlayableBehaviour and WaitForEndOfFrameComponent
15+
/// - This component get's added to a transient GameObject, that lives in the scene in play mode and that is associated
16+
/// to the recording session.
17+
/// </summary>
718
[ExecuteInEditMode]
819
class WaitForEndOfFrameComponent : MonoBehaviour
920
{

source/Core/FrameRecorder/Core/Engine/UnityHelpers.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
namespace UnityEngine.FrameRecorder
44
{
5+
6+
/// <summary>
7+
/// What is this:
8+
/// Motivation :
9+
/// Notes:
10+
/// </summary>
511
public static class UnityHelpers
612
{
713
public static void Destroy(Object obj, bool allowDestroyingAssets = false)

source/Core/FrameRecorder/Recorders/PNG/Engine/PNGRecorder.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.IO;
4+
using UnityEngine.FrameRecorder.Input;
35

46
namespace UnityEngine.FrameRecorder
57
{
68
[FrameRecorder(typeof(PNGRecorderSettings),"Video", "PNG" )]
7-
public class PNGRecorder : BaseImageRecorder<PNGRecorderSettings>
9+
public class PNGRecorder : GenericRecorder<PNGRecorderSettings>
810
{
911
string MakeFileName(RecordingSession session)
1012
{
@@ -40,5 +42,14 @@ public override void RecordFrame(RecordingSession session)
4042
File.WriteAllBytes(MakeFileName(session), bytes);
4143
}
4244

45+
public override List<RecorderInputSetting> DefaultInputs()
46+
{
47+
var settings = new List<RecorderInputSetting>();
48+
var setting = ScriptableObject.CreateInstance(typeof(AdamBeautyInputSettings)) as AdamBeautyInputSettings;
49+
50+
settings.Add(setting);
51+
return settings;
52+
}
53+
4354
}
4455
}

source/FrameCapturer/Recorders/EXR/EXRRecorder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace UTJ.FrameCapturer.Recorders
88
{
99
[FrameRecorder(typeof(EXRRecorderSettings),"Video", "UTJ/OpenEXR" )]
10-
public class EXRRecorder : BaseImageRecorder<EXRRecorderSettings>
10+
public class EXRRecorder : GenericRecorder<EXRRecorderSettings>
1111
{
1212
static readonly string[] s_channelNames = { "R", "G", "B", "A" };
1313
fcAPI.fcExrContext m_ctx;

source/FrameCapturer/Recorders/GIF/GIFRecorder.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.IO;
34
using UnityEngine;
45
using UnityEngine.FrameRecorder;
56
using UnityEngine.FrameRecorder;
7+
using UnityEngine.FrameRecorder.Input;
68

79
namespace UTJ.FrameCapturer.Recorders
810
{
911
[FrameRecorder(typeof(GIFRecorderSettings),"Video", "UTJ/GIF" )]
10-
public class GIFRecorder : BaseImageRecorder<GIFRecorderSettings>
12+
public class GIFRecorder : GenericRecorder<GIFRecorderSettings>
1113
{
1214
fcAPI.fcGifContext m_ctx;
1315
fcAPI.fcStream m_stream;
1416

17+
public override List<RecorderInputSetting> DefaultInputs()
18+
{
19+
var settings = new List<RecorderInputSetting>();
20+
var setting = ScriptableObject.CreateInstance(typeof(AdamBeautyInputSettings)) as AdamBeautyInputSettings;
21+
22+
settings.Add(setting);
23+
return settings;
24+
}
25+
1526
public override bool BeginRecording(RecordingSession session)
1627
{
1728
if (!base.BeginRecording(session)) { return false; }

source/FrameCapturer/Recorders/MP4/MP4Recorder.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.IO;
34
using UnityEngine;
45
using UnityEngine.FrameRecorder;
56
using UnityEngine.FrameRecorder;
7+
using UnityEngine.FrameRecorder.Input;
68

79
namespace UTJ.FrameCapturer.Recorders
810
{
911
[FrameRecorder(typeof(MP4RecorderSettings),"Video", "UTJ/MPeg-4" )]
10-
public class MP4Recorder : BaseImageRecorder<MP4RecorderSettings>
12+
public class MP4Recorder : GenericRecorder<MP4RecorderSettings>
1113
{
1214
fcAPI.fcMP4Context m_ctx;
1315

16+
public override List<RecorderInputSetting> DefaultInputs()
17+
{
18+
var settings = new List<RecorderInputSetting>();
19+
var setting = ScriptableObject.CreateInstance(typeof(AdamBeautyInputSettings)) as AdamBeautyInputSettings;
20+
21+
settings.Add(setting);
22+
return settings;
23+
}
24+
1425
public override bool BeginRecording(RecordingSession session)
1526
{
1627
if (!base.BeginRecording(session)) { return false; }

0 commit comments

Comments
 (0)