diff --git a/Editor/EditorUIToolkitCustomization.cs b/Editor/EditorUIToolkitCustomization.cs index f4e7998..763b66a 100644 --- a/Editor/EditorUIToolkitCustomization.cs +++ b/Editor/EditorUIToolkitCustomization.cs @@ -1,3 +1,4 @@ +using System.Runtime.CompilerServices; using UnityEditor; using UnityEngine; using UnityEngine.UIElements; @@ -20,12 +21,6 @@ namespace Module.UIToolkit.Editor ApplyChanges(); } - private static void InitializeStyleSheets() - { - if (_ussCollectionView == null) - _ussCollectionView = FindStyleSheet("editor-collection-view"); - } - internal static void ApplyChanges() { InitializeStyleSheets(); @@ -38,19 +33,24 @@ namespace Module.UIToolkit.Editor var window = windows[i]; var ve = window.rootVisualElement; - if (ve == null) + if (ve == null || _ussCollectionView == null) continue; - - if (_ussCollectionView != null) - { - if (settings.collectionViewDisableMaxHeight) - ve.styleSheets.Add(_ussCollectionView); - else - ve.styleSheets.Remove(_ussCollectionView); - } + + if (settings.collectionViewDisableMaxHeight) + ve.styleSheets.Add(_ussCollectionView); + else + ve.styleSheets.Remove(_ussCollectionView); } } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static void InitializeStyleSheets() + { + if (_ussCollectionView == null) + _ussCollectionView = FindStyleSheet("editor-collection-view"); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static StyleSheet FindStyleSheet(string name) { var guids = AssetDatabase.FindAssets($"t:{nameof(StyleSheet)} {name}"); @@ -62,6 +62,7 @@ namespace Module.UIToolkit.Editor return AssetDatabase.LoadAssetAtPath(path); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static EditorWindow[] GetAllOpenEditorWindows() { return Resources.FindObjectsOfTypeAll(); diff --git a/Editor/Settings/Settings.cs b/Editor/Settings/Settings.cs index 9297dd1..37fe41c 100644 --- a/Editor/Settings/Settings.cs +++ b/Editor/Settings/Settings.cs @@ -10,7 +10,13 @@ namespace Module.UIToolkit.Editor public bool collectionViewDisableMaxHeight = true; private static Settings _settings; - + + internal void Save() + { + var json = JsonUtility.ToJson(this); + EditorPrefs.SetString(nameof(Settings), json); + } + internal static Settings Load() { if (_settings != null) @@ -24,11 +30,5 @@ namespace Module.UIToolkit.Editor return _settings; } - - internal void Save() - { - var json = JsonUtility.ToJson(this); - EditorPrefs.SetString(nameof(Settings), json); - } } } \ No newline at end of file diff --git a/README.md b/README.md index 90acac3..b0b0fbe 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,13 @@ -# module-menu-item-tool +# Description + +This module currently contains a single option to disable max-height of collection views that was introduced with the revamp of the Unity Editor UI. + +## Preferences + +In `Edit/Preferences` it is possible to toggle the changes in section `Module/Editor UIToolkit`. + + +# Demo +editor-ui-toolkit-toggle-disable-max-height + diff --git a/~Documentation.meta b/~Documentation.meta new file mode 100644 index 0000000..e8810be --- /dev/null +++ b/~Documentation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a8ccf6436cc4f1a478de912b2e065398 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/~Documentation/Images.meta b/~Documentation/Images.meta new file mode 100644 index 0000000..a540bef --- /dev/null +++ b/~Documentation/Images.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0f68296271c569c4d80b8ba16ee8b8de +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/~Documentation/Images/editor-ui-toolkit-toggle-disable-max-height.gif b/~Documentation/Images/editor-ui-toolkit-toggle-disable-max-height.gif new file mode 100644 index 0000000..e080e17 Binary files /dev/null and b/~Documentation/Images/editor-ui-toolkit-toggle-disable-max-height.gif differ diff --git a/~Documentation/Images/editor-ui-toolkit-toggle-disable-max-height.gif.meta b/~Documentation/Images/editor-ui-toolkit-toggle-disable-max-height.gif.meta new file mode 100644 index 0000000..4e0c64e --- /dev/null +++ b/~Documentation/Images/editor-ui-toolkit-toggle-disable-max-height.gif.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: 67d0bcb6c898489409b70228d1a114df +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: