Color brush - Added linear gradient rotation

Profile editor - Updated conditions UI
This commit is contained in:
SpoinkyNL committed 2020-08-03 22:41:13 +02:00
1 parent 7b1cefca8b
commit 10c839f8c9
21 files changed
+400 -150

No files matched your search

+13 -12
View File
@@ -21,6 +21,7 @@ namespace Artemis.Core.Models.Profile
Parent = parent;
Name = name;
Enabled = true;
DisplayContinuously = true;
_layerEffects = new List<BaseLayerEffect>();
_expandedPropertyGroups = new List<string>();
@@ -95,7 +96,7 @@ namespace Artemis.Core.Models.Profile
if (stickToMainSegment)
{
if (!RepeatMainSegment)
if (!DisplayContinuously)
{
var position = timeOverride + StartSegmentLength;
if (position > StartSegmentLength + EndSegmentLength)
@@ -146,6 +147,16 @@ namespace Artemis.Core.Models.Profile
folderPath.Transform(SKMatrix.MakeTranslation(folderPath.Bounds.Left * -1, folderPath.Bounds.Top * -1));
var targetLocation = Path.Bounds.Location;
if (Parent is Folder parentFolder)
targetLocation -= parentFolder.Path.Bounds.Location;
canvas.Save();
using var clipPath = new SKPath(folderPath);
clipPath.Transform(SKMatrix.MakeTranslation(targetLocation.X, targetLocation.Y));
canvas.ClipPath(clipPath);
foreach (var baseLayerEffect in LayerEffects.Where(e => e.Enabled))
baseLayerEffect.PreProcess(folderCanvas, _folderBitmap.Info, folderPath, folderPaint);
@@ -161,17 +172,7 @@ namespace Artemis.Core.Models.Profile
profileElement.Render(deltaTime, folderCanvas, _folderBitmap.Info);
folderCanvas.Restore();
}
var targetLocation = Path.Bounds.Location;
if (Parent is Folder parentFolder)
targetLocation -= parentFolder.Path.Bounds.Location;
canvas.Save();
using var clipPath = new SKPath(folderPath);
clipPath.Transform(SKMatrix.MakeTranslation(targetLocation.X, targetLocation.Y));
canvas.ClipPath(clipPath);
foreach (var baseLayerEffect in LayerEffects.Where(e => e.Enabled))
baseLayerEffect.PostProcess(canvas, canvasInfo, folderPath, folderPaint);
canvas.DrawBitmap(_folderBitmap, targetLocation, folderPaint);
+7 -3
View File
@@ -39,6 +39,7 @@ namespace Artemis.Core.Models.Profile
Parent = parent;
Name = name;
Enabled = true;
DisplayContinuously = true;
General = new LayerGeneralProperties {IsCorePropertyGroup = true};
Transform = new LayerTransformProperties {IsCorePropertyGroup = true};
@@ -131,8 +132,11 @@ namespace Artemis.Core.Models.Profile
keyframes.AddRange(baseLayerProperty.BaseKeyframes);
foreach (var baseLayerProperty in Transform.GetAllLayerProperties())
keyframes.AddRange(baseLayerProperty.BaseKeyframes);
foreach (var baseLayerProperty in LayerBrush.BaseProperties.GetAllLayerProperties())
keyframes.AddRange(baseLayerProperty.BaseKeyframes);
if (LayerBrush?.BaseProperties != null)
{
foreach (var baseLayerProperty in LayerBrush.BaseProperties.GetAllLayerProperties())
keyframes.AddRange(baseLayerProperty.BaseKeyframes);
}
return keyframes;
}
@@ -246,7 +250,7 @@ namespace Artemis.Core.Models.Profile
if (stickToMainSegment)
{
if (!RepeatMainSegment)
if (!DisplayContinuously)
{
var position = timeOverride + StartSegmentLength;
if (position > StartSegmentLength + EndSegmentLength)
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Events;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Storage.Entities.Profile;
@@ -102,61 +103,61 @@ namespace Artemis.Core.Models.Profile.LayerProperties
/// <summary>
/// Occurs once every frame when the layer property is updated
/// </summary>
public event EventHandler Updated;
public event EventHandler<LayerPropertyEventArgs> Updated;
/// <summary>
/// Occurs when the base value of the layer property was updated
/// </summary>
public event EventHandler BaseValueChanged;
public event EventHandler<LayerPropertyEventArgs> BaseValueChanged;
/// <summary>
/// Occurs when the <see cref="IsHidden" /> value of the layer property was updated
/// </summary>
public event EventHandler VisibilityChanged;
public event EventHandler<LayerPropertyEventArgs> VisibilityChanged;
/// <summary>
/// Occurs when keyframes are enabled/disabled
/// </summary>
public event EventHandler KeyframesToggled;
public event EventHandler<LayerPropertyEventArgs> KeyframesToggled;
/// <summary>
/// Occurs when a new keyframe was added to the layer property
/// </summary>
public event EventHandler KeyframeAdded;
public event EventHandler<LayerPropertyEventArgs> KeyframeAdded;
/// <summary>
/// Occurs when a keyframe was removed from the layer property
/// </summary>
public event EventHandler KeyframeRemoved;
public event EventHandler<LayerPropertyEventArgs> KeyframeRemoved;
protected virtual void OnUpdated()
{
Updated?.Invoke(this, EventArgs.Empty);
Updated?.Invoke(this, new LayerPropertyEventArgs(this));
}
protected virtual void OnBaseValueChanged()
{
BaseValueChanged?.Invoke(this, EventArgs.Empty);
BaseValueChanged?.Invoke(this, new LayerPropertyEventArgs(this));
}
protected virtual void OnVisibilityChanged()
{
VisibilityChanged?.Invoke(this, EventArgs.Empty);
VisibilityChanged?.Invoke(this, new LayerPropertyEventArgs(this));
}
protected virtual void OnKeyframesToggled()
{
KeyframesToggled?.Invoke(this, EventArgs.Empty);
KeyframesToggled?.Invoke(this, new LayerPropertyEventArgs(this));
}
protected virtual void OnKeyframeAdded()
{
KeyframeAdded?.Invoke(this, EventArgs.Empty);
KeyframeAdded?.Invoke(this, new LayerPropertyEventArgs(this));
}
protected virtual void OnKeyframeRemoved()
{
KeyframeRemoved?.Invoke(this, EventArgs.Empty);
KeyframeRemoved?.Invoke(this, new LayerPropertyEventArgs(this));
}
#endregion
@@ -253,13 +253,29 @@ namespace Artemis.Core.Models.Profile
}
instance.ApplyToLayerProperty(entity, this, fromStorage);
instance.BaseValueChanged += InstanceOnBaseValueChanged;
}
private void InstanceOnBaseValueChanged(object sender, EventArgs e)
{
OnLayerPropertyBaseValueChanged(new LayerPropertyEventArgs((BaseLayerProperty) sender));
}
#region Events
internal event EventHandler PropertyGroupUpdating;
/// <summary>
/// Occurs when the property group has initialized all its children
/// </summary>
public event EventHandler PropertyGroupInitialized;
/// <summary>
/// Occurs when one of the base value of one of the layer properties in this group changes
/// <para>Note: Will not trigger on properties in child groups</para>
/// </summary>
public event EventHandler<LayerPropertyEventArgs> LayerPropertyBaseValueChanged;
/// <summary>
/// Occurs when the <see cref="IsHidden" /> value of the layer property was updated
/// </summary>
@@ -275,6 +291,11 @@ namespace Artemis.Core.Models.Profile
VisibilityChanged?.Invoke(this, EventArgs.Empty);
}
protected virtual void OnLayerPropertyBaseValueChanged(LayerPropertyEventArgs e)
{
LayerPropertyBaseValueChanged?.Invoke(this, e);
}
#endregion
}
}
@@ -25,7 +25,7 @@ namespace Artemis.Core.Models.Profile
StartSegmentLength = RenderElementEntity.StartSegmentLength;
MainSegmentLength = RenderElementEntity.MainSegmentLength;
EndSegmentLength = RenderElementEntity.EndSegmentLength;
RepeatMainSegment = RenderElementEntity.RepeatMainSegment;
DisplayContinuously = RenderElementEntity.DisplayContinuously;
AlwaysFinishTimeline = RenderElementEntity.AlwaysFinishTimeline;
}
@@ -34,7 +34,7 @@ namespace Artemis.Core.Models.Profile
RenderElementEntity.StartSegmentLength = StartSegmentLength;
RenderElementEntity.MainSegmentLength = MainSegmentLength;
RenderElementEntity.EndSegmentLength = EndSegmentLength;
RenderElementEntity.RepeatMainSegment = RepeatMainSegment;
RenderElementEntity.DisplayContinuously = DisplayContinuously;
RenderElementEntity.AlwaysFinishTimeline = AlwaysFinishTimeline;
RenderElementEntity.LayerEffects.Clear();
@@ -127,7 +127,7 @@ namespace Artemis.Core.Models.Profile
private TimeSpan _startSegmentLength;
private TimeSpan _mainSegmentLength;
private TimeSpan _endSegmentLength;
private bool _repeatMainSegment;
private bool _displayContinuously;
private bool _alwaysFinishTimeline;
/// <summary>
@@ -174,10 +174,10 @@ namespace Artemis.Core.Models.Profile
/// <summary>
/// Gets or sets whether main timeline should repeat itself as long as display conditions are met
/// </summary>
public bool RepeatMainSegment
public bool DisplayContinuously
{
get => _repeatMainSegment;
set => SetAndNotify(ref _repeatMainSegment, value);
get => _displayContinuously;
set => SetAndNotify(ref _displayContinuously, value);
}
/// <summary>
@@ -201,7 +201,7 @@ namespace Artemis.Core.Models.Profile
if (DisplayConditionMet)
{
// If we are at the end of the main timeline, wrap around back to the beginning
if (RepeatMainSegment && TimelinePosition >= mainSegmentEnd)
if (DisplayContinuously && TimelinePosition >= mainSegmentEnd)
TimelinePosition = StartSegmentLength + (mainSegmentEnd - TimelinePosition);
else if (TimelinePosition >= TimelineLength)
TimelinePosition = TimelineLength;