1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Profiles - Fixed elements updating while disabled

This commit is contained in:
Robert 2022-11-26 22:59:24 +01:00
parent b607690286
commit 6b6ea0f973
2 changed files with 71 additions and 53 deletions

View File

@ -99,6 +99,8 @@ public sealed class Folder : RenderProfileElement
return;
}
try
{
UpdateDisplayCondition();
UpdateTimeline(deltaTime);
@ -113,6 +115,11 @@ public sealed class Folder : RenderProfileElement
foreach (ProfileElement child in Children)
child.Update(deltaTime);
}
finally
{
Timeline.ClearDelta();
}
}
/// <inheritdoc />
public override void Reset()
@ -224,8 +231,6 @@ public sealed class Folder : RenderProfileElement
canvas.Restore();
layerPaint.DisposeSelfAndProperties();
}
Timeline.ClearDelta();
}
#endregion
@ -233,8 +238,10 @@ public sealed class Folder : RenderProfileElement
/// <inheritdoc />
public override void Enable()
{
// No checks here, effects will do their own checks to ensure they never enable twice
// Also not enabling children, they'll enable themselves during their own Update
if (!Enabled)
return;
// Not enabling children, they'll enable themselves during their own Update
foreach (BaseLayerEffect baseLayerEffect in LayerEffects)
baseLayerEffect.InternalEnable();
@ -244,7 +251,9 @@ public sealed class Folder : RenderProfileElement
/// <inheritdoc />
public override void Disable()
{
// No checks here, effects will do their own checks to ensure they never disable twice
if (!Enabled)
return;
foreach (BaseLayerEffect baseLayerEffect in LayerEffects)
baseLayerEffect.InternalDisable();

View File

@ -370,6 +370,8 @@ public sealed class Layer : RenderProfileElement
return;
}
try
{
UpdateDisplayCondition();
UpdateTimeline(deltaTime);
@ -378,7 +380,7 @@ public sealed class Layer : RenderProfileElement
else if (Suspended || (Timeline.IsFinished && !_renderCopies.Any()))
Disable();
if (Timeline.Delta == TimeSpan.Zero)
if (!Enabled || Timeline.Delta == TimeSpan.Zero)
return;
General.Update(Timeline);
@ -407,6 +409,11 @@ public sealed class Layer : RenderProfileElement
}
}
}
finally
{
Timeline.ClearDelta();
}
}
/// <inheritdoc />
public override void Render(SKCanvas canvas, SKPointI basePosition, ProfileElement? editorFocus)
@ -485,8 +492,6 @@ public sealed class Layer : RenderProfileElement
{
layerPaint.DisposeSelfAndProperties();
}
Timeline.ClearDelta();
}
private void RenderCopies(SKCanvas canvas, SKPointI basePosition)
@ -498,7 +503,9 @@ public sealed class Layer : RenderProfileElement
/// <inheritdoc />
public override void Enable()
{
// No checks here, the brush and effects will do their own checks to ensure they never enable twice
if (Enabled)
return;
bool tryOrBreak = TryOrBreak(() => LayerBrush?.InternalEnable(), "Failed to enable layer brush");
if (!tryOrBreak)
return;
@ -517,7 +524,9 @@ public sealed class Layer : RenderProfileElement
/// <inheritdoc />
public override void Disable()
{
// No checks here, the brush and effects will do their own checks to ensure they never disable twice
if (!Enabled)
return;
LayerBrush?.InternalDisable();
foreach (BaseLayerEffect baseLayerEffect in LayerEffects)
baseLayerEffect.InternalDisable();