mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-03-24 10:18:47 +00:00
Modules - Improved override behavior when activation reqs are met
Profile editor - Fixed error when pressing play without a selected element
This commit is contained in:
parent
fc91fd7225
commit
e30e37e8e3
@ -47,11 +47,6 @@ namespace Artemis.Core.Services
|
||||
if (ActiveModuleOverride == overrideModule)
|
||||
return;
|
||||
|
||||
// Always deactivate all modules whenever override is called
|
||||
var modules = _pluginService.GetPluginsOfType<Module>().ToList();
|
||||
foreach (var module in modules)
|
||||
OverrideDeactivate(module);
|
||||
|
||||
if (overrideModule != null)
|
||||
{
|
||||
OverrideActivate(overrideModule);
|
||||
@ -60,6 +55,11 @@ namespace Artemis.Core.Services
|
||||
else
|
||||
_logger.Information("Clearing active module override");
|
||||
|
||||
// Always deactivate all other modules whenever override is called
|
||||
var modules = _pluginService.GetPluginsOfType<Module>().ToList();
|
||||
foreach (var module in modules.Where(m => m != overrideModule))
|
||||
OverrideDeactivate(module);
|
||||
|
||||
ActiveModuleOverride = overrideModule;
|
||||
}
|
||||
finally
|
||||
@ -78,7 +78,23 @@ namespace Artemis.Core.Services
|
||||
await ActiveModuleSemaphore.WaitAsync();
|
||||
|
||||
if (ActiveModuleOverride != null)
|
||||
{
|
||||
// The conditions of the active module override may be matched, in that case reactivate as a non-override
|
||||
// the principle is different for this service but not for the module
|
||||
var shouldBeActivated = ActiveModuleOverride.EvaluateActivationRequirements();
|
||||
if (shouldBeActivated && ActiveModuleOverride.IsActivatedOverride)
|
||||
{
|
||||
ActiveModuleOverride.Deactivate(true);
|
||||
ActiveModuleOverride.Activate(false);
|
||||
}
|
||||
else if (!shouldBeActivated && !ActiveModuleOverride.IsActivatedOverride)
|
||||
{
|
||||
ActiveModuleOverride.Deactivate(false);
|
||||
ActiveModuleOverride.Activate(true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
@ -562,20 +562,23 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
|
||||
Execute.PostToUIThread(() =>
|
||||
{
|
||||
var newTime = ProfileEditorService.CurrentTime.Add(TimeSpan.FromSeconds(e.DeltaTime));
|
||||
if (Repeating && RepeatTimeline)
|
||||
if (SelectedProfileElement != null)
|
||||
{
|
||||
if (newTime > SelectedProfileElement.TimelineLength)
|
||||
newTime = TimeSpan.Zero;
|
||||
}
|
||||
else if (Repeating && RepeatSegment)
|
||||
{
|
||||
if (newTime > GetCurrentSegmentEnd())
|
||||
newTime = GetCurrentSegmentStart();
|
||||
}
|
||||
else if (newTime > SelectedProfileElement.TimelineLength)
|
||||
{
|
||||
newTime = SelectedProfileElement.TimelineLength;
|
||||
Pause();
|
||||
if (Repeating && RepeatTimeline)
|
||||
{
|
||||
if (newTime > SelectedProfileElement.TimelineLength)
|
||||
newTime = TimeSpan.Zero;
|
||||
}
|
||||
else if (Repeating && RepeatSegment)
|
||||
{
|
||||
if (newTime > GetCurrentSegmentEnd())
|
||||
newTime = GetCurrentSegmentStart();
|
||||
}
|
||||
else if (newTime > SelectedProfileElement.TimelineLength)
|
||||
{
|
||||
newTime = SelectedProfileElement.TimelineLength;
|
||||
Pause();
|
||||
}
|
||||
}
|
||||
|
||||
ProfileEditorService.CurrentTime = newTime;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user