Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [4.0.0-pre.1] - 2021-08-25
### Added
- Added a slider to change the JPEG quality when using Image Recorders or AOV Recorders.
- Added a new <AOV> wildcard for AOV Image Sequence recorders, and include it in the default file name.

### Changed
- Modified the Recorder menu item to cycle the Recorder Window status between open, in focus, and closed.
- Added <Recorder> wildcard to the default file name of all recorders.
- Moved the Recorder Options from Recorder menu items to Unity Editor user Preferences.
- Expose the AudioInput, AudioRecorderSettings, and WAVEncoder classes to the public API.

### Fixed
- Fix the "Open output location" button functionality in Linux.
  • Loading branch information
Unity Technologies committed Aug 25, 2021
1 parent d36b1e5 commit 1b312fe
Show file tree
Hide file tree
Showing 44 changed files with 774 additions and 178 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.0.0-pre.1] - 2021-08-25
### Added
- Added a slider to change the JPEG quality when using Image Recorders or AOV Recorders.
- Added a new <AOV> wildcard for AOV Image Sequence recorders, and include it in the default file name.

### Changed
- Modified the Recorder menu item to cycle the Recorder Window status between open, in focus, and closed.
- Added <Recorder> wildcard to the default file name of all recorders.
- Moved the Recorder Options from Recorder menu items to Unity Editor user Preferences.
- Expose the AudioInput, AudioRecorderSettings, and WAVEncoder classes to the public API.

### Fixed
- Fix the "Open output location" button functionality in Linux.

## [3.0.1] - 2021-07-22
### Fixed
- Perform the appropriate color space conversion for Texture Sampling sources when required.
Expand Down
Binary file modified Documentation~/Images/RecorderImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 10 additions & 9 deletions Documentation~/OutputFileProperties.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@ The **+Wildcards** menu helps you quickly append them to the file name string, b

| Placeholder | Description | Resolved value example |
|--|--|--|
| `<Recorder>` | • In Recorder window: the Recorder name from the Recorder list.<br />• In Timeline track: the name of the Recorder clip. | `My Recorder` |
| `<Time>` | The time the recording is generated. Uses the `00h00m` format. | `16h52m` |
| `<Take>` | The **Take Number** value. Uses the `000` format. | `002` |
| `<AOV>` | The name of the [**AOV to Export** selected for recording](RecorderAOV.md#aov-to-export). | `Beauty` |
| `<Date>` | The date the recording is generated. Uses the `yyyy-MM-dd` format. | `2020-11-03` |
| `<Project>` | The name of the current Unity Project. | `My Project` |
| `<Extension>` | The file extension of the output format (without the period). | `png` |
| `<Frame>` | The current frame number. Uses the `0000` format.<br/><br/>This is useful for Image Sequence Recorders which output each frame as a separate file. | `0154` |
| `<GameObject>` | The name of the [**GameObject** targeted for recording](RecorderAnimation.md#capture). | `My GameObject` |
| `<GameObjectScene>` | The name of the Scene containing the [**GameObject** targeted for recording](RecorderAnimation.md#capture). | `My Scene` |
| `<Product>` | The value of the [Product Name](https://docs.unity3d.com/Manual/class-PlayerSettings.html#ProductName) field from Unity's Player General Settings. | `My Product` |
| `<Scene>` | The name of the current Unity Scene. | `My Scene` |
| `<Project>` | The name of the current Unity Project. | `My Project` |
| `<Recorder>` | • In Recorder window: the Recorder name from the Recorder list.<br />• In Timeline track: the name of the Recorder clip. | `My Recorder` |
| `<Resolution>` | The output image dimensions (width by height) in pixels. Uses the `WxH` format. | `1920x1080` |
| `<Frame>` | The current frame number. Uses the `0000` format.<br/><br/>This is useful for Image Sequence Recorders which output each frame as a separate file. | `0154` |
| `<Extension>` | The file extension of the output format (without the period). | `png` |
| `<GameObject>` | The name of the GameObject being recorded. | `My GameObject` |
| `<GameObjectScene>` | The name of the Scene containing the GameObject being Recorded. | `My Scene` |
| `<Scene>` | The name of the current Unity Scene. | `My Scene` |
| `<Take>` | The **Take Number** value. Uses the `000` format. | `002` |
| `<Time>` | The time the recording is generated. Uses the `00h00m` format. | `16h52m` |

**Note:** Some placeholders might not be available depending on the Recorder type you are using.
3 changes: 2 additions & 1 deletion Documentation~/RecorderAOV.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ Use this section to set up the media format you need to save the recorded images
| **Color Space** | | The color space (gamma curve and gamut) to use in the output images. |
| | sRGB, sRGB | Uses sRGB curve and sRGB primaries. |
| | Linear, sRGB (unclamped) | Uses linear curve and sRGB primaries.<br/>This option is only available when you set the **Format** to **EXR**.<br/><br/>**Important:** To get the expected unclamped values in the output images, you must:<br/><br/>• Disable any Tonemapping post-processing effects in your Scene (menu: **Edit > Project Settings > HDRP Default Settings** and deselect **Tonemapping**) and in any Volume that includes a Tonemapping override (select the Volume, navigate in the Inspector and deselect **Tonemapping** if present).<br/><br/>• Disable **Dithering** on the Camera selected for the capture (in the Inspector, navigate to **General** and deselect **Dithering**). |
| **Compression** | | The compression method to apply when saving the data. <br/>This property is only available when you set the **Format** to **EXR**. |
| **Quality** | | The JPEG encoding quality level. <br/>This property is only available when you set the **Format** to **JPEG**. |
| **Compression** | | The EXR compression method to apply when saving the data. <br/>This property is only available when you set the **Format** to **EXR**. |
| | None | Disables all compression. |
| | Zip | Applies deflate compression to blocks of 16 scanlines at a time.<br/>This is the default selection. |
| | RLE | Applies [Run-length encoding](https://en.wikipedia.org/wiki/Run-length_encoding) compression. |
Expand Down
3 changes: 2 additions & 1 deletion Documentation~/RecorderImage.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ Use this section to set up the media format you need to save the recorded images
| **Color Space** | | The color space (gamma curve and gamut) to use in the output images. |
| | sRGB, sRGB | Uses sRGB curve and sRGB primaries. |
| | Linear, sRGB (unclamped) | Uses linear curve and sRGB primaries.<br/>This option is only available when you set the **Format** to **EXR**.<br/><br/>**Important:** To get the expected unclamped values in the output images, you must:<br/><br/>• Disable any Tonemapping post-processing effects in your Scene (menu: **Edit > Project Settings > HDRP Default Settings** and deselect **Tonemapping**) and in any Volume that includes a Tonemapping override (select the Volume, navigate in the Inspector and deselect **Tonemapping** if present).<br/><br/>• Disable **Dithering** on the Camera selected for the capture (in the Inspector, navigate to **General** and deselect **Dithering**). |
| **Compression** | | The compression method to apply when saving the data. <br/>This property is only available when you set the **Media File Format** to **EXR**. |
| **Quality** | | The JPEG encoding quality level. <br/>This property is only available when you set the **Media File Format** to **JPEG**. |
| **Compression** | | The EXR compression method to apply when saving the data. <br/>This property is only available when you set the **Media File Format** to **EXR**. |
| | None | Disables all compression. |
| | Zip | Applies deflate compression to blocks of 16 scanlines at a time.<br/>This is the default selection. |
| | RLE | Applies [Run-length encoding](https://en.wikipedia.org/wiki/Run-length_encoding) compression. |
Expand Down
10 changes: 10 additions & 0 deletions Editor/Encoding/CoreMediaEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ internal override string GetDefaultExtension()
{
return "mp4";
}

internal override bool IsFormatSupported(VideoRecorderOutputFormat format)
{
#if UNITY_EDITOR_LINUX
// MP4 is not supported on Linux
return format != VideoRecorderOutputFormat.MP4;
#else
return true;
#endif
}
}

internal class CoreMediaEncoder : IMediaEncoder
Expand Down
5 changes: 5 additions & 0 deletions Editor/Encoding/MediaEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ internal virtual string GetDefaultExtension()
{
throw new NotImplementedException();
}

internal virtual bool IsFormatSupported(VideoRecorderOutputFormat format)
{
return true;
}
}

internal interface IMediaEncoder : IDisposable
Expand Down
10 changes: 10 additions & 0 deletions Editor/ProRes/ProResEncoderPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ internal override string GetDefaultExtension()
{
return "mov";
}

internal override bool IsFormatSupported(VideoRecorderOutputFormat format)
{
#if UNITY_EDITOR_LINUX
// ProRes is not supported on Linux
return false;
#else
return true;
#endif
}
}

internal class ProResEncoderCore
Expand Down
1 change: 0 additions & 1 deletion Editor/Sources/FileNameGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public static class DefaultWildcard
/// The current frame ID (a four-digit zero-padded number).
/// </summary>
public static readonly string Frame = GeneratePattern("Frame");

/// <summary>
/// The file extension of the output format.
/// </summary>
Expand Down
61 changes: 38 additions & 23 deletions Editor/Sources/FileNameGeneratorDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,35 +183,38 @@ static void OpenInOSX(string path, bool openInsideFolder)
}

var arguments = (openInsideFolder ? "" : "-R ") + osxPath;

try
{
System.Diagnostics.Process.Start("open", arguments);
}
catch (System.ComponentModel.Win32Exception e)
{
// tried to open mac finder in windows
// just silently skip error
// we currently have no platform define for the current OS we are in, so we resort to this
e.HelpLink = ""; // do anything with this variable to silence warning about not using it
}
System.Diagnostics.Process.Start("open", arguments);
}

static void OpenInWindows(string path, bool openInsideFolder)
{
var winPath = path.Replace("/", "\\"); // windows explorer doesn't like forward slashes
System.Diagnostics.Process.Start("explorer.exe", (openInsideFolder ? "/root," : "/select,") + winPath);
}

try
static void OpenInLinux(string path)
{
FileInfo fiPath = new FileInfo(path);
if (fiPath.Exists)
{
System.Diagnostics.Process.Start("explorer.exe", (openInsideFolder ? "/root," : "/select,") + winPath);
// xdg-open will open the file with the default file handler, so instead we pass the parent directory
// because we want to open a file explorer, not a file _handler_.
path = fiPath.DirectoryName;
}
catch (System.ComponentModel.Win32Exception e)

var linuxPath = path.Replace("\\", "/");

if (!linuxPath.StartsWith("\""))
{
// tried to open win explorer in mac
// just silently skip error
// we currently have no platform define for the current OS we are in, so we resort to this
e.HelpLink = ""; // do anything with this variable to silence warning about not using it
linuxPath = "\"" + linuxPath;
}

if (!linuxPath.EndsWith("\""))
{
linuxPath = linuxPath + "\"";
}

System.Diagnostics.Process.Start("xdg-open", linuxPath);
}

public static void Open(string path)
Expand All @@ -221,13 +224,25 @@ public static void Open(string path)

var openInsideFolder = Directory.Exists(path);

if (Application.platform == RuntimePlatform.WindowsEditor)
try
{
OpenInWindows(path, openInsideFolder);
if (Application.platform == RuntimePlatform.WindowsEditor)
{
OpenInWindows(path, openInsideFolder);
}
else if (Application.platform == RuntimePlatform.OSXEditor)
{
OpenInOSX(path, openInsideFolder);
}
else if (Application.platform == RuntimePlatform.LinuxEditor)
{
OpenInLinux(path);
}
}
else if (Application.platform == RuntimePlatform.OSXEditor)
catch (System.ComponentModel.Win32Exception e)
{
OpenInOSX(path, openInsideFolder);
// Safe guard for platform
e.HelpLink = ""; // do anything with this variable to silence warning about not using it
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Editor/Sources/PanelSplitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PanelSplitter : VisualElement
void SetWidth(float value)
{
m_AffectedElement.style.width = value;
RecorderOptions.recorderPanelWith = value;
RecorderOptions.recorderPanelWidth = value;
}

public PanelSplitter(VisualElement affectedElement)
Expand All @@ -34,7 +34,7 @@ public PanelSplitter(VisualElement affectedElement)
UIElementHelper.RegisterTrickleDownCallback<MouseMoveEvent>(this, OnMouseMove);
UIElementHelper.RegisterTrickleDownCallback<MouseUpEvent>(this, OnMouseUp);

var w = RecorderOptions.recorderPanelWith;
var w = RecorderOptions.recorderPanelWidth;
if (w > 0.0f)
SetWidth(w);
}
Expand Down
2 changes: 1 addition & 1 deletion Editor/Sources/RecorderAnalytics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public static MovieRecorderInfo FromRecorder(MovieRecorder r)
else
{
ret.media_format = r.Settings.OutputFormat.ConvertToString();
ret.quality = r.Settings.VideoBitRateMode.ConvertToString();
ret.quality = r.Settings.EncodingQuality.ConvertToString();
}

return ret;
Expand Down
2 changes: 1 addition & 1 deletion Editor/Sources/RecorderEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public abstract class RecorderEditor : Editor
SerializedProperty m_FileNameGenerator;
SerializedProperty m_Take;


internal event Action OnRecorderValidated;
SavedBool showFormat;
SavedBool showOutputFile;
Expand Down Expand Up @@ -156,6 +155,7 @@ public override void OnInspectorGUI()
OnEncodingGui();
EditorGUILayout.Separator();
}

