1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Profile editor - Increase device image rescale quality

Profile editor - Fix double timeline speed when switching between play modes
This commit is contained in:
Robert 2021-07-03 15:30:49 +02:00
parent 51a5724adf
commit ee16d69fb3
5 changed files with 22 additions and 24 deletions

View File

@ -246,6 +246,16 @@ namespace Artemis.Core.Services
{ {
lock (_profileCategories) lock (_profileCategories)
{ {
ProfileConfiguration? editedProfileConfiguration = _profileCategories.SelectMany(c => c.ProfileConfigurations).FirstOrDefault(p => p.IsBeingEdited);
if (editedProfileConfiguration != null)
{
editedProfileConfiguration.Profile?.Render(canvas, SKPointI.Empty);
return;
}
if (RenderForEditor)
return;
// Iterate the children in reverse because the first category must be rendered last to end up on top // Iterate the children in reverse because the first category must be rendered last to end up on top
for (int i = _profileCategories.Count - 1; i > -1; i--) for (int i = _profileCategories.Count - 1; i > -1; i--)
{ {
@ -255,15 +265,9 @@ namespace Artemis.Core.Services
try try
{ {
ProfileConfiguration profileConfiguration = profileCategory.ProfileConfigurations[j]; ProfileConfiguration profileConfiguration = profileCategory.ProfileConfigurations[j];
// Always render profiles being edited // Ensure all criteria are met before rendering
if (profileConfiguration.IsBeingEdited) if (!profileConfiguration.IsSuspended && !profileConfiguration.IsMissingModule && profileConfiguration.ActivationConditionMet)
profileConfiguration.Profile?.Render(canvas, SKPointI.Empty); profileConfiguration.Profile?.Render(canvas, SKPointI.Empty);
else
{
// Ensure all criteria are met before rendering
if (!profileConfiguration.IsSuspended && !profileConfiguration.IsMissingModule && profileConfiguration.ActivationConditionMet)
profileConfiguration.Profile?.Render(canvas, SKPointI.Empty);
}
} }
catch (Exception e) catch (Exception e)
{ {
@ -395,13 +399,6 @@ namespace Artemis.Core.Services
} }
} }
/// <summary>
/// Creates a new profile configuration and adds it to the provided <see cref="ProfileCategory" />
/// </summary>
/// <param name="category">The profile category to add the profile to</param>
/// <param name="name">The name of the new profile configuration</param>
/// <param name="icon">The icon of the new profile configuration</param>
/// <returns>The newly created profile configuration</returns>
public ProfileConfiguration CreateProfileConfiguration(ProfileCategory category, string name, string icon) public ProfileConfiguration CreateProfileConfiguration(ProfileCategory category, string name, string icon)
{ {
ProfileConfiguration configuration = new(category, name, icon); ProfileConfiguration configuration = new(category, name, icon);
@ -413,10 +410,6 @@ namespace Artemis.Core.Services
return configuration; return configuration;
} }
/// <summary>
/// Removes the provided profile configuration from the <see cref="ProfileCategory" />
/// </summary>
/// <param name="profileConfiguration"></param>
public void RemoveProfileConfiguration(ProfileConfiguration profileConfiguration) public void RemoveProfileConfiguration(ProfileConfiguration profileConfiguration)
{ {
profileConfiguration.Category.RemoveProfileConfiguration(profileConfiguration); profileConfiguration.Category.RemoveProfileConfiguration(profileConfiguration);

View File

@ -570,7 +570,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
{ {
if (!ProfileEditorService.Playing) if (!ProfileEditorService.Playing)
{ {
Pause(); CoreService.FrameRendering -= CoreServiceOnFrameRendering;
return; return;
} }

View File

@ -27,7 +27,7 @@
<KeyBinding Command="{s:Action Undo}" Modifiers="Control" Key="Z" /> <KeyBinding Command="{s:Action Undo}" Modifiers="Control" Key="Z" />
<KeyBinding Command="{s:Action Redo}" Modifiers="Control" Key="Y" /> <KeyBinding Command="{s:Action Redo}" Modifiers="Control" Key="Y" />
<KeyBinding Command="{s:Action ToggleSuspend}" Key="F5" /> <KeyBinding Command="{s:Action ToggleSuspend}" Key="F5" />
<KeyBinding Command="{s:Action ToggleAutoSuspend}" Modifiers="Ctrl" Key="F5" /> <KeyBinding Command="{s:Action ToggleAutoSuspend}" Modifiers="Shift" Key="F5" />
</UserControl.InputBindings> </UserControl.InputBindings>
<Grid ClipToBounds="True"> <Grid ClipToBounds="True">
@ -105,10 +105,10 @@
Command="{s:Action ToggleSuspend}" Command="{s:Action ToggleSuspend}"
InputGestureText="F5" /> InputGestureText="F5" />
<MenuItem Header="Run Profile on Focus Loss" <MenuItem Header="Run Profile on Focus Loss"
ToolTip="If enabled, regular profile playback is resumed on focus loss" ToolTip="If enabled, run mode is set to normal on focus loss"
IsCheckable="True" IsCheckable="True"
IsChecked="{Binding StopOnFocusLoss.Value}" IsChecked="{Binding StopOnFocusLoss.Value}"
InputGestureText="Ctrl+F5" /> InputGestureText="Shift+F5" />
</MenuItem> </MenuItem>
<MenuItem Header="_Scripting" IsEnabled="False"> <MenuItem Header="_Scripting" IsEnabled="False">
<MenuItem Header="_Profile Scripts" <MenuItem Header="_Profile Scripts"

View File

@ -101,6 +101,7 @@
<DataTemplate> <DataTemplate>
<shared:DeviceVisualizer Device="{Binding}" <shared:DeviceVisualizer Device="{Binding}"
ShowColors="True" ShowColors="True"
RenderOptions.BitmapScalingMode="HighQuality"
HighlightedLeds="{Binding DataContext.HighlightedLeds, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" /> HighlightedLeds="{Binding DataContext.HighlightedLeds, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>

View File

@ -33,7 +33,11 @@
Visibility="{Binding Device.Layout.Image, ConverterParameter=Inverted, Converter={StaticResource NullToVisibilityConverter}}" Visibility="{Binding Device.Layout.Image, ConverterParameter=Inverted, Converter={StaticResource NullToVisibilityConverter}}"
IsHitTestVisible="False"/> IsHitTestVisible="False"/>
<shared:DeviceVisualizer Device="{Binding Device}" ShowColors="True" VerticalAlignment="Top" HorizontalAlignment="Left" /> <shared:DeviceVisualizer Device="{Binding Device}"
RenderOptions.BitmapScalingMode="HighQuality"
ShowColors="True"
VerticalAlignment="Top"
HorizontalAlignment="Left" />
</Grid> </Grid>