Compare commits

..

6 Commits

Author SHA1 Message Date
semantic-release-bot 184967c120 chore(release): 5.8.2 [skip ci]
## [5.8.2](https://github.com/mob-sakai/UIEffect/compare/5.8.1...5.8.2) (2025-04-23)

### Bug Fixes

* `Flip` is ignored when loading a preset ([e1f3abf](https://github.com/mob-sakai/UIEffect/commit/e1f3abf7a65b62718b28e33ac2f7d700c3ae3f5a))
* fix detail color ([90ab16c](https://github.com/mob-sakai/UIEffect/commit/90ab16c3fd46435ebf7c8e47ffb4ec521d2f61c9))
* indicate in the inspector using tooltips and asterisks that `Rotation` and `Keep Aspect Ratio` are shared properties ([2cca822](https://github.com/mob-sakai/UIEffect/commit/2cca822413aa7580e1eb777c3295d1de928cd65f))
2025-04-23 23:24:29 +00:00
mob-sakai 2cca822413 fix: indicate in the inspector using tooltips and asterisks that Rotation and Keep Aspect Ratio are shared properties 2025-04-19 10:22:34 +09:00
mob-sakai 90ab16c3fd fix: fix detail color 2025-04-19 10:22:34 +09:00
mob-sakai e1f3abf7a6 fix: Flip is ignored when loading a preset 2025-04-19 10:21:16 +09:00
mob-sakai 770e61bb12 chore: refactor 2025-04-18 17:32:30 +09:00
mob-sakai a0820bf847 chore: update coffee.internal 2025-04-18 17:14:44 +09:00
12 changed files with 75 additions and 50 deletions
+4 -4
View File
@@ -5,14 +5,14 @@
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "2045eaab5b485827cef8bf0bb9e1552dce4f8d6d"
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.minimal-resource": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "2bd2bf356dd692a39de9db2ff11faaf79fbfaea3"
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.nano-monitor": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
@@ -21,14 +21,14 @@
"dependencies": {
"com.unity.ugui": "1.0.0"
},
"hash": "2045eaab5b485827cef8bf0bb9e1552dce4f8d6d"
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.symbolic-linker": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/SymbolicLinker",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "3c280f1a8f4db5038b881ff07f270efd9638fa31"
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.ui-effect": {
"version": "file:src",
+9
View File
@@ -1,3 +1,12 @@
## [5.8.2](https://github.com/mob-sakai/UIEffect/compare/5.8.1...5.8.2) (2025-04-23)
### Bug Fixes
* `Flip` is ignored when loading a preset ([e1f3abf](https://github.com/mob-sakai/UIEffect/commit/e1f3abf7a65b62718b28e33ac2f7d700c3ae3f5a))
* fix detail color ([90ab16c](https://github.com/mob-sakai/UIEffect/commit/90ab16c3fd46435ebf7c8e47ffb4ec521d2f61c9))
* indicate in the inspector using tooltips and asterisks that `Rotation` and `Keep Aspect Ratio` are shared properties ([2cca822](https://github.com/mob-sakai/UIEffect/commit/2cca822413aa7580e1eb777c3295d1de928cd65f))
## [5.8.1](https://github.com/mob-sakai/UIEffect/compare/5.8.0...5.8.1) (2025-04-17)
+10 -8
View File
@@ -101,6 +101,8 @@ namespace Coffee.UIEffects.Editors
private SerializedProperty _detailTexSpeed;
private SerializedProperty _flip;
private static GUIContent s_RotationLabel = new GUIContent("* Rotation");
private static GUIContent s_KeepAspectRatioLabel = new GUIContent("* Keep Aspect Ratio");
protected virtual void OnEnable()
{
@@ -134,6 +136,9 @@ namespace Coffee.UIEffects.Editors
_transitionPatternReverse = serializedObject.FindProperty("m_TransitionPatternReverse");
_transitionAutoPlaySpeed = serializedObject.FindProperty("m_TransitionAutoPlaySpeed");
s_RotationLabel.tooltip = _transitionRotation.tooltip;
s_KeepAspectRatioLabel.tooltip = _transitionKeepAspectRatio.tooltip;
_targetMode = serializedObject.FindProperty("m_TargetMode");
_targetColor = serializedObject.FindProperty("m_TargetColor");
_targetRange = serializedObject.FindProperty("m_TargetRange");
@@ -251,9 +256,8 @@ namespace Coffee.UIEffects.Editors
EditorApplication.QueuePlayerLoopUpdate();
}
EditorGUILayout.PropertyField(_transitionRotation, EditorGUIUtility.TrTempContent("Rotation"));
EditorGUILayout.PropertyField(_transitionKeepAspectRatio,
EditorGUIUtility.TrTempContent("Keep Aspect Ratio"));
EditorGUILayout.PropertyField(_transitionRotation, s_RotationLabel);
EditorGUILayout.PropertyField(_transitionKeepAspectRatio, s_KeepAspectRatioLabel);
EditorGUILayout.PropertyField(_transitionReverse, EditorGUIUtility.TrTempContent("Reverse"));
EditorGUI.indentLevel--;
@@ -387,8 +391,7 @@ namespace Coffee.UIEffects.Editors
EditorGUILayout.PropertyField(_gradationRotation);
}
EditorGUILayout.PropertyField(_transitionKeepAspectRatio,
EditorGUIUtility.TrTempContent("Keep Aspect Ratio"));
EditorGUILayout.PropertyField(_transitionKeepAspectRatio, s_KeepAspectRatioLabel);
EditorGUI.indentLevel--;
}
@@ -442,9 +445,8 @@ namespace Coffee.UIEffects.Editors
EditorApplication.QueuePlayerLoopUpdate();
}
EditorGUILayout.PropertyField(_transitionRotation, EditorGUIUtility.TrTempContent("Rotation"));
EditorGUILayout.PropertyField(_transitionKeepAspectRatio,
EditorGUIUtility.TrTempContent("Keep Aspect Ratio"));
EditorGUILayout.PropertyField(_transitionRotation, s_RotationLabel);
EditorGUILayout.PropertyField(_transitionKeepAspectRatio, s_KeepAspectRatioLabel);
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
}
@@ -282,7 +282,7 @@ namespace Coffee.UIEffectInternal
_errorOnUnregisteredVariant = property.FindPropertyRelative("m_ErrorOnUnregisteredVariant");
_asset = property.FindPropertyRelative("m_Asset");
_rlOptionalShaders = new ReorderableList(so, optionalShaders, false, true, true, true);
_rlOptionalShaders = new ReorderableList(so, optionalShaders, true, true, true, true);
_rlOptionalShaders.drawHeaderCallback = rect =>
{
var rLabel = new Rect(rect.x, rect.y, rect.width - 80, rect.height);
@@ -302,12 +302,10 @@ namespace Coffee.UIEffectInternal
optionalShaders.ClearArray();
}
};
_rlOptionalShaders.elementHeightCallback = _ => _expandOptionalShaders
? EditorGUIUtility.singleLineHeight * 2 + 4
: 0;
_rlOptionalShaders.elementHeight = EditorGUIUtility.singleLineHeight * 2 + 4;
_rlOptionalShaders.drawElementCallback = (r, index, isActive, isFocused) =>
{
if (optionalShaders.arraySize <= index || !_expandOptionalShaders) return;
if (optionalShaders.arraySize <= index) return;
var element = optionalShaders.GetArrayElementAtIndex(index);
if (element == null) return;
@@ -322,7 +320,7 @@ namespace Coffee.UIEffectInternal
}
var rArrow = new Rect(r.x, r.y + h + 4, 20, h);
EditorGUI.LabelField(rArrow, "->");
EditorGUI.LabelField(rArrow, GUIContent.none, "ArrowNavigationRight");
var rValue = new Rect(r.x + 20, r.y + h + 4, r.width - 20, h);
if (GUI.Button(rValue, value.stringValue, EditorStyles.popup))
+23 -2
View File
@@ -69,10 +69,14 @@ namespace Coffee.UIEffects
[SerializeField]
protected Vector2 m_TransitionTexSpeed = new Vector2(0, 0);
[Tooltip("Effect rotation (0–360).\n" +
"NOTE: This property is shared between `Transition Filter` and `Detail Filter`.")]
[SerializeField]
[Range(0, 360)]
private float m_TransitionRotation = 0;
[Tooltip("The effect maintains its aspect ratio.\n" +
"NOTE: This property is shared between `Transition Filter`, `Gradation Mode`, and `Detail Filter`.")]
[SerializeField]
protected bool m_TransitionKeepAspectRatio = true;
@@ -1393,13 +1397,13 @@ namespace Coffee.UIEffects
set => m_CustomRoot = value;
}
public override Flip flip
public Flip flip
{
get => m_Flip;
set
{
if (m_Flip == value) return;
m_Flip = value;
context.m_Flip = m_Flip = value;
SetVerticesDirty();
}
}
@@ -1714,6 +1718,11 @@ namespace Coffee.UIEffects
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
}
if (!append || src.m_Flip != 0)
{
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
}
Misc.SetDirty(dst);
UpdateContext(context);
SetVerticesDirty();
@@ -1838,6 +1847,11 @@ namespace Coffee.UIEffects
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
}
if (!append || src.m_Flip != 0)
{
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
}
Misc.SetDirty(dst);
UpdateContext(context);
SetVerticesDirty();
@@ -1960,6 +1974,11 @@ namespace Coffee.UIEffects
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
}
if (!append || src.m_Flip != 0)
{
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
}
Misc.SetDirty(dst);
}
@@ -2044,6 +2063,8 @@ namespace Coffee.UIEffects
dst.m_DetailTexScale = src.m_DetailTexScale;
dst.m_DetailTexOffset = src.m_DetailTexOffset;
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
dst.m_Flip = src.m_Flip;
}
}
}
+2 -8
View File
@@ -62,12 +62,6 @@ namespace Coffee.UIEffects
public virtual RectTransform transitionRoot => transform as RectTransform;
public virtual Flip flip
{
get => 0;
set { }
}
protected override void OnEnable()
{
_onBeforeCanvasRebuild ??= OnBeforeCanvasRebuild;
@@ -115,7 +109,7 @@ namespace Coffee.UIEffects
{
if (!_material || !graphic || context == null) return;
context.UpdateViewMatrix(GetCurrentMaterial(), transitionRoot, graphic.canvas.rootCanvas, flip);
context.UpdateViewMatrix(GetCurrentMaterial(), transitionRoot, graphic.canvas.rootCanvas);
}
public void ModifyMesh(Mesh mesh)
@@ -129,7 +123,7 @@ namespace Coffee.UIEffects
_canModifyMesh = CanModifyMesh();
if (_canModifyMesh)
{
context.ModifyMesh(graphic, transitionRoot, vh, canModifyShape, flip);
context.ModifyMesh(graphic, transitionRoot, vh, canModifyShape);
}
}
+12 -9
View File
@@ -238,6 +238,8 @@ namespace Coffee.UIEffects
public Vector2 m_DetailTexOffset;
public Vector2 m_DetailTexSpeed;
public Flip m_Flip;
public bool willModifyMaterial => m_ToneFilter != ToneFilter.None
|| m_ColorFilter != ColorFilter.None
|| m_SamplingFilter != SamplingFilter.None
@@ -383,6 +385,8 @@ namespace Coffee.UIEffects
dst.m_DetailTexScale = src.m_DetailTexScale;
dst.m_DetailTexOffset = src.m_DetailTexOffset;
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
dst.m_Flip = src.m_Flip;
}
public void SetGradationDirty()
@@ -520,7 +524,7 @@ namespace Coffee.UIEffects
material.SetFloat(s_EdgeShinyAutoPlaySpeed, enable ? m_EdgeShinyAutoPlaySpeed : 0);
}
public void UpdateViewMatrix(Material material, RectTransform transitionRoot, Canvas canvas, Flip flip)
public void UpdateViewMatrix(Material material, RectTransform transitionRoot, Canvas canvas)
{
if (!material) return;
@@ -531,10 +535,10 @@ namespace Coffee.UIEffects
scale.x = scale.y = Mathf.Min(scale.x, scale.y);
}
if (0 != (flip & Flip.Effect))
if (0 != (m_Flip & Flip.Effect))
{
scale.x = 0 != (flip & Flip.Horizontal) ? -scale.x : scale.x;
scale.y = 0 != (flip & Flip.Vertical) ? -scale.y : scale.y;
scale.x = 0 != (m_Flip & Flip.Horizontal) ? -scale.x : scale.x;
scale.y = 0 != (m_Flip & Flip.Vertical) ? -scale.y : scale.y;
}
var pivot = new Vector2(0.5f, 0.5f);
@@ -635,11 +639,10 @@ namespace Coffee.UIEffects
}
}
public void ModifyMesh(Graphic graphic, RectTransform transitionRoot, VertexHelper vh,
bool canModifyShape, Flip flip)
public void ModifyMesh(Graphic graphic, RectTransform transitionRoot, VertexHelper vh, bool canModifyShape)
{
// Apply flip (without effect).
ApplyFlipWithoutEffect(vh, flip);
ApplyFlipWithoutEffect(vh, m_Flip);
var count = vh.currentIndexCount;
if (!willModifyVertex || count == 0) return;
@@ -678,10 +681,10 @@ namespace Coffee.UIEffects
}
// Apply flip (with effect).
ApplyFlipWithEffect(verts, flip);
ApplyFlipWithEffect(verts, m_Flip);
// Apply shadow.
ApplyShadow(verts, transitionRoot, flip);
ApplyShadow(verts, transitionRoot, m_Flip);
vh.Clear();
vh.AddUIVertexTriangleStream(verts);
+2
View File
@@ -171,6 +171,8 @@ namespace Coffee.UIEffects
dst.m_DetailTexScale = src.m_DetailTexScale;
dst.m_DetailTexOffset = src.m_DetailTexOffset;
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
dst.m_Flip = src.m_Flip;
}
}
}
-2
View File
@@ -95,8 +95,6 @@ namespace Coffee.UIEffects
}
}
public override Flip flip => target ? target.flip : 0;
public override float actualSamplingScale => Mathf.Clamp(m_SamplingScale, 0.01f, 100);
public override bool canModifyShape => m_AllowToModifyMeshShape;
@@ -254,7 +254,6 @@ namespace Coffee.UIEffects
replica.target = pEffect;
replica.useTargetTransform = true;
replica.customRoot = null;
replica.flip = pEffect.flip;
}
else if (effect is UIEffectReplica pReplica && pReplica.isActiveAndEnabled)
{
@@ -262,7 +261,6 @@ namespace Coffee.UIEffects
replica.preset = pReplica.preset;
replica.useTargetTransform = pReplica.useTargetTransform;
replica.customRoot = pReplica.customRoot;
replica.flip = pReplica.flip;
}
else
{
+8 -8
View File
@@ -629,25 +629,25 @@ half4 apply_detail_filter(half4 color, float2 uvLocal)
half4 detail = tex2D(_DetailTex, uv);
#if DETAIL_MASKING // Detail.Masking
{
color *= inv_lerp(_DetailThreshold.x, _DetailThreshold.y, detail.a);
color.a *= inv_lerp(_DetailThreshold.x, _DetailThreshold.y, detail.a);
}
#elif DETAIL_MULTIPLY // Detail.Multiply
{
detail *= _DetailColor;
color.rgb *= detail.rgb;
color = lerp(inColor, color * detail.a, _DetailIntensity);
color = lerp(inColor, color, _DetailIntensity * detail.a);
}
#elif DETAIL_ADDITIVE // Detail.Additive
{
detail *= _DetailColor;
color.rgb += detail.rgb * detail.a * color.a;
color = lerp(inColor, color, _DetailIntensity);
color.rgb += detail.rgb * color.a;
color = lerp(inColor, color, _DetailIntensity * detail.a);
}
#elif DETAIL_SUBTRACTIVE // Detail.Subtractive
{
detail *= _DetailColor;
color.rgb -= detail.rgb * detail.a * color.a;
color = lerp(inColor, color, _DetailIntensity);
color.rgb -= detail.rgb * color.a;
color = lerp(inColor, color, _DetailIntensity * detail.a);
}
#elif DETAIL_REPLACE // Detail.Replace
{
@@ -658,8 +658,8 @@ half4 apply_detail_filter(half4 color, float2 uvLocal)
#elif DETAIL_MULTIPLY_ADDITIVE // Detail.MultiplyAdditive
{
detail *= _DetailColor;
color.rgb *= (1 + detail.rgb * detail.a);
color = lerp(inColor, color, _DetailIntensity);
color.rgb *= (1 + detail.rgb);
color = lerp(inColor, color, _DetailIntensity * detail.a);
}
#else
{
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "com.coffee.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!",
"version": "5.8.1",
"version": "5.8.2",
"unity": "2020.3",
"license": "MIT",
"repository": {