showOutputFile.value = DrawHeaderFoldout(Styles.OutputFileLabel, showOutputFile, false);
if (showOutputFile)
{
Expand Down
46 changes: 6 additions & 40 deletions Editor/Sources/RecorderOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ namespace UnityEditor.Recorder
/// </summary>
public static class RecorderOptions
{
const string k_VerboseModeMenuItem = RecorderWindow.MenuRoot + "Options/Verbose Mode";
const string k_ShowRecorderGameObject = RecorderWindow.MenuRoot + "Options/Show Recorder GameObject";
const string k_ShowLegacyModeMenuItem = RecorderWindow.MenuRoot + "Options/Show Legacy Recorders";

const string k_ExitPayModeItem = RecorderWindow.MenuRoot + "Options/Exit PlayMode";
Expand All @@ -20,21 +18,20 @@ public static class RecorderOptions
/// </summary>
public static bool VerboseMode
{
get { return EditorPrefs.GetBool(k_VerboseModeMenuItem, false); }
set { EditorPrefs.SetBool(k_VerboseModeMenuItem, value); }
get => RecorderPreferencesSettings.Instance.VerboseMode;
set => RecorderPreferencesSettings.Instance.VerboseMode = value;
}

/// <summary>
/// The recoder uses a "Unity-RecorderSessions" GameObject to store Scene references and manage recording sessions.
/// The recorder uses a "Unity-RecorderSessions" GameObject to store Scene references and manage recording sessions.
/// If true, this GameObject will be visible in the Scene Hierarchy.
/// </summary>
public static bool ShowRecorderGameObject
{
get { return EditorPrefs.GetBool(k_ShowRecorderGameObject, false); }
get => RecorderPreferencesSettings.Instance.ShowGO;
set
{
EditorPrefs.SetBool(k_ShowRecorderGameObject, value);
UnityHelpers.SetGameObjectsVisibility(value);
RecorderPreferencesSettings.Instance.ShowGO = value;
}
}

Expand All @@ -44,7 +41,7 @@ internal static bool exitPlayMode
set { EditorPrefs.SetBool(k_ExitPayModeItem, value); }
}

internal static float recorderPanelWith
internal static float recorderPanelWidth
{
get { return EditorPrefs.GetFloat(k_RecorderPanelWidth, 0); }
set { EditorPrefs.SetFloat(k_RecorderPanelWidth, value); }
Expand All @@ -55,37 +52,6 @@ internal static int selectedRecorderIndex
get { return EditorPrefs.GetInt(k_SelectedRecorderIndex, 0); }
set { EditorPrefs.SetInt(k_SelectedRecorderIndex, value); }
}


[MenuItem(k_VerboseModeMenuItem, false, RecorderWindow.MenuRootIndex + 200)]
static void ToggleDebugMode()
{
var value = !VerboseMode;
EditorPrefs.SetBool(k_VerboseModeMenuItem, value);
VerboseMode = value;
}

[MenuItem(k_VerboseModeMenuItem, true)]
static bool ToggleDebugModeValidate()
{
Menu.SetChecked(k_VerboseModeMenuItem, VerboseMode);
return true;
}

[MenuItem(k_ShowRecorderGameObject, false, RecorderWindow.MenuRootIndex + 200)]
static void ToggleShowRecorderGameObject()
{
var value = !ShowRecorderGameObject;
EditorPrefs.SetBool(k_ShowRecorderGameObject, value);
ShowRecorderGameObject = value;
}

[MenuItem(k_ShowRecorderGameObject, true)]
static bool ToggleShowRecorderGameObjectValidate()
{
Menu.SetChecked(k_ShowRecorderGameObject, ShowRecorderGameObject);
return true;
}
}

[UsedImplicitly]
Expand Down
8 changes: 8 additions & 0 deletions Editor/Sources/RecorderPreferences.meta

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

Loading

0 comments on commit 1b312fe

Please sign in to comment.