diff --git a/src/Artemis.UI/Screens/Modules/Tabs/ActivationRequirementsViewModel.cs b/src/Artemis.UI/Screens/Modules/Tabs/ActivationRequirementsViewModel.cs
index 4a77305ef..eb68da1e4 100644
--- a/src/Artemis.UI/Screens/Modules/Tabs/ActivationRequirementsViewModel.cs
+++ b/src/Artemis.UI/Screens/Modules/Tabs/ActivationRequirementsViewModel.cs
@@ -29,6 +29,8 @@ namespace Artemis.UI.Screens.Modules.Tabs
{
Items.Clear();
Items.AddRange(Module.ActivationRequirements.Select(_moduleVmFactory.CreateActivationRequirementViewModel));
+
+ base.OnActivate();
}
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
index 3908cac1c..63d83a3a2 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
@@ -10,6 +10,7 @@
xmlns:utilities="clr-namespace:Artemis.UI.Utilities"
xmlns:layerProperties="clr-namespace:Artemis.UI.Screens.ProfileEditor.LayerProperties"
xmlns:controls="clr-namespace:Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Controls"
+ xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
x:Class="Artemis.UI.Screens.ProfileEditor.LayerProperties.LayerPropertiesView"
mc:Ignorable="d"
d:DesignHeight="450"
@@ -112,12 +113,35 @@
-
-
-
+
+
+
+
+
+
+
+ Don't repeat the timeline
+ This setting only applies to the editor and affect the repeat mode during profile use
+
+
+
+
+
+
+
+
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs
index d796b833b..1015fd9a1 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs
@@ -25,8 +25,10 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
private readonly ILayerPropertyVmFactory _layerPropertyVmFactory;
private LayerPropertyGroupViewModel _brushPropertyGroup;
private bool _playing;
+ private bool _repeating;
+ private bool _repeatSegment;
+ private bool _repeatTimeline = true;
private int _propertyTreeIndex;
- private bool _repeatAfterLastKeyframe;
private int _rightSideIndex;
private RenderProfileElement _selectedProfileElement;
@@ -89,10 +91,22 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
set => SetAndNotify(ref _playing, value);
}
- public bool RepeatAfterLastKeyframe
+ public bool Repeating
{
- get => _repeatAfterLastKeyframe;
- set => SetAndNotify(ref _repeatAfterLastKeyframe, value);
+ get => _repeating;
+ set => SetAndNotify(ref _repeating, value);
+ }
+
+ public bool RepeatSegment
+ {
+ get => _repeatSegment;
+ set => SetAndNotify(ref _repeatSegment, value);
+ }
+
+ public bool RepeatTimeline
+ {
+ get => _repeatTimeline;
+ set => SetAndNotify(ref _repeatTimeline, value);
}
public string FormattedCurrentTime => $"{Math.Floor(ProfileEditorService.CurrentTime.TotalSeconds):00}.{ProfileEditorService.CurrentTime.Milliseconds:000}";
@@ -486,6 +500,27 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
ProfileEditorService.CurrentTime = TimeSpan.FromMilliseconds(newTime);
}
+ public void CycleRepeating()
+ {
+ if (!Repeating)
+ {
+ RepeatTimeline = true;
+ RepeatSegment = false;
+ Repeating = true;
+ }
+ else if (RepeatTimeline)
+ {
+ RepeatTimeline = false;
+ RepeatSegment = true;
+ }
+ else if (RepeatSegment)
+ {
+ RepeatTimeline = true;
+ RepeatSegment = false;
+ Repeating = false;
+ }
+ }
+
private TimeSpan CalculateEndTime()
{
var keyframeViewModels = LayerPropertyGroups.SelectMany(g => g.GetAllKeyframeViewModels(false)).ToList();
@@ -497,19 +532,50 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
return keyframeViewModels.Max(k => k.Position).Add(TimeSpan.FromSeconds(10));
}
+ private TimeSpan GetCurrentSegmentStart()
+ {
+ var current = ProfileEditorService.CurrentTime;
+ if (current < StartTimelineSegmentViewModel.SegmentEnd)
+ return StartTimelineSegmentViewModel.SegmentStart;
+ if (current < MainTimelineSegmentViewModel.SegmentEnd)
+ return MainTimelineSegmentViewModel.SegmentStart;
+ if (current < EndTimelineSegmentViewModel.SegmentEnd)
+ return EndTimelineSegmentViewModel.SegmentStart;
+
+ return TimeSpan.Zero;
+ }
+
+ private TimeSpan GetCurrentSegmentEnd()
+ {
+ var current = ProfileEditorService.CurrentTime;
+ if (current < StartTimelineSegmentViewModel.SegmentEnd)
+ return StartTimelineSegmentViewModel.SegmentEnd;
+ if (current < MainTimelineSegmentViewModel.SegmentEnd)
+ return MainTimelineSegmentViewModel.SegmentEnd;
+ if (current < EndTimelineSegmentViewModel.SegmentEnd)
+ return EndTimelineSegmentViewModel.SegmentEnd;
+
+ return TimeSpan.Zero;
+ }
+
private void CoreServiceOnFrameRendering(object sender, FrameRenderingEventArgs e)
{
Execute.PostToUIThread(() =>
{
var newTime = ProfileEditorService.CurrentTime.Add(TimeSpan.FromSeconds(e.DeltaTime));
- if (RepeatAfterLastKeyframe)
+ if (Repeating && RepeatTimeline)
{
- if (newTime > CalculateEndTime().Subtract(TimeSpan.FromSeconds(10)))
+ if (newTime > SelectedProfileElement.TimelineLength)
newTime = TimeSpan.Zero;
}
- else if (newTime > CalculateEndTime())
+ else if (Repeating && RepeatSegment)
{
- newTime = CalculateEndTime();
+ if (newTime > GetCurrentSegmentEnd())
+ newTime = GetCurrentSegmentStart();
+ }
+ else if (newTime > SelectedProfileElement.TimelineLength)
+ {
+ newTime = SelectedProfileElement.TimelineLength;
Pause();
}
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelinePropertyView.xaml b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelinePropertyView.xaml
index 4edbc83ac..5fa7f7181 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelinePropertyView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelinePropertyView.xaml
@@ -3,13 +3,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:timeline="clr-namespace:Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
- MinWidth="{Binding Width}"
HorizontalAlignment="Stretch">
e)
@@ -87,11 +85,6 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
UpdateKeyframes();
}
- private void ProfileEditorServiceOnPixelsPerSecondChanged(object sender, EventArgs e)
- {
- Width = GetAllKeyframeViewModels().Max(k => k.Position.TotalSeconds * _profileEditorService.PixelsPerSecond + 25);
- }
-
private void UpdateKeyframes()
{
// Only show keyframes if they are enabled
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineSegmentViewModel.cs
index 6bcd63afe..06bc9b6be 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineSegmentViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineSegmentViewModel.cs
@@ -18,6 +18,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
private bool _showRepeatButton;
private bool _showSegmentName;
private TimeSpan _segmentLength;
+ private TimeSpan _segmentStart;
+ private TimeSpan _segmentEnd;
private double _segmentWidth;
private bool _segmentEnabled;
private double _segmentStartPosition;
@@ -59,6 +61,18 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
set => SetAndNotify(ref _segmentLength, value);
}
+ public TimeSpan SegmentStart
+ {
+ get => _segmentStart;
+ set => SetAndNotify(ref _segmentStart, value);
+ }
+
+ public TimeSpan SegmentEnd
+ {
+ get => _segmentEnd;
+ set => SetAndNotify(ref _segmentEnd, value);
+ }
+
public double SegmentWidth
{
get => _segmentWidth;
@@ -134,6 +148,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
if (SelectedProfileElement == null)
{
SegmentLength = TimeSpan.Zero;
+ SegmentStart = TimeSpan.Zero;
+ SegmentEnd = TimeSpan.Zero;
SegmentStartPosition = 0;
SegmentWidth = 0;
SegmentEnabled = false;
@@ -143,21 +159,22 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
if (Segment == SegmentViewModelType.Start)
{
SegmentLength = SelectedProfileElement.StartSegmentLength;
- SegmentStartPosition = 0;
+ SegmentStart = TimeSpan.Zero;
}
else if (Segment == SegmentViewModelType.Main)
{
SegmentLength = SelectedProfileElement.MainSegmentLength;
- SegmentStartPosition = ProfileEditorService.PixelsPerSecond * SelectedProfileElement.StartSegmentLength.TotalSeconds;
+ SegmentStart = SelectedProfileElement.StartSegmentLength;
}
else if (Segment == SegmentViewModelType.End)
{
SegmentLength = SelectedProfileElement.EndSegmentLength;
- SegmentStartPosition = ProfileEditorService.PixelsPerSecond * (SelectedProfileElement.StartSegmentLength.TotalSeconds +
- SelectedProfileElement.MainSegmentLength.TotalSeconds);
+ SegmentStart = SelectedProfileElement.StartSegmentLength + SelectedProfileElement.MainSegmentLength;
}
- SegmentWidth = ProfileEditorService.PixelsPerSecond * SegmentLength.TotalSeconds;
+ SegmentEnd = SegmentStart + SegmentLength;
+ SegmentStartPosition = SegmentStart.TotalSeconds * ProfileEditorService.PixelsPerSecond;
+ SegmentWidth = SegmentLength.TotalSeconds * ProfileEditorService.PixelsPerSecond;
SegmentEnabled = SegmentLength != TimeSpan.Zero;
UpdateHeader();
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineViewModel.cs
index b9e91da3c..3d1e8f37e 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineViewModel.cs
@@ -68,9 +68,9 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
private void Update()
{
- StartSegmentEndPosition = LayerPropertiesViewModel.StartTimelineSegmentViewModel.SegmentWidth;
- MainSegmentEndPosition = StartSegmentEndPosition + LayerPropertiesViewModel.MainTimelineSegmentViewModel.SegmentWidth;
- EndSegmentEndPosition = MainSegmentEndPosition + LayerPropertiesViewModel.EndTimelineSegmentViewModel.SegmentWidth;
+ StartSegmentEndPosition = LayerPropertiesViewModel.StartTimelineSegmentViewModel.SegmentEnd.TotalSeconds * _profileEditorService.PixelsPerSecond;
+ MainSegmentEndPosition = LayerPropertiesViewModel.MainTimelineSegmentViewModel.SegmentEnd.TotalSeconds * _profileEditorService.PixelsPerSecond;
+ EndSegmentEndPosition = LayerPropertiesViewModel.EndTimelineSegmentViewModel.SegmentEnd.TotalSeconds * _profileEditorService.PixelsPerSecond;
TotalTimelineWidth = EndSegmentEndPosition;
}
diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml
index 5d3ad756b..4eb77d12c 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml
@@ -140,6 +140,7 @@