@@ -21,11 +21,11 @@ enum EState
21
21
22
22
RecorderWindowSettings m_WindowSettingsAsset ;
23
23
24
- public static void ShowAndPreselectCategory ( string category )
24
+ public static void ShowAndPreselectCategory ( string category )
25
25
{
26
26
var window = GetWindow ( typeof ( RecorderWindow ) , false , "Recorder" ) as RecorderWindow ;
27
27
28
- if ( RecordersInventory . recordersByCategory . ContainsKey ( category ) )
28
+ if ( RecordersInventory . recordersByCategory . ContainsKey ( category ) )
29
29
window . m_StartingCategory = category ;
30
30
}
31
31
@@ -35,64 +35,76 @@ public void OnEnable()
35
35
}
36
36
37
37
DateTime m_LastRepaint = DateTime . MinValue ;
38
+
38
39
protected void Update ( )
39
40
{
40
- if ( m_State == EState . Recording && ( DateTime . Now - m_LastRepaint ) . TotalMilliseconds > 50 )
41
+ if ( m_State == EState . Recording && ( DateTime . Now - m_LastRepaint ) . TotalMilliseconds > 50 )
41
42
{
42
43
Repaint ( ) ;
43
44
}
44
45
}
45
46
47
+
48
+ Vector2 m_ScrollPos ;
49
+
46
50
public void OnGUI ( )
47
51
{
48
- m_LastRepaint = DateTime . Now ;
49
-
50
- // Bug? work arround: on Stop play, Enable is not called.
51
- if ( m_Editor != null && m_Editor . target == null )
52
+ m_ScrollPos = EditorGUILayout . BeginScrollView ( m_ScrollPos ) ;
53
+ try
52
54
{
53
- UnityHelpers . Destroy ( m_Editor ) ;
54
- m_Editor = null ;
55
- m_recorderSelector = null ;
56
- }
55
+ m_LastRepaint = DateTime . Now ;
57
56
58
- if ( m_recorderSelector == null )
59
- {
60
- if ( m_WindowSettingsAsset == null )
57
+ // Bug? work arround: on Stop play, Enable is not called.
58
+ if ( m_Editor != null && m_Editor . target == null )
61
59
{
62
- var candidates = AssetDatabase . FindAssets ( "t:RecorderWindowSettings" ) ;
63
- if ( candidates . Length > 0 )
64
- {
65
- var path = AssetDatabase . GUIDToAssetPath ( candidates [ 0 ] ) ;
66
- m_WindowSettingsAsset = AssetDatabase . LoadAssetAtPath < RecorderWindowSettings > ( path ) ;
67
- }
68
- else
69
- {
70
- m_WindowSettingsAsset = ScriptableObject . CreateInstance < RecorderWindowSettings > ( ) ;
71
- AssetDatabase . CreateAsset ( m_WindowSettingsAsset , "Assets/FrameRecordingSettings.asset" ) ;
72
- AssetDatabase . SaveAssets ( ) ;
73
- }
60
+ UnityHelpers . Destroy ( m_Editor ) ;
61
+ m_Editor = null ;
62
+ m_recorderSelector = null ;
74
63
}
75
64
76
- m_recorderSelector = new RecorderSelector ( OnRecorderSelected , true ) ;
77
- m_recorderSelector . Init ( m_WindowSettingsAsset . m_Settings , m_StartingCategory ) ;
78
- }
65
+ if ( m_recorderSelector == null )
66
+ {
67
+ if ( m_WindowSettingsAsset == null )
68
+ {
69
+ var candidates = AssetDatabase . FindAssets ( "t:RecorderWindowSettings" ) ;
70
+ if ( candidates . Length > 0 )
71
+ {
72
+ var path = AssetDatabase . GUIDToAssetPath ( candidates [ 0 ] ) ;
73
+ m_WindowSettingsAsset = AssetDatabase . LoadAssetAtPath < RecorderWindowSettings > ( path ) ;
74
+ }
75
+ else
76
+ {
77
+ m_WindowSettingsAsset = ScriptableObject . CreateInstance < RecorderWindowSettings > ( ) ;
78
+ AssetDatabase . CreateAsset ( m_WindowSettingsAsset , "Assets/FrameRecordingSettings.asset" ) ;
79
+ AssetDatabase . SaveAssets ( ) ;
80
+ }
81
+ }
79
82
80
- if ( m_State == EState . WaitingForPlayModeToStartRecording && EditorApplication . isPlaying )
81
- DelayedStartRecording ( ) ;
83
+ m_recorderSelector = new RecorderSelector ( OnRecorderSelected , true ) ;
84
+ m_recorderSelector . Init ( m_WindowSettingsAsset . m_Settings , m_StartingCategory ) ;
85
+ }
82
86
83
- using ( new EditorGUI . DisabledScope ( EditorApplication . isPlaying ) )
84
- m_recorderSelector . OnGui ( ) ;
87
+ if ( m_State == EState . WaitingForPlayModeToStartRecording && EditorApplication . isPlaying )
88
+ DelayedStartRecording ( ) ;
85
89
86
- if ( m_Editor != null )
87
- {
88
- m_Editor . showBounds = true ;
89
90
using ( new EditorGUI . DisabledScope ( EditorApplication . isPlaying ) )
91
+ m_recorderSelector . OnGui ( ) ;
92
+
93
+ if ( m_Editor != null )
90
94
{
91
- EditorGUILayout . Separator ( ) ;
92
- m_Editor . OnInspectorGUI ( ) ;
93
- EditorGUILayout . Separator ( ) ;
95
+ m_Editor . showBounds = true ;
96
+ using ( new EditorGUI . DisabledScope ( EditorApplication . isPlaying ) )
97
+ {
98
+ EditorGUILayout . Separator ( ) ;
99
+ m_Editor . OnInspectorGUI ( ) ;
100
+ EditorGUILayout . Separator ( ) ;
101
+ }
102
+ RecordButtonOnGui ( ) ;
94
103
}
95
- RecordButtonOnGui ( ) ;
104
+ }
105
+ finally
106
+ {
107
+ EditorGUILayout . EndScrollView ( ) ;
96
108
}
97
109
}
98
110
0 commit comments