Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [2.0.2-preview.3] - 2019-05-28
### Fixes and Linux support
- Add Gif and Legacy Recorders core library binaries for Linux
- Fix build errors related to fccore
- Fix a bug with Recorder Clip that would produce one frame movie if never displayed in the inspector
- Warning clean-up in 2018.4
- Remove ActiveCamera target when HDRP is available
- Fixed "NullReferenceException" errors related to changes in GameView in 2019.3
  • Loading branch information
Unity Technologies committed May 27, 2019
1 parent b229c04 commit b7f6e92
Show file tree
Hide file tree
Showing 15 changed files with 224 additions and 56 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.0.2-preview.3] - 2019-05-28
### Fixes and Linux support
- Add Gif and Legacy Recorders core library binaries for Linux
- Fix build errors related to fccore
- Fix a bug with Recorder Clip that would produce one frame movie if never displayed in the inspector
- Warning clean-up in 2018.4
- Remove ActiveCamera target when HDRP is available
- Fixed "NullReferenceException" errors related to changes in GameView in 2019.3

## [2.0.1-preview.1] - 2019-05-20
### Audio Recorder and some bug fixes
- Integrate AudioRecorder in the package
Expand Down
2 changes: 1 addition & 1 deletion Editor/Sources/RecorderItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public RecorderItem(RecorderControllerSettings prefs, RecorderSettings recorderS

#if UNITY_2019_1_OR_NEWER
m_Toggle.RegisterValueChangedCallback(evt =>
#elif UNITY_2018_3
#elif UNITY_2018_3_OR_NEWER
m_Toggle.OnValueChanged(evt =>
#else
m_Toggle.OnToggle(() =>
Expand Down
2 changes: 1 addition & 1 deletion Editor/Sources/RecorderWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ void OnEnable()
paddingRight = 0.0f,
#if UNITY_2019_1_OR_NEWER
unityBackgroundScaleMode = ScaleMode.ScaleToFit,
#elif UNITY_2018_3
#elif UNITY_2018_3_OR_NEWER
backgroundScaleMode = ScaleMode.ScaleToFit,
#else
backgroundSize = ScaleMode.ScaleToFit,
Expand Down
14 changes: 14 additions & 0 deletions Editor/Sources/Recorders/_Inputs/Camera/CameraInputSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,22 @@ public class CameraInputSettings : StandardImageInputSettings
public bool flipFinalOutput;
public bool captureUI;

internal static bool IsHDRPAvailable()
{
// For backward compatibility with unity version < 19.1
// Use reflection to determine if hdrp is available
const string ClassName = "UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline";
const string editorDllName = "Unity.RenderPipelines.HighDefinition.Runtime";
var hdrpRenderPipeline = Type.GetType(ClassName + ", " + editorDllName );
return (hdrpRenderPipeline != null);
}

public CameraInputSettings()
{
if (IsHDRPAvailable())
{
source = ImageSource.MainCamera;
}
outputImageHeight = ImageHeight.Window;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ protected override void Initialize(SerializedProperty property)
if (m_Initialized)
return;

if (CameraInputSettings.IsHDRPAvailable())
{
m_SupportedSources = ImageSource.MainCamera | ImageSource.TaggedCamera;
}
base.Initialize(property);

m_Source = property.FindPropertyRelative("source");
m_CameraTag = property.FindPropertyRelative("cameraTag");
m_OutputResolution = property.FindPropertyRelative("m_OutputResolution");
Expand Down
18 changes: 13 additions & 5 deletions Editor/Sources/Recorders/_Inputs/GameViewSize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,30 @@ static class GameViewSize
public static int modifiedResolutionCount;
const int miscSize = 1; // Used when no main GameView exists (ex: batchmode)

#if UNITY_2019_3_OR_NEWER
static Type s_GameViewType = Type.GetType("UnityEditor.PreviewEditorWindow,UnityEditor");
static string s_GetGameViewFuncName = "GetMainPreviewWindow";
#else
static Type s_GameViewType = Type.GetType("UnityEditor.GameView,UnityEditor");
static string s_GetGameViewFuncName = "GetMainGameView";
#endif
static EditorWindow GetMainGameView()
{
var T = Type.GetType("UnityEditor.GameView,UnityEditor");
var getMainGameView = T.GetMethod("GetMainGameView", BindingFlags.NonPublic | BindingFlags.Static);
var getMainGameView = s_GameViewType.GetMethod(s_GetGameViewFuncName, BindingFlags.NonPublic | BindingFlags.Static);
var res = getMainGameView.Invoke(null, null);
return (EditorWindow)res;
}

public static void DisableMaxOnPlay()
{
var gameView = GetMainGameView();
if (gameView == null)
return;

if (gameView.GetType().GetField("m_MaximizeOnPlay", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(gameView) as bool? == true)
if (s_GameViewType.GetField("m_MaximizeOnPlay", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(gameView) as bool? == true)
{
Debug.LogWarning("'Maximize on Play' not compatible wit recorder: disabling it!");
gameView.GetType().GetField("m_MaximizeOnPlay", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gameView, false);
Debug.LogWarning("'Maximize on Play' not compatible with recorder: disabling it!");
s_GameViewType.GetField("m_MaximizeOnPlay", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gameView, false);
}
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b7f6e92

Please sign in to comment.