Skip to content

Commit 016297e

Browse files
author
Unity Technologies
committed
Unity 2023.1.0a22 C# reference source code
1 parent 9cd83fb commit 016297e

File tree

304 files changed

+9535
-6141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

304 files changed

+9535
-6141
lines changed

Editor/IncrementalBuildPipeline/BeeBuildProgramCommon.Data/BeeBuildProgramCommon.Data.gen.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
88
<EnableDefaultItems>false</EnableDefaultItems>
99
<LangVersion>latest</LangVersion>
10-
<NoWarn>1071</NoWarn>
10+
<NoWarn>1701</NoWarn>
1111
</PropertyGroup>
1212
<ItemGroup>
1313
<Compile Include="Data.cs" />

Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary.Data/PlayerBuildProgramLibrary.Data.gen.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
88
<EnableDefaultItems>false</EnableDefaultItems>
99
<LangVersion>latest</LangVersion>
10-
<NoWarn>1071</NoWarn>
10+
<NoWarn>1701</NoWarn>
1111
<AssemblyName>PlayerBuildProgramLibrary.Data</AssemblyName>
1212
</PropertyGroup>
1313
<ItemGroup>

Editor/IncrementalBuildPipeline/ScriptCompilationBuildProgram.Data/ScriptCompilationBuildProgram.Data.gen.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
88
<EnableDefaultItems>false</EnableDefaultItems>
99
<LangVersion>latest</LangVersion>
10-
<NoWarn>1071</NoWarn>
10+
<NoWarn>1701</NoWarn>
1111
</PropertyGroup>
1212
<ItemGroup>
1313
<Compile Include="Data.cs" />

Editor/Mono/EditorGUIUtility.bindings.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ public static void RenderGameViewCameras(RenderTexture target, int targetDisplay
151151
internal static extern void RenderPlayModeViewCamerasInternal(RenderTexture target, int targetDisplay, Vector2 mousePosition, bool gizmos, bool renderIMGUI);
152152
internal static extern void SetupWindowSpaceAndVSyncInternal(Rect screenRect);
153153

154+
internal static extern void PerformTonemappingForGameView();
155+
internal static extern void DrawTextureHdrSupport(Rect screenRect, Texture texture, Rect sourceRect, int leftBorder,
156+
int rightBorder, int topBorder, int bottomBorder, Color color, Material mat, int pass, bool resetLinearToSrgbIfHdrActive);
157+
154158
private static extern Texture2D FindTextureByName(string name);
155159
private static extern Texture2D FindTextureByType([NotNull] Type type);
156160
internal static extern string GetObjectNameWithInfo(Object obj);

Editor/Mono/GameView/GameView.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,9 @@ private void OnGUI()
11391139
{
11401140
GUI.Box(m_ZoomArea.drawRect, GUIContent.none, Styles.gameViewBackgroundStyle);
11411141

1142+
// Tonemapping for HDR targets
1143+
EditorGUIUtility.PerformTonemappingForGameView();
1144+
11421145
Vector2 oldOffset = GUIUtility.s_EditorScreenPointOffset;
11431146
GUIUtility.s_EditorScreenPointOffset = Vector2.zero;
11441147
SavedGUIState oldState = SavedGUIState.Create();
@@ -1179,7 +1182,7 @@ private void OnGUI()
11791182
Rect drawRect = deviceFlippedTargetInView;
11801183
drawRect.x = Mathf.Round(drawRect.x);
11811184
drawRect.y = Mathf.Round(drawRect.y);
1182-
Graphics.DrawTexture(drawRect, m_RenderTexture, new Rect(0, 0, 1, 1), 0, 0, 0, 0, GUI.color, GUI.blitMaterial);
1185+
EditorGUIUtility.DrawTextureHdrSupport(drawRect, m_RenderTexture, new Rect(0, 0, 1, 1), 0, 0, 0, 0, GUI.color, GUI.blitMaterial, -1, true);
11831186
GUI.EndGroup();
11841187
}
11851188
}

Editor/Mono/Inspector/CameraOverlay.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ public override void OnGUI()
176176
RenderTexture.active = rt;
177177
}
178178

179+
previewCamera.cameraType = CameraType.Preview;
179180
previewCamera.Render();
180181

181182
Graphics.DrawTexture(previewRect, previewTexture, new Rect(0, 0, 1, 1), 0, 0, 0, 0, GUI.color, EditorGUIUtility.GUITextureBlit2SRGBMaterial);

Editor/Mono/Inspector/GraphicsSettingsInspector.cs

Lines changed: 144 additions & 184 deletions
Large diffs are not rendered by default.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Unity C# reference source
2+
// Copyright (c) Unity Technologies. For terms of use, see
3+
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
4+
5+
using UnityEditor.Experimental;
6+
using UnityEngine;
7+
using UnityEngine.UIElements;
8+
9+
namespace UnityEditor
10+
{
11+
internal abstract class GraphicsSettingsElement : VisualElement
12+
{
13+
protected SerializedObject m_SerializedObject;
14+
protected SettingsWindow m_SettingsWindow;
15+
16+
protected Color HighlightSelectionColor = EditorResources.GetStyle("sb-settings-panel-client-area").GetColor("-unity-search-highlight-selection-color");
17+
protected Color HighlightColor = EditorResources.GetStyle("sb-settings-panel-client-area").GetColor("-unity-search-highlight-color");
18+
19+
//We rely on SupportedOn attribute for the cases when we need to show element for SRP.
20+
//Here is a way to specify when we want to have element visible for BuiltinOnly.
21+
//Important notice: we check first for SupportedOn first, then for this backup field.
22+
public virtual bool BuiltinOnly => false;
23+
24+
internal void Initialize(SerializedObject serializedObject)
25+
{
26+
m_SerializedObject = serializedObject;
27+
28+
m_SettingsWindow = EditorWindow.GetWindow<SettingsWindow>();
29+
30+
Initialize();
31+
}
32+
33+
protected abstract void Initialize();
34+
}
35+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Unity C# reference source
2+
// Copyright (c) Unity Technologies. For terms of use, see
3+
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
4+
5+
using UnityEngine.UIElements;
6+
7+
namespace UnityEditor
8+
{
9+
internal class GraphicsSettingsInspectorAlwaysIncludedShader : GraphicsSettingsElement
10+
{
11+
public new class UxmlFactory : UxmlFactory<GraphicsSettingsInspectorAlwaysIncludedShader, UxmlTraits> { }
12+
13+
SerializedProperty m_AlwaysIncludedShaders;
14+
15+
protected override void Initialize()
16+
{
17+
m_AlwaysIncludedShaders = m_SerializedObject.FindProperty("m_AlwaysIncludedShaders");
18+
m_AlwaysIncludedShaders.isExpanded = true;
19+
20+
Add(new IMGUIContainer(Draw));
21+
}
22+
23+
void Draw()
24+
{
25+
using var highlightScope = new EditorGUI.LabelHighlightScope(m_SettingsWindow.GetSearchText(), HighlightSelectionColor, HighlightColor);
26+
using var check = new EditorGUI.ChangeCheckScope();
27+
EditorGUILayout.PropertyField(m_AlwaysIncludedShaders, true);
28+
if (check.changed)
29+
m_SerializedObject.ApplyModifiedProperties();
30+
}
31+
}
32+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Unity C# reference source
2+
// Copyright (c) Unity Technologies. For terms of use, see
3+
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
4+
5+
using UnityEngine;
6+
using UnityEngine.UIElements;
7+
8+
namespace UnityEditor;
9+
10+
internal class GraphicsSettingsInspectorBuiltinShaderLabel : GraphicsSettingsElement
11+
{
12+
public new class UxmlFactory : UxmlFactory<GraphicsSettingsInspectorBuiltinShaderLabel, UxmlTraits> { }
13+
14+
internal class Styles
15+
{
16+
public static readonly GUIContent builtinSettings = EditorGUIUtility.TrTextContent("Built-in Shader Settings");
17+
}
18+
19+
protected override void Initialize()
20+
{
21+
Add(new Label(Styles.builtinSettings.text));
22+
}
23+
}

0 commit comments

Comments
 (0)