From 3ff5b7b7ff1dac2a8c52b74b9fb7148a7f4e9a15 Mon Sep 17 00:00:00 2001 From: Unity Technologies Date: Wed, 1 Feb 2023 14:26:56 +0000 Subject: [PATCH 1/6] Unity 2023.1.0b2 C# reference source code --- Editor/Mono/AssemblyInfo/AssemblyInfo.cs | 1 - Editor/Mono/BuildPipeline/NamedBuildTarget.cs | 3 +- Editor/Mono/BuildTarget.cs | 1 + Editor/Mono/BuildTargetConverter.cs | 2 - Editor/Mono/BuildTargetGroup.cs | 1 + Editor/Mono/GUI/Toolbar.cs | 1 + Editor/Mono/Inspector/EditorDragging.cs | 7 --- .../PlayerConnection/ConnectionDropDown.cs | 1 - .../ScriptCompilation/CustomScriptAssembly.cs | 1 + Modules/IMGUI/GUI.cs | 62 +------------------ .../TerrainEditor/Overlays/BrushAttributes.cs | 2 +- .../TerrainEditor/Overlays/BrushesOverlay.cs | 2 +- .../TerrainTransientToolbarOverlay.cs | 2 +- Projects/CSharp/UnityEditor.csproj | 2 +- Projects/CSharp/UnityEngine.csproj | 2 +- README.md | 2 +- Runtime/Export/BaseClass.cs | 1 + .../TouchScreenKeyboard.bindings.cs | 14 ----- 18 files changed, 13 insertions(+), 94 deletions(-) diff --git a/Editor/Mono/AssemblyInfo/AssemblyInfo.cs b/Editor/Mono/AssemblyInfo/AssemblyInfo.cs index 2682979939..2f5234fa6d 100644 --- a/Editor/Mono/AssemblyInfo/AssemblyInfo.cs +++ b/Editor/Mono/AssemblyInfo/AssemblyInfo.cs @@ -50,7 +50,6 @@ [assembly: InternalsVisibleTo("UnityEditor.WindowsStandalone.Extensions")] [assembly: InternalsVisibleTo("UnityEditor.OSXStandalone.Extensions")] [assembly: InternalsVisibleTo("UnityEditor.Lumin.Extensions")] -[assembly: InternalsVisibleTo("UnityEditor.Stadia.Extensions")] [assembly: InternalsVisibleTo("UnityEditor.GameCoreScarlett.Extensions")] [assembly: InternalsVisibleTo("UnityEditor.GameCoreXboxOne.Extensions")] [assembly: InternalsVisibleTo("UnityEditor.GameCoreCommon.Extensions")] diff --git a/Editor/Mono/BuildPipeline/NamedBuildTarget.cs b/Editor/Mono/BuildPipeline/NamedBuildTarget.cs index d10a54e8bd..5d6e08be5e 100644 --- a/Editor/Mono/BuildPipeline/NamedBuildTarget.cs +++ b/Editor/Mono/BuildPipeline/NamedBuildTarget.cs @@ -45,6 +45,7 @@ namespace UnityEditor.Build public static readonly NamedBuildTarget XboxOne = new NamedBuildTarget("XboxOne"); public static readonly NamedBuildTarget tvOS = new NamedBuildTarget("tvOS"); public static readonly NamedBuildTarget NintendoSwitch = new NamedBuildTarget("Nintendo Switch"); + [System.Obsolete("Stadia has been removed in 2023.1")] public static readonly NamedBuildTarget Stadia = new NamedBuildTarget("Stadia"); public static readonly NamedBuildTarget LinuxHeadlessSimulation = new NamedBuildTarget("LinuxHeadlessSimulation"); [System.Obsolete("CloudRendering is deprecated, please use LinuxHeadlessSimulation (UnityUpgradable) -> LinuxHeadlessSimulation", false)] @@ -99,8 +100,6 @@ public static NamedBuildTarget FromBuildTargetGroup(BuildTargetGroup buildTarget return NamedBuildTarget.tvOS; case BuildTargetGroup.Switch: return NamedBuildTarget.NintendoSwitch; - case BuildTargetGroup.Stadia: - return NamedBuildTarget.Stadia; case BuildTargetGroup.LinuxHeadlessSimulation: return NamedBuildTarget.LinuxHeadlessSimulation; case BuildTargetGroup.EmbeddedLinux: diff --git a/Editor/Mono/BuildTarget.cs b/Editor/Mono/BuildTarget.cs index c54218c403..eed1434c7e 100644 --- a/Editor/Mono/BuildTarget.cs +++ b/Editor/Mono/BuildTarget.cs @@ -121,6 +121,7 @@ public enum BuildTarget [System.Obsolete("Lumin has been removed in 2022.2")] Lumin = 39, + [System.Obsolete("Stadia has been removed in 2023.1")] Stadia = 40, [System.Obsolete("CloudRendering is deprecated, please use LinuxHeadlessSimulation (UnityUpgradable) -> LinuxHeadlessSimulation", false)] diff --git a/Editor/Mono/BuildTargetConverter.cs b/Editor/Mono/BuildTargetConverter.cs index 1b71ce181e..7f32bd4a99 100644 --- a/Editor/Mono/BuildTargetConverter.cs +++ b/Editor/Mono/BuildTargetConverter.cs @@ -46,8 +46,6 @@ internal static class BuildTargetConverter return RuntimePlatform.GameCoreXboxSeries; case BuildTarget.GameCoreXboxOne: return RuntimePlatform.GameCoreXboxOne; - case BuildTarget.Stadia: - return RuntimePlatform.Stadia; case BuildTarget.EmbeddedLinux: return RuntimePlatform.EmbeddedLinuxArm64; case BuildTarget.QNX: diff --git a/Editor/Mono/BuildTargetGroup.cs b/Editor/Mono/BuildTargetGroup.cs index ccd4e6699c..6466bd45f0 100644 --- a/Editor/Mono/BuildTargetGroup.cs +++ b/Editor/Mono/BuildTargetGroup.cs @@ -98,6 +98,7 @@ public enum BuildTargetGroup [Obsolete("Lumin has been removed in 2022.2")] Lumin = 28, + [Obsolete("Stadia has been removed in 2023.1")] Stadia = 29, [System.Obsolete("CloudRendering is deprecated, please use LinuxHeadlessSimulation (UnityUpgradable) -> LinuxHeadlessSimulation", false)] diff --git a/Editor/Mono/GUI/Toolbar.cs b/Editor/Mono/GUI/Toolbar.cs index 1df88833c6..26b6594ef2 100644 --- a/Editor/Mono/GUI/Toolbar.cs +++ b/Editor/Mono/GUI/Toolbar.cs @@ -100,6 +100,7 @@ void CreateContents() protected override void OnDisable() { + m_Root?.RemoveFromHierarchy(); base.OnDisable(); EditorApplication.modifierKeysChanged -= Repaint; } diff --git a/Editor/Mono/Inspector/EditorDragging.cs b/Editor/Mono/Inspector/EditorDragging.cs index 31a7b8d442..247f919b84 100644 --- a/Editor/Mono/Inspector/EditorDragging.cs +++ b/Editor/Mono/Inspector/EditorDragging.cs @@ -98,13 +98,6 @@ void HandleNativeDragDropInBottomArea(Editor[] editors, Rect rect) } DragAndDrop.visualMode = DragAndDrop.DropOnInspectorWindow(editor.targets, Event.current.type == EventType.DragPerform); - - if (Event.current.type == EventType.DragPerform) - { - DragAndDrop.AcceptDrag(); - m_TargetIndex = -1; - GUIUtility.ExitGUI(); - } } void HandleEditorDragging(Editor[] editors, int editorIndex, Rect targetRect, float markerY, bool bottomTarget) diff --git a/Editor/Mono/Networking/PlayerConnection/ConnectionDropDown.cs b/Editor/Mono/Networking/PlayerConnection/ConnectionDropDown.cs index 3b5bd0cda3..aba28e0286 100644 --- a/Editor/Mono/Networking/PlayerConnection/ConnectionDropDown.cs +++ b/Editor/Mono/Networking/PlayerConnection/ConnectionDropDown.cs @@ -142,7 +142,6 @@ public static GUIContent GetIcon(string name) "WSAPlayerX64" => EditorGUIUtility.IconContent("BuildSettings.Metro.Small"), "WSAPlayerARM" => EditorGUIUtility.IconContent("BuildSettings.Metro.Small"), "Switch" => EditorGUIUtility.IconContent("BuildSettings.Switch.Small"), - "Stadia" => EditorGUIUtility.IconContent("BuildSettings.Stadia.small"), "EmbeddedLinuxArm64" => EditorGUIUtility.IconContent("BuildSettings.EmbeddedLinux.Small"), "EmbeddedLinuxArm32" => EditorGUIUtility.IconContent("BuildSettings.EmbeddedLinux.Small"), "EmbeddedLinuxX64" => EditorGUIUtility.IconContent("BuildSettings.EmbeddedLinux.Small"), diff --git a/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs b/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs index bafdba1c32..3c75a193e5 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs @@ -358,6 +358,7 @@ static CustomScriptAssembly() new CustomScriptAssemblyPlatform("LinuxStandalone32", BuildTarget.StandaloneLinux), new CustomScriptAssemblyPlatform("LinuxStandaloneUniversal", BuildTarget.StandaloneLinuxUniversal), new CustomScriptAssemblyPlatform("Lumin", BuildTarget.Lumin), + new CustomScriptAssemblyPlatform("Stadia", BuildTarget.Stadia), }; #pragma warning restore 0618 } diff --git a/Modules/IMGUI/GUI.cs b/Modules/IMGUI/GUI.cs index 61e99c6f28..0643213521 100644 --- a/Modules/IMGUI/GUI.cs +++ b/Modules/IMGUI/GUI.cs @@ -607,11 +607,7 @@ internal static void DoTextField(Rect position, int id, GUIContent content, bool editor.controlID = id; editor.DetectFocusChange(); - if (TouchScreenKeyboard.isRequiredToForceOpen) - { - HandleTextFieldEventForDesktopWithForcedKeyboard(position, id, content, multiline, maxLength, style, secureText, editor); - } - else if (TouchScreenKeyboard.isSupported && !TouchScreenKeyboard.isInPlaceEditingAllowed) + if (TouchScreenKeyboard.isSupported && !TouchScreenKeyboard.isInPlaceEditingAllowed) { HandleTextFieldEventForTouchscreen(position, id, content, multiline, maxLength, style, secureText, maskChar, editor); } @@ -814,62 +810,6 @@ private static void HandleTextFieldEventForDesktop(Rect position, int id, GUICon } } - private static void HandleTextFieldEventForDesktopWithForcedKeyboard(Rect position, int id, GUIContent content, bool multiline, int maxLength, GUIStyle style, string secureText, TextEditor editor) - { - // On certain platforms, the TouchScreenKeyboard must always be "open" in order to receive text events. The keyboard.active state signals - // the platform to switch between "text input" and "key input" modes; unlike other platforms only one of these modes is active at a time. - // Therefore, TextField must open the keyboard when it has focus and deactivate it when it loses focus. - - bool openKeyboard = false; - - // Due to the asynchronous behavior of the platform's APIs (race conditions) we cannot guarantee the keyboard will land in the correct state - // simply by responding to mouse and keyboard events. Instead we must check the keyboard state matches the UI focus state every - // frame and make changes when necessary. - if (Event.current.type == EventType.Repaint) - { - // Disable keyboard for previously active text field, if any - if (s_HotTextField != -1 && s_HotTextField != id) - { - TextEditor currentEditor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), s_HotTextField); - currentEditor.keyboardOnScreen.active = false; - currentEditor.keyboardOnScreen = null; - } - - if (editor.keyboardOnScreen != null) - { - if (GUIUtility.keyboardControl != id || !Application.isFocused) - { - // Text field isn't focused; reset keyboard reference - editor.keyboardOnScreen.active = false; - editor.keyboardOnScreen = null; - } - else if (!editor.keyboardOnScreen.active) - { - // UI is focused and keyboard is valid, but it's inactive for some reason; need to re-open it - openKeyboard = true; - } - } - else if (GUIUtility.keyboardControl == id && Application.isFocused) - { - // Text field is focused but don't have a valid Keyboard; need to open it - openKeyboard = true; - } - } - - if (openKeyboard) - { - editor.keyboardOnScreen = TouchScreenKeyboard.Open( - secureText ?? content.text, - TouchScreenKeyboardType.Default, - true, - multiline, - (secureText != null)); - } - - // Continue processing the event normally for Desktop - HandleTextFieldEventForDesktop(position, id, content, multiline, maxLength, style, editor); - } - public static bool Toggle(Rect position, bool value, string text) { return Toggle(position, value, GUIContent.Temp(text), s_Skin.toggle); diff --git a/Modules/TerrainEditor/Overlays/BrushAttributes.cs b/Modules/TerrainEditor/Overlays/BrushAttributes.cs index c613cf9f7c..47ca9a33d3 100644 --- a/Modules/TerrainEditor/Overlays/BrushAttributes.cs +++ b/Modules/TerrainEditor/Overlays/BrushAttributes.cs @@ -12,7 +12,7 @@ namespace UnityEditor.TerrainTools { - [Overlay(typeof(SceneView), "Brush Attributes")] + [Overlay(typeof(SceneView), "Brush Attributes", defaultDockPosition = DockPosition.Top, defaultDockZone = DockZone.TopToolbar)] [Icon("TerrainOverlays/BrushSettingIcons/BrushAttributes.png")] internal class BrushAttributes : ToolbarOverlay, ITransientOverlay, ICreateHorizontalToolbar, ICreateVerticalToolbar { diff --git a/Modules/TerrainEditor/Overlays/BrushesOverlay.cs b/Modules/TerrainEditor/Overlays/BrushesOverlay.cs index 3c0be48239..e7308b0603 100644 --- a/Modules/TerrainEditor/Overlays/BrushesOverlay.cs +++ b/Modules/TerrainEditor/Overlays/BrushesOverlay.cs @@ -75,7 +75,7 @@ internal static void OnGUI(BrushGUIEditFlags flags = BrushGUIEditFlags.All) // brush masks ---------------- - [Overlay(typeof(SceneView), "Brush Masks")] + [Overlay(typeof(SceneView), "Brush Masks", defaultDockPosition = DockPosition.Top, defaultDockZone = DockZone.LeftToolbar, defaultDockIndex = 10)] [Icon("TerrainOverlays/BrushSettingIcons/BrushMask.png")] internal class BrushMaskOverlay : ToolbarOverlay, ITransientOverlay { diff --git a/Modules/TerrainEditor/Overlays/TerrainTransientToolbarOverlay.cs b/Modules/TerrainEditor/Overlays/TerrainTransientToolbarOverlay.cs index 58cb3b6af8..bddd32cfdb 100644 --- a/Modules/TerrainEditor/Overlays/TerrainTransientToolbarOverlay.cs +++ b/Modules/TerrainEditor/Overlays/TerrainTransientToolbarOverlay.cs @@ -36,7 +36,7 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse } } - [Overlay(typeof(SceneView), "Terrain Tools")] + [Overlay(typeof(SceneView), "Terrain Tools", defaultDockPosition = DockPosition.Top, defaultDockZone = DockZone.LeftToolbar, defaultDockIndex = -1)] internal class TerrainTransientToolbarOverlay : ToolbarOverlay, ITransientOverlay, ICreateHorizontalToolbar, ICreateVerticalToolbar { bool m_OverlaysPackageInstalled; diff --git a/Projects/CSharp/UnityEditor.csproj b/Projects/CSharp/UnityEditor.csproj index e0b9979fd4..65119d80d2 100644 --- a/Projects/CSharp/UnityEditor.csproj +++ b/Projects/CSharp/UnityEditor.csproj @@ -6,7 +6,7 @@ false true false - $(DefineConstants);COMBINED_ASSEMBLIES;DEBUG;DEBUGGER_LISTENS_FIXED_PORT;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;ENABLE_ALTERNATIVE_LISTEN_PORT;ENABLE_AR;ENABLE_AUDIO;ENABLE_AUDIO_MANAGER_BASED_SCHEDULING;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_CLOUD_LICENSE;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_COLLAB_TESTING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_CLUSTER_SYNC;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_EDITOR_GAME_SERVICES;ENABLE_EDITOR_HUB_LICENSE;ENABLE_ETC_COMPRESSION;ENABLE_EVENT_QUEUE;ENABLE_GAMECENTER_API;ENABLE_GENERATE_NATIVE_PLUGINS_FOR_ASSEMBLIES_API;ENABLE_HOLOLENS_MODULE_API;ENABLE_LZMA;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_UNITYTLS;ENABLE_MARSHALLING_TESTS;ENABLE_MICROPHONE;ENABLE_MONO;ENABLE_MOVIES;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NAVIGATION_HEIGHTMESH_RUNTIME_SUPPORT;ENABLE_NAVIGATION_PACKAGE_DEBUG_VISUALIZATION;ENABLE_NAVIGATION_UI_REQUIRES_PACKAGE;ENABLE_NETWORK;ENABLE_NVIDIA;ENABLE_PHYSICS;ENABLE_RUNTIME_GI;ENABLE_SCRIPTING_GC_WBARRIERS;ENABLE_TEXTURE_STREAMING;ENABLE_UNITYEVENTS;ENABLE_UNITYWEBREQUEST;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_UNITY_GAME_SERVICES_ANALYTICS_SUPPORT;ENABLE_VERSION_CONTROL_INTEGRATION;ENABLE_VIDEO;ENABLE_VIRTUALTEXTURING;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WEBSOCKET_CLIENT;ENABLE_WEBSOCKET_HOST;ENABLE_WWW;INCLUDE_DYNAMIC_GI;PLATFORM_SUPPORTS_GAMEPAD_AUDIO;PLATFORM_SUPPORTS_MONO;PLAYERCONNECTION_LISTENS_FIXED_PORT;RENDER_SOFTWARE_CURSOR;TEXTCORE_1_0_OR_NEWER;TRACE;UNITY_ANDROID_API;UNITY_ASSEMBLIES_API;UNITY_ASSERTIONS;UNITY_BJM_API;UNITY_CAN_SHOW_SPLASH_SCREEN;UNITY_EDITOR;UNITY_EDITOR_API;UNITY_EDITOR_LINUX;UNITY_GAMECORE_API;UNITY_GAMECORE_SCARLETT_API;UNITY_GAMECORE_XBOXONE_API;UNITY_IPHONE_API;UNITY_METRO_API;UNITY_PS4_API;UNITY_PS5_API;UNITY_STANDALONE_GGP_API;UNITY_STANDALONE_LINUX_API;UNITY_STANDALONE_OSX_API;UNITY_STANDALONE_WIN_API;UNITY_SWITCH_API;UNITY_TINYPROFILING_INTERNAL;UNITY_TVOS_API;UNITY_UNITYADS_API;UNITY_WEBGL_API;USE_ITEM_LIBRARY_MODULE;USE_PROPERTY_DATABASE;USE_QUERY_BUILDER;USE_SEARCH_ENGINE_API;USE_SEARCH_MODULE + $(DefineConstants);COMBINED_ASSEMBLIES;DEBUG;DEBUGGER_LISTENS_FIXED_PORT;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;ENABLE_ALTERNATIVE_LISTEN_PORT;ENABLE_AR;ENABLE_AUDIO;ENABLE_AUDIO_MANAGER_BASED_SCHEDULING;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_CLOUD_LICENSE;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_COLLAB_TESTING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_CLUSTER_SYNC;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_EDITOR_GAME_SERVICES;ENABLE_EDITOR_HUB_LICENSE;ENABLE_ETC_COMPRESSION;ENABLE_EVENT_QUEUE;ENABLE_GAMECENTER_API;ENABLE_GENERATE_NATIVE_PLUGINS_FOR_ASSEMBLIES_API;ENABLE_HOLOLENS_MODULE_API;ENABLE_LZMA;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_UNITYTLS;ENABLE_MARSHALLING_TESTS;ENABLE_MICROPHONE;ENABLE_MONO;ENABLE_MOVIES;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NAVIGATION_HEIGHTMESH_RUNTIME_SUPPORT;ENABLE_NAVIGATION_PACKAGE_DEBUG_VISUALIZATION;ENABLE_NAVIGATION_UI_REQUIRES_PACKAGE;ENABLE_NETWORK;ENABLE_NVIDIA;ENABLE_PHYSICS;ENABLE_RUNTIME_GI;ENABLE_SCRIPTING_GC_WBARRIERS;ENABLE_TEXTURE_STREAMING;ENABLE_UNITYEVENTS;ENABLE_UNITYWEBREQUEST;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_UNITY_GAME_SERVICES_ANALYTICS_SUPPORT;ENABLE_VERSION_CONTROL_INTEGRATION;ENABLE_VIDEO;ENABLE_VIRTUALTEXTURING;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WEBSOCKET_CLIENT;ENABLE_WEBSOCKET_HOST;ENABLE_WWW;INCLUDE_DYNAMIC_GI;PLATFORM_SUPPORTS_GAMEPAD_AUDIO;PLATFORM_SUPPORTS_MONO;PLAYERCONNECTION_LISTENS_FIXED_PORT;RENDER_SOFTWARE_CURSOR;TEXTCORE_1_0_OR_NEWER;TRACE;UNITY_ANDROID_API;UNITY_ASSEMBLIES_API;UNITY_ASSERTIONS;UNITY_CAN_SHOW_SPLASH_SCREEN;UNITY_EDITOR;UNITY_EDITOR_API;UNITY_EDITOR_LINUX;UNITY_GAMECORE_API;UNITY_GAMECORE_SCARLETT_API;UNITY_GAMECORE_XBOXONE_API;UNITY_IPHONE_API;UNITY_METRO_API;UNITY_PS4_API;UNITY_PS5_API;UNITY_STANDALONE_LINUX_API;UNITY_STANDALONE_OSX_API;UNITY_STANDALONE_WIN_API;UNITY_SWITCH_API;UNITY_TINYPROFILING_INTERNAL;UNITY_TVOS_API;UNITY_UNITYADS_API;UNITY_WEBGL_API;USE_ITEM_LIBRARY_MODULE;USE_PROPERTY_DATABASE;USE_QUERY_BUILDER;USE_SEARCH_ENGINE_API;USE_SEARCH_MODULE latest 1701;0169;0649;0626 diff --git a/Projects/CSharp/UnityEngine.csproj b/Projects/CSharp/UnityEngine.csproj index 13f772096a..2228d22817 100644 --- a/Projects/CSharp/UnityEngine.csproj +++ b/Projects/CSharp/UnityEngine.csproj @@ -6,7 +6,7 @@ false true false - $(DefineConstants);COMBINED_ASSEMBLIES;DEBUG;DEBUGGER_LISTENS_FIXED_PORT;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;ENABLE_ALTERNATIVE_LISTEN_PORT;ENABLE_AR;ENABLE_AUDIO;ENABLE_AUDIO_MANAGER_BASED_SCHEDULING;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_CLOUD_LICENSE;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_COLLAB_TESTING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_EDITOR_GAME_SERVICES;ENABLE_EDITOR_HUB_LICENSE;ENABLE_GENERATE_NATIVE_PLUGINS_FOR_ASSEMBLIES_API;ENABLE_HOLOLENS_MODULE_API;ENABLE_LZMA;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_UNITYTLS;ENABLE_MARSHALLING_TESTS;ENABLE_MICROPHONE;ENABLE_MONO;ENABLE_MOVIES;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NAVIGATION_HEIGHTMESH_RUNTIME_SUPPORT;ENABLE_NAVIGATION_PACKAGE_DEBUG_VISUALIZATION;ENABLE_NAVIGATION_UI_REQUIRES_PACKAGE;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_SCRIPTING_GC_WBARRIERS;ENABLE_TEXTURE_STREAMING;ENABLE_UNITYEVENTS;ENABLE_UNITYWEBREQUEST;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_UNITY_GAME_SERVICES_ANALYTICS_SUPPORT;ENABLE_VERSION_CONTROL_INTEGRATION;ENABLE_VIDEO;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WEBSOCKET_CLIENT;ENABLE_WWW;INCLUDE_DYNAMIC_GI;PLATFORM_SUPPORTS_MONO;PLAYERCONNECTION_LISTENS_FIXED_PORT;RENDER_SOFTWARE_CURSOR;TEXTCORE_1_0_OR_NEWER;TRACE;UNITY_ANDROID_API;UNITY_ASSEMBLIES_API;UNITY_ASSERTIONS;UNITY_BJM_API;UNITY_EDITOR;UNITY_EDITOR_API;UNITY_GAMECORE_API;UNITY_GAMECORE_SCARLETT_API;UNITY_GAMECORE_XBOXONE_API;UNITY_IPHONE_API;UNITY_METRO_API;UNITY_PS4_API;UNITY_PS5_API;UNITY_STANDALONE_LINUX_API;UNITY_STANDALONE_OSX_API;UNITY_STANDALONE_WIN_API;UNITY_SWITCH_API;UNITY_TVOS_API;UNITY_WEBGL_API + $(DefineConstants);COMBINED_ASSEMBLIES;DEBUG;DEBUGGER_LISTENS_FIXED_PORT;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;ENABLE_ALTERNATIVE_LISTEN_PORT;ENABLE_AR;ENABLE_AUDIO;ENABLE_AUDIO_MANAGER_BASED_SCHEDULING;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_CLOUD_LICENSE;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_COLLAB_TESTING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_EDITOR_GAME_SERVICES;ENABLE_EDITOR_HUB_LICENSE;ENABLE_GENERATE_NATIVE_PLUGINS_FOR_ASSEMBLIES_API;ENABLE_HOLOLENS_MODULE_API;ENABLE_LZMA;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_UNITYTLS;ENABLE_MARSHALLING_TESTS;ENABLE_MICROPHONE;ENABLE_MONO;ENABLE_MOVIES;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NAVIGATION_HEIGHTMESH_RUNTIME_SUPPORT;ENABLE_NAVIGATION_PACKAGE_DEBUG_VISUALIZATION;ENABLE_NAVIGATION_UI_REQUIRES_PACKAGE;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_SCRIPTING_GC_WBARRIERS;ENABLE_TEXTURE_STREAMING;ENABLE_UNITYEVENTS;ENABLE_UNITYWEBREQUEST;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_UNITY_GAME_SERVICES_ANALYTICS_SUPPORT;ENABLE_VERSION_CONTROL_INTEGRATION;ENABLE_VIDEO;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WEBSOCKET_CLIENT;ENABLE_WWW;INCLUDE_DYNAMIC_GI;PLATFORM_SUPPORTS_MONO;PLAYERCONNECTION_LISTENS_FIXED_PORT;RENDER_SOFTWARE_CURSOR;TEXTCORE_1_0_OR_NEWER;TRACE;UNITY_ANDROID_API;UNITY_ASSEMBLIES_API;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_API;UNITY_GAMECORE_API;UNITY_GAMECORE_SCARLETT_API;UNITY_GAMECORE_XBOXONE_API;UNITY_IPHONE_API;UNITY_METRO_API;UNITY_PS4_API;UNITY_PS5_API;UNITY_STANDALONE_LINUX_API;UNITY_STANDALONE_OSX_API;UNITY_STANDALONE_WIN_API;UNITY_SWITCH_API;UNITY_TVOS_API;UNITY_WEBGL_API latest 1701;0626 diff --git a/README.md b/README.md index 4aecedd433..ad42e1e971 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Unity 2023.1.0b1 C# reference source code +## Unity 2023.1.0b2 C# reference source code The C# part of the Unity engine and editor source code. May be used for reference purposes only. diff --git a/Runtime/Export/BaseClass.cs b/Runtime/Export/BaseClass.cs index 317f6165e9..21c532245c 100644 --- a/Runtime/Export/BaseClass.cs +++ b/Runtime/Export/BaseClass.cs @@ -123,6 +123,7 @@ public enum RuntimePlatform [System.Obsolete("Lumin is no longer supported in Unity 2022.2")] Lumin = 33, // BJM + [System.Obsolete("Stadia is no longer supported in Unity 2023.1")] Stadia = 34, // Cloud Rendering [System.Obsolete("CloudRendering is deprecated, please use LinuxHeadlessSimulation (UnityUpgradable) -> LinuxHeadlessSimulation", false)] diff --git a/Runtime/Export/TouchScreenKeyboard/TouchScreenKeyboard.bindings.cs b/Runtime/Export/TouchScreenKeyboard/TouchScreenKeyboard.bindings.cs index d592050b93..6347962098 100644 --- a/Runtime/Export/TouchScreenKeyboard/TouchScreenKeyboard.bindings.cs +++ b/Runtime/Export/TouchScreenKeyboard/TouchScreenKeyboard.bindings.cs @@ -93,7 +93,6 @@ public static bool isSupported case RuntimePlatform.Switch: case RuntimePlatform.PS4: case RuntimePlatform.PS5: - case RuntimePlatform.Stadia: case RuntimePlatform.WebGLPlayer: case RuntimePlatform.GameCoreXboxSeries: case RuntimePlatform.GameCoreXboxOne: @@ -128,19 +127,6 @@ public static bool isInPlaceEditingAllowed } - // Some platforms require us to always open TouchScreenKeyboard even if a physical keyboard is connected - // and in-place editing is used. - internal static bool isRequiredToForceOpen - { - get - { - return IsRequiredToForceOpen(); - } - } - - [FreeFunction("TouchScreenKeyboard_IsRequiredToForceOpen")] - extern private static bool IsRequiredToForceOpen(); - // Opens the native keyboard provided by OS on the screen. public static TouchScreenKeyboard Open(string text, [DefaultValue("TouchScreenKeyboardType.Default")] TouchScreenKeyboardType keyboardType, [DefaultValue("true")] bool autocorrection, [DefaultValue("false")] bool multiline, [DefaultValue("false")] bool secure, [DefaultValue("false")] bool alert, [DefaultValue("\"\"")] string textPlaceholder, [DefaultValue("0")] int characterLimit) { From 963b05b9d90f9876da8897d75842010603ad6727 Mon Sep 17 00:00:00 2001 From: Unity Technologies Date: Wed, 8 Feb 2023 16:02:45 +0000 Subject: [PATCH 2/6] Unity 2023.1.0b3 C# reference source code --- .../Softlocks/SoftlockViewController.cs | 20 -- Editor/Mono/GUI/AppStatusBar.cs | 9 + Editor/Mono/GUI/WindowLayout.cs | 1 + .../GameView/GameViewSizesMenuModifyItemUI.cs | 23 +-- .../SpeedTreeImporterModelEditor.cs | 4 +- Editor/Mono/ObjectListArea.cs | 48 +---- Editor/Mono/ObjectListLocalGroup.cs | 6 +- Editor/Mono/SceneView/SceneViewMotion.cs | 3 + Editor/Mono/Unwrapping.bindings.cs | 3 + .../Controllers/BaseTreeViewController.cs | 39 +++- Modules/AndroidJNI/AndroidApp.bindings.cs | 35 ++++ Modules/AndroidJNI/AndroidCommon.cs | 25 --- Modules/AndroidJNI/AndroidJNI.bindings.cs | 3 +- Modules/AndroidJNI/AndroidJava.cs | 15 +- Modules/GridAndSnap/LinkedVector3Field.cs | 14 +- Modules/GridAndSnap/SnapSettingsWindow.cs | 2 +- Modules/IMGUI/GUIStyle.cs | 11 +- Modules/IMGUI/IMGUITextHandle.cs | 91 ++++++--- Modules/IMGUI/TextEditor.cs | 4 +- .../Editor/UI/ScopedRegistriesSettings.cs | 2 +- Modules/QuickSearch/Editor/Utilities/Utils.cs | 5 - .../ShortcutManagerWindowView.cs | 2 + .../TerrainEditor/Overlays/BrushAttributes.cs | 18 +- .../Managed/TextGenerator.cs | 66 +------ .../TextCoreTextEngine/Managed/TextHandle.cs | 2 - .../Managed/TextMarkupTagsCommon.cs | 2 + .../Builder/Explorer/BuilderExplorer.cs | 21 ++- .../Builder/Explorer/BuilderExplorerItem.cs | 4 +- .../Builder/Explorer/BuilderHierarchy.cs | 17 -- .../Builder/Explorer/BuilderStyleSheets.cs | 17 ++ .../BuilderInspectorInheritedStyles.cs | 44 ++++- .../Builder/Utilities/BuilderConstants.cs | 6 +- .../ElementHierarchyView.cs | 175 +++++++++++++----- Projects/CSharp/UnityEditor.csproj | 2 +- Projects/CSharp/UnityEngine.csproj | 6 +- README.md | 2 +- .../Graphics/GraphicsRenderers.bindings.cs | 9 + .../Unity.CompilationPipeline.Common.dll | Bin 38 files changed, 424 insertions(+), 332 deletions(-) create mode 100644 Modules/AndroidJNI/AndroidApp.bindings.cs delete mode 100644 Modules/AndroidJNI/AndroidCommon.cs rename artifacts/Stevedore/{unity-compiler-win-x64_3bf1 => unity-compiler-win-x64_fa9e}/Unity.CompilationPipeline.Common/Unity.CompilationPipeline.Common.dll (100%) diff --git a/Editor/Mono/Collab/Softlocks/SoftlockViewController.cs b/Editor/Mono/Collab/Softlocks/SoftlockViewController.cs index e4de3221f8..8dbac230b0 100644 --- a/Editor/Mono/Collab/Softlocks/SoftlockViewController.cs +++ b/Editor/Mono/Collab/Softlocks/SoftlockViewController.cs @@ -336,26 +336,6 @@ private static string GetDisplayCount(int count) return totalLocksText; } - // When the given 'text' exceeds the given 'width', out-of-bound characters - // are removed as well as a few more to display a trailing ellipsis. - // If 'text' does not exceed width, text is returned. - private string FitTextToWidth(string text, float width, GUIStyle style) - { - int characterCountVisible = style.GetNumCharactersThatFitWithinWidth(text, width); - if (characterCountVisible > 1 && characterCountVisible != text.Length) - { - string ellipsedText; - int characterLength = (characterCountVisible - 1); - if (!Instance.m_Cache.TryGetEllipsedNames(text, characterLength, out ellipsedText)) - { - ellipsedText = text.Substring(0, characterLength) + (" \u2026"); // 'horizontal ellipsis' (U+2026) is: ... - Instance.m_Cache.StoreEllipsedNames(text, ellipsedText, characterLength); - } - return ellipsedText; - } - return text; - } - #endregion #region GUI Content diff --git a/Editor/Mono/GUI/AppStatusBar.cs b/Editor/Mono/GUI/AppStatusBar.cs index 733c2f2a00..e2cee3898e 100644 --- a/Editor/Mono/GUI/AppStatusBar.cs +++ b/Editor/Mono/GUI/AppStatusBar.cs @@ -61,11 +61,15 @@ static Styles() const double k_CheckUnresponsiveFrequencyInSecond = 0.5; const float k_ShowProgressThreshold = 0.5f; private double m_LastUpdate; + private bool m_IsQuitting; private bool showBakeMode { get { + if (m_IsQuitting) + return false; + var settings = Lightmapping.GetLightingSettingsOrDefaultsFallback(); return settings.bakedGI || settings.realtimeGI; } @@ -93,6 +97,8 @@ protected override void OnEnable() Progress.added += RefreshProgressBar; Progress.removed += RefreshProgressBar; Progress.updated += RefreshProgressBar; + + EditorApplication.editorApplicationQuit += OnQuit; } protected override void OnDisable() @@ -100,6 +106,7 @@ protected override void OnDisable() Progress.added -= RefreshProgressBar; Progress.removed -= RefreshProgressBar; Progress.updated -= RefreshProgressBar; + EditorApplication.editorApplicationQuit -= OnQuit; EditorApplication.delayCall -= DelayRepaint; base.OnDisable(); } @@ -474,6 +481,8 @@ private GUIContent GetBakeModeIcon(bool? bakeMode) return Lightmapping.GetLightingSettingsOrDefaultsFallback().autoGenerate; } + private void OnQuit() + => m_IsQuitting = true; [RequiredByNativeCode] public static void StatusChanged() diff --git a/Editor/Mono/GUI/WindowLayout.cs b/Editor/Mono/GUI/WindowLayout.cs index fec8b45d5e..83e6a452dc 100644 --- a/Editor/Mono/GUI/WindowLayout.cs +++ b/Editor/Mono/GUI/WindowLayout.cs @@ -1613,6 +1613,7 @@ internal static SaveWindowLayout ShowWindow() { SaveWindowLayout w = GetWindowDontShow(); w.minSize = w.maxSize = new Vector2(k_Width, k_Height); + w.m_Pos = new Rect(0, 0,k_Width, k_Height); w.ShowAuxWindow(); return w; } diff --git a/Editor/Mono/GameView/GameViewSizesMenuModifyItemUI.cs b/Editor/Mono/GameView/GameViewSizesMenuModifyItemUI.cs index 2ac7b2877a..8ffdf97ae7 100644 --- a/Editor/Mono/GameView/GameViewSizesMenuModifyItemUI.cs +++ b/Editor/Mono/GameView/GameViewSizesMenuModifyItemUI.cs @@ -99,9 +99,11 @@ override public void OnGUI(Rect rect) { if (string.IsNullOrEmpty(displayText)) displayText = "Result"; - else - displayText = GetCroppedText(displayText, cropWidth, EditorStyles.label); - GUILayout.Label(GUIContent.Temp(displayText), EditorStyles.label); + + var clipping = EditorStyles.label.clipping; + EditorStyles.label.clipping = TextClipping.Ellipsis; + GUILayout.Label(GUIContent.Temp(displayText), EditorStyles.label, GUILayout.MaxWidth(cropWidth)); + EditorStyles.label.clipping = clipping; } GUILayout.FlexibleSpace(); GUILayout.Space(margin); @@ -133,21 +135,6 @@ override public void OnGUI(Rect rect) GUILayout.Space(Styles.windowBottomPadding); } - - string GetCroppedText(string fullText, float cropWidth, GUIStyle style) - { - // Check if we need to crop - int characterCountVisible = style.GetNumCharactersThatFitWithinWidth(fullText, cropWidth); - if (characterCountVisible == -1) - { - return fullText; - } - - if (characterCountVisible > 1 && characterCountVisible != fullText.Length) - return fullText.Substring(0, characterCountVisible - 1) + ("\u2026"); // 'horizontal ellipsis' (U+2026) is: ... - else - return fullText; - } } } diff --git a/Editor/Mono/ImportSettings/SpeedTreeImporterModelEditor.cs b/Editor/Mono/ImportSettings/SpeedTreeImporterModelEditor.cs index 880932b86e..76bcac056d 100644 --- a/Editor/Mono/ImportSettings/SpeedTreeImporterModelEditor.cs +++ b/Editor/Mono/ImportSettings/SpeedTreeImporterModelEditor.cs @@ -256,7 +256,7 @@ private bool DoMaterialsHaveDifferentShader() { foreach (var mat in mr.sharedMaterials) { - if (mat.shader != defaultShader) + if (mat?.shader != defaultShader) return true; } } @@ -265,7 +265,7 @@ private bool DoMaterialsHaveDifferentShader() { foreach (var br in prefabs[i].transform.GetComponentsInChildren()) { - if (br.billboard.material.shader != defaultBillboardShader) + if (br.billboard.material?.shader != defaultBillboardShader) return true; } } diff --git a/Editor/Mono/ObjectListArea.cs b/Editor/Mono/ObjectListArea.cs index bc50f31383..6534e6607c 100644 --- a/Editor/Mono/ObjectListArea.cs +++ b/Editor/Mono/ObjectListArea.cs @@ -103,8 +103,6 @@ static class Styles public bool foldersFirst { get; set; } int m_KeyboardControlID; - Dictionary m_AssetReferenceToCroppedNameMap = new Dictionary(new AssetReference.GuidThenInstanceIDEqualityComparer()); - int m_WidthUsedForCroppingName; bool m_AllowRenameOnMouseUp = true; @@ -212,9 +210,6 @@ public void Init(Rect rect, HierarchyType hierarchyType, SearchFilter searchFilt Repaint(); - // Clear instanceID to cropped name cache on init - ClearCroppedLabelCache(); - // Prepare data SetupData(true); } @@ -1280,43 +1275,6 @@ public void OnInspectorUpdate() } } - void ClearCroppedLabelCache() - { - m_AssetReferenceToCroppedNameMap.Clear(); - } - - protected string GetCroppedLabelText(AssetReference assetReference, string fullText, float cropWidth) - { - // Clear when width changes - if (m_WidthUsedForCroppingName != (int)cropWidth) - ClearCroppedLabelCache(); - - string croppedText; - if (!m_AssetReferenceToCroppedNameMap.TryGetValue(assetReference, out croppedText)) - { - // Ensure to clean up once in a while - if (m_AssetReferenceToCroppedNameMap.Count > GetMaxNumVisibleItems() * 2 + 30) - ClearCroppedLabelCache(); - - // Check if we need to crop - int characterCountVisible = Styles.resultsGridLabel.GetNumCharactersThatFitWithinWidth(fullText, cropWidth); - if (characterCountVisible == -1) - { - Repaint(); - return fullText; // failed: do not cache result - } - - if (characterCountVisible > 1 && characterCountVisible != fullText.Length) - croppedText = fullText.Substring(0, characterCountVisible - 1) + ("\u2026"); // 'horizontal ellipsis' (U+2026) is: ... - else - croppedText = fullText; - - m_AssetReferenceToCroppedNameMap[assetReference] = croppedText; - m_WidthUsedForCroppingName = (int)cropWidth; - } - return croppedText; - } - public bool IsShowing(int instanceID) { return m_LocalAssets.IndexOf(instanceID) >= 0; @@ -1386,7 +1344,8 @@ public void BeginPing(int instanceID) float vcPadding = s_VCEnabled ? k_ListModeVersionControlOverlayPadding : 0f; var assetReference = new AssetReference() { instanceID = instanceID }; - GUIContent cont = new GUIContent(m_LocalAssets.ListMode ? name : GetCroppedLabelText(assetReference, name, m_WidthUsedForCroppingName)); + var textClipping = m_LocalAssets.ListMode ? TextClipping.Overflow : TextClipping.Ellipsis; + GUIContent cont = new GUIContent(name); string label = cont.text; if (m_LocalAssets.ListMode) @@ -1410,6 +1369,8 @@ public void BeginPing(int instanceID) else { m_Ping.m_PingStyle = Styles.miniPing; + var oldClipping = m_Ping.m_PingStyle.clipping; + m_Ping.m_PingStyle.clipping = textClipping; Vector2 pingLabelSize = m_Ping.m_PingStyle.CalcSize(cont); m_Ping.m_ContentRect.width = pingLabelSize.x; m_Ping.m_ContentRect.height = pingLabelSize.y; @@ -1421,6 +1382,7 @@ public void BeginPing(int instanceID) Styles.resultsGridLabel.Draw(r, label, false, false, false, false); Styles.resultsGridLabel.alignment = orgAnchor; }; + m_Ping.m_PingStyle.clipping = oldClipping; } Vector2 pos = CalculatePingPosition(); m_Ping.m_ContentRect.x = pos.x; diff --git a/Editor/Mono/ObjectListLocalGroup.cs b/Editor/Mono/ObjectListLocalGroup.cs index 971f58e26c..a60e03faf3 100644 --- a/Editor/Mono/ObjectListLocalGroup.cs +++ b/Editor/Mono/ObjectListLocalGroup.cs @@ -943,11 +943,13 @@ void DrawItem(Rect position, FilteredHierarchy.FilterResult filterItem, BuiltinR if (isDropTarget) Styles.resultsLabel.Draw(new Rect(labelRect.x - 10, labelRect.y, labelRect.width + 20, labelRect.height), GUIContent.none, true, true, false, false); - labeltext = m_Owner.GetCroppedLabelText(assetReference, labeltext, orgPosition.width); + var oldClipping = Styles.resultsGridLabel.clipping; + Styles.resultsGridLabel.clipping = TextClipping.Ellipsis; var labelNewRect = Styles.resultsGridLabel.CalcSizeWithConstraints(GUIContent.Temp(labeltext), orgPosition.size); labelRect.x = orgPosition.x + (orgPosition.width - labelNewRect.x) / 2.0f; - labelRect.width = labelNewRect.x; + labelRect.width = labelNewRect.x + Styles.resultsGridLabel.padding.horizontal; Styles.resultsGridLabel.Draw(labelRect, labeltext, false, false, selected, m_Owner.HasFocus()); + Styles.resultsGridLabel.clipping = oldClipping; } } diff --git a/Editor/Mono/SceneView/SceneViewMotion.cs b/Editor/Mono/SceneView/SceneViewMotion.cs index 2787de81c0..64e1ba7fd7 100644 --- a/Editor/Mono/SceneView/SceneViewMotion.cs +++ b/Editor/Mono/SceneView/SceneViewMotion.cs @@ -91,6 +91,7 @@ static void Init() s_Initialized = true; } + [ReserveModifiers(ShortcutModifiers.Shift)] class SceneViewViewport : IShortcutToolContext { public bool active => IsActive; @@ -106,12 +107,14 @@ public static bool IsActive } } + [ReserveModifiers(ShortcutModifiers.Shift)] class SceneViewViewport2D : IShortcutToolContext { public bool active => SceneViewViewport.IsActive && ((SceneView.lastActiveSceneView?.in2DMode ?? false) || (SceneView.lastActiveSceneView?.isRotationLocked ?? false)); } + [ReserveModifiers(ShortcutModifiers.Shift)] class SceneViewViewport3D : IShortcutToolContext { public bool active => SceneViewViewport.IsActive diff --git a/Editor/Mono/Unwrapping.bindings.cs b/Editor/Mono/Unwrapping.bindings.cs index eb66678f06..40e0f8cf59 100644 --- a/Editor/Mono/Unwrapping.bindings.cs +++ b/Editor/Mono/Unwrapping.bindings.cs @@ -44,6 +44,9 @@ public static Vector2[] GeneratePerTriangleUV(Mesh src) // Will generate per-triangle uv (3 uv pairs for each triangle) with provided settings public static Vector2[] GeneratePerTriangleUV(Mesh src, UnwrapParam settings) { + if (src == null) + throw new ArgumentNullException("src"); + return GeneratePerTriangleUVImpl(src, settings); } diff --git a/ModuleOverrides/com.unity.ui/Core/Collections/Controllers/BaseTreeViewController.cs b/ModuleOverrides/com.unity.ui/Core/Collections/Controllers/BaseTreeViewController.cs index dec6c8e33a..76581ed4d2 100644 --- a/ModuleOverrides/com.unity.ui/Core/Collections/Controllers/BaseTreeViewController.cs +++ b/ModuleOverrides/com.unity.ui/Core/Collections/Controllers/BaseTreeViewController.cs @@ -6,6 +6,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; +using Unity.Profiling; namespace UnityEngine.UIElements { @@ -17,6 +18,7 @@ public abstract class BaseTreeViewController : CollectionViewController Dictionary m_TreeItems = new Dictionary(); List m_RootIndices = new List(); List m_ItemWrappers = new List(); + HashSet m_TreeItemIdsWithItemWrappers = new HashSet(); List m_WrapperInsertionList = new List(); /// @@ -214,12 +216,15 @@ public virtual int GetTreeItemsCount() /// The index of the item in the expanded items source. Returns -1 if the item is not visible. public override int GetIndexForId(int id) { - for (var index = 0; index < m_ItemWrappers.Count; index++) + if (m_TreeItemIdsWithItemWrappers.Contains(id)) { - var wrapper = m_ItemWrappers[index]; - if (wrapper.id == id) + for (var index = 0; index < m_ItemWrappers.Count; index++) { - return index; + var wrapper = m_ItemWrappers[index]; + if (wrapper.id == id) + { + return index; + } } } @@ -320,6 +325,7 @@ public bool IsExpandedByIndex(int index) return IsExpanded(m_ItemWrappers[index].id); } + static readonly ProfilerMarker K_ExpandItemByIndex = new ProfilerMarker(ProfilerCategory.Scripts, "BaseTreeViewController.ExpandItemByIndex"); /// /// Expands the item with the specified index, making his children visible. Allows to expand the whole hierarchy under that item. /// @@ -328,6 +334,7 @@ public bool IsExpandedByIndex(int index) /// Whether to refresh items or not. Set to false when doing multiple operations on the tree, to only do one RefreshItems once all operations are done. public void ExpandItemByIndex(int index, bool expandAllChildren, bool refresh = true) { + using var marker = K_ExpandItemByIndex.Auto(); if (!HasChildrenByIndex(index)) return; @@ -337,12 +344,11 @@ public void ExpandItemByIndex(int index, bool expandAllChildren, bool refresh = var childrenIdsList = new List(); foreach (var childId in childrenIds) { - if (m_ItemWrappers.All(x => x.id != childId)) + if (!m_TreeItemIdsWithItemWrappers.Contains(childId)) childrenIdsList.Add(childId); } - CreateWrappers(childrenIdsList, GetIndentationDepth(index) + 1, - ref m_WrapperInsertionList); + CreateWrappers(childrenIdsList, GetIndentationDepth(index) + 1, ref m_WrapperInsertionList); m_ItemWrappers.InsertRange(index + 1, m_WrapperInsertionList); if (!baseTreeView.expandedItemIds.Contains(m_ItemWrappers[index].id)) baseTreeView.expandedItemIds.Add(m_ItemWrappers[index].id); @@ -416,9 +422,13 @@ public void CollapseItemByIndex(int index, bool collapseAllChildren) recursiveChildCount++; currentIndex++; } + var end = index + 1 + recursiveChildCount; + for (int i = index + 1; i < end; i++) + { + m_TreeItemIdsWithItemWrappers.Remove(m_ItemWrappers[i].id); + } m_ItemWrappers.RemoveRange(index + 1, recursiveChildCount); - baseTreeView.RefreshItems(); } @@ -431,12 +441,17 @@ public void CollapseItem(int id, bool collapseAllChildren) { // Try to find it in the currently visible list. for (var i = 0; i < m_ItemWrappers.Count; ++i) + { if (m_ItemWrappers[i].id == id) + { if (IsExpandedByIndex(i)) { CollapseItemByIndex(i, collapseAllChildren); return; } + break; + } + } if (!baseTreeView.expandedItemIds.Contains(id)) return; @@ -473,6 +488,7 @@ public void CollapseAll() internal void RegenerateWrappers() { m_ItemWrappers.Clear(); + m_TreeItemIdsWithItemWrappers.Clear(); var rootItemIds = GetRootItemIds(); if (rootItemIds == null) @@ -481,10 +497,12 @@ internal void RegenerateWrappers() CreateWrappers(rootItemIds, 0, ref m_ItemWrappers); SetItemsSourceWithoutNotify(m_ItemWrappers); } - + + static readonly ProfilerMarker k_CreateWrappers = new ProfilerMarker("BaseTreeViewController.CreateWrappers"); void CreateWrappers(IEnumerable treeViewItemIds, int depth, ref List wrappers) { - if (treeViewItemIds == null || wrappers == null) + using var marker = k_CreateWrappers.Auto(); + if (treeViewItemIds == null || wrappers == null || m_TreeItemIdsWithItemWrappers == null) return; foreach (var id in treeViewItemIds) @@ -494,6 +512,7 @@ void CreateWrappers(IEnumerable treeViewItemIds, int depth, ref List("currentActivity"); + } + + return m_Activity; + } + } + + public static extern IntPtr UnityPlayerRaw { [ThreadSafe] get; } + } +} diff --git a/Modules/AndroidJNI/AndroidCommon.cs b/Modules/AndroidJNI/AndroidCommon.cs deleted file mode 100644 index d500be1f8f..0000000000 --- a/Modules/AndroidJNI/AndroidCommon.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Unity C# reference source -// Copyright (c) Unity Technologies. For terms of use, see -// https://unity3d.com/legal/licenses/Unity_Reference_Only_License - - -namespace UnityEngine.Android -{ - internal static class Common - { - private static AndroidJavaObject m_Activity; - - public static AndroidJavaObject GetActivity() - { - if (m_Activity != null) - return m_Activity; - - using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) - { - m_Activity = unityPlayer.GetStatic("currentActivity"); - } - - return m_Activity; - } - } -} diff --git a/Modules/AndroidJNI/AndroidJNI.bindings.cs b/Modules/AndroidJNI/AndroidJNI.bindings.cs index 5827c4c77d..1d7aa13353 100644 --- a/Modules/AndroidJNI/AndroidJNI.bindings.cs +++ b/Modules/AndroidJNI/AndroidJNI.bindings.cs @@ -3,6 +3,7 @@ // https://unity3d.com/legal/licenses/Unity_Reference_Only_License using UnityEngine; +using UnityEngine.Android; using UnityEngine.Bindings; using UnityEngine.Scripting; using Unity.Collections; @@ -106,7 +107,7 @@ public static IntPtr CreateJavaProxy(AndroidJavaProxy proxy) var handle = GCHandle.Alloc(proxy); try { - return _AndroidJNIHelper.CreateJavaProxy(GCHandle.ToIntPtr(handle), proxy); + return _AndroidJNIHelper.CreateJavaProxy(AndroidApp.UnityPlayerRaw, GCHandle.ToIntPtr(handle), proxy); } catch { diff --git a/Modules/AndroidJNI/AndroidJava.cs b/Modules/AndroidJNI/AndroidJava.cs index 044ce7c66a..7cbe99180a 100644 --- a/Modules/AndroidJNI/AndroidJava.cs +++ b/Modules/AndroidJNI/AndroidJava.cs @@ -1061,7 +1061,7 @@ private static IntPtr GetMethodID(string clazz, string methodName, string signat private static readonly IntPtr s_ReflectionHelperGetMethodID = GetStaticMethodID(RELECTION_HELPER_CLASS_NAME, "getMethodID", "(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/reflect/Method;"); private static readonly IntPtr s_ReflectionHelperGetFieldID = GetStaticMethodID(RELECTION_HELPER_CLASS_NAME, "getFieldID", "(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/reflect/Field;"); private static readonly IntPtr s_ReflectionHelperGetFieldSignature = GetStaticMethodID(RELECTION_HELPER_CLASS_NAME, "getFieldSignature", "(Ljava/lang/reflect/Field;)Ljava/lang/String;"); - private static readonly IntPtr s_ReflectionHelperNewProxyInstance = GetStaticMethodID(RELECTION_HELPER_CLASS_NAME, "newProxyInstance", "(JLjava/lang/Class;)Ljava/lang/Object;"); + private static readonly IntPtr s_ReflectionHelperNewProxyInstance = GetStaticMethodID(RELECTION_HELPER_CLASS_NAME, "newProxyInstance", "(Lcom/unity3d/player/UnityPlayer;JLjava/lang/Class;)Ljava/lang/Object;"); private static readonly IntPtr s_ReflectionHelperSetNativeExceptionOnProxy = GetStaticMethodID(RELECTION_HELPER_CLASS_NAME, "setNativeExceptionOnProxy", "(Ljava/lang/Object;JZ)V"); private static readonly IntPtr s_FieldGetDeclaringClass = GetMethodID("java/lang/reflect/Field", "getDeclaringClass", "()Ljava/lang/Class;"); @@ -1128,11 +1128,12 @@ public static string GetFieldSignature(IntPtr field) return AndroidJNISafe.CallStaticStringMethod(s_ReflectionHelperClass, s_ReflectionHelperGetFieldSignature, jniArgs); } - public static IntPtr NewProxyInstance(IntPtr delegateHandle, IntPtr interfaze) + public static IntPtr NewProxyInstance(IntPtr player, IntPtr delegateHandle, IntPtr interfaze) { - jvalue[] jniArgs = new jvalue[2]; - jniArgs[0].j = delegateHandle.ToInt64(); - jniArgs[1].l = interfaze; + jvalue[] jniArgs = new jvalue[3]; + jniArgs[0].l = player; + jniArgs[1].j = delegateHandle.ToInt64(); + jniArgs[2].l = interfaze; return AndroidJNISafe.CallStaticObjectMethod(s_ReflectionHelperClass, s_ReflectionHelperNewProxyInstance, jniArgs); } @@ -1149,9 +1150,9 @@ public static void SetNativeExceptionOnProxy(IntPtr proxy, Exception e, bool met [UsedByNativeCode] sealed class _AndroidJNIHelper { - public static IntPtr CreateJavaProxy(IntPtr delegateHandle, AndroidJavaProxy proxy) + public static IntPtr CreateJavaProxy(IntPtr player, IntPtr delegateHandle, AndroidJavaProxy proxy) { - return AndroidReflection.NewProxyInstance(delegateHandle, proxy.javaInterface.GetRawClass()); + return AndroidReflection.NewProxyInstance(player, delegateHandle, proxy.javaInterface.GetRawClass()); } public static IntPtr CreateJavaRunnable(AndroidJavaRunnable jrunnable) diff --git a/Modules/GridAndSnap/LinkedVector3Field.cs b/Modules/GridAndSnap/LinkedVector3Field.cs index a9e2db7231..a02aff5ee5 100644 --- a/Modules/GridAndSnap/LinkedVector3Field.cs +++ b/Modules/GridAndSnap/LinkedVector3Field.cs @@ -15,6 +15,7 @@ class LinkedVector3Field : Vector3Field bool m_Linked; readonly VisualElement m_LinkedToggle; + readonly FloatField m_XField; readonly FloatField m_YField; readonly FloatField m_ZField; @@ -49,7 +50,7 @@ public LinkedVector3Field(string label) : base(label) ? "StyleSheets/SceneViewToolbarElements/LinkedVector3FieldDark.uss" : "StyleSheets/SceneViewToolbarElements/LinkedVector3FieldLight.uss")); - var xField = this.Q("unity-x-input"); + m_XField = this.Q("unity-x-input"); m_YField = this.Q("unity-y-input"); m_ZField = this.Q("unity-z-input"); @@ -60,6 +61,17 @@ public LinkedVector3Field(string label) : base(label) UpdateLinkedState(); } + public bool isDelayed + { + get => m_XField.isDelayed; + set + { + m_XField.isDelayed = value; + m_YField.isDelayed = value; + m_ZField.isDelayed = value; + } + } + void UpdateLinkedState() { if (linked) diff --git a/Modules/GridAndSnap/SnapSettingsWindow.cs b/Modules/GridAndSnap/SnapSettingsWindow.cs index 6c5a3d0aca..24306383a8 100644 --- a/Modules/GridAndSnap/SnapSettingsWindow.cs +++ b/Modules/GridAndSnap/SnapSettingsWindow.cs @@ -51,7 +51,7 @@ protected override void OnEnable() rootVisualElement.Add(new SnapSettingsHeader(L10n.Tr("Grid Snapping"), ResetValues)); - m_GridSize = new LinkedVector3Field(L10n.Tr("Grid Size")) { name = "GridSize" }; + m_GridSize = new LinkedVector3Field(L10n.Tr("Grid Size")) { name = "GridSize", isDelayed = true}; m_GridSize.value = GridSettings.size; m_GridSize.linked = Mathf.Approximately(m_GridSize.value.x, m_GridSize.value.y) && Mathf.Approximately(m_GridSize.value.x, m_GridSize.value.z); GridSettings.sizeChanged += (value) => m_GridSize.SetValueWithoutNotify(value); diff --git a/Modules/IMGUI/GUIStyle.cs b/Modules/IMGUI/GUIStyle.cs index 86db082cfc..c3bbea5fb5 100644 --- a/Modules/IMGUI/GUIStyle.cs +++ b/Modules/IMGUI/GUIStyle.cs @@ -411,7 +411,7 @@ public static implicit operator GUIStyle(string str) // Get the pixel position of a given string index. public Vector2 GetCursorPixelPosition(Rect position, GUIContent content, int cursorStringIndex) { - var handle = IMGUITextHandle.GetTextHandle(this, padding.Remove(position), content.textWithWhitespace, Color.white, true); + var handle = IMGUITextHandle.GetTextHandle(this, padding.Remove(position), content.textWithWhitespace, Color.white); var cursorPos = handle.GetCursorPositionFromStringIndexUsingLineHeight(cursorStringIndex); cursorPos = new Vector2(Mathf.Max(0.0f, cursorPos.x), cursorPos.y); var rectOffset = Internal_GetTextRectOffset(position, content, new Vector2(handle.preferredSize.x, handle.preferredSize.y > 0 ? handle.preferredSize.y : lineHeight)); @@ -427,13 +427,13 @@ internal Rect[] GetHyperlinkRects(IMGUITextHandle handle, Rect content) // Get the cursor position (indexing into contents.text) when the user clicked at cursorPixelPosition public int GetCursorStringIndex(Rect position, GUIContent content, Vector2 cursorPixelPosition) { - return IMGUITextHandle.GetTextHandle(this, position, content.textWithWhitespace, Color.white, true).GetCursorIndexFromPosition(cursorPixelPosition); + return IMGUITextHandle.GetTextHandle(this, position, content.textWithWhitespace, Color.white).GetCursorIndexFromPosition(cursorPixelPosition); } // Returns number of characters that can fit within width, returns -1 if fails due to missing font internal int GetNumCharactersThatFitWithinWidth(string text, float width) { - return IMGUITextHandle.GetTextHandle(this, new Rect(0, 0, width, 1), text, Color.white, true).GetNumCharactersThatFitWithinWidth(width); + return IMGUITextHandle.GetTextHandle(this, new Rect(0, 0, width, 1), text, Color.white).GetNumCharactersThatFitWithinWidth(width); } // Calculate the size of a some content if it is rendered with this style. @@ -466,7 +466,7 @@ public float CalcHeight(GUIContent content, float width) internal Vector2 GetPreferredSize(string content, Rect rect) { - return IMGUITextHandle.GetTextHandle(this, padding.Remove(rect), content, Color.white, true).GetPreferredSize(); + return IMGUITextHandle.GetTextHandle(this, padding.Remove(rect), content, Color.white).GetPreferredSize(); } public bool isHeightDependantOnWidth => fixedHeight == 0 && (wordWrap && imagePosition != ImagePosition.ImageOnly); @@ -523,8 +523,7 @@ public enum TextClipping Overflow = 0, // Text gets clipped to be inside the element. Clip = 1, - // Text gets truncated with dots to show it is too long - // Truncate = 2 + Ellipsis = 2, } } diff --git a/Modules/IMGUI/IMGUITextHandle.cs b/Modules/IMGUI/IMGUITextHandle.cs index 980e622229..12f58a96bf 100644 --- a/Modules/IMGUI/IMGUITextHandle.cs +++ b/Modules/IMGUI/IMGUITextHandle.cs @@ -5,12 +5,15 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using UnityEngine.TextCore.Text; namespace UnityEngine { internal class IMGUITextHandle : TextHandle { + internal LinkedListNode tuple; + const float sFallbackFontSize = 13; const float sTimeToFlush = 1.0f; const string kDefaultFontName = "LegacyRuntime.ttf"; @@ -21,54 +24,79 @@ internal class IMGUITextHandle : TextHandle private static IMGUITextHandle s_TextHandle = new IMGUITextHandle(); - private static List textHandles = new List(); + private static Dictionary textHandles = new Dictionary(); + private static LinkedList textHandlesTuple = new LinkedList(); + private static float lastCleanupTime; + + internal class TextHandleTuple + { + public TextHandleTuple(float lastTimeUsed, int hashCode) + { + this.hashCode = hashCode; + this.lastTimeUsed = lastTimeUsed; + } + + public float lastTimeUsed; + public int hashCode; + } internal static void EmptyCache() { GUIStyle.Internal_CleanupAllTextGenerator(); textHandles.Clear(); + textHandlesTuple.Clear(); } - internal static IMGUITextHandle GetTextHandle(GUIStyle style, Rect position, string content, Color32 textColor, bool isOnlyForGeometry = false) + internal static IMGUITextHandle GetTextHandle(GUIStyle style, Rect position, string content, Color32 textColor) { var settings = new TextCore.Text.TextGenerationSettings(); ConvertGUIStyleToGenerationSettings(settings, style, textColor, content, position); - return GetTextHandle(settings, isOnlyForGeometry); + return GetTextHandle(settings); } - private static IMGUITextHandle GetTextHandle(TextCore.Text.TextGenerationSettings settings, bool isOnlyForGeometry) + private static void ClearUnusedTextHandles() { var currentTime = Time.realtimeSinceStartup; - bool isCached = false; - IMGUITextHandle textHandleCached = null; - int hash = isOnlyForGeometry ? settings.cachedGeomertyHashCode : settings.cachedHashCode; - - for (int i = textHandles.Count - 1; i >= 0; i--) + while (textHandlesTuple.Count > 0) { - var textHandle = textHandles[i]; - var hash2 = isOnlyForGeometry ? textHandle.textGenerationSettings.cachedGeomertyHashCode : textHandle.textGenerationSettings.cachedHashCode; - if (hash == hash2) + var tuple = textHandlesTuple.First(); + if (currentTime - tuple.lastTimeUsed > sTimeToFlush) { - textHandleCached = textHandle; - textHandle.lastTimeUsed = currentTime; - isCached = true; + GUIStyle.Internal_DestroyTextGenerator(tuple.hashCode); + textHandles.Remove(tuple.hashCode); + textHandlesTuple.RemoveFirst(); } + else + break; + } + } - if (currentTime - textHandle.lastTimeUsed > sTimeToFlush) - { - GUIStyle.Internal_DestroyTextGenerator(textHandle.textGenerationSettings.cachedHashCode); - textHandles.RemoveAt(i); - } + private static IMGUITextHandle GetTextHandle(TextCore.Text.TextGenerationSettings settings) + { + var currentTime = Time.realtimeSinceStartup; + if (currentTime - lastCleanupTime > sTimeToFlush) + { + ClearUnusedTextHandles(); + lastCleanupTime = currentTime; } - if (isCached) + int hash = settings.cachedHashCode; + + if (textHandles.TryGetValue(hash, out IMGUITextHandle textHandleCached)) + { + textHandlesTuple.Remove(textHandleCached.tuple); + textHandlesTuple.AddLast(textHandleCached.tuple); return textHandleCached; + } var handle = new IMGUITextHandle(); - handle.lastTimeUsed = currentTime; - textHandles.Add(handle); + var tuple = new TextHandleTuple(currentTime, hash); + var listNode = new LinkedListNode(tuple); + handle.tuple = listNode; + textHandles[hash] = handle; handle.Update(settings); handle.UpdatePreferredSize(settings); + textHandlesTuple.AddLast(listNode); return handle; } @@ -79,7 +107,6 @@ internal static float GetLineHeight(GUIStyle style) return GetLineHeightDefault(settings); } - internal TextInfo GetTextInfo(ref int id) { id = textGenerationSettings.cachedHashCode; @@ -161,6 +188,7 @@ private static void ConvertGUIStyleToGenerationSettings(UnityEngine.TextCore.Tex settings.fontStyle = TextGeneratorUtilities.LegacyStyleToNewStyle(style.fontStyle); settings.textAlignment = TextGeneratorUtilities.LegacyAlignmentToNewAlignment(tempAlignment); + settings.overflowMode = LegacyClippingToNewOverflow(style.clipping); settings.wordWrap = rect.width > 0 ? style.wordWrap : false; settings.wordWrappingRatio = 0.4f; settings.richText = style.richText; @@ -173,7 +201,6 @@ private static void ConvertGUIStyleToGenerationSettings(UnityEngine.TextCore.Tex else settings.fontSize = sFallbackFontSize; - settings.overflowMode = TextOverflowMode.Overflow; settings.characterSpacing = 0; settings.wordSpacing = 0; settings.paragraphSpacing = 0; @@ -182,5 +209,19 @@ private static void ConvertGUIStyleToGenerationSettings(UnityEngine.TextCore.Tex settings.inverseYAxis = true; settings.shouldConvertToLinearSpace = false; } + + static TextOverflowMode LegacyClippingToNewOverflow(TextClipping clipping) + { + switch (clipping) + { + case TextClipping.Clip: + return TextOverflowMode.Masking; + case TextClipping.Ellipsis: + return TextOverflowMode.Ellipsis; + case TextClipping.Overflow: + default: + return TextOverflowMode.Overflow; + } + } } } diff --git a/Modules/IMGUI/TextEditor.cs b/Modules/IMGUI/TextEditor.cs index 88bf4cc4ae..e520bcb4a4 100644 --- a/Modules/IMGUI/TextEditor.cs +++ b/Modules/IMGUI/TextEditor.cs @@ -141,7 +141,7 @@ public enum DblClickSnapping : byte { WORDS, PARAGRAPHS } public TextEditor() { var style = GUIStyle.none; - m_TextHandle = new IMGUITextHandle(); + m_TextHandle = IMGUITextHandle.GetTextHandle(style, position, textWithWhitespace, Color.white); m_TextSelecting = new TextSelectingUtilities(m_TextHandle); m_TextEditing = new TextEditingUtilities(m_TextSelecting, m_TextHandle, m_Content.text); m_Content.OnTextChanged += OnContentTextChangedHandle; @@ -408,7 +408,7 @@ public void UpdateScrollOffsetIfNeeded(Event evt) internal void UpdateTextHandle() { - m_TextHandle = IMGUITextHandle.GetTextHandle(style, style.padding.Remove(position), textWithWhitespace, Color.white, true); + m_TextHandle = IMGUITextHandle.GetTextHandle(style, style.padding.Remove(position), textWithWhitespace, Color.white); m_TextEditing.textHandle = m_TextHandle; m_TextSelecting.textHandle = m_TextHandle; } diff --git a/Modules/PackageManagerUI/Editor/UI/ScopedRegistriesSettings.cs b/Modules/PackageManagerUI/Editor/UI/ScopedRegistriesSettings.cs index 765bad5a3f..1047c27510 100644 --- a/Modules/PackageManagerUI/Editor/UI/ScopedRegistriesSettings.cs +++ b/Modules/PackageManagerUI/Editor/UI/ScopedRegistriesSettings.cs @@ -57,7 +57,7 @@ public ScopedRegistriesSettings() scopedRegistriesInfoBox.Q