Skip to content

Commit a1cb18c

Browse files
committed
Updating package and increasing name checks for playback.
1 parent 1726704 commit a1cb18c

3 files changed

Lines changed: 36 additions & 26 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- Rotation statistic recording
1111
- Option to flatten multipart statistics (e.g. XYZ) into a single line during CSV export
1212

13+
### Changed
14+
- Playback file checks are more aggressive to ensure file changes are accounted for
15+
1316
## [1.1.2] - 11/07/23
1417

1518
### Added

Core/Editor/Scripts/PlaybackManagerEditor.cs

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public class PlaybackManagerEditor : Editor
3030
private SerializedProperty _timeCounter;
3131
private SerializedProperty _ignoreFile;
3232

33+
private bool _awaitingRefreshVal = false;
34+
3335
private string _componentFilter = "";
3436

3537
private GUIContent _recordFoldoutGUI = new GUIContent("", "You can drag files onto this header to add them to the files list.");
@@ -53,6 +55,14 @@ private void Awake()
5355
}
5456
}
5557

58+
private void OnDestroy()
59+
{
60+
if (_awaitingRefreshVal)
61+
{
62+
Debug.LogWarning("Playback Manager needs to Update Files before you can enter play mode.", serializedObject.targetObject);
63+
}
64+
}
65+
5666
public override bool RequiresConstantRepaint()
5767
{
5868
return false;
@@ -65,6 +75,7 @@ private void SetProperties()
6575
_binders = serializedObject.FindProperty("_binders");
6676
_currentFile = serializedObject.FindProperty("_currentFile");
6777
_awaitingRefresh = serializedObject.FindProperty("_awaitingFileRefresh");
78+
_awaitingRefreshVal = _awaitingRefresh.boolValue;
6879
_oldFileIndex = serializedObject.FindProperty("_oldFileIndex");
6980
_playing = serializedObject.FindProperty("_playing");
7081
_changingFiles = serializedObject.FindProperty("_changingFiles");
@@ -248,19 +259,15 @@ private void RecordedFilesList()
248259
if (_recordedFiles.isExpanded)
249260
{
250261
_fileScrollPos = EditorGUILayout.BeginScrollView(_fileScrollPos, GUILayout.Height(Sizes.Playback.heightFileScroll));
262+
EditorGUI.BeginChangeCheck();
251263
for (int i = 0; i < _recordedFiles.arraySize; i++)
252264
{
253-
if (!(_fileScrollPos.y - ((Sizes.heightLine + Sizes.padding)*2) <= ((Sizes.heightLine+Sizes.padding) * (i - 1)) && _fileScrollPos.y + Sizes.Playback.heightFileScroll > ((Sizes.heightLine + Sizes.padding) * i)))
265+
if (!(_fileScrollPos.y - ((Sizes.heightLine + Sizes.padding) * 2) <= ((Sizes.heightLine + Sizes.padding) * (i - 1)) && _fileScrollPos.y + Sizes.Playback.heightFileScroll > ((Sizes.heightLine + Sizes.padding) * i)))
254266
{
255267
EditorGUILayout.LabelField("");
256268
continue;
257269
}
258270

259-
if (_recordedFiles.GetArrayElementAtIndex(i).objectReferenceValue == null)
260-
{
261-
_awaitingRefresh.boolValue = true;
262-
}
263-
264271
EditorGUILayout.BeginHorizontal();
265272

266273
EditorGUI.BeginDisabledGroup(_awaitingRefresh.boolValue);
@@ -283,7 +290,6 @@ private void RecordedFilesList()
283290
{
284291
_recordedFiles.GetArrayElementAtIndex(i).objectReferenceValue = null;
285292
_recordedFiles.DeleteArrayElementAtIndex(i);
286-
_awaitingRefresh.boolValue = true;
287293
if (_currentFile.intValue >= _recordedFiles.arraySize)
288294
{
289295
_currentFile.intValue = _recordedFiles.arraySize - 1;
@@ -294,6 +300,10 @@ private void RecordedFilesList()
294300

295301
EditorGUILayout.EndHorizontal();
296302
}
303+
if (EditorGUI.EndChangeCheck())
304+
{
305+
_awaitingRefresh.boolValue = true;
306+
}
297307
EditorGUILayout.EndScrollView();
298308
}
299309
}
@@ -324,13 +334,13 @@ private void Playlists()
324334
for (int i = 0; i < _recordedFiles.arraySize; i++)
325335
{
326336
TextAsset t = (TextAsset)_recordedFiles.GetArrayElementAtIndex(i).objectReferenceValue;
327-
if(t == null)
337+
if (t == null)
328338
{
329339
continue;
330340
}
331341
string guid = "";
332342
long local = 0;
333-
if(AssetDatabase.TryGetGUIDAndLocalFileIdentifier(t, out guid, out local))
343+
if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(t, out guid, out local))
334344
{
335345
playlist.Add(new PlaylistItem(t.name, AssetDatabase.GUIDToAssetPath(guid), guid));
336346
}
@@ -343,10 +353,10 @@ private void Playlists()
343353

344354
EditorGUI.EndDisabledGroup();
345355

346-
if (GUILayout.Button(new GUIContent("Load Playlist","Loading a playlist will overwrite your current set of loaded files. Playlist order is determined on how files are found, not the order they are present within the file.")))
356+
if (GUILayout.Button(new GUIContent("Load Playlist", "Loading a playlist will overwrite your current set of loaded files. Playlist order is determined on how files are found, not the order they are present within the file.")))
347357
{
348358
var path = EditorUtility.OpenFilePanel("Load Playlist", "", "json");
349-
if(path.Length != 0)
359+
if (path.Length != 0)
350360
{
351361
try
352362
{
@@ -357,7 +367,7 @@ private void Playlists()
357367
for (int i = 0; i < playlist.Count; i++)
358368
{
359369
temp = AssetDatabase.GUIDToAssetPath(playlist[i].guid.ToString());
360-
if(temp.Contains(playlist[i].name + ".bytes"))
370+
if (temp.Contains(playlist[i].name + ".bytes"))
361371
{
362372
textAssets.Add(AssetDatabase.LoadAssetAtPath<TextAsset>(temp));
363373
playlist.RemoveAt(i);
@@ -370,19 +380,19 @@ private void Playlists()
370380
for (int i = 0; i < assets.Length; i++)
371381
{
372382
temp = AssetDatabase.GUIDToAssetPath(assets[i]);
373-
if(temp.EndsWith("bytes"))
383+
if (temp.EndsWith("bytes"))
374384
{
375385
for (int j = 0; j < playlist.Count; j++)
376386
{
377-
if(temp.Contains(playlist[j].name))
387+
if (temp.Contains(playlist[j].name))
378388
{
379389
textAssets.Add(AssetDatabase.LoadAssetAtPath<TextAsset>(temp));
380390
playlist.RemoveAt(j);
381391
break;
382392
}
383393
}
384394
}
385-
if(playlist.Count == 0)
395+
if (playlist.Count == 0)
386396
{
387397
break;
388398
}
@@ -433,7 +443,7 @@ private void RecordComponents()
433443
}
434444
}
435445

436-
GUIContent recordComponents = new GUIContent("Recorded Items (" + _binders.arraySize+")", EditorMessages.playbackRecordItemInfo);
446+
GUIContent recordComponents = new GUIContent("Recorded Items (" + _binders.arraySize + ")", EditorMessages.playbackRecordItemInfo);
437447

438448
EditorGUILayout.BeginHorizontal();
439449

@@ -444,19 +454,19 @@ private void RecordComponents()
444454
GUIContent redLabel = new GUIContent(EditorGUIUtility.IconContent("redLight"));
445455
redLabel.tooltip = EditorMessages.playbackRecordItemInfo;
446456

447-
_binders.isExpanded = EditorGUI.Foldout(foldoutRect,_binders.isExpanded, recordComponents, true, Styles.foldoutBold);
457+
_binders.isExpanded = EditorGUI.Foldout(foldoutRect, _binders.isExpanded, recordComponents, true, Styles.foldoutBold);
448458

449-
EditorGUILayout.LabelField(greenLabel,Styles.textIconBold,GUILayout.Width(Sizes.widthIcon));
459+
EditorGUILayout.LabelField(greenLabel, Styles.textIconBold, GUILayout.Width(Sizes.widthIcon));
450460

451461
GUIContent gcLabel = new GUIContent(assignedCount.ToString(), EditorMessages.playbackRecordItemInfo);
452462

453-
EditorGUILayout.LabelField(gcLabel,Styles.textBold, GUILayout.Width(Styles.textBold.CalcSize(gcLabel).x));
463+
EditorGUILayout.LabelField(gcLabel, Styles.textBold, GUILayout.Width(Styles.textBold.CalcSize(gcLabel).x));
454464

455-
EditorGUILayout.LabelField(redLabel,Styles.textIconBold, GUILayout.Width(Sizes.widthIcon));
465+
EditorGUILayout.LabelField(redLabel, Styles.textIconBold, GUILayout.Width(Sizes.widthIcon));
456466

457467
GUIContent rcLabel = new GUIContent(unassignedCount.ToString(), EditorMessages.playbackRecordItemInfo);
458468

459-
EditorGUILayout.LabelField(rcLabel, Styles.textBold,GUILayout.Width(Styles.textBold.CalcSize(rcLabel).x));
469+
EditorGUILayout.LabelField(rcLabel, Styles.textBold, GUILayout.Width(Styles.textBold.CalcSize(rcLabel).x));
460470

461471
EditorGUILayout.EndHorizontal();
462472

@@ -507,7 +517,7 @@ private void PlaybackIgnoreItems()
507517
EditorGUILayout.LabelField(new GUIContent("Playback Ignore File", "This file controls which components on a RecordComponent's object are NOT disabled when playback begins. If no file is assigned then the default values for each RecordComponent will be used."), Styles.textBold);
508518
_ignoreFile.objectReferenceValue = EditorGUILayout.ObjectField(_ignoreFile.objectReferenceValue, typeof(PlaybackIgnoreComponentsObject), false);
509519
EditorGUILayout.EndHorizontal();
510-
if(_ignoreFile.objectReferenceValue == null)
520+
if (_ignoreFile.objectReferenceValue == null)
511521
{
512522
EditorGUILayout.HelpBox("To create an Ignore File, go to your project assets, right click -> Create -> PlayRecorder -> Playback Ignore Asset. If no file is selected, default values are used.", MessageType.Info);
513523
}
@@ -569,8 +579,5 @@ private void PlaybackControls()
569579

570580
EditorGUI.EndDisabledGroup();
571581
}
572-
573-
574582
}
575-
576583
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.ultraleap.playrecorder",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "Unity scene logic recorder tool for editor and builds.",
55
"displayName": "Ultraleap PlayRecorder",
66
"unity": "2020.3",

0 commit comments

Comments
 (0)