mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-19 17:22:37 +08:00
fix: Flip is ignored when loading a preset
This commit is contained in:
@@ -1393,13 +1393,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 +1714,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 +1843,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 +1970,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 +2059,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user