diff --git a/src/Artemis.Core/Plugins/LayerBrush/Abstract/BaseLayerBrush.cs b/src/Artemis.Core/Plugins/LayerBrush/Abstract/BaseLayerBrush.cs
index 83754837c..f983fe4ac 100644
--- a/src/Artemis.Core/Plugins/LayerBrush/Abstract/BaseLayerBrush.cs
+++ b/src/Artemis.Core/Plugins/LayerBrush/Abstract/BaseLayerBrush.cs
@@ -1,5 +1,6 @@
using System;
using Artemis.Core.Models.Profile;
+using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces;
using SkiaSharp;
@@ -11,6 +12,8 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
///
public abstract class BaseLayerBrush : IDisposable
{
+ private bool _supportsTransformation = true;
+
///
/// Gets the layer this brush is applied to
///
@@ -37,9 +40,19 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
public virtual LayerPropertyGroup BaseProperties => null;
///
- /// Gets whether the brush supports transformations, RGB.NET brushes never support transformation
+ /// Gets or sets whether the brush supports transformations
+ /// Note: RGB.NET brushes can never be transformed and setting this to true will throw an exception
///
- public bool SupportsTransformation { get; protected set; }
+ public bool SupportsTransformation
+ {
+ get => _supportsTransformation;
+ protected set
+ {
+ if (BrushType == LayerBrushType.RgbNet)
+ throw new ArtemisPluginException(PluginInfo, "An RGB.NET brush cannot support transformation");
+ _supportsTransformation = value;
+ }
+ }
public void Dispose()
{
diff --git a/src/Artemis.Core/Plugins/LayerBrush/Abstract/RgbNetLayerBrush.cs b/src/Artemis.Core/Plugins/LayerBrush/Abstract/RgbNetLayerBrush.cs
index bb6dcef15..8c7d06bad 100644
--- a/src/Artemis.Core/Plugins/LayerBrush/Abstract/RgbNetLayerBrush.cs
+++ b/src/Artemis.Core/Plugins/LayerBrush/Abstract/RgbNetLayerBrush.cs
@@ -13,6 +13,7 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
protected RgbNetLayerBrush()
{
BrushType = LayerBrushType.RgbNet;
+ SupportsTransformation = false;
}
///
diff --git a/src/Artemis.UI.Shared/Services/Interfaces/IProfileEditorService.cs b/src/Artemis.UI.Shared/Services/Interfaces/IProfileEditorService.cs
index 2623b8c32..064b4c2a5 100644
--- a/src/Artemis.UI.Shared/Services/Interfaces/IProfileEditorService.cs
+++ b/src/Artemis.UI.Shared/Services/Interfaces/IProfileEditorService.cs
@@ -19,7 +19,7 @@ namespace Artemis.UI.Shared.Services.Interfaces
IKernel Kernel { get; }
void ChangeSelectedProfile(Profile profile);
- void UpdateSelectedProfile();
+ void UpdateSelectedProfile(bool includeChildren);
void ChangeSelectedProfileElement(ProfileElement profileElement);
void UpdateSelectedProfileElement();
void UpdateProfilePreview();
diff --git a/src/Artemis.UI.Shared/Services/ProfileEditorService.cs b/src/Artemis.UI.Shared/Services/ProfileEditorService.cs
index aaae33cc0..ee23c561f 100644
--- a/src/Artemis.UI.Shared/Services/ProfileEditorService.cs
+++ b/src/Artemis.UI.Shared/Services/ProfileEditorService.cs
@@ -71,9 +71,9 @@ namespace Artemis.UI.Shared.Services
OnSelectedProfileChanged(profileElementEvent);
}
- public void UpdateSelectedProfile()
+ public void UpdateSelectedProfile(bool includeChildren)
{
- _profileService.UpdateProfile(SelectedProfile, false);
+ _profileService.UpdateProfile(SelectedProfile, includeChildren);
UpdateProfilePreview();
OnSelectedProfileElementUpdated(new ProfileElementEventArgs(SelectedProfile));
}
diff --git a/src/Artemis.UI/Converters/NullToVisibilityConverter.cs b/src/Artemis.UI/Converters/NullToVisibilityConverter.cs
index 60eebe97c..36c31ae09 100644
--- a/src/Artemis.UI/Converters/NullToVisibilityConverter.cs
+++ b/src/Artemis.UI/Converters/NullToVisibilityConverter.cs
@@ -9,17 +9,22 @@ namespace Artemis.UI.Converters
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- var direction = (Parameters) Enum.Parse(typeof(Parameters), (string) parameter ?? throw new InvalidOperationException());
+ Parameters direction;
+ if (parameter == null)
+ direction = Parameters.Normal;
+ else
+ direction = (Parameters) Enum.Parse(typeof(Parameters), (string) parameter);
+
if (direction == Parameters.Normal)
{
if (value == null)
- return Visibility.Hidden;
+ return Visibility.Collapsed;
return Visibility.Visible;
}
if (value == null)
return Visibility.Visible;
- return Visibility.Hidden;
+ return Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
index a9d9da3e1..3beff72c3 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
@@ -1,4 +1,4 @@
-
-
-
-
-
+
+
+
+
+
@@ -147,13 +149,13 @@
VerticalScrollBarVisibility="Hidden" ScrollChanged="TimelineScrollChanged">
-
@@ -175,7 +177,7 @@
VerticalScrollBarVisibility="Auto"
ScrollChanged="TimelineScrollChanged">
-
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs
index 88a63ce9c..1263d1aa2 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs
@@ -47,6 +47,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
}
public Layer SelectedLayer { get; set; }
+ public Folder SelectedFolder { get; set; }
+
public BindableCollection 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;
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/ProfileTreeView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/ProfileTreeView.xaml
index cfb383c9a..e6cb7c960 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/ProfileTreeView.xaml
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/ProfileTreeView.xaml
@@ -47,21 +47,23 @@
-
-
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs
index 386a8b01d..34a59503d 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs
@@ -78,7 +78,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree
break;
}
- _profileEditorService.UpdateSelectedProfile();
+ _profileEditorService.UpdateSelectedProfile(true);
}
// ReSharper disable once UnusedMember.Global - Called from view
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
index 1b9950548..6209223da 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
@@ -114,7 +114,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
ProfileElement.AddChild(new Folder(ProfileElement.Profile, ProfileElement, "New folder"));
UpdateProfileElements();
- _profileEditorService.UpdateSelectedProfile();
+ _profileEditorService.UpdateSelectedProfile(true);
}
public void AddLayer()
@@ -124,7 +124,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
_layerService.CreateLayer(ProfileElement.Profile, ProfileElement, "New layer");
UpdateProfileElements();
- _profileEditorService.UpdateSelectedProfile();
+ _profileEditorService.UpdateSelectedProfile(true);
}
// ReSharper disable once UnusedMember.Global - Called from view
@@ -136,7 +136,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
if (result is string newName)
{
ProfileElement.Name = newName;
- _profileEditorService.UpdateSelectedProfile();
+ _profileEditorService.UpdateSelectedProfile(true);
}
}
@@ -153,11 +153,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
// Farewell, cruel world
var parent = Parent;
- ProfileElement.Parent.RemoveChild(ProfileElement);
+ ProfileElement.Parent?.RemoveChild(ProfileElement);
parent.RemoveExistingElement(this);
parent.UpdateProfileElements();
- _profileEditorService.UpdateSelectedProfile();
+ _profileEditorService.UpdateSelectedProfile(true);
}
public void UpdateProfileElements()
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs
index bb8165241..97b681dae 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs
@@ -7,6 +7,7 @@ using System.Windows.Media.Imaging;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.LayerShapes;
using Artemis.Core.Models.Surface;
+using Artemis.Core.Plugins.LayerBrush.Abstract;
using Artemis.UI.Extensions;
using Artemis.UI.Services.Interfaces;
using Artemis.UI.Shared.Services.Interfaces;
@@ -147,7 +148,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
break;
}
- shapeGeometry.Transform = _layerEditorService.GetLayerTransformGroup(Layer);
+ if (Layer.LayerBrush == null || Layer.LayerBrush.SupportsTransformation)
+ shapeGeometry.Transform = _layerEditorService.GetLayerTransformGroup(Layer);
+
ShapeGeometry = shapeGeometry;
});
}
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs
index 0cd4be0d6..e7cf9a8a7 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileViewModel.cs
@@ -207,7 +207,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
if (_profileEditorService.SelectedProfileElement is Layer layer)
{
CanApplyToLayer = true;
- CanSelectEditTool = (layer.LayerBrush == null || layer.LayerBrush.BrushType == LayerBrushType.Regular) && layer.Leds.Any();
+ CanSelectEditTool = (layer.LayerBrush == null || layer.LayerBrush.SupportsTransformation) && layer.Leds.Any();
}
else
{
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/SelectionToolViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/SelectionToolViewModel.cs
index f8c705799..56e20911d 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/SelectionToolViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/SelectionToolViewModel.cs
@@ -58,7 +58,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
newLayer.AddLeds(selectedLeds);
ProfileEditorService.ChangeSelectedProfileElement(newLayer);
ProfileEditorService.UpdateSelectedProfileElement();
- ProfileEditorService.UpdateSelectedProfile();
+ ProfileEditorService.UpdateSelectedProfile(false);
}
// If no folder selected, apply it to a new layer in the root folder
else
@@ -68,7 +68,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
newLayer.AddLeds(selectedLeds);
ProfileEditorService.ChangeSelectedProfileElement(newLayer);
ProfileEditorService.UpdateSelectedProfileElement();
- ProfileEditorService.UpdateSelectedProfile();
+ ProfileEditorService.UpdateSelectedProfile(false);
}
}