mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Layer brushes - Render now always originates from 0,0
RGB.NET brushes - GetBrush is no called after properties are initialized Profile editor - Fixed inputs not responding to updates from the visualization tools when keyframes are disabled
This commit is contained in:
parent
72485e5d71
commit
97c85e238c
@ -207,12 +207,12 @@ namespace Artemis.Core.Models.Profile
|
||||
if (LayerBrush?.BaseProperties == null || !LayerBrush.BaseProperties.PropertiesInitialized)
|
||||
return;
|
||||
|
||||
// TODO: Remove, this is slow and stupid
|
||||
// For now, reset all keyframe engines after the last keyframe was hit
|
||||
// This is a placeholder method of repeating the animation until repeat modes are implemented
|
||||
var properties = new List<BaseLayerProperty>(General.GetAllLayerProperties().Where(p => p.BaseKeyframes.Any()));
|
||||
properties.AddRange(Transform.GetAllLayerProperties().Where(p => p.BaseKeyframes.Any()));
|
||||
properties.AddRange(LayerBrush.BaseProperties.GetAllLayerProperties().Where(p => p.BaseKeyframes.Any()));
|
||||
|
||||
// For now, reset all keyframe engines after the last keyframe was hit
|
||||
// This is a placeholder method of repeating the animation until repeat modes are implemented
|
||||
var timeLineEnd = properties.Any() ? properties.Max(p => p.BaseKeyframes.Max(k => k.Position)) : TimeSpan.MaxValue;
|
||||
if (properties.Any(p => p.TimelineProgress >= timeLineEnd))
|
||||
{
|
||||
@ -240,8 +240,12 @@ namespace Artemis.Core.Models.Profile
|
||||
/// <inheritdoc />
|
||||
public override void Render(double deltaTime, SKCanvas canvas, SKImageInfo canvasInfo)
|
||||
{
|
||||
// Ensure the layer is ready
|
||||
if (Path == null || LayerShape?.Path == null || !General.PropertiesInitialized || !Transform.PropertiesInitialized)
|
||||
return;
|
||||
// Ensure the brush is ready
|
||||
if (LayerBrush?.BaseProperties?.PropertiesInitialized == false || LayerBrush?.BrushType != LayerBrushType.Regular)
|
||||
return;
|
||||
|
||||
canvas.Save();
|
||||
canvas.ClipPath(Path);
|
||||
@ -269,9 +273,6 @@ namespace Artemis.Core.Models.Profile
|
||||
|
||||
private void StretchRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPaint paint)
|
||||
{
|
||||
if (LayerBrush == null || !LayerBrush.BaseProperties.PropertiesInitialized || LayerBrush.BrushType != LayerBrushType.Regular)
|
||||
return;
|
||||
|
||||
// Apply transformations
|
||||
var sizeProperty = Transform.Scale.CurrentValue;
|
||||
var rotationProperty = Transform.Rotation.CurrentValue;
|
||||
@ -293,9 +294,6 @@ namespace Artemis.Core.Models.Profile
|
||||
|
||||
private void ClipRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPaint paint)
|
||||
{
|
||||
if (LayerBrush == null || !LayerBrush.BaseProperties.PropertiesInitialized || LayerBrush.BrushType != LayerBrushType.Regular)
|
||||
return;
|
||||
|
||||
// Apply transformations
|
||||
var sizeProperty = Transform.Scale.CurrentValue;
|
||||
var rotationProperty = Transform.Rotation.CurrentValue;
|
||||
|
||||
@ -26,6 +26,11 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
|
||||
internal override void InternalRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
{
|
||||
// Move the canvas to the top-left of the render path
|
||||
canvas.Translate(path.Bounds.Left, path.Bounds.Top);
|
||||
// Pass the render path to the layer brush positioned at 0,0
|
||||
path.Transform(SKMatrix.MakeTranslation(path.Bounds.Left * -1, path.Bounds.Top * -1));
|
||||
|
||||
Render(canvas, canvasInfo, path, paint);
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
|
||||
Layer = layer;
|
||||
Layer.RenderPropertiesUpdated += LayerOnRenderPropertiesUpdated;
|
||||
UpdateLedGroup();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -59,6 +58,7 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
internal override void Initialize(ILayerService layerService)
|
||||
{
|
||||
InitializeProperties(layerService);
|
||||
UpdateLedGroup();
|
||||
}
|
||||
|
||||
// Not used in this brush type
|
||||
|
||||
@ -14,6 +14,7 @@ namespace Artemis.UI.Shared.PropertyInput
|
||||
LayerProperty = layerProperty;
|
||||
ProfileEditorService = profileEditorService;
|
||||
LayerProperty.Updated += LayerPropertyOnUpdated;
|
||||
LayerProperty.BaseValueChanged += LayerPropertyOnUpdated;
|
||||
UpdateInputValue();
|
||||
}
|
||||
|
||||
@ -22,6 +23,7 @@ namespace Artemis.UI.Shared.PropertyInput
|
||||
LayerProperty = layerProperty;
|
||||
ProfileEditorService = profileEditorService;
|
||||
LayerProperty.Updated += LayerPropertyOnUpdated;
|
||||
LayerProperty.BaseValueChanged += LayerPropertyOnUpdated;
|
||||
UpdateInputValue();
|
||||
}
|
||||
|
||||
@ -43,6 +45,7 @@ namespace Artemis.UI.Shared.PropertyInput
|
||||
public virtual void Dispose()
|
||||
{
|
||||
LayerProperty.Updated -= LayerPropertyOnUpdated;
|
||||
LayerProperty.BaseValueChanged -= LayerPropertyOnUpdated;
|
||||
}
|
||||
|
||||
protected virtual void OnInputValueApplied()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user