mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Added keyframe creation outside the timeline
Added existing shape moving
This commit is contained in:
1 parent
ce2f05b135
commit
e9677f2070
22 files changed
+178
-148
No files matched your search
+6
-6
@@ -40,25 +40,25 @@
|
||||
<!-- Misc controls & time display -->
|
||||
<DockPanel Grid.Row="0" VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Play from start (Shift+Space)" Command="{s:Action PlayFromStart}">
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Play from start (Shift+Space)" Command="{s:Action PlayFromStart}" Focusable="False">
|
||||
<materialDesign:PackIcon Kind="StepForward" />
|
||||
</Button>
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Toggle play/pause (Space)" Command="{s:Action Play}">
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Toggle play/pause (Space)" Command="{s:Action Play}" Focusable="False">
|
||||
<StackPanel>
|
||||
<materialDesign:PackIcon Kind="Play" Visibility="{Binding Playing, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}" />
|
||||
<materialDesign:PackIcon Kind="Pause" Visibility="{Binding Playing, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Go to start" Command="{s:Action GoToStart}">
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Go to start" Command="{s:Action GoToStart}" Focusable="False">
|
||||
<materialDesign:PackIcon Kind="SkipBackward" />
|
||||
</Button>
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Go to end" Command="{s:Action GoToEnd}">
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Go to end" Command="{s:Action GoToEnd}" Focusable="False">
|
||||
<materialDesign:PackIcon Kind="SkipForward" />
|
||||
</Button>
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Previous frame" Command="{s:Action GoToPreviousFrame}">
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Previous frame" Command="{s:Action GoToPreviousFrame}" Focusable="False">
|
||||
<materialDesign:PackIcon Kind="SkipPrevious" />
|
||||
</Button>
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Next frame" Command="{s:Action GoToNextFrame}">
|
||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Next frame" Command="{s:Action GoToNextFrame}" Focusable="False">
|
||||
<materialDesign:PackIcon Kind="SkipNext" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
+2
-1
@@ -19,7 +19,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
{
|
||||
_kernel = kernel;
|
||||
_profileEditorService = profileEditorService;
|
||||
_keyframesEnabled = layerProperty.UntypedKeyframes.Any();
|
||||
_keyframesEnabled = layerProperty.IsUsingKeyframes;
|
||||
|
||||
LayerProperty = layerProperty;
|
||||
Parent = parent;
|
||||
@@ -56,6 +56,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
LayerProperty.ClearKeyframes();
|
||||
|
||||
// Force the keyframe engine to update, the new keyframe is the current keyframe
|
||||
LayerProperty.IsUsingKeyframes = _keyframesEnabled;
|
||||
LayerProperty.KeyframeEngine.Update(0);
|
||||
|
||||
_profileEditorService.UpdateSelectedProfileElement();
|
||||
|
||||
+1
-13
@@ -15,7 +15,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
||||
|
||||
public float FloatInputValue
|
||||
{
|
||||
get => (float) InputValue;
|
||||
get => (float?) InputValue ?? 0f;
|
||||
set => InputValue = value;
|
||||
}
|
||||
|
||||
@@ -23,17 +23,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
||||
{
|
||||
NotifyOfPropertyChange(() => FloatInputValue);
|
||||
}
|
||||
|
||||
protected override void UpdateBaseValue(object value)
|
||||
{
|
||||
var layerProperty = (LayerProperty<float>) LayerPropertyViewModel.LayerProperty;
|
||||
layerProperty.Value = (float) value;
|
||||
}
|
||||
|
||||
protected override void UpdateKeyframeValue(BaseKeyframe baseKeyframe, object value)
|
||||
{
|
||||
var keyframe = (Keyframe<float>) baseKeyframe;
|
||||
keyframe.Value = (float) value;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-13
@@ -15,7 +15,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
||||
|
||||
public int IntInputValue
|
||||
{
|
||||
get => (int) InputValue;
|
||||
get => (int?) InputValue ?? 0;
|
||||
set => InputValue = value;
|
||||
}
|
||||
|
||||
@@ -23,17 +23,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
||||
{
|
||||
NotifyOfPropertyChange(() => IntInputValue);
|
||||
}
|
||||
|
||||
protected override void UpdateBaseValue(object value)
|
||||
{
|
||||
var layerProperty = (LayerProperty<int>) LayerPropertyViewModel.LayerProperty;
|
||||
layerProperty.Value = (int) value;
|
||||
}
|
||||
|
||||
protected override void UpdateKeyframeValue(BaseKeyframe baseKeyframe, object value)
|
||||
{
|
||||
var keyframe = (Keyframe<int>) baseKeyframe;
|
||||
keyframe.Value = (int) value;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-18
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.UI.Exceptions;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Stylet;
|
||||
@@ -43,29 +42,13 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
||||
|
||||
private void UpdateInputValue(object value)
|
||||
{
|
||||
// If keyframes are disabled, update the base value
|
||||
if (!LayerPropertyViewModel.KeyframesEnabled)
|
||||
{
|
||||
UpdateBaseValue(value);
|
||||
return;
|
||||
}
|
||||
|
||||
// If on a keyframe, update the keyframe
|
||||
var currentKeyframe = LayerPropertyViewModel.LayerProperty.UntypedKeyframes.FirstOrDefault(k => k.Position == ProfileEditorService.CurrentTime);
|
||||
// Create a new keyframe if none found
|
||||
if (currentKeyframe == null)
|
||||
currentKeyframe = LayerPropertyViewModel.LayerProperty.CreateNewKeyframe(ProfileEditorService.CurrentTime);
|
||||
|
||||
UpdateKeyframeValue(currentKeyframe, value);
|
||||
LayerPropertyViewModel.LayerProperty.SetCurrentValue(value, ProfileEditorService.CurrentTime);
|
||||
// Force the keyframe engine to update, the edited keyframe might affect the current keyframe progress
|
||||
LayerPropertyViewModel.LayerProperty.KeyframeEngine.Update(0);
|
||||
|
||||
ProfileEditorService.UpdateSelectedProfileElement();
|
||||
|
||||
}
|
||||
|
||||
public abstract void Update();
|
||||
protected abstract void UpdateBaseValue(object value);
|
||||
protected abstract void UpdateKeyframeValue(BaseKeyframe baseKeyframe, object value);
|
||||
}
|
||||
}
|
||||
+2
-14
@@ -19,14 +19,14 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
||||
[DependsOn(nameof(InputValue))]
|
||||
public float X
|
||||
{
|
||||
get => ((SKPoint) InputValue).X;
|
||||
get => ((SKPoint?) InputValue)?.X ?? 0;
|
||||
set => InputValue = new SKPoint(value, Y);
|
||||
}
|
||||
|
||||
[DependsOn(nameof(InputValue))]
|
||||
public float Y
|
||||
{
|
||||
get => ((SKPoint) InputValue).Y;
|
||||
get => ((SKPoint?)InputValue)?.Y ?? 0;
|
||||
set => InputValue = new SKPoint(X, value);
|
||||
}
|
||||
|
||||
@@ -35,17 +35,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
||||
NotifyOfPropertyChange(() => X);
|
||||
NotifyOfPropertyChange(() => Y);
|
||||
}
|
||||
|
||||
protected override void UpdateBaseValue(object value)
|
||||
{
|
||||
var layerProperty = (LayerProperty<SKPoint>) LayerPropertyViewModel.LayerProperty;
|
||||
layerProperty.Value = (SKPoint) value;
|
||||
}
|
||||
|
||||
protected override void UpdateKeyframeValue(BaseKeyframe baseKeyframe, object value)
|
||||
{
|
||||
var keyframe = (Keyframe<SKPoint>) baseKeyframe;
|
||||
keyframe.Value = (SKPoint) value;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-14
@@ -19,14 +19,14 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
||||
[DependsOn(nameof(InputValue))]
|
||||
public float Width
|
||||
{
|
||||
get => ((SKSize) InputValue).Width;
|
||||
get => ((SKSize?) InputValue)?.Width ?? 0;
|
||||
set => InputValue = new SKSize(value, Height);
|
||||
}
|
||||
|
||||
[DependsOn(nameof(InputValue))]
|
||||
public float Height
|
||||
{
|
||||
get => ((SKSize) InputValue).Height;
|
||||
get => ((SKSize?)InputValue)?.Height ?? 0;
|
||||
set => InputValue = new SKSize(Width, value);
|
||||
}
|
||||
|
||||
@@ -35,17 +35,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
||||
NotifyOfPropertyChange(() => Width);
|
||||
NotifyOfPropertyChange(() => Height);
|
||||
}
|
||||
|
||||
protected override void UpdateBaseValue(object value)
|
||||
{
|
||||
var layerProperty = (LayerProperty<SKSize>) LayerPropertyViewModel.LayerProperty;
|
||||
layerProperty.Value = (SKSize) value;
|
||||
}
|
||||
|
||||
protected override void UpdateKeyframeValue(BaseKeyframe baseKeyframe, object value)
|
||||
{
|
||||
var keyframe = (Keyframe<SKSize>) baseKeyframe;
|
||||
keyframe.Value = (SKSize) value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user