Documentation: Updated README.md and added a small demo gif
This commit is contained in:
parent
f1e33f5e6b
commit
5f37c59a79
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
@ -20,12 +21,6 @@ namespace Module.UIToolkit.Editor
|
||||||
ApplyChanges();
|
ApplyChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InitializeStyleSheets()
|
|
||||||
{
|
|
||||||
if (_ussCollectionView == null)
|
|
||||||
_ussCollectionView = FindStyleSheet("editor-collection-view");
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void ApplyChanges()
|
internal static void ApplyChanges()
|
||||||
{
|
{
|
||||||
InitializeStyleSheets();
|
InitializeStyleSheets();
|
||||||
|
|
@ -38,19 +33,24 @@ namespace Module.UIToolkit.Editor
|
||||||
var window = windows[i];
|
var window = windows[i];
|
||||||
var ve = window.rootVisualElement;
|
var ve = window.rootVisualElement;
|
||||||
|
|
||||||
if (ve == null)
|
if (ve == null || _ussCollectionView == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (_ussCollectionView != null)
|
if (settings.collectionViewDisableMaxHeight)
|
||||||
{
|
ve.styleSheets.Add(_ussCollectionView);
|
||||||
if (settings.collectionViewDisableMaxHeight)
|
else
|
||||||
ve.styleSheets.Add(_ussCollectionView);
|
ve.styleSheets.Remove(_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)
|
private static StyleSheet FindStyleSheet(string name)
|
||||||
{
|
{
|
||||||
var guids = AssetDatabase.FindAssets($"t:{nameof(StyleSheet)} {name}");
|
var guids = AssetDatabase.FindAssets($"t:{nameof(StyleSheet)} {name}");
|
||||||
|
|
@ -62,6 +62,7 @@ namespace Module.UIToolkit.Editor
|
||||||
return AssetDatabase.LoadAssetAtPath<StyleSheet>(path);
|
return AssetDatabase.LoadAssetAtPath<StyleSheet>(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private static EditorWindow[] GetAllOpenEditorWindows()
|
private static EditorWindow[] GetAllOpenEditorWindows()
|
||||||
{
|
{
|
||||||
return Resources.FindObjectsOfTypeAll<EditorWindow>();
|
return Resources.FindObjectsOfTypeAll<EditorWindow>();
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,13 @@ namespace Module.UIToolkit.Editor
|
||||||
public bool collectionViewDisableMaxHeight = true;
|
public bool collectionViewDisableMaxHeight = true;
|
||||||
|
|
||||||
private static Settings _settings;
|
private static Settings _settings;
|
||||||
|
|
||||||
|
internal void Save()
|
||||||
|
{
|
||||||
|
var json = JsonUtility.ToJson(this);
|
||||||
|
EditorPrefs.SetString(nameof(Settings), json);
|
||||||
|
}
|
||||||
|
|
||||||
internal static Settings Load()
|
internal static Settings Load()
|
||||||
{
|
{
|
||||||
if (_settings != null)
|
if (_settings != null)
|
||||||
|
|
@ -24,11 +30,5 @@ namespace Module.UIToolkit.Editor
|
||||||
|
|
||||||
return _settings;
|
return _settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Save()
|
|
||||||
{
|
|
||||||
var json = JsonUtility.ToJson(this);
|
|
||||||
EditorPrefs.SetString(nameof(Settings), json);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
13
README.md
13
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
|
||||||
|
<img src="~Documentation/Images/editor-ui-toolkit-toggle-disable-max-height.gif" height="600" alt="editor-ui-toolkit-toggle-disable-max-height">
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
8
~Documentation.meta
Normal file
8
~Documentation.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a8ccf6436cc4f1a478de912b2e065398
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
~Documentation/Images.meta
Normal file
8
~Documentation/Images.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0f68296271c569c4d80b8ba16ee8b8de
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
|
|
@ -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:
|
||||||
Loading…
Reference in a new issue