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

Layer timeline - Show keyframes of collapsed groups

Profile editor - Don't reload UI elements on undo/redo if there's nothing to undo/redo
Layer properties - Properly show/hide properties
This commit is contained in:
SpoinkyNL 2020-05-29 17:21:29 +02:00
parent dd000e7bed
commit 728baa1b7f
20 changed files with 182 additions and 83 deletions

View File

@ -10,6 +10,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
public abstract class BaseLayerProperty
{
private bool _keyframesEnabled;
private bool _isHidden;
internal BaseLayerProperty()
{
@ -48,7 +49,15 @@ namespace Artemis.Core.Models.Profile.LayerProperties
/// <summary>
/// Gets or sets whether the property is hidden in the UI
/// </summary>
public bool IsHidden { get; set; }
public bool IsHidden
{
get => _isHidden;
set
{
_isHidden = value;
OnVisibilityChanged();
}
}
/// <summary>
/// Indicates whether the BaseValue was loaded from storage, useful to check whether a default value must be applied
@ -100,6 +109,11 @@ namespace Artemis.Core.Models.Profile.LayerProperties
/// </summary>
public event EventHandler BaseValueChanged;
/// <summary>
/// Occurs when the <see cref="IsHidden"/> value of the layer property was updated
/// </summary>
public event EventHandler VisibilityChanged;
/// <summary>
/// Occurs when keyframes are enabled/disabled
/// </summary>
@ -125,6 +139,11 @@ namespace Artemis.Core.Models.Profile.LayerProperties
BaseValueChanged?.Invoke(this, EventArgs.Empty);
}
protected virtual void OnVisibilityChanged()
{
VisibilityChanged?.Invoke(this, EventArgs.Empty);
}
protected virtual void OnKeyframesToggled()
{
KeyframesToggled?.Invoke(this, EventArgs.Empty);
@ -143,5 +162,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
#endregion
public abstract void ApplyDefaultValue();
}
}

View File

@ -284,6 +284,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
public override void ApplyDefaultValue()
{
BaseValue = DefaultValue;
CurrentValue = DefaultValue;
}
}

View File

@ -4,7 +4,7 @@ using Artemis.Storage.Entities.Profile;
namespace Artemis.Core.Models.Profile.LayerProperties.Types
{
/// <inheritdoc/>
/// <inheritdoc />
public class ColorGradientLayerProperty : LayerProperty<ColorGradient>
{
internal ColorGradientLayerProperty()
@ -12,21 +12,17 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types
KeyframesSupported = false;
}
internal override void ApplyToLayerProperty(PropertyEntity entity, LayerPropertyGroup layerPropertyGroup, bool fromStorage)
{
base.ApplyToLayerProperty(entity, layerPropertyGroup, fromStorage);
// Don't allow color gradients to be null
if (BaseValue == null)
{
BaseValue = DefaultValue ?? new ColorGradient();
}
}
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
{
throw new ArtemisCoreException("Color Gradients do not support keyframes.");
}
internal override void ApplyToLayerProperty(PropertyEntity entity, LayerPropertyGroup layerPropertyGroup, bool fromStorage)
{
base.ApplyToLayerProperty(entity, layerPropertyGroup, fromStorage);
// Don't allow color gradients to be null
BaseValue ??= DefaultValue ?? new ColorGradient();
}
}
}

View File

@ -18,6 +18,7 @@ namespace Artemis.Core.Models.Profile
private readonly List<BaseLayerProperty> _layerProperties;
private readonly List<LayerPropertyGroup> _layerPropertyGroups;
private ReadOnlyCollection<BaseLayerProperty> _allLayerProperties;
private bool _isHidden;
protected LayerPropertyGroup()
{
@ -53,7 +54,15 @@ namespace Artemis.Core.Models.Profile
/// <summary>
/// Gets or sets whether the property is hidden in the UI
/// </summary>
public bool IsHidden { get; set; }
public bool IsHidden
{
get => _isHidden;
set
{
_isHidden = value;
OnVisibilityChanged();
}
}
/// <summary>
/// A list of all layer properties in this group
@ -211,6 +220,11 @@ namespace Artemis.Core.Models.Profile
internal event EventHandler<PropertyGroupUpdatingEventArgs> PropertyGroupOverriding;
public event EventHandler PropertyGroupInitialized;
/// <summary>
/// Occurs when the <see cref="IsHidden" /> value of the layer property was updated
/// </summary>
public event EventHandler VisibilityChanged;
internal virtual void OnPropertyGroupUpdating(PropertyGroupUpdatingEventArgs e)
{
PropertyGroupUpdating?.Invoke(this, e);
@ -221,6 +235,11 @@ namespace Artemis.Core.Models.Profile
PropertyGroupOverriding?.Invoke(this, e);
}
protected virtual void OnVisibilityChanged()
{
VisibilityChanged?.Invoke(this, EventArgs.Empty);
}
#endregion
}
}

