diff --git a/src/Artemis.Core/Services/ModuleService.cs b/src/Artemis.Core/Services/ModuleService.cs index 37903801f..b7148fdd8 100644 --- a/src/Artemis.Core/Services/ModuleService.cs +++ b/src/Artemis.Core/Services/ModuleService.cs @@ -46,12 +46,7 @@ namespace Artemis.Core.Services if (ActiveModuleOverride == overrideModule) return; - - // Always deactivate all modules whenever override is called - var modules = _pluginService.GetPluginsOfType().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().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(); diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs index 8151541ff..3bacabc15 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs @@ -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;