Skip to content

Commit

Permalink
Added obsolescence support for recorders
Browse files Browse the repository at this point in the history
build: 0.2.0021
  • Loading branch information
jasonm-unity committed Dec 6, 2017
1 parent 1eb95e7 commit fd2da29
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 14 deletions.
7 changes: 6 additions & 1 deletion source/FrameRecorder/Core/Editor/RecorderSelector.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Recorder;

namespace UnityEditor.Recorder
Expand Down Expand Up @@ -75,7 +76,7 @@ void SetCategory(string category)
{
m_Category = category;
if (string.IsNullOrEmpty(m_Category) && m_Categories.Length > 0)
m_Category = m_Categories[0];
m_Category = "Video"; // default

if (string.IsNullOrEmpty(m_Category))
{
Expand Down Expand Up @@ -153,6 +154,10 @@ void SelectRecorder( Type newSelection )
if (selectedRecorder == newSelection)
return;

var recorderAttribs = newSelection.GetCustomAttributes(typeof(ObsoleteAttribute), false);
if (recorderAttribs.Length > 0 )
Debug.LogWarning( "Recorder " + ((ObsoleteAttribute)recorderAttribs[0]).Message);

selectedRecorder = newSelection;
m_SetRecorderCallback();
}
Expand Down
1 change: 0 additions & 1 deletion source/FrameRecorder/Core/Editor/RecorderWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ public void OnRecorderSelected()

void CleanupSettingsAsset()
{
var assetPath = AssetDatabase.GetAssetPath(m_WindowSettingsAsset);
UnityHelpers.Destroy(m_WindowSettingsAsset, true);
m_WindowSettingsAsset = ScriptableObject.CreateInstance<RecorderWindowSettings>();
AssetDatabase.CreateAsset(m_WindowSettingsAsset, FRPackagerPaths.GetRecorderRootPath() + "/RecorderWindowSettings.asset");
Expand Down
5 changes: 4 additions & 1 deletion source/FrameRecorder/Core/Engine/InputSettingsList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ public void Rebuild()
Debug.LogError("Recorder Input asset in invalid!");
else
{
Debug.LogWarning("Recorder input setting missing from scene, adding with default state.");
if( Application.isPlaying )
Debug.LogError("Recorder input setting missing from scene, adding with default state.");
else if( Verbose.enabled )
Debug.Log("Recorder input setting missing from scene, adding with default state.");
var replacementInput = ScriptableObject.CreateInstance(binder.inputType) as RecorderInputSetting;
replacementInput.m_Id = inputAsset.m_Id;
m_InputsSettings.Add(replacementInput);
Expand Down
2 changes: 1 addition & 1 deletion source/FrameRecorder/Core/Engine/RecorderVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace UnityEditor.Recorder
public class RecorderVersion : ScriptableObject
{
public const string Version = "0.2"; // major.minor.build
public static int BuildNumber = 20;
public static int BuildNumber = 21;
public static string Tag
{
get { return string.Format("{0}.{1:0000}", Version, BuildNumber); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnityEngine;
using UnityEngine.Recorder;
using UnityEngine.Recorder.Input;

namespace UnityEditor.Recorder.Input
{
[CustomEditor(typeof(ScreenCaptureInputSettings))]
Expand All @@ -29,7 +29,7 @@ public override void OnInspectorGUI()
{
AddProperty(m_RenderSize, () =>
{
m_ResSelector.OnInspectorGUI( (target as ImageInputSettings).maxSupportedSize, m_RenderSize );
m_ResSelector.OnInspectorGUI((target as ImageInputSettings).maxSupportedSize, m_RenderSize);
});

if (m_RenderSize.intValue > (int)EImageDimension.Window)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ protected override void Dispose(bool disposing)
#if UNITY_EDITOR
if (m_ModifiedResolution)
{
GameViewSize.m_ModifiedResolutionCount --;
if(GameViewSize.m_ModifiedResolutionCount == 0 )
GameViewSize.m_ModifiedResolutionCount--;
if (GameViewSize.m_ModifiedResolutionCount == 0)
GameViewSize.RestoreSize();
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ public override bool isValid
}
}
}

#endif
12 changes: 6 additions & 6 deletions source/FrameRecorder/Packager/Private/Editor/FRPackager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public static string GetFrameRecorderRootPath()
return Application.dataPath + "/Recorder/";
}

[MenuItem("Tools/Recorder/Asset Store/Increment Version", false, 100)]
static void IncrementVersion()
[MenuItem("Tools/Recorder/Asset Store/Decrement Version", false, 100)]
static void DecrementVersion()
{
UpdateVersion();
UpdateVersion(-1);
}

[MenuItem("Tools/Recorder/Asset Store/Generate Assetstore package", false, 100)]
Expand All @@ -31,7 +31,7 @@ static void GenerateAssetStorePackage()
AssetDatabase.Refresh();
}

UpdateVersion();
UpdateVersion(1);

var files = new []
{
Expand All @@ -50,7 +50,7 @@ static void GenerateAssetStorePackage()
Debug.Log("Generated package: " + destFile);
}

static void UpdateVersion()
static void UpdateVersion( int delta )
{
var path = FRPackagerPaths.GetRecorderVersionFilePath();
var script = File.ReadAllText(path);
Expand All @@ -61,7 +61,7 @@ static void UpdateVersion()
var endOffset = script.IndexOf(";", startOffset);
var pattern = script.Substring(startOffset, endOffset - startOffset);

RecorderVersion.BuildNumber++;
RecorderVersion.BuildNumber+=delta;
script = script.Replace(pattern, string.Format("public static int BuildNumber = {0}", RecorderVersion.BuildNumber));
File.WriteAllText(path, script);
AssetDatabase.Refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ protected override void OnOutputGui()
aRecorderSettings.outputPath = EditorGUILayout.TextField("Output Path", aRecorderSettings.outputPath);
}

protected override void OnEncodingGroupGui()
{
}

protected override void OnGroupGui()
{
recorderSettings = EditorGUILayout.Foldout(recorderSettings,"Recorder Settings");
Expand Down

0 comments on commit fd2da29

Please sign in to comment.