View File

@ -26,13 +26,13 @@ namespace Artemis.Core.Services.Storage.Interfaces
/// </summary>
/// <param name="selectedProfile"></param>
/// <param name="module"></param>
void UndoUpdateProfile(Profile selectedProfile, ProfileModule module);
bool UndoUpdateProfile(Profile selectedProfile, ProfileModule module);
/// <summary>
/// Attempts to restore the profile to the state it had before the last <see cref="UndoUpdateProfile" /> call.
/// </summary>
/// <param name="selectedProfile"></param>
/// <param name="module"></param>
void RedoUpdateProfile(Profile selectedProfile, ProfileModule module);
bool RedoUpdateProfile(Profile selectedProfile, ProfileModule module);
}
}

View File

@ -123,12 +123,12 @@ namespace Artemis.Core.Services.Storage
_profileRepository.Save(profile.ProfileEntity);
}
public void UndoUpdateProfile(Profile profile, ProfileModule module)
public bool UndoUpdateProfile(Profile profile, ProfileModule module)
{
if (!profile.UndoStack.Any())
{
_logger.Debug("Undo profile update - Failed, undo stack empty");
return;
return false;
}
ActivateProfile(module, null);
@ -140,14 +140,15 @@ namespace Artemis.Core.Services.Storage
ActivateProfile(module, profile);
_logger.Debug("Undo profile update - Success");
return true;
}
public void RedoUpdateProfile(Profile profile, ProfileModule module)
public bool RedoUpdateProfile(Profile profile, ProfileModule module)
{
if (!profile.RedoStack.Any())
{
_logger.Debug("Redo profile update - Failed, redo empty");
return;
return false;
}
ActivateProfile(module, null);
@ -159,6 +160,7 @@ namespace Artemis.Core.Services.Storage
ActivateProfile(module, profile);
_logger.Debug("Redo profile update - Success");
return true;
}
private void InitializeLayerProperties(Profile profile)
@ -169,7 +171,9 @@ namespace Artemis.Core.Services.Storage
layer.General.InitializeProperties(_layerService, layer, "General.");
if (!layer.Transform.PropertiesInitialized)
layer.Transform.InitializeProperties(_layerService, layer, "Transform.");
};
}
;
}
private void InstantiateLayerBrushes(Profile profile)
@ -178,7 +182,7 @@ namespace Artemis.Core.Services.Storage
foreach (var layer in profile.GetAllLayers().Where(l => l.LayerBrush == null))
_layerService.InstantiateLayerBrush(layer);
}
private void ActiveProfilesPopulateLeds(ArtemisSurface surface)
{
var profileModules = _pluginService.GetPluginsOfType<ProfileModule>();
@ -192,7 +196,7 @@ namespace Artemis.Core.Services.Storage
foreach (var profileModule in profileModules.Where(p => p.ActiveProfile != null).ToList())
InstantiateLayerBrushes(profileModule.ActiveProfile);
}
#region Event handlers
private void OnActiveSurfaceConfigurationSelected(object sender, SurfaceConfigurationEventArgs e)

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using LiteDB;
namespace Artemis.Storage.Entities.Profile

View File

@ -9,10 +9,6 @@
d:DesignHeight="101.848" d:DesignWidth="242.956">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ColorPicker.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:ColorToStringConverter x:Key="ColorToStringConverter" />
<converters:ColorToSolidColorConverter x:Key="ColorToSolidColorConverter" />
<VisualBrush x:Key="Checkerboard" TileMode="Tile" Stretch="Uniform" ViewportUnits="Absolute" Viewport="0,0,10,10">
@ -62,14 +58,14 @@
Grid.Row="1"
OpacityMask="{x:Null}">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource MaterialDesignHorizontalColorSliderTrackRepeatButton}" />
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{DynamicResource MaterialDesignHorizontalColorSliderTrackRepeatButton}" />
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource MaterialDesignHorizontalColorSliderTrackRepeatButton}" />
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{DynamicResource MaterialDesignHorizontalColorSliderTrackRepeatButton}" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Width="20" Height="20" VerticalAlignment="Center" Focusable="False" OverridesDefaultStyle="True"
Template="{StaticResource MaterialDesignColorSliderThumb}">
Template="{DynamicResource MaterialDesignColorSliderThumb}">
<Thumb.Foreground>
<SolidColorBrush
Color="{Binding Color, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Mode=OneWay, Converter={StaticResource ColorToSolidColorConverter}}" />
@ -124,7 +120,7 @@
<Slider Grid.Row="1" Margin="8"
IsMoveToPointEnabled="True"
Orientation="Horizontal"
Style="{StaticResource MaterialDesignColorSlider}"
Style="{DynamicResource MaterialDesignColorSlider}"
Template="{StaticResource MaterialDesignOpacitySlider}"
Value="{Binding ColorOpacity, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
Maximum="255" />

View File

@ -8,10 +8,6 @@
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ColorPicker.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:ColorGradientToGradientStopsConverter x:Key="ColorGradientToGradientStopsConverter" />
<VisualBrush x:Key="Checkerboard" TileMode="Tile" Stretch="Uniform" ViewportUnits="Absolute" Viewport="0,0,10,10">
<VisualBrush.Visual>

View File

@ -61,7 +61,7 @@
<Grid x:Name="ContainerGrid">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
@ -196,16 +196,15 @@
HorizontalAlignment="Stretch"
ZIndex="2"
Background="{DynamicResource MaterialDesignCardBackground}">
<!-- Zoom control -->
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Slider Orientation="Horizontal"
HorizontalAlignment="Right"
Margin="10"
Minimum="31"
Maximum="350"
Value="{Binding ProfileEditorService.PixelsPerSecond}"
Width="319" />
</StackPanel>
<Slider Orientation="Horizontal"
HorizontalAlignment="Right"
Margin="10 5"
Minimum="31"
Maximum="350"
Value="{Binding ProfileEditorService.PixelsPerSecond}"
Width="319" />
</StackPanel>
</Grid>
</UserControl>

View File

@ -92,6 +92,13 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
#region View model managament
public List<LayerPropertyGroupViewModel> GetAllLayerPropertyGroupViewModels()
{
var groups = LayerPropertyGroups.ToList();
groups.AddRange(groups.SelectMany(g => g.Children).Where(g => g is LayerPropertyGroupViewModel).Cast<LayerPropertyGroupViewModel>());
return groups;
}
private void PopulateProperties(ProfileElement profileElement)
{
if (SelectedLayer != null)

View File

@ -23,8 +23,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
TimelinePropertyGroupViewModel = new TimelinePropertyGroupViewModel(this);
PopulateChildren();
LayerPropertyGroup.VisibilityChanged += LayerPropertyGroupOnVisibilityChanged;
}
public override bool IsExpanded
{
get => LayerPropertyGroup.Layer.IsPropertyGroupExpanded(LayerPropertyGroup);
@ -68,7 +70,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
public override List<BaseLayerPropertyKeyframe> GetKeyframes(bool visibleOnly)
{
var result = new List<BaseLayerPropertyKeyframe>();
if (!IsExpanded)
if (visibleOnly && !IsExpanded)
return result;
foreach (var layerPropertyBaseViewModel in Children)
@ -81,6 +83,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
{
foreach (var layerPropertyBaseViewModel in Children)
layerPropertyBaseViewModel.Dispose();
LayerPropertyGroup.VisibilityChanged -= LayerPropertyGroupOnVisibilityChanged;
TimelinePropertyGroupViewModel.Dispose();
}
public List<LayerPropertyBaseViewModel> GetAllChildren()
@ -95,5 +100,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
return result;
}
private void LayerPropertyGroupOnVisibilityChanged(object? sender, EventArgs e)
{
NotifyOfPropertyChange(nameof(IsVisible));
}
}
}

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
@ -33,6 +34,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
else
PropertyDescription.Name = $"Unknown {typeof(T).Name} property";
}
LayerProperty.VisibilityChanged += LayerPropertyOnVisibilityChanged;
}
public override bool IsVisible => !LayerProperty.IsHidden;
@ -51,6 +54,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
{
TreePropertyViewModel.Dispose();
TimelinePropertyViewModel.Dispose();
LayerProperty.VisibilityChanged -= LayerPropertyOnVisibilityChanged;
}
public void SetCurrentValue(T value, bool saveChanges)
@ -61,6 +66,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
else
ProfileEditorService.UpdateProfilePreview();
}
private void LayerPropertyOnVisibilityChanged(object? sender, EventArgs e)
{
NotifyOfPropertyChange(nameof(IsVisible));
}
}
public abstract class LayerPropertyViewModel : LayerPropertyBaseViewModel

View File

@ -30,42 +30,17 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="{x:Type ContentPresenter}">
<Setter Property="Canvas.Left" Value="{Binding X}" />
<Setter Property="Canvas.Left" Value="{Binding}" />
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Ellipse Fill="{StaticResource PrimaryHueMidBrush}"
<Ellipse Fill="{StaticResource MaterialDesignCheckBoxDisabled}"
Stroke="White"
StrokeThickness="0"
Width="10"
Height="10"
Margin="-5,6,0,0"
s:View.ActionTarget="{Binding}">
<Ellipse.Style>
<Style TargetType="{x:Type Ellipse}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsSelected}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="StrokeThickness"
To="1" Duration="0:0:0.25" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="StrokeThickness"
To="0" Duration="0:0:0.25" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
Margin="-5,6,0,0">
</Ellipse>
</DataTemplate>
</ItemsControl.ItemTemplate>

View File

@ -1,4 +1,8 @@
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
using System;
using System.ComponentModel;
using System.Linq;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
using Stylet;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
{
@ -7,8 +11,40 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
public TimelinePropertyGroupViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel)
{
LayerPropertyGroupViewModel = (LayerPropertyGroupViewModel) layerPropertyBaseViewModel;
TimelineKeyframeViewModels = new BindableCollection<double>();
LayerPropertyGroupViewModel.ProfileEditorService.PixelsPerSecondChanged += ProfileEditorServiceOnPixelsPerSecondChanged;
LayerPropertyGroupViewModel.PropertyChanged += LayerPropertyGroupViewModelOnPropertyChanged;
UpdateKeyframes();
}
public LayerPropertyGroupViewModel LayerPropertyGroupViewModel { get; }
public BindableCollection<double> TimelineKeyframeViewModels { get; set; }
public TimelineViewModel TimelineViewModel { get; set; }
public void UpdateKeyframes()
{
TimelineKeyframeViewModels.Clear();
TimelineKeyframeViewModels.AddRange(LayerPropertyGroupViewModel.GetKeyframes(false)
.Select(k => LayerPropertyGroupViewModel.ProfileEditorService.PixelsPerSecond * k.Position.TotalSeconds));
}
public void Dispose()
{
LayerPropertyGroupViewModel.ProfileEditorService.PixelsPerSecondChanged -= ProfileEditorServiceOnPixelsPerSecondChanged;
LayerPropertyGroupViewModel.PropertyChanged -= LayerPropertyGroupViewModelOnPropertyChanged;
}
private void LayerPropertyGroupViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(LayerPropertyGroupViewModel.IsExpanded))
UpdateKeyframes();
}
private void ProfileEditorServiceOnPixelsPerSecondChanged(object? sender, EventArgs e)
{
UpdateKeyframes();
}
}
}

View File

@ -32,6 +32,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
{
foreach (var layerPropertyGroupViewModel in LayerPropertyGroups)
{
layerPropertyGroupViewModel.TimelinePropertyGroupViewModel.TimelineViewModel = this;
layerPropertyGroupViewModel.TimelinePropertyGroupViewModel.UpdateKeyframes();
foreach (var layerPropertyBaseViewModel in layerPropertyGroupViewModel.GetAllChildren())
{
if (layerPropertyBaseViewModel is LayerPropertyViewModel layerPropertyViewModel)

View File

@ -11,6 +11,7 @@ using Artemis.Core.Services.Storage.Interfaces;
using Artemis.UI.Screens.Module.ProfileEditor.Dialogs;
using Artemis.UI.Screens.Module.ProfileEditor.DisplayConditions;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
using Artemis.UI.Screens.Module.ProfileEditor.ProfileTree;
using Artemis.UI.Screens.Module.ProfileEditor.Visualization;
using Artemis.UI.Services.Interfaces;
@ -110,12 +111,28 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
public void Undo()
{
// Expanded status is also undone because undoing works a bit crude, that's annoying
var beforeGroups = LayerPropertiesViewModel.GetAllLayerPropertyGroupViewModels();
var expandedPaths = beforeGroups.Where(g => g.IsExpanded).Select(g => g.LayerPropertyGroup.Path).ToList();
_profileEditorService.UndoUpdateProfile(Module);
// Restore the expanded status
foreach (var allLayerPropertyGroupViewModel in LayerPropertiesViewModel.GetAllLayerPropertyGroupViewModels())
allLayerPropertyGroupViewModel.IsExpanded = expandedPaths.Contains(allLayerPropertyGroupViewModel.LayerPropertyGroup.Path);
}
public void Redo()
{
// Expanded status is also undone because undoing works a bit crude, that's annoying
var beforeGroups = LayerPropertiesViewModel.GetAllLayerPropertyGroupViewModels();
var expandedPaths = beforeGroups.Where(g => g.IsExpanded).Select(g => g.LayerPropertyGroup.Path).ToList();
_profileEditorService.RedoUpdateProfile(Module);
// Restore the expanded status
foreach (var allLayerPropertyGroupViewModel in LayerPropertiesViewModel.GetAllLayerPropertyGroupViewModels())
allLayerPropertyGroupViewModel.IsExpanded = expandedPaths.Contains(allLayerPropertyGroupViewModel.LayerPropertyGroup.Path);
}
protected override void OnInitialActivate()

View File

@ -157,7 +157,10 @@ namespace Artemis.UI.Services
public void UndoUpdateProfile(ProfileModule module)
{
_profileService.UndoUpdateProfile(SelectedProfile, module);
var undid = _profileService.UndoUpdateProfile(SelectedProfile, module);
if (!undid)
return;
OnSelectedProfileChanged(new ProfileElementEventArgs(SelectedProfile, SelectedProfile));
if (SelectedProfileElement != null)
@ -173,7 +176,10 @@ namespace Artemis.UI.Services
public void RedoUpdateProfile(ProfileModule module)
{
_profileService.RedoUpdateProfile(SelectedProfile, module);
var redid = _profileService.RedoUpdateProfile(SelectedProfile, module);
if (!redid)
return;
OnSelectedProfileChanged(new ProfileElementEventArgs(SelectedProfile, SelectedProfile));
if (SelectedProfileElement != null)

View File

@ -28,10 +28,11 @@ namespace Artemis.Plugins.LayerBrushes.Color
protected override void OnPropertiesInitialized()
{
GradientType.BaseValueChanged += GradientTypeOnBaseValueChanged;
GradientType.BaseValueChanged += (sender, args) => UpdateVisibility();
UpdateVisibility();
}
private void GradientTypeOnBaseValueChanged(object sender, EventArgs e)
private void UpdateVisibility()
{
Color.IsHidden = GradientType.BaseValue != LayerBrushes.Color.GradientType.Solid;
Gradient.IsHidden = GradientType.BaseValue == LayerBrushes.Color.GradientType.Solid;

View File

@ -46,10 +46,11 @@ namespace Artemis.Plugins.LayerBrushes.Noise
protected override void OnPropertiesInitialized()
{
ColorType.BaseValueChanged += ColorTypeOnBaseValueChanged;
ColorType.BaseValueChanged += (sender, args) => UpdateVisibility();
UpdateVisibility();
}
private void ColorTypeOnBaseValueChanged(object sender, EventArgs e)
private void UpdateVisibility()
{
GradientColor.IsHidden = ColorType.BaseValue != ColorMappingType.Gradient;
MainColor.IsHidden = ColorType.BaseValue != ColorMappingType.Simple;