Skip to content

Commit a46b3a2

Browse files
author
Unity Technologies
committed
Unity 2022.2.0b9 C# reference source code
1 parent e1237d5 commit a46b3a2

File tree

25 files changed

+243
-122
lines changed

25 files changed

+243
-122
lines changed

Editor/Mono/GUI/AppStatusBar.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,11 @@ private void DrawBakeMode()
312312
if (GUILayout.Button(GetBakeModeIcon(m_autoLightBakingOn), Styles.statusIcon))
313313
{
314314
Event.current.Use();
315-
LightingWindow.CreateLightingWindow();
315+
316+
if (LightingWindow.isShown)
317+
LightingWindow.DestroyLightingWindow();
318+
else
319+
LightingWindow.CreateLightingWindow();
316320
}
317321

318322
var buttonRect = GUILayoutUtility.GetLastRect();

Editor/Mono/GUI/Tools/EditorToolAttributes.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ protected ToolAttribute(string displayName, Type targetType = null, Type editorT
3131
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
3232
public sealed class EditorToolAttribute : ToolAttribute
3333
{
34-
public EditorToolAttribute(string displayName, Type componentToolTarget = null, Type editorToolContext = null)
34+
public EditorToolAttribute(string displayName, Type componentToolTarget = null)
35+
: base(displayName, componentToolTarget) {}
36+
public EditorToolAttribute(string displayName, Type componentToolTarget, Type editorToolContext)
3537
: base(displayName, componentToolTarget, editorToolContext) {}
3638
}
3739

Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class SettingsContent
231231
public static readonly GUIContent lightmapQualityAndroidWarning = EditorGUIUtility.TrTextContent("The Lightmap Encoding scheme you have selected requires OpenGL ES 3.0 or Vulkan. Navigate to 'Android Player Settings' > 'Rendering' and disable the OpenGL ES 2 API.");
232232
public static readonly GUIContent hdrCubemapQualityAndroidWarning = EditorGUIUtility.TrTextContent("The HDR Cubemap Encoding scheme you have selected requires OpenGL ES 3.0 or Vulkan. Navigate to 'Android Player Settings' > 'Rendering' and disable the OpenGL ES 2 API.");
233233
public static readonly GUIContent legacyClampBlendShapeWeights = EditorGUIUtility.TrTextContent("Clamp BlendShapes (Deprecated)*", "If set, the range of BlendShape weights in SkinnedMeshRenderers will be clamped.");
234-
public static readonly GUIContent virtualTexturingSupportEnabled = EditorGUIUtility.TrTextContent("Virtual Texturing*", "Enable support for Virtual Texturing. Changing this value requires an Editor restart.");
234+
public static readonly GUIContent virtualTexturingSupportEnabled = EditorGUIUtility.TrTextContent("Virtual Texturing (Experimental)*", "Enable Virtual Texturing. This feature is experimental and not ready for production use. Changing this value requires an Editor restart.");
235235
public static readonly GUIContent virtualTexturingUnsupportedPlatformWarning = EditorGUIUtility.TrTextContent("The current target platform does not support Virtual Texturing. To build for this platform, uncheck Enable Virtual Texturing.");
236236
public static readonly GUIContent virtualTexturingUnsupportedAPI = EditorGUIUtility.TrTextContent("The target graphics API does not support Virtual Texturing. To target compatible graphics APIs, uncheck 'Auto Graphics API', and remove OpenGL ES 2/3 and OpenGLCore.");
237237
public static readonly GUIContent virtualTexturingUnsupportedAPIWin = EditorGUIUtility.TrTextContent("The target Windows graphics API does not support Virtual Texturing. To target compatible graphics APIs, uncheck 'Auto Graphics API for Windows', and remove OpenGL ES 2/3 and OpenGLCore.");
@@ -639,7 +639,7 @@ void OnEnable()
639639
m_VirtualTexturingSupportEnabled = FindPropertyAssert("virtualTexturingSupportEnabled");
640640
m_ShaderPrecisionModel = FindPropertyAssert("shaderPrecisionModel");
641641

642-
m_ForceSRGBBlit = FindPropertyAssert("forceSRGBBlit");
642+
m_ForceSRGBBlit = FindPropertyAssert("hmiForceSRGBBlit");
643643

644644
m_SettingsExtensions = new ISettingEditorExtension[validPlatforms.Length];
645645
for (int i = 0; i < validPlatforms.Length; i++)

Editor/Mono/PlayerSettingsEmbeddedLinux.bindings.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ public partial class PlayerSettings : UnityObject
1515
public sealed partial class EmbeddedLinux
1616
{
1717
// Custom path to store data files
18-
[NativeProperty("PlayerDataPath")]
18+
[NativeProperty("HmiPlayerDataPath")]
1919
public static extern string playerDataPath { get; set; }
2020

21-
[NativeProperty("ForceSRGBBlit")]
21+
[NativeProperty("HmiForceSRGBBlit")]
2222
public static extern bool forceSRGBBlit { get; set; }
2323

24-
[NativeProperty("EnableGamepadInput")]
24+
[NativeProperty("EmbeddedLinuxEnableGamepadInput")]
2525
public static extern bool enableGamepadInput { get; set; }
2626

27-
[NativeProperty("CpuConfiguration")]
27+
[NativeProperty("HmiCpuConfiguration")]
2828
public static extern int[] cpuConfiguration { get; set; }
2929

3030
[NativeProperty("HmiLoadingImage")]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.Bindings;
7+
using UnityObject = UnityEngine.Object;
8+
9+
namespace UnityEditor
10+
{
11+
public partial class PlayerSettings : UnityObject
12+
{
13+
[NativeHeader("Runtime/Misc/PlayerSettings.h")]
14+
[StaticAccessor("GetPlayerSettings()", StaticAccessorType.Dot)]
15+
public sealed partial class QNX
16+
{
17+
// Custom path to store data files
18+
[NativeProperty("HmiPlayerDataPath")]
19+
public static extern string playerDataPath { get; set; }
20+
21+
[NativeProperty("HmiForceSRGBBlit")]
22+
public static extern bool forceSRGBBlit { get; set; }
23+
24+
[NativeProperty("HmiCpuConfiguration")]
25+
public static extern int[] cpuConfiguration { get; set; }
26+
27+
[NativeProperty("HmiLoadingImage")]
28+
public static extern Texture2D hmiLoadingImage { get; set; }
29+
}
30+
}
31+
}

Editor/Mono/SceneModeWindows/LightingWindow.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ internal void SetSelectedTabIndex(int index)
117117

118118
void OnEnable()
119119
{
120+
s_Window = this;
121+
120122
titleContent = GetLocalizedTitleContent();
121123

122124
foreach (var pair in m_Tabs)
@@ -624,12 +626,22 @@ void Summary()
624626
GUILayout.EndVertical();
625627
}
626628

629+
internal static LightingWindow s_Window;
630+
internal static bool isShown => s_Window && !s_Window.docked;
631+
627632
[MenuItem("Window/Rendering/Lighting", false, 1)]
628633
internal static void CreateLightingWindow()
629634
{
630635
LightingWindow window = EditorWindow.GetWindow<LightingWindow>();
631636
window.minSize = new Vector2(390, 390);
632637
window.Show();
638+
s_Window = window;
639+
}
640+
641+
internal static void DestroyLightingWindow()
642+
{
643+
s_Window.Close();
644+
s_Window = null;
633645
}
634646
}
635647
} // namespace

Editor/Mono/SceneModeWindows/LightingWindowLightingTab.cs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class Styles
2222
{
2323
public static readonly float buttonWidth = 200;
2424

25-
public static readonly GUIContent newLightingSettings = EditorGUIUtility.TrTextContent("New Lighting Settings");
25+
public static readonly GUIContent newLightingSettings = EditorGUIUtility.TrTextContent("New", "Create a new Lighting Settings Asset with default settings.");
26+
public static readonly GUIContent cloneLightingSettings = EditorGUIUtility.TrTextContent("Clone", "Create a new Lighting Settings Asset based on the current settings.");
2627

2728
public static readonly GUIContent lightingSettings = EditorGUIUtility.TrTextContent("Lighting Settings");
2829
public static readonly GUIContent workflowSettings = EditorGUIUtility.TrTextContent("Workflow Settings");
@@ -113,6 +114,24 @@ public void OnSelectionChange()
113114
{
114115
}
115116

117+
private void CreateLightingSettings(LightingSettings from = null)
118+
{
119+
LightingSettings ls;
120+
if (from == null)
121+
{
122+
ls = new LightingSettings();
123+
ls.name = "New Lighting Settings";
124+
}
125+
else
126+
{
127+
ls = Object.Instantiate(from);
128+
ls.name = from.name;
129+
}
130+
Undo.RecordObject(m_LightmapSettings.targetObject, "New Lighting Settings");
131+
Lightmapping.lightingSettingsInternal = ls;
132+
ProjectWindowUtil.CreateAsset(ls, (ls.name + ".lighting"));
133+
}
134+
116135
void LightingSettingsGUI()
117136
{
118137
m_ShowLightingSettings.value = EditorGUILayout.FoldoutTitlebar(m_ShowLightingSettings.value, Styles.lightingSettings, true);
@@ -121,20 +140,13 @@ void LightingSettingsGUI()
121140
{
122141
++EditorGUI.indentLevel;
123142

124-
EditorGUILayout.PropertyField(m_LightingSettingsAsset, GUIContent.Temp("Lighting Settings Asset"));
125-
126-
EditorGUILayout.Space();
127143
GUILayout.BeginHorizontal();
128-
GUILayout.FlexibleSpace();
144+
EditorGUILayout.PropertyField(m_LightingSettingsAsset, GUIContent.Temp("Lighting Settings Asset"));
129145

130-
if (GUILayout.Button(Styles.newLightingSettings, GUILayout.Width(170)))
131-
{
132-
var ls = new LightingSettings();
133-
ls.name = "New Lighting Settings";
134-
Undo.RecordObject(m_LightmapSettings.targetObject, "New Lighting Settings");
135-
Lightmapping.lightingSettingsInternal = ls;
136-
ProjectWindowUtil.CreateAsset(ls, (ls.name + ".lighting"));
137-
}
146+
if (GUILayout.Button(Styles.newLightingSettings, EditorStyles.miniButtonLeft, GUILayout.Width(50)))
147+
CreateLightingSettings();
148+
else if (GUILayout.Button(Styles.cloneLightingSettings, EditorStyles.miniButtonRight, GUILayout.Width(50)))
149+
CreateLightingSettings(Lightmapping.GetLightingSettingsOrDefaultsFallback());
138150

139151
GUILayout.EndHorizontal();
140152
EditorGUILayout.Space();

ModuleOverrides/com.unity.ui/Core/Controls/DoubleField.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ protected override string ValueToString(double v)
4343
/// <returns>The double parsed from the string.</returns>
4444
protected override double StringToValue(string str)
4545
{
46-
double v;
47-
UINumericFieldsUtils.StringToDouble(str, out v);
48-
return v;
46+
return UINumericFieldsUtils.StringToDouble(str, out var v) ? v : rawValue;
4947
}
5048

5149
/// <summary>

ModuleOverrides/com.unity.ui/Core/Controls/FloatField.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ protected override string ValueToString(float v)
4242
/// <returns>The float parsed from the string.</returns>
4343
protected override float StringToValue(string str)
4444
{
45-
double v;
46-
UINumericFieldsUtils.StringToDouble(str, out v);
47-
return Mathf.ClampToFloat(v);
45+
return UINumericFieldsUtils.StringToDouble(str, out var v) ? Mathf.ClampToFloat(v) : rawValue;
4846
}
4947

5048
/// <summary>

ModuleOverrides/com.unity.ui/Core/Controls/IntegerField.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ protected override string ValueToString(int v)
4343
/// <returns>The integer parsed from the string.</returns>
4444
protected override int StringToValue(string str)
4545
{
46-
long v;
47-
UINumericFieldsUtils.StringToLong(str, out v);
48-
return Mathf.ClampToInt(v);
46+
return UINumericFieldsUtils.StringToLong(str, out var v) ? Mathf.ClampToInt(v) : rawValue;
4947
}
5048

5149
/// <summary>

0 commit comments

Comments
 (0)