mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Core - Refactored display conditions
Profile editor - Added UIs for each condition type
This commit is contained in:
1 parent
66ea718316
commit
3dfc25b092
47 files changed
+1305
-546
No files matched your search
@@ -10,7 +10,7 @@ public class DeleteKeyframe : IProfileEditorCommand
|
||||
private readonly ILayerPropertyKeyframe _keyframe;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="DeleteKeyframe{T}" /> class.
|
||||
/// Creates a new instance of the <see cref="DeleteKeyframe" /> class.
|
||||
/// </summary>
|
||||
public DeleteKeyframe(ILayerPropertyKeyframe keyframe)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared.Services.NodeEditor;
|
||||
|
||||
namespace Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a profile editor command that can be used to update an event condition's trigger mode.
|
||||
/// </summary>
|
||||
public class UpdateEventConditionPath : IProfileEditorCommand, IDisposable
|
||||
{
|
||||
private readonly EventCondition _eventCondition;
|
||||
private readonly DataModelPath? _value;
|
||||
private readonly DataModelPath? _oldValue;
|
||||
private readonly NodeConnectionStore? _store;
|
||||
private bool _executed;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="UpdateEventTriggerMode" /> class.
|
||||
/// </summary>
|
||||
public UpdateEventConditionPath(EventCondition eventCondition, DataModelPath? value)
|
||||
{
|
||||
_eventCondition = eventCondition;
|
||||
_value = value;
|
||||
_oldValue = eventCondition.EventPath;
|
||||
|
||||
INode? startNode = eventCondition.GetStartNode();
|
||||
if (startNode != null)
|
||||
_store = new NodeConnectionStore(startNode);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DisplayName => "Update event path";
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Execute()
|
||||
{
|
||||
// Store old connections
|
||||
_store?.Store();
|
||||
|
||||
// Change the end node
|
||||
_eventCondition.EventPath = _value;
|
||||
_eventCondition.UpdateEventNode();
|
||||
|
||||
_executed = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Undo()
|
||||
{
|
||||
// Change the end node
|
||||
_eventCondition.EventPath = _oldValue;
|
||||
_eventCondition.UpdateEventNode();
|
||||
|
||||
// Restore old connections
|
||||
_store?.Restore();
|
||||
|
||||
_executed = false;
|
||||
}
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
if (_executed)
|
||||
_oldValue?.Dispose();
|
||||
else
|
||||
_value?.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Artemis.Core;
|
||||
|
||||
namespace Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a profile editor command that can be used to update an event condition's overlap mode.
|
||||
/// </summary>
|
||||
public class UpdateEventOverlapMode : IProfileEditorCommand
|
||||
{
|
||||
private readonly EventCondition _eventCondition;
|
||||
private readonly EventOverlapMode _value;
|
||||
private readonly EventOverlapMode _oldValue;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="UpdateEventOverlapMode" /> class.
|
||||
/// </summary>
|
||||
public UpdateEventOverlapMode(EventCondition eventCondition, EventOverlapMode value)
|
||||
{
|
||||
_eventCondition = eventCondition;
|
||||
_value = value;
|
||||
_oldValue = eventCondition.OverlapMode;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DisplayName => "Update event overlap mode";
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Execute()
|
||||
{
|
||||
_eventCondition.OverlapMode = _value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Undo()
|
||||
{
|
||||
_eventCondition.OverlapMode = _oldValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Artemis.Core;
|
||||
|
||||
namespace Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a profile editor command that can be used to update an event condition's trigger mode.
|
||||
/// </summary>
|
||||
public class UpdateEventTriggerMode : IProfileEditorCommand
|
||||
{
|
||||
private readonly EventCondition _eventCondition;
|
||||
private readonly EventTriggerMode _oldValue;
|
||||
private readonly EventTriggerMode _value;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="UpdateEventTriggerMode" /> class.
|
||||
/// </summary>
|
||||
public UpdateEventTriggerMode(EventCondition eventCondition, EventTriggerMode value)
|
||||
{
|
||||
_eventCondition = eventCondition;
|
||||
_value = value;
|
||||
_oldValue = eventCondition.TriggerMode;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DisplayName => "Update event trigger mode";
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Execute()
|
||||
{
|
||||
_eventCondition.TriggerMode = _value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Undo()
|
||||
{
|
||||
_eventCondition.TriggerMode = _oldValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Artemis.Core;
|
||||
|
||||
namespace Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a profile editor command that can be used to update an static condition's play mode.
|
||||
/// </summary>
|
||||
public class UpdateStaticPlayMode : IProfileEditorCommand
|
||||
{
|
||||
private readonly StaticCondition _staticCondition;
|
||||
private readonly StaticPlayMode _value;
|
||||
private readonly StaticPlayMode _oldValue;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="UpdateEventTriggerMode" /> class.
|
||||
/// </summary>
|
||||
public UpdateStaticPlayMode(StaticCondition staticCondition, StaticPlayMode value)
|
||||
{
|
||||
_staticCondition = staticCondition;
|
||||
_value = value;
|
||||
_oldValue = staticCondition.PlayMode;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DisplayName => "Update condition play mode";
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Execute()
|
||||
{
|
||||
_staticCondition.PlayMode = _value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Undo()
|
||||
{
|
||||
_staticCondition.PlayMode = _oldValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Artemis.Core;
|
||||
|
||||
namespace Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a profile editor command that can be used to update an static condition's play mode.
|
||||
/// </summary>
|
||||
public class UpdateStaticStopMode : IProfileEditorCommand
|
||||
{
|
||||
private readonly StaticCondition _staticCondition;
|
||||
private readonly StaticStopMode _value;
|
||||
private readonly StaticStopMode _oldValue;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="UpdateEventTriggerMode" /> class.
|
||||
/// </summary>
|
||||
public UpdateStaticStopMode(StaticCondition staticCondition, StaticStopMode value)
|
||||
{
|
||||
_staticCondition = staticCondition;
|
||||
_value = value;
|
||||
_oldValue = staticCondition.StopMode;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DisplayName => "Update condition stop mode";
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Execute()
|
||||
{
|
||||
_staticCondition.StopMode = _value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Undo()
|
||||
{
|
||||
_staticCondition.StopMode = _oldValue;
|
||||
}
|
||||
}
|
||||
@@ -96,8 +96,7 @@ internal class ProfileEditorService : IProfileEditorService
|
||||
else
|
||||
{
|
||||
renderElement.Enable();
|
||||
bool stickToMainSegment = (renderElement != _profileElementSubject.Value || renderElement.Timeline.Length < time) && renderElement.Timeline.PlayMode == TimelinePlayMode.Repeat;
|
||||
renderElement.OverrideTimelineAndApply(time, stickToMainSegment);
|
||||
renderElement.OverrideTimelineAndApply(time);
|
||||
|
||||
foreach (ProfileElement child in renderElement.Children)
|
||||
TickProfileElement(child, time);
|
||||
|
||||
Reference in new issue
Block a user