diff --git a/src/Artemis.Core/Models/Profile/Layer.cs b/src/Artemis.Core/Models/Profile/Layer.cs index 9dec90456..beca25a7d 100644 --- a/src/Artemis.Core/Models/Profile/Layer.cs +++ b/src/Artemis.Core/Models/Profile/Layer.cs @@ -50,7 +50,8 @@ public sealed class Layer : RenderProfileElement /// The profile the layer belongs to /// The parent of the layer /// The entity of the layer - public Layer(Profile profile, ProfileElement parent, LayerEntity layerEntity) : base(parent, parent.Profile) + /// A boolean indicating whether or not to attempt to load the node script straight away + public Layer(Profile profile, ProfileElement parent, LayerEntity layerEntity, bool loadNodeScript = false) : base(parent, parent.Profile) { LayerEntity = layerEntity; EntityId = layerEntity.Id; @@ -62,6 +63,8 @@ public sealed class Layer : RenderProfileElement Load(); Initialize(); + if (loadNodeScript) + LoadNodeScript(); } /// diff --git a/src/Artemis.UI/Extensions/ProfileElementExtensions.cs b/src/Artemis.UI/Extensions/ProfileElementExtensions.cs index 08ca23e2c..905c6aa10 100644 --- a/src/Artemis.UI/Extensions/ProfileElementExtensions.cs +++ b/src/Artemis.UI/Extensions/ProfileElementExtensions.cs @@ -55,7 +55,7 @@ public static class ProfileElementExtensions return folderClipboardModel.Paste(parent.Profile, parent); case LayerEntity layerEntity: layerEntity.Id = Guid.NewGuid(); - return new Layer(parent.Profile, parent, layerEntity); + return new Layer(parent.Profile, parent, layerEntity, true); default: return null; } diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemViewModel.cs index c6cb955ae..526c5412d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemViewModel.cs @@ -41,7 +41,7 @@ public class LayerTreeItemViewModel : TreeItemViewModel copy.Id = Guid.NewGuid(); copy.Name = Layer.Parent.GetNewFolderName(copy.Name + " - copy"); - Layer copied = new(Layer.Profile, Layer.Parent, copy); + Layer copied = new(Layer.Profile, Layer.Parent, copy, true); ProfileEditorService.ExecuteCommand(new AddProfileElement(copied, Layer.Parent, Layer.Order - 1)); Layer.Profile.PopulateLeds(_rgbService.EnabledDevices); }