Layer properties - Restored much functionality on the reworked VMs

This commit is contained in:
SpoinkyNL committed 2020-05-24 22:05:04 +02:00
1 parent 3d244ff028
commit 8456817a2b
29 files changed
+440 -209

No files matched your search

+6 -7
View File
@@ -27,8 +27,8 @@ namespace Artemis.Core.Services
var layer = new Layer(profile, parent, name);
// Layers have two hardcoded property groups, instantiate them
layer.General.InitializeProperties(this, layer, null);
layer.Transform.InitializeProperties(this, layer, null);
layer.General.InitializeProperties(this, layer, "General.");
layer.Transform.InitializeProperties(this, layer, "Transform.");
// With the properties loaded, the layer brush can be instantiated
InstantiateLayerBrush(layer);
@@ -58,11 +58,10 @@ namespace Artemis.Core.Services
new ConstructorArgument("layer", layer),
new ConstructorArgument("descriptor", descriptor)
};
var layerBrush = (BaseLayerBrush) _kernel.Get(descriptor.LayerBrushType, arguments);
layerBrush.InitializeProperties(this, null);
layer.LayerBrush = layerBrush;
return layerBrush;
layer.LayerBrush = (BaseLayerBrush)_kernel.Get(descriptor.LayerBrushType, arguments); ;
layer.LayerBrush.InitializeProperties(this, "LayerBrush.");
layer.OnLayerBrushUpdated();
return layer.LayerBrush;
}
public void RemoveLayerBrush(Layer layer)
@@ -93,8 +93,8 @@ namespace Artemis.Core.Services.Storage
module.ChangeActiveProfile(profile, _surfaceService.ActiveSurface);
if (profile != null)
{
InitializeCoreProperties(profile);
InstantiateProfileLayerBrushes(profile);
InitializeLayerProperties(profile);
InstantiateLayerBrushes(profile);
}
}
@@ -159,18 +159,18 @@ namespace Artemis.Core.Services.Storage
_logger.Debug("Redo profile update - Success");
}
private void InitializeCoreProperties(Profile profile)
private void InitializeLayerProperties(Profile profile)
{
foreach (var layer in profile.GetAllLayers().Where(l => l.LayerBrush == null))
{
if (!layer.General.PropertiesInitialized)
layer.General.InitializeProperties(_layerService, layer, null);
layer.General.InitializeProperties(_layerService, layer, "General.");
if (!layer.Transform.PropertiesInitialized)
layer.Transform.InitializeProperties(_layerService, layer, null);
layer.Transform.InitializeProperties(_layerService, layer, "Transform.");
};
}
private void InstantiateProfileLayerBrushes(Profile profile)
private void InstantiateLayerBrushes(Profile profile)
{
// Only instantiate brushes for layers without an existing brush instance
foreach (var layer in profile.GetAllLayers().Where(l => l.LayerBrush == null))
@@ -188,7 +188,7 @@ namespace Artemis.Core.Services.Storage
{
var profileModules = _pluginService.GetPluginsOfType<ProfileModule>();
foreach (var profileModule in profileModules.Where(p => p.ActiveProfile != null).ToList())
InstantiateProfileLayerBrushes(profileModule.ActiveProfile);
InstantiateLayerBrushes(profileModule.ActiveProfile);
}
#region Event handlers