Profile editor - Fixed new layers not saving in some situations

Profile tree - Improved buttons visibility
Layer brushes - Support transformation by default, unless a RGB.NET brush
This commit is contained in:
SpoinkyNL committed 2020-06-11 21:16:13 +02:00
1 parent c60ae48e66
commit f917728ac8
13 files changed
+88 -40

No files matched your search

@@ -1,4 +1,4 @@
<UserControl x:Class="Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.LayerPropertiesView"
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -8,16 +8,14 @@
xmlns:timeline="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:behaviors="clr-namespace:Artemis.UI.Behaviors"
xmlns:Converters="clr-namespace:Artemis.UI.Converters" x:Class="Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.LayerPropertiesView"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800"
d:DataContext="{d:DesignInstance local:LayerPropertiesViewModel}"
d:DataContext="{d:DesignInstance {x:Type local:LayerPropertiesViewModel}}"
behaviors:InputBindingBehavior.PropagateInputBindingsToWindow="True">
<UserControl.InputBindings>
<KeyBinding Command="{s:Action Play}" Key="Space" />
<KeyBinding Command="{s:Action PlayFromStart}" Modifiers="Shift" Key="Space" />
</UserControl.InputBindings>
<UserControl.Resources>
<Converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter"/>
<Style x:Key="SvStyle" TargetType="{x:Type ScrollViewer}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
@@ -33,7 +31,7 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ScrollContentPresenter Grid.ColumnSpan="2" Grid.RowSpan="2" />
<ScrollBar Name="PART_VerticalScrollBar"
<ScrollBar x:Name="PART_VerticalScrollBar"
HorizontalAlignment="Right"
Opacity="0.5"
Grid.Row="0"
@@ -42,7 +40,7 @@
Maximum="{TemplateBinding ScrollableHeight}"
ViewportSize="{TemplateBinding ViewportHeight}"
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" />
<ScrollBar Name="PART_HorizontalScrollBar"
<ScrollBar x:Name="PART_HorizontalScrollBar"
VerticalAlignment="Bottom"
Orientation="Horizontal"
Opacity="0.5"
@@ -58,6 +56,10 @@
</Setter>
</Style>
</UserControl.Resources>
<UserControl.InputBindings>
<KeyBinding Command="{s:Action Play}" Key="Space" />
<KeyBinding Command="{s:Action PlayFromStart}" Modifiers="Shift" Key="Space" />
</UserControl.InputBindings>
<Grid x:Name="ContainerGrid">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
@@ -147,13 +149,13 @@
VerticalScrollBarVisibility="Hidden" ScrollChanged="TimelineScrollChanged">
<Grid Background="{DynamicResource MaterialDesignCardBackground}">
<!-- Caret -->
<Canvas ZIndex="1"
<Canvas Panel.ZIndex="1"
Margin="{Binding TimeCaretPosition}"
Cursor="SizeWE"
MouseDown="{s:Action TimelineMouseDown}"
MouseUp="{s:Action TimelineMouseUp}"
MouseMove="{s:Action TimelineMouseMove}">
<Polygon Points="-10,0 0,20, 10,00" Fill="{StaticResource SecondaryAccentBrush}" />
<Polygon Points="-10,0 0,20 10,0" Fill="{StaticResource SecondaryAccentBrush}" />
<Line X1="0" X2="0" Y1="0" Y2="{Binding ActualHeight, ElementName=ContainerGrid}"
StrokeThickness="2" Stroke="{StaticResource SecondaryAccentBrush}" />
</Canvas>
@@ -175,7 +177,7 @@
VerticalScrollBarVisibility="Auto"
ScrollChanged="TimelineScrollChanged">
<Grid>
<Canvas ZIndex="1"
<Canvas Panel.ZIndex="1"
Margin="{Binding TimeCaretPosition}"
Cursor="SizeWE"
MouseDown="{s:Action TimelineMouseDown}"
@@ -194,7 +196,7 @@
Grid.ColumnSpan="2"
Grid.Column="0"
HorizontalAlignment="Stretch"
ZIndex="2"
Panel.ZIndex="2"
Background="{DynamicResource MaterialDesignCardBackground}">
<!-- Selected layer controls -->
<Grid.ColumnDefinitions>
@@ -206,15 +208,26 @@
<ColumnDefinition />
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" Margin="6">
<StackPanel Grid.Column="0"
Orientation="Horizontal"
Margin="6"
Visibility="{Binding SelectedLayer, Converter={StaticResource NullToVisibilityConverter}}">
<materialDesign:PackIcon Kind="Layers" Width="16" />
<materialDesign:PackIcon Kind="{Binding SelectedLayer.LayerBrush.Descriptor.Icon}"
Width="16"
Margin="5 0 0 0"
ToolTip="{Binding SelectedLayer.LayerBrush.Descriptor.DisplayName, Mode=OneWay}"
Background="Transparent" />
Background="Transparent"
Visibility="{Binding SelectedLayer.LayerBrush, Converter={StaticResource NullToVisibilityConverter}}"/>
<TextBlock Text="{Binding SelectedLayer.Name}" Margin="5 0 0 0" />
</StackPanel>
<StackPanel Grid.Column="0"
Orientation="Horizontal"
Margin="6"
Visibility="{Binding SelectedFolder, Converter={StaticResource NullToVisibilityConverter}}">
<materialDesign:PackIcon Kind="Folder" Width="16" />
<TextBlock Text="{Binding SelectedFolder.Name}" Margin="5 0 0 0" />
</StackPanel>
<Button Grid.Column="1"
Style="{StaticResource MaterialDesignFlatMidBgButton}"
Margin="0 -2"
@@ -224,7 +237,7 @@
ToolTip="Change the property's data binding"
VerticalAlignment="Center">
<TextBlock FontSize="10">ADD EFFECT</TextBlock>
<TextBlock FontSize="10"><Run Text="ADD EFFECT"/></TextBlock>
</Button>
</Grid>
@@ -47,6 +47,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
}
public Layer SelectedLayer { get; set; }
public Folder SelectedFolder { get; set; }
public BindableCollection<LayerPropertyGroupViewModel> LayerPropertyGroups { get; set; }
public TreeViewModel TreeViewModel { get; set; }
public TimelineViewModel TimelineViewModel { get; set; }
@@ -104,6 +106,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
private void PopulateProperties(ProfileElement profileElement)
{
if (SelectedFolder != null)
{
SelectedFolder = null;
}
if (SelectedLayer != null)
{
SelectedLayer.LayerBrushUpdated -= SelectedLayerOnLayerBrushUpdated;
@@ -115,7 +121,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
LayerPropertyGroups.Clear();
_brushPropertyGroup = null;
if (profileElement is Layer layer)
if (profileElement is Folder folder)
{
SelectedFolder = folder;
}
else if (profileElement is Layer layer)
{
SelectedLayer = layer;
SelectedLayer.LayerBrushUpdated += SelectedLayerOnLayerBrushUpdated;
@@ -151,7 +161,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
if (SelectedLayer == null)
return;
var hideRenderRelatedProperties = SelectedLayer?.LayerBrush?.BrushType == LayerBrushType.Regular && SelectedLayer.LayerBrush.SupportsTransformation;
var hideRenderRelatedProperties = SelectedLayer?.LayerBrush != null && !SelectedLayer.LayerBrush.SupportsTransformation;
SelectedLayer.General.ShapeType.IsHidden = hideRenderRelatedProperties;
SelectedLayer.General.FillType.IsHidden = hideRenderRelatedProperties;
SelectedLayer.General.BlendMode.IsHidden = hideRenderRelatedProperties;