Profile editor - Changed approach to one timeline split into segments

This commit is contained in:
SpoinkyNL committed 2020-07-16 23:15:49 +02:00
1 parent 7cfe9a46ee
commit dc8ca8ee95
17 files changed
+287 -257

No files matched your search

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Models;
using Artemis.UI.Shared.Events;
@@ -15,7 +14,6 @@ namespace Artemis.UI.Shared.Services.Interfaces
Profile SelectedProfile { get; }
RenderProfileElement SelectedProfileElement { get; }
TimeSpan CurrentTime { get; set; }
Timeline CurrentTimeline { get; set; }
int PixelsPerSecond { get; set; }
IReadOnlyList<PropertyInputRegistration> RegisteredPropertyEditors { get; }
IKernel Kernel { get; }
@@ -55,12 +53,7 @@ namespace Artemis.UI.Shared.Services.Interfaces
/// Occurs when the current editor time is changed
/// </summary>
event EventHandler CurrentTimeChanged;
/// <summary>
/// Occurs when the current editor timeline is changed
/// </summary>
event EventHandler CurrentTimelineChanged;
/// <summary>
/// Occurs when the pixels per second (zoom level) is changed
/// </summary>
@@ -25,7 +25,6 @@ namespace Artemis.UI.Shared.Services
private TimeSpan _currentTime;
private TimeSpan _lastUpdateTime;
private int _pixelsPerSecond;
private Timeline _currentTimeline;
public ProfileEditorService(ICoreService coreService, IProfileService profileService, IKernel kernel, ILogger logger)
{
@@ -49,24 +48,15 @@ namespace Artemis.UI.Shared.Services
set
{
if (_currentTime.Equals(value)) return;
_currentTime = value;
if (value > SelectedProfileElement.TimelineLength)
_currentTime = SelectedProfileElement.TimelineLength;
else
_currentTime = value;
UpdateProfilePreview();
OnCurrentTimeChanged();
}
}
public Timeline CurrentTimeline
{
get => _currentTimeline;
set
{
if (_currentTimeline.Equals(value)) return;
_currentTimeline = value;
UpdateProfilePreview();
OnCurrentTimelineChanged();
}
}
public int PixelsPerSecond
{
get => _pixelsPerSecond;
@@ -126,14 +116,12 @@ namespace Artemis.UI.Shared.Services
var delta = CurrentTime - _lastUpdateTime;
foreach (var folder in SelectedProfile.GetAllFolders())
{
folder.CurrentTimeline = CurrentTimeline;
foreach (var baseLayerEffect in folder.LayerEffects)
baseLayerEffect.Update(delta.TotalSeconds);
}
foreach (var layer in SelectedProfile.GetAllLayers())
{
layer.CurrentTimeline = CurrentTimeline;
layer.OverrideProgress(CurrentTime);
layer.LayerBrush?.Update(delta.TotalSeconds);
foreach (var baseLayerEffect in layer.LayerEffects)