mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Folders - Improved how conditions on folder children are handled
Timeline - Fixed exception when main segment length is 0 on repeat play mode Profile editor - Only repeat non-selected elements if their timeline is configured that way Per LED brushes - Fixed opacity not being applied Intro profile - Updated for timelines
This commit is contained in:
1 parent
458fd2a704
commit
383b8f7b8d
6 files changed
+381
-198
No files matched your search
@@ -52,16 +52,15 @@ namespace Artemis.Core
|
||||
_expandedPropertyGroups = new List<string>();
|
||||
|
||||
Load();
|
||||
UpdateChildrenTimelineLength();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether this folder is at the root of the profile tree
|
||||
/// Gets a boolean indicating whether this folder is at the root of the profile tree
|
||||
/// </summary>
|
||||
public bool IsRootFolder => Parent == Profile;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the longest timeline of all this folders children
|
||||
/// Gets the longest timeline of all this folders children
|
||||
/// </summary>
|
||||
public Timeline LongestChildTimeline { get; private set; }
|
||||
|
||||
@@ -112,7 +111,6 @@ namespace Artemis.Core
|
||||
throw new ObjectDisposedException("Folder");
|
||||
|
||||
base.AddChild(child, order);
|
||||
UpdateChildrenTimelineLength();
|
||||
CalculateRenderProperties();
|
||||
}
|
||||
|
||||
@@ -123,7 +121,6 @@ namespace Artemis.Core
|
||||
throw new ObjectDisposedException("Folder");
|
||||
|
||||
base.RemoveChild(child);
|
||||
UpdateChildrenTimelineLength();
|
||||
CalculateRenderProperties();
|
||||
}
|
||||
|
||||
@@ -151,23 +148,6 @@ namespace Artemis.Core
|
||||
OnRenderPropertiesUpdated();
|
||||
}
|
||||
|
||||
private void UpdateChildrenTimelineLength()
|
||||
{
|
||||
Timeline longest = new Timeline() {MainSegmentLength = TimeSpan.Zero};
|
||||
foreach (ProfileElement profileElement in Children)
|
||||
{
|
||||
if (profileElement is Folder folder && folder.LongestChildTimeline.Length > longest.Length)
|
||||
longest = folder.LongestChildTimeline;
|
||||
else if (profileElement is Layer layer &&
|
||||
layer.Timeline.PlayMode == TimelinePlayMode.Once &&
|
||||
layer.Timeline.StopMode == TimelineStopMode.Finish &&
|
||||
layer.Timeline.Length > longest.Length)
|
||||
longest = layer.Timeline;
|
||||
}
|
||||
|
||||
LongestChildTimeline = longest;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
Disposed = true;
|
||||
@@ -231,6 +211,10 @@ namespace Artemis.Core
|
||||
if (Path == null)
|
||||
return;
|
||||
|
||||
// No point rendering if none of the children are going to render
|
||||
if (!Children.Any(c => c is RenderProfileElement renderElement && !renderElement.Timeline.IsFinished))
|
||||
return;
|
||||
|
||||
RenderFolder(Timeline, canvas, canvasInfo);
|
||||
}
|
||||
|
||||
@@ -245,9 +229,6 @@ namespace Artemis.Core
|
||||
|
||||
private void RenderFolder(Timeline timeline, SKCanvas canvas, SKImageInfo canvasInfo)
|
||||
{
|
||||
if (Timeline.IsFinished && LongestChildTimeline.IsFinished)
|
||||
return;
|
||||
|
||||
PrepareForRender(timeline);
|
||||
|
||||
if (_folderBitmap == null)
|
||||
|
||||
@@ -250,7 +250,7 @@ namespace Artemis.Core
|
||||
#endregion
|
||||
|
||||
#region Rendering
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
@@ -325,11 +325,7 @@ namespace Artemis.Core
|
||||
|
||||
using SKPath layerPath = new SKPath(Path);
|
||||
using SKCanvas layerCanvas = new SKCanvas(_layerBitmap);
|
||||
using SKPaint layerPaint = new SKPaint
|
||||
{
|
||||
FilterQuality = SKFilterQuality.Low,
|
||||
Color = new SKColor(0, 0, 0, (byte) (Transform.Opacity.CurrentValue * 2.55f))
|
||||
};
|
||||
using SKPaint layerPaint = new SKPaint {FilterQuality = SKFilterQuality.Low};
|
||||
layerCanvas.Clear();
|
||||
|
||||
layerPath.Transform(SKMatrix.MakeTranslation(layerPath.Bounds.Left * -1, layerPath.Bounds.Top * -1));
|
||||
@@ -348,7 +344,11 @@ namespace Artemis.Core
|
||||
else if (General.ResizeMode.CurrentValue == LayerResizeMode.Clip)
|
||||
ClipRender(layerCanvas, _layerBitmap.Info, layerPaint, layerPath);
|
||||
|
||||
using SKPaint canvasPaint = new SKPaint {BlendMode = General.BlendMode.CurrentValue};
|
||||
using SKPaint canvasPaint = new SKPaint
|
||||
{
|
||||
BlendMode = General.BlendMode.CurrentValue,
|
||||
Color = new SKColor(0, 0, 0, (byte) (Transform.Opacity.CurrentValue * 2.55f))
|
||||
};
|
||||
foreach (BaseLayerEffect baseLayerEffect in LayerEffects.Where(e => e.Enabled))
|
||||
baseLayerEffect.PostProcess(layerCanvas, _layerBitmap.Info, layerPath, canvasPaint);
|
||||
|
||||
|
||||
@@ -320,6 +320,9 @@ namespace Artemis.Core
|
||||
}
|
||||
|
||||
bool conditionMet = DisplayCondition.Evaluate();
|
||||
if (Parent is RenderProfileElement parent && !parent.DisplayConditionMet)
|
||||
conditionMet = false;
|
||||
|
||||
if (!DisplayCondition.ContainsEvents)
|
||||
{
|
||||
// Regular conditions reset the timeline whenever their condition is met and was not met before that
|
||||
|
||||
@@ -293,7 +293,14 @@ namespace Artemis.Core
|
||||
Position += delta;
|
||||
|
||||
if (stickToMainSegment && Position >= MainSegmentStartPosition)
|
||||
Position = MainSegmentStartPosition + TimeSpan.FromMilliseconds(Position.TotalMilliseconds % MainSegmentLength.TotalMilliseconds);
|
||||
{
|
||||
// If the main segment has no length, simply stick to the start of the segment
|
||||
if (MainSegmentLength == TimeSpan.Zero)
|
||||
Position = MainSegmentStartPosition;
|
||||
// Ensure wrapping back around retains the delta time
|
||||
else
|
||||
Position = MainSegmentStartPosition + TimeSpan.FromMilliseconds(Position.TotalMilliseconds % MainSegmentLength.TotalMilliseconds);
|
||||
}
|
||||
|
||||
foreach (Timeline extraTimeline in _extraTimelines)
|
||||
extraTimeline.Update(delta, false);
|
||||
|
||||
Reference in new issue
Block a user