mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Layer properties - Improved error messaging
Profile editor - Fixed layer creation in selection tool not initializing the layer Device visualizer - Better handle missing images
This commit is contained in:
1 parent
f1cbfb36e9
commit
f5a937fd7a
10 files changed
+46
-24
No files matched your search
@@ -72,14 +72,6 @@ namespace Artemis.Core.Models.Profile
|
||||
return folder;
|
||||
}
|
||||
|
||||
public Layer AddLayer(string name)
|
||||
{
|
||||
var layer = new Layer(Profile, this, name) {Order = Children.LastOrDefault()?.Order ?? 1};
|
||||
layer.LayerShape = new Rectangle(layer);
|
||||
AddChild(layer);
|
||||
return layer;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[Folder] {nameof(Name)}: {Name}, {nameof(Order)}: {Order}";
|
||||
|
||||
@@ -130,14 +130,17 @@ namespace Artemis.Core.Models.Profile
|
||||
if (propertyDescription != null)
|
||||
{
|
||||
if (!typeof(BaseLayerProperty).IsAssignableFrom(propertyInfo.PropertyType))
|
||||
throw new ArtemisPluginException("Layer property with PropertyDescription attribute must be of type LayerProperty");
|
||||
throw new ArtemisPluginException($"Layer property with PropertyDescription attribute must be of type LayerProperty at {path + propertyInfo.Name}");
|
||||
|
||||
var instance = (BaseLayerProperty) Activator.CreateInstance(propertyInfo.PropertyType, true);
|
||||
instance.Parent = this;
|
||||
instance.PropertyDescription = (PropertyDescriptionAttribute)propertyDescription;
|
||||
if (instance == null)
|
||||
throw new ArtemisPluginException($"Failed to create instance of layer property at {path + propertyInfo.Name}");
|
||||
|
||||
instance.Layer = layer;
|
||||
|
||||
instance.Parent = this;
|
||||
instance.PropertyDescription = (PropertyDescriptionAttribute) propertyDescription;
|
||||
InitializeProperty(layer, path + propertyInfo.Name, instance);
|
||||
|
||||
propertyInfo.SetValue(this, instance);
|
||||
_layerProperties.Add(instance);
|
||||
}
|
||||
@@ -150,16 +153,23 @@ namespace Artemis.Core.Models.Profile
|
||||
throw new ArtemisPluginException("Layer property with PropertyGroupDescription attribute must be of type LayerPropertyGroup");
|
||||
|
||||
var instance = (LayerPropertyGroup) Activator.CreateInstance(propertyInfo.PropertyType);
|
||||
if (instance == null)
|
||||
throw new ArtemisPluginException($"Failed to create instance of layer property group at {path + propertyInfo.Name}");
|
||||
|
||||
instance.Parent = this;
|
||||
instance.GroupDescription = (PropertyGroupDescriptionAttribute)propertyGroupDescription;
|
||||
instance.GroupDescription = (PropertyGroupDescriptionAttribute) propertyGroupDescription;
|
||||
instance.InitializeProperties(layerService, layer, $"{path}{propertyInfo.Name}.");
|
||||
|
||||
propertyInfo.SetValue(this, instance);
|
||||
_layerPropertyGroups.Add(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Request the property group to populate defaults
|
||||
PopulateDefaults();
|
||||
|
||||
// Apply the newly populated defaults
|
||||
foreach (var layerProperty in _layerProperties.Where(p => !p.IsLoadedFromStorage))
|
||||
layerProperty.ApplyDefaultValue();
|
||||
|
||||
@@ -167,7 +177,7 @@ namespace Artemis.Core.Models.Profile
|
||||
PropertiesInitialized = true;
|
||||
OnPropertyGroupInitialized();
|
||||
}
|
||||
|
||||
|
||||
internal void ApplyToEntity()
|
||||
{
|
||||
if (!PropertiesInitialized)
|
||||
|
||||
Reference in new issue
Block a user