mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-12-01 10:12:38 +08:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 154fbef0fa | |||
| 240ac6b206 | |||
| ff9055471a | |||
| 86c74e77c4 | |||
| 1332f805ff | |||
| 50c0e475ca | |||
| 7be2bf463d | |||
| 8d906a7836 | |||
| 587ff28e91 |
@@ -1,3 +1,24 @@
|
|||||||
|
## [5.14.1](https://github.com/mob-sakai/UIEffect/compare/5.14.0...5.14.1) (2026-11-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* queue TextMeshPro parent for submesh rebuild ([240ac6b](https://github.com/mob-sakai/UIEffect/commit/240ac6b206229dfcdba7a3f38341ae9b198aff6f)), closes [#416](https://github.com/mob-sakai/UIEffect/issues/416)
|
||||||
|
|
||||||
|
# [5.14.0](https://github.com/mob-sakai/UIEffect/compare/5.13.0...5.14.0) (2026-11-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* output colors for gradients are incorrect when `enableColorCorrection=true` ([587ff28](https://github.com/mob-sakai/UIEffect/commit/587ff28e91d229baa5c56d0ac58030b44ddf7271))
|
||||||
|
* paste color is incorrect when `enableColorCorrection=true` ([7be2bf4](https://github.com/mob-sakai/UIEffect/commit/7be2bf463dc91feb41d4585841ddc489f0302433))
|
||||||
|
* picked color is incorrect when `enableColorCorrection=true` ([8d906a7](https://github.com/mob-sakai/UIEffect/commit/8d906a78365147833c8d9ba58224c7819a957d4d))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* improve CSS gradient paste handling ([50c0e47](https://github.com/mob-sakai/UIEffect/commit/50c0e475ca9c77fe4584f8be8478e243fb193c6f)), closes [#415](https://github.com/mob-sakai/UIEffect/issues/415)
|
||||||
|
|
||||||
# [5.13.0](https://github.com/mob-sakai/UIEffect/compare/5.12.1...5.13.0) (2026-11-25)
|
# [5.13.0](https://github.com/mob-sakai/UIEffect/compare/5.12.1...5.13.0) (2026-11-25)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -1,109 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 4075e0c7a9e2c4f4d8f9e3c34e3e59a3
|
|
||||||
TextureImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 12
|
|
||||||
mipmaps:
|
|
||||||
mipMapMode: 0
|
|
||||||
enableMipMap: 0
|
|
||||||
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
|
|
||||||
isReadable: 0
|
|
||||||
streamingMipmaps: 0
|
|
||||||
streamingMipmapsPriority: 0
|
|
||||||
vTOnly: 0
|
|
||||||
grayScaleToAlpha: 0
|
|
||||||
generateCubemap: 6
|
|
||||||
cubemapConvolution: 0
|
|
||||||
seamlessCubemap: 0
|
|
||||||
textureFormat: 1
|
|
||||||
maxTextureSize: 2048
|
|
||||||
textureSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
filterMode: 1
|
|
||||||
aniso: 1
|
|
||||||
mipBias: 0
|
|
||||||
wrapU: 1
|
|
||||||
wrapV: 1
|
|
||||||
wrapW: 0
|
|
||||||
nPOTScale: 0
|
|
||||||
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: 1
|
|
||||||
spriteTessellationDetail: -1
|
|
||||||
textureType: 2
|
|
||||||
textureShape: 1
|
|
||||||
singleChannelComponent: 0
|
|
||||||
flipbookRows: 1
|
|
||||||
flipbookColumns: 1
|
|
||||||
maxTextureSizeSet: 0
|
|
||||||
compressionQualitySet: 0
|
|
||||||
textureFormatSet: 0
|
|
||||||
ignorePngGamma: 0
|
|
||||||
applyGammaDecoding: 0
|
|
||||||
cookieLightType: 0
|
|
||||||
platformSettings:
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: DefaultTexturePlatform
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: Standalone
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
spriteSheet:
|
|
||||||
serializedVersion: 2
|
|
||||||
sprites: []
|
|
||||||
outline: []
|
|
||||||
physicsShape: []
|
|
||||||
bones: []
|
|
||||||
spriteID:
|
|
||||||
internalID: 0
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
secondaryTextures: []
|
|
||||||
spritePackingTag:
|
|
||||||
pSDRemoveMatte: 0
|
|
||||||
pSDShowRemoveMatteOption: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 547 B |
@@ -1,109 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 5634431eb895c4ff6bf61ddd65c83608
|
|
||||||
TextureImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 12
|
|
||||||
mipmaps:
|
|
||||||
mipMapMode: 0
|
|
||||||
enableMipMap: 0
|
|
||||||
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
|
|
||||||
isReadable: 0
|
|
||||||
streamingMipmaps: 0
|
|
||||||
streamingMipmapsPriority: 0
|
|
||||||
vTOnly: 0
|
|
||||||
grayScaleToAlpha: 0
|
|
||||||
generateCubemap: 6
|
|
||||||
cubemapConvolution: 0
|
|
||||||
seamlessCubemap: 0
|
|
||||||
textureFormat: 1
|
|
||||||
maxTextureSize: 2048
|
|
||||||
textureSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
filterMode: 1
|
|
||||||
aniso: 1
|
|
||||||
mipBias: 0
|
|
||||||
wrapU: 1
|
|
||||||
wrapV: 1
|
|
||||||
wrapW: 0
|
|
||||||
nPOTScale: 0
|
|
||||||
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: 1
|
|
||||||
spriteTessellationDetail: -1
|
|
||||||
textureType: 2
|
|
||||||
textureShape: 1
|
|
||||||
singleChannelComponent: 0
|
|
||||||
flipbookRows: 1
|
|
||||||
flipbookColumns: 1
|
|
||||||
maxTextureSizeSet: 0
|
|
||||||
compressionQualitySet: 0
|
|
||||||
textureFormatSet: 0
|
|
||||||
ignorePngGamma: 0
|
|
||||||
applyGammaDecoding: 0
|
|
||||||
cookieLightType: 0
|
|
||||||
platformSettings:
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: DefaultTexturePlatform
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: Standalone
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
spriteSheet:
|
|
||||||
serializedVersion: 2
|
|
||||||
sprites: []
|
|
||||||
outline: []
|
|
||||||
physicsShape: []
|
|
||||||
bones: []
|
|
||||||
spriteID:
|
|
||||||
internalID: 0
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
secondaryTextures: []
|
|
||||||
spritePackingTag:
|
|
||||||
pSDRemoveMatte: 0
|
|
||||||
pSDShowRemoveMatteOption: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -12,7 +12,8 @@ namespace Coffee.UIEffects.Editors
|
|||||||
|
|
||||||
internal static void PasteFromClipboard(SerializedProperty color)
|
internal static void PasteFromClipboard(SerializedProperty color)
|
||||||
{
|
{
|
||||||
if (!TryParseColor(GUIUtility.systemCopyBuffer, out var value))
|
var clipboard = GUIUtility.systemCopyBuffer;
|
||||||
|
if (!TryParseColor(clipboard, out var value))
|
||||||
{
|
{
|
||||||
EditorUtility.DisplayDialog("Paste Color",
|
EditorUtility.DisplayDialog("Paste Color",
|
||||||
$"Supported formats are {SupportedFormats}, or CSS background/background-color declarations containing one of these values.",
|
$"Supported formats are {SupportedFormats}, or CSS background/background-color declarations containing one of these values.",
|
||||||
@@ -20,7 +21,7 @@ namespace Coffee.UIEffects.Editors
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
color.colorValue = value;
|
color.colorValue = ApplyPasteColorCorrection(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool TryParseColor(string text, out Color color)
|
internal static bool TryParseColor(string text, out Color color)
|
||||||
@@ -86,6 +87,11 @@ namespace Coffee.UIEffects.Editors
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Color ApplyPasteColorCorrection(Color color)
|
||||||
|
{
|
||||||
|
return UIEffectProjectSettings.enableColorCorrection ? color.linear : color;
|
||||||
|
}
|
||||||
|
|
||||||
private static bool TryExtractCssColorValue(string text, out string value)
|
private static bool TryExtractCssColorValue(string text, out string value)
|
||||||
{
|
{
|
||||||
foreach (var declaration in text.Split(';'))
|
foreach (var declaration in text.Split(';'))
|
||||||
|
|||||||
@@ -15,10 +15,16 @@ namespace Coffee.UIEffects.Editors
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal static void PasteFromClipboard(SerializedProperty property,
|
internal static void PasteFromClipboard(SerializedProperty property,
|
||||||
Func<SerializedProperty, Gradient> getGradient,
|
Action<SerializedProperty, Gradient> setGradient,
|
||||||
Action<SerializedProperty, Gradient> setGradient)
|
SerializedProperty gradationMode,
|
||||||
|
SerializedProperty gradationRotation,
|
||||||
|
SerializedProperty gradationOffset,
|
||||||
|
SerializedProperty gradationScale,
|
||||||
|
SerializedProperty gradationWrapMode,
|
||||||
|
SerializedProperty gradationReverse)
|
||||||
{
|
{
|
||||||
if (!TryParseCssGradient(GUIUtility.systemCopyBuffer, out var value))
|
var clipboard = GUIUtility.systemCopyBuffer;
|
||||||
|
if (!TryParseCssGradient(clipboard, out var value, out var mode, out var rotation))
|
||||||
{
|
{
|
||||||
EditorUtility.DisplayDialog("Paste Gradient",
|
EditorUtility.DisplayDialog("Paste Gradient",
|
||||||
"The clipboard does not contain a supported CSS linear-gradient(...) or radial-gradient(...) value.",
|
"The clipboard does not contain a supported CSS linear-gradient(...) or radial-gradient(...) value.",
|
||||||
@@ -26,13 +32,28 @@ namespace Coffee.UIEffects.Editors
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
value.mode = getGradient(property).mode;
|
value.mode = GradientMode.Blend;
|
||||||
setGradient(property, value);
|
setGradient(property, value);
|
||||||
|
gradationMode.intValue = (int)mode;
|
||||||
|
gradationWrapMode.intValue = (int)(mode == GradationMode.RadialGradient
|
||||||
|
? TextureWrapMode.Clamp
|
||||||
|
: TextureWrapMode.Repeat);
|
||||||
|
if (rotation.HasValue)
|
||||||
|
{
|
||||||
|
gradationRotation.floatValue = rotation.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
gradationOffset.floatValue = 0;
|
||||||
|
gradationScale.floatValue = 1;
|
||||||
|
gradationReverse.boolValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool TryParseCssGradient(string text, out Gradient gradient)
|
private static bool TryParseCssGradient(string text, out Gradient gradient, out GradationMode mode,
|
||||||
|
out float? rotation)
|
||||||
{
|
{
|
||||||
gradient = null;
|
gradient = null;
|
||||||
|
mode = GradationMode.None;
|
||||||
|
rotation = null;
|
||||||
if (string.IsNullOrWhiteSpace(text))
|
if (string.IsNullOrWhiteSpace(text))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -65,6 +86,8 @@ namespace Coffee.UIEffects.Editors
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mode = isRadial ? GradationMode.RadialGradient : GradationMode.AngleGradient;
|
||||||
|
|
||||||
var depth = 0;
|
var depth = 0;
|
||||||
var closeIndex = -1;
|
var closeIndex = -1;
|
||||||
for (var i = openIndex; i < text.Length; i++)
|
for (var i = openIndex; i < text.Length; i++)
|
||||||
@@ -106,6 +129,10 @@ namespace Coffee.UIEffects.Editors
|
|||||||
&& (isRadial || IsGradientDirection(arguments[0])))
|
&& (isRadial || IsGradientDirection(arguments[0])))
|
||||||
{
|
{
|
||||||
firstStopIndex = 1;
|
firstStopIndex = 1;
|
||||||
|
if (!isRadial && TryParseLinearGradientAngle(arguments[0], out var cssAngle))
|
||||||
|
{
|
||||||
|
rotation = Mathf.Repeat(cssAngle - 90, 360);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var stops = new List<GradientStop>();
|
var stops = new List<GradientStop>();
|
||||||
@@ -284,6 +311,73 @@ namespace Coffee.UIEffects.Editors
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool TryParseLinearGradientAngle(string text, out float degrees)
|
||||||
|
{
|
||||||
|
text = text.Trim();
|
||||||
|
switch (text.ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "to top":
|
||||||
|
degrees = 0;
|
||||||
|
return true;
|
||||||
|
case "to top right":
|
||||||
|
case "to right top":
|
||||||
|
degrees = 45;
|
||||||
|
return true;
|
||||||
|
case "to right":
|
||||||
|
degrees = 90;
|
||||||
|
return true;
|
||||||
|
case "to bottom right":
|
||||||
|
case "to right bottom":
|
||||||
|
degrees = 135;
|
||||||
|
return true;
|
||||||
|
case "to bottom":
|
||||||
|
degrees = 180;
|
||||||
|
return true;
|
||||||
|
case "to bottom left":
|
||||||
|
case "to left bottom":
|
||||||
|
degrees = 225;
|
||||||
|
return true;
|
||||||
|
case "to left":
|
||||||
|
degrees = 270;
|
||||||
|
return true;
|
||||||
|
case "to top left":
|
||||||
|
case "to left top":
|
||||||
|
degrees = 315;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var suffixes = new[] { "deg", "grad", "rad", "turn" };
|
||||||
|
foreach (var suffix in suffixes)
|
||||||
|
{
|
||||||
|
if (!text.EndsWith(suffix, StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| !float.TryParse(text.Substring(0, text.Length - suffix.Length),
|
||||||
|
NumberStyles.Float, CultureInfo.InvariantCulture, out var value)
|
||||||
|
|| float.IsNaN(value) || float.IsInfinity(value))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (suffix)
|
||||||
|
{
|
||||||
|
case "grad":
|
||||||
|
degrees = value * 0.9f;
|
||||||
|
return true;
|
||||||
|
case "rad":
|
||||||
|
degrees = value * Mathf.Rad2Deg;
|
||||||
|
return true;
|
||||||
|
case "turn":
|
||||||
|
degrees = value * 360;
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
degrees = value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
degrees = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static GradientStop SetStopPosition(GradientStop stop, float position)
|
private static GradientStop SetStopPosition(GradientStop stop, float position)
|
||||||
{
|
{
|
||||||
stop.position = position;
|
stop.position = position;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ namespace Coffee.UIEffects.Editors
|
|||||||
(Action<SerializedProperty, Gradient>)Delegate.CreateDelegate(typeof(Action<SerializedProperty, Gradient>),
|
(Action<SerializedProperty, Gradient>)Delegate.CreateDelegate(typeof(Action<SerializedProperty, Gradient>),
|
||||||
s_PiGradient.SetMethod);
|
s_PiGradient.SetMethod);
|
||||||
|
|
||||||
private static GUIContent s_ReverseGradientContent;
|
|
||||||
private static GUIContent s_PasteColorContent;
|
private static GUIContent s_PasteColorContent;
|
||||||
private static GUIContent s_PasteGradientContent;
|
private static GUIContent s_PasteGradientContent;
|
||||||
private static readonly GUIContent s_RotationLabel = new GUIContent("* Rotation");
|
private static readonly GUIContent s_RotationLabel = new GUIContent("* Rotation");
|
||||||
@@ -114,10 +113,9 @@ namespace Coffee.UIEffects.Editors
|
|||||||
|
|
||||||
protected virtual void OnEnable()
|
protected virtual void OnEnable()
|
||||||
{
|
{
|
||||||
if (s_ReverseGradientContent == null)
|
if (s_PasteColorContent == null)
|
||||||
{
|
{
|
||||||
var iconDir = "Packages/com.coffee.ui-effect/Editor/Icons";
|
var iconDir = "Packages/com.coffee.ui-effect/Editor/Icons";
|
||||||
s_ReverseGradientContent = Misc.GetIconContent($"{iconDir}/ReverseIcon.png", "Reverse gradient");
|
|
||||||
s_PasteColorContent = Misc.GetIconContent($"{iconDir}/PasteIcon.png",
|
s_PasteColorContent = Misc.GetIconContent($"{iconDir}/PasteIcon.png",
|
||||||
$"Paste {PasteColorUtil.SupportedFormats} or CSS background/background-color declarations.");
|
$"Paste {PasteColorUtil.SupportedFormats} or CSS background/background-color declarations.");
|
||||||
s_PasteGradientContent = Misc.GetIconContent($"{iconDir}/PasteIcon.png",
|
s_PasteGradientContent = Misc.GetIconContent($"{iconDir}/PasteIcon.png",
|
||||||
@@ -378,7 +376,18 @@ namespace Coffee.UIEffects.Editors
|
|||||||
|
|
||||||
// Gradient
|
// Gradient
|
||||||
DrawSeparator();
|
DrawSeparator();
|
||||||
if (DrawHeaderPopup(_gradationMode))
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
var isGradationEnabled = DrawHeaderPopup(_gradationMode);
|
||||||
|
if (GUILayout.Button(s_PasteGradientContent, "IconButton"))
|
||||||
|
{
|
||||||
|
PasteGradientUtil.PasteFromClipboard(_gradationGradient, s_SetGradient,
|
||||||
|
_gradationMode, _gradationRotation, _gradationOffset, _gradationScale, _gradationWrapMode,
|
||||||
|
_gradationReverse);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
if (isGradationEnabled)
|
||||||
{
|
{
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
EditorGUILayout.PropertyField(_gradationColorFilter);
|
EditorGUILayout.PropertyField(_gradationColorFilter);
|
||||||
@@ -525,7 +534,7 @@ namespace Coffee.UIEffects.Editors
|
|||||||
var colorValue = EditorGUI.ColorField(colorRect, label, color.colorValue, true, showAlpha, hdr);
|
var colorValue = EditorGUI.ColorField(colorRect, label, color.colorValue, true, showAlpha, hdr);
|
||||||
if (EditorGUI.EndChangeCheck())
|
if (EditorGUI.EndChangeCheck())
|
||||||
{
|
{
|
||||||
color.colorValue = colorValue;
|
color.colorValue = UIEffectProjectSettings.enableColorCorrection ? colorValue : colorValue.gamma;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUI.Button(pasteRect, s_PasteColorContent, "IconButton"))
|
if (GUI.Button(pasteRect, s_PasteColorContent, "IconButton"))
|
||||||
@@ -537,55 +546,17 @@ namespace Coffee.UIEffects.Editors
|
|||||||
private static void DrawGradientField(SerializedProperty gradient)
|
private static void DrawGradientField(SerializedProperty gradient)
|
||||||
{
|
{
|
||||||
var r = EditorGUILayout.GetControlRect();
|
var r = EditorGUILayout.GetControlRect();
|
||||||
const float reverseWidth = 20f;
|
|
||||||
const float pasteWidth = 20f;
|
|
||||||
var gradientRect = new Rect(r.x, r.y, r.width - reverseWidth - pasteWidth - 4, r.height);
|
|
||||||
var reverseRect = new Rect(gradientRect.xMax + 2, r.y, reverseWidth, r.height);
|
|
||||||
var pasteRect = new Rect(reverseRect.xMax + 2, r.y, pasteWidth, r.height);
|
|
||||||
var label = EditorGUIUtility.TrTempContent(gradient.displayName);
|
var label = EditorGUIUtility.TrTempContent(gradient.displayName);
|
||||||
label.tooltip = gradient.tooltip;
|
label.tooltip = gradient.tooltip;
|
||||||
var hdr = UIEffectProjectSettings.useHdrColorPicker;
|
var hdr = UIEffectProjectSettings.useHdrColorPicker;
|
||||||
EditorGUI.showMixedValue = gradient.hasMultipleDifferentValues;
|
EditorGUI.showMixedValue = gradient.hasMultipleDifferentValues;
|
||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
var gradientValue = EditorGUI.GradientField(gradientRect, label, s_GetGradient(gradient), hdr);
|
var gradientValue = EditorGUI.GradientField(r, label, s_GetGradient(gradient), hdr);
|
||||||
if (EditorGUI.EndChangeCheck())
|
if (EditorGUI.EndChangeCheck())
|
||||||
{
|
{
|
||||||
s_SetGradient(gradient, gradientValue);
|
s_SetGradient(gradient, gradientValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUI.Button(reverseRect, s_ReverseGradientContent, "IconButton"))
|
|
||||||
{
|
|
||||||
ReverseGradient(gradient);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GUI.Button(pasteRect, s_PasteGradientContent, "IconButton"))
|
|
||||||
{
|
|
||||||
PasteGradientUtil.PasteFromClipboard(gradient, s_GetGradient, s_SetGradient);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void ReverseGradient(SerializedProperty property)
|
|
||||||
{
|
|
||||||
var source = s_GetGradient(property);
|
|
||||||
var colorKeys = source.colorKeys;
|
|
||||||
var alphaKeys = source.alphaKeys;
|
|
||||||
for (var i = 0; i < colorKeys.Length; i++)
|
|
||||||
{
|
|
||||||
colorKeys[i].time = 1f - colorKeys[i].time;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < alphaKeys.Length; i++)
|
|
||||||
{
|
|
||||||
alphaKeys[i].time = 1f - alphaKeys[i].time;
|
|
||||||
}
|
|
||||||
|
|
||||||
Array.Reverse(colorKeys);
|
|
||||||
Array.Reverse(alphaKeys);
|
|
||||||
|
|
||||||
var reversed = new Gradient { mode = source.mode };
|
|
||||||
reversed.SetKeys(colorKeys, alphaKeys);
|
|
||||||
s_SetGradient(property, reversed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DrawColor(SerializedProperty color, ColorFilter filter, ColorFilter prevFilter,
|
private static void DrawColor(SerializedProperty color, ColorFilter filter, ColorFilter prevFilter,
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
|
|||||||
|
|
||||||
#### Gradation Mode
|
#### Gradation Mode
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- **Gradation Mode**: `None`, `Horizontal`, `HorizontalGradient`, `Vertical`, `VerticalGradient`, `Radial`, `RadialGradient`, `Diagonal`, `DiagonalToRightBottom`, `DiagonalToLeftBottom`, `Angle`, `AngleGradient`
|
- **Gradation Mode**: `None`, `Horizontal`, `HorizontalGradient`, `Vertical`, `VerticalGradient`, `Radial`, `RadialGradient`, `Diagonal`, `DiagonalToRightBottom`, `DiagonalToLeftBottom`, `Angle`, `AngleGradient`
|
||||||

|

|
||||||
@@ -414,12 +414,9 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
|
|||||||
- ⚠️ NOTE: `Keep Aspect Ratio` is shared with `Transition Filter` and `Gradation Mode` and `Detail Filter`.
|
- ⚠️ NOTE: `Keep Aspect Ratio` is shared with `Transition Filter` and `Gradation Mode` and `Detail Filter`.
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> The paste button beside a gradient field accepts CSS `linear-gradient(...)` and `radial-gradient(...)` values, importing their color stops and positions. CSS direction and shape are not applied.
|
> The paste button beside the Gradation Mode selector accepts CSS `linear-gradient(...)` and `radial-gradient(...)` values, including gradients in CSS `background` declarations. It imports the color stops and positions, selects `AngleGradient` or `RadialGradient`, and resets the gradation offset and scale. Explicit linear-gradient directions and angles (`deg`, `grad`, `rad`, or `turn`) are applied to the rotation. CSS radial-gradient shape, size, and position are not imported.
|
||||||
> This is useful when copying and pasting color codes from CSS, USS, Figma, Photoshop, etc.
|
> This is useful when copying and pasting color codes from CSS, USS, Figma, Photoshop, etc.
|
||||||
|
|
||||||
> [!TIP]
|
|
||||||
> Click the reverse button beside a gradient field to reverse its color and alpha stops.
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
#### Edge Mode
|
#### Edge Mode
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ namespace Coffee.UIEffects
|
|||||||
{
|
{
|
||||||
var x = m_GradationReverse ? w - 1 - i : i;
|
var x = m_GradationReverse ? w - 1 - i : i;
|
||||||
var t = (float)i / (w - 1);
|
var t = (float)i / (w - 1);
|
||||||
s_Colors[x] = ApplyColorSpace(m_GradationGradient.Evaluate(t));
|
s_Colors[x] = ApplyColorSpaceForGradient(m_GradationGradient.Evaluate(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
_gradationRampTex.wrapMode = m_GradationWrapMode;
|
_gradationRampTex.wrapMode = m_GradationWrapMode;
|
||||||
@@ -325,7 +325,7 @@ namespace Coffee.UIEffects
|
|||||||
for (var i = 0; i < w; i++)
|
for (var i = 0; i < w; i++)
|
||||||
{
|
{
|
||||||
var t = (float)i / (w - 1);
|
var t = (float)i / (w - 1);
|
||||||
s_Colors[i] = ApplyColorSpace(m_TransitionGradient.Evaluate(t));
|
s_Colors[i] = ApplyColorSpaceForGradient(m_TransitionGradient.Evaluate(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
s_Colors[w - 1].a = 0;
|
s_Colors[w - 1].a = 0;
|
||||||
@@ -862,5 +862,10 @@ namespace Coffee.UIEffects
|
|||||||
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color.linear : color;
|
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color.linear : color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Color ApplyColorSpaceForGradient(Color color)
|
||||||
|
{
|
||||||
|
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color.linear : color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,13 @@ namespace Coffee.UIEffects
|
|||||||
|
|
||||||
public override void SetVerticesDirty(Graphic graphic, bool enabled)
|
public override void SetVerticesDirty(Graphic graphic, bool enabled)
|
||||||
{
|
{
|
||||||
|
// TMP submeshes are updated only when the parent is rebuilt, so queue the parent even if the replica is disabled. (#416)
|
||||||
|
if (graphic is TMP_SubMeshUI subMeshUI)
|
||||||
|
{
|
||||||
|
graphic = subMeshUI.textComponent as TextMeshProUGUI;
|
||||||
|
enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (graphic is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
|
if (graphic is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
|
||||||
{
|
{
|
||||||
if (enabled)
|
if (enabled)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "com.coffee.ui-effect.shadergraph-builtin",
|
"name": "com.coffee.ui-effect.shadergraph-builtin",
|
||||||
"displayName": "UI Effect - ShaderGraph Support (Unity 6 BuiltIn)",
|
"displayName": "UI Effect - ShaderGraph Support (Unity 6 BuiltIn)",
|
||||||
"description": "An extension for UI Effect that adds ShaderGraph support (Unity 6 BuiltIn).",
|
"description": "An extension for UI Effect that adds ShaderGraph support (Unity 6 BuiltIn).",
|
||||||
"version": "5.13.0",
|
"version": "5.14.1",
|
||||||
"unity": "2020.3",
|
"unity": "2020.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"url": "https://github.com/mob-sakai"
|
"url": "https://github.com/mob-sakai"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.coffee.ui-effect": "5.13.0"
|
"com.coffee.ui-effect": "5.14.1"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ui",
|
"ui",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "com.coffee.ui-effect.shadergraph-urp",
|
"name": "com.coffee.ui-effect.shadergraph-urp",
|
||||||
"displayName": "UI Effect - ShaderGraph Support (Unity 6 URP)",
|
"displayName": "UI Effect - ShaderGraph Support (Unity 6 URP)",
|
||||||
"description": "An extension for UI Effect that adds ShaderGraph support (Unity 6 URP).",
|
"description": "An extension for UI Effect that adds ShaderGraph support (Unity 6 URP).",
|
||||||
"version": "5.13.0",
|
"version": "5.14.1",
|
||||||
"unity": "2020.3",
|
"unity": "2020.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
"url": "https://github.com/mob-sakai"
|
"url": "https://github.com/mob-sakai"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.coffee.ui-effect": "5.13.0",
|
"com.coffee.ui-effect": "5.14.1",
|
||||||
"com.coffee.ui-effect-shadergraph-builtin": "5.13.0"
|
"com.coffee.ui-effect-shadergraph-builtin": "5.14.1"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ui",
|
"ui",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "com.coffee.ui-effect.textmeshpro-legacy",
|
"name": "com.coffee.ui-effect.textmeshpro-legacy",
|
||||||
"displayName": "UI Effect - TextMeshPro Support",
|
"displayName": "UI Effect - TextMeshPro Support",
|
||||||
"description": "An extension for UI Effect that adds TextMeshPro support.",
|
"description": "An extension for UI Effect that adds TextMeshPro support.",
|
||||||
"version": "5.13.0",
|
"version": "5.14.1",
|
||||||
"unity": "2020.3",
|
"unity": "2020.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"url": "https://github.com/mob-sakai"
|
"url": "https://github.com/mob-sakai"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.coffee.ui-effect": "5.13.0"
|
"com.coffee.ui-effect": "5.14.1"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ui",
|
"ui",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "com.coffee.ui-effect.textmeshpro",
|
"name": "com.coffee.ui-effect.textmeshpro",
|
||||||
"displayName": "UI Effect - TextMeshPro Support (Unity 6)",
|
"displayName": "UI Effect - TextMeshPro Support (Unity 6)",
|
||||||
"description": "An extension for UI Effect that adds TextMeshPro support (Unity 6).",
|
"description": "An extension for UI Effect that adds TextMeshPro support (Unity 6).",
|
||||||
"version": "5.13.0",
|
"version": "5.14.1",
|
||||||
"unity": "2020.3",
|
"unity": "2020.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"url": "https://github.com/mob-sakai"
|
"url": "https://github.com/mob-sakai"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.coffee.ui-effect": "5.13.0"
|
"com.coffee.ui-effect": "5.14.1"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ui",
|
"ui",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "com.coffee.ui-effect.v4-compatible-components",
|
"name": "com.coffee.ui-effect.v4-compatible-components",
|
||||||
"displayName": "UI Effect - v4 Compatible Components",
|
"displayName": "UI Effect - v4 Compatible Components",
|
||||||
"description": "An extension for UI Effect that adds v4 compatible components.",
|
"description": "An extension for UI Effect that adds v4 compatible components.",
|
||||||
"version": "5.13.0",
|
"version": "5.14.1",
|
||||||
"unity": "2020.3",
|
"unity": "2020.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"url": "https://github.com/mob-sakai"
|
"url": "https://github.com/mob-sakai"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.coffee.ui-effect": "5.13.0",
|
"com.coffee.ui-effect": "5.14.1",
|
||||||
"com.unity.modules.animation": "1.0.0"
|
"com.unity.modules.animation": "1.0.0"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "com.coffee.ui-effect",
|
"name": "com.coffee.ui-effect",
|
||||||
"displayName": "UI Effect",
|
"displayName": "UI Effect",
|
||||||
"description": "UIEffect is an open-source package that allows you to intuitively apply rich UI effects directly from the Inspector or via code.\nCombine various filters, such as grayscale, blur, and dissolve, to decorate your UI with a unique visual style!",
|
"description": "UIEffect is an open-source package that allows you to intuitively apply rich UI effects directly from the Inspector or via code.\nCombine various filters, such as grayscale, blur, and dissolve, to decorate your UI with a unique visual style!",
|
||||||
"version": "5.13.0",
|
"version": "5.14.1",
|
||||||
"unity": "2020.3",
|
"unity": "2020.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in New Issue
Block a user