Skip to content

Commit b585ede

Browse files
committed
Adding UI feedback for incomplete/invalid recorder settings.
1 parent 8220524 commit b585ede

File tree

8 files changed

+52
-3
lines changed

8 files changed

+52
-3
lines changed

source/FrameRecorder/Core/Engine/InputSettings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ namespace UnityEngine.FrameRecorder
1010
public abstract class RecorderInputSetting : ScriptableObject
1111
{
1212
public abstract Type inputType { get; }
13+
public abstract bool isValid { get; }
1314
}
1415

1516
/// <summary>
1617
/// What is this:
1718
/// Motivation :
1819
/// Notes:
1920
/// </summary>
20-
public class InputSettings<TInput> : RecorderInputSetting
21+
public abstract class InputSettings<TInput> : RecorderInputSetting
2122
{
2223
public override Type inputType
2324
{

source/FrameRecorder/Core/Engine/RecorderSettings.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34

45
namespace UnityEngine.FrameRecorder
56
{
@@ -70,7 +71,19 @@ public bool fixedDuration
7071

7172
public virtual bool isValid
7273
{
73-
get { return m_FrameRate > 0; }
74+
get
75+
{
76+
if (m_FrameRate == 0)
77+
return false;
78+
79+
if (m_SourceSettings != null)
80+
{
81+
var valid = m_SourceSettings.All(x => x.isValid);
82+
return valid;
83+
}
84+
85+
return true;
86+
}
7487
}
7588

7689
public virtual void OnEnable()

source/FrameRecorder/Inputs/Adam/Editor/AdamBeautySourceEditor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ public override void OnInspectorGUI()
8080
renderSize.intValue = m_FinalSize.intValue;
8181

8282
serializedObject.ApplyModifiedProperties();
83+
84+
if (!(target as AdamBeautyInputSettings).isValid)
85+
{
86+
EditorGUILayout.HelpBox("Incomplete/Invalid settings", MessageType.Warning);
87+
}
88+
8389
}
8490
}
8591

source/FrameRecorder/Inputs/Adam/Engine/AdamBeautyInputSettings.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,12 @@ public class AdamBeautyInputSettings : InputSettings<AdamBeautyInput>
1111
public float m_SuperKernelScale = 1f;
1212
public RenderTexture m_RenderTexture;
1313
public string m_CameraTag;
14+
15+
public override bool isValid {
16+
get
17+
{
18+
return source == EImageSource.GameDisplay || source == EImageSource.MainCamera;
19+
}
20+
}
1421
}
1522
}

source/FrameRecorder/Inputs/CBRenderTexture/Editor/CBRenderTextureInputSettingsEditor.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,13 @@ public override void OnInspectorGUI()
6060

6161
EditorGUILayout.PropertyField(m_FlipVertically, new GUIContent("Flip image vertically"));
6262

63-
6463
serializedObject.ApplyModifiedProperties();
64+
65+
if (!(target as CBRenderTextureInputSettings).isValid)
66+
{
67+
EditorGUILayout.HelpBox("Incomplete/Invalid settings", MessageType.Warning);
68+
}
69+
6570
}
6671
}
6772
}

source/FrameRecorder/Inputs/CBRenderTexture/Engine/CBRenderTextureInputSettings.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ public class CBRenderTextureInputSettings : InputSettings<CBRenderTextureInput>
88
public string m_CameraTag;
99
public bool m_FlipVertical = false;
1010
public bool m_PadSize = false;
11+
12+
public override bool isValid {
13+
get { return source != EImageSource.TaggedCamera || !string.IsNullOrEmpty(m_CameraTag); }
14+
}
1115
}
1216
}

source/FrameRecorder/Inputs/RenderTexture/Editor/RenderTextureInputSettingsEditor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public override void OnInspectorGUI()
3333
}
3434

3535
serializedObject.ApplyModifiedProperties();
36+
37+
if (!(target as RenderTextureInputSettings).isValid)
38+
{
39+
EditorGUILayout.HelpBox("Incomplete/Invalid settings", MessageType.Warning);
40+
}
3641
}
3742
}
3843
}

source/FrameRecorder/Inputs/RenderTexture/Engine/RenderTextureInputSettings.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,13 @@
33
public class RenderTextureInputSettings : InputSettings<RenderTextureInput>
44
{
55
public RenderTexture m_SourceRTxtr;
6+
7+
public override bool isValid {
8+
get
9+
{
10+
return m_SourceRTxtr != null;
11+
}
12+
}
13+
614
}
715
}

0 commit comments

Comments
 (0)