mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Layer effects - Normalized method naming
This commit is contained in:
parent
e27f658cea
commit
73e992bbb7
@ -61,9 +61,6 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="RGB.NET.Brushes">
|
|
||||||
<HintPath>..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Brushes.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="RGB.NET.Core">
|
<Reference Include="RGB.NET.Core">
|
||||||
<HintPath>..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Core.dll</HintPath>
|
<HintPath>..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Artemis.Core.Exceptions;
|
using Artemis.Core.Exceptions;
|
||||||
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
|
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
|
||||||
|
using Artemis.Core.Plugins.DataModelExpansions.Internal;
|
||||||
using Artemis.Core.Plugins.Modules;
|
using Artemis.Core.Plugins.Modules;
|
||||||
|
|
||||||
namespace Artemis.Core.Plugins.DataModelExpansions
|
namespace Artemis.Core.Plugins.DataModelExpansions
|
||||||
|
|||||||
@ -1,10 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Reflection;
|
using Artemis.Core.Plugins.DataModelExpansions.Internal;
|
||||||
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
|
|
||||||
using Artemis.Core.Utilities;
|
using Artemis.Core.Utilities;
|
||||||
|
|
||||||
namespace Artemis.Core.Plugins.DataModelExpansions
|
namespace Artemis.Core.Plugins.DataModelExpansions
|
||||||
@ -12,7 +9,7 @@ namespace Artemis.Core.Plugins.DataModelExpansions
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allows you to expand the application-wide datamodel
|
/// Allows you to expand the application-wide datamodel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseDataModelExpansion<T> : BaseDataModelExpansion where T : DataModel
|
public abstract class DataModelExpansion<T> : BaseDataModelExpansion where T : DataModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The data model driving this module
|
/// The data model driving this module
|
||||||
@ -58,31 +55,4 @@ namespace Artemis.Core.Plugins.DataModelExpansions
|
|||||||
base.InternalDisablePlugin();
|
base.InternalDisablePlugin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// For internal use only, to implement your own layer property type, extend <see cref="BaseDataModelExpansion{T}" />
|
|
||||||
/// instead.
|
|
||||||
/// </summary>
|
|
||||||
public abstract class BaseDataModelExpansion : Plugin
|
|
||||||
{
|
|
||||||
protected readonly List<PropertyInfo> HiddenPropertiesList = new List<PropertyInfo>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of all properties ignored at runtime using IgnoreProperty(x => x.y)
|
|
||||||
/// </summary>
|
|
||||||
public ReadOnlyCollection<PropertyInfo> HiddenProperties => HiddenPropertiesList.AsReadOnly();
|
|
||||||
|
|
||||||
internal DataModel InternalDataModel { get; set; }
|
|
||||||
public abstract void Update(double deltaTime);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Override to provide your own data model description. By default this returns a description matching your plugin
|
|
||||||
/// name and description
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public virtual DataModelPropertyAttribute GetDataModelDescription()
|
|
||||||
{
|
|
||||||
return new DataModelPropertyAttribute {Name = PluginInfo.Name, Description = PluginInfo.Description};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Reflection;
|
||||||
|
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Plugins.DataModelExpansions.Internal
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// For internal use only, to implement your own layer property type, extend <see cref="DataModelExpansion{T}" />
|
||||||
|
/// instead.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class BaseDataModelExpansion : Plugin
|
||||||
|
{
|
||||||
|
protected readonly List<PropertyInfo> HiddenPropertiesList = new List<PropertyInfo>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a list of all properties ignored at runtime using IgnoreProperty(x => x.y)
|
||||||
|
/// </summary>
|
||||||
|
public ReadOnlyCollection<PropertyInfo> HiddenProperties => HiddenPropertiesList.AsReadOnly();
|
||||||
|
|
||||||
|
internal DataModel InternalDataModel { get; set; }
|
||||||
|
public abstract void Update(double deltaTime);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override to provide your own data model description. By default this returns a description matching your plugin
|
||||||
|
/// name and description
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual DataModelPropertyAttribute GetDataModelDescription()
|
||||||
|
{
|
||||||
|
return new DataModelPropertyAttribute {Name = PluginInfo.Name, Description = PluginInfo.Description};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,7 +22,7 @@ namespace Artemis.Core.Plugins.LayerEffects
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A read-only collection of all layer effects added with <see cref="AddLayerEffectDescriptor{T}" />
|
/// A read-only collection of all layer effects added with <see cref="RegisterLayerEffectDescriptor{T}" />
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ReadOnlyCollection<LayerEffectDescriptor> LayerEffectDescriptors => _layerEffectDescriptors.AsReadOnly();
|
public ReadOnlyCollection<LayerEffectDescriptor> LayerEffectDescriptors => _layerEffectDescriptors.AsReadOnly();
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ namespace Artemis.Core.Plugins.LayerEffects
|
|||||||
/// The Material icon to display in the UI, a full reference can be found
|
/// The Material icon to display in the UI, a full reference can be found
|
||||||
/// <see href="https://materialdesignicons.com">here</see>
|
/// <see href="https://materialdesignicons.com">here</see>
|
||||||
/// </param>
|
/// </param>
|
||||||
protected void AddLayerEffectDescriptor<T>(string displayName, string description, string icon) where T : BaseLayerEffect
|
protected void RegisterLayerEffectDescriptor<T>(string displayName, string description, string icon) where T : BaseLayerEffect
|
||||||
{
|
{
|
||||||
if (!Enabled)
|
if (!Enabled)
|
||||||
throw new ArtemisPluginException(PluginInfo, "Can only add a layer effect descriptor when the plugin is enabled");
|
throw new ArtemisPluginException(PluginInfo, "Can only add a layer effect descriptor when the plugin is enabled");
|
||||||
|
|||||||
@ -28,7 +28,7 @@ namespace Artemis.Core.Plugins.Modules
|
|||||||
/// Gets or sets whether this module must also expand the main data model
|
/// Gets or sets whether this module must also expand the main data model
|
||||||
/// <para>
|
/// <para>
|
||||||
/// Note: If expanding the main data model is all you want your plugin to do, create a
|
/// Note: If expanding the main data model is all you want your plugin to do, create a
|
||||||
/// <see cref="BaseDataModelExpansion{T}" /> plugin instead.
|
/// <see cref="DataModelExpansion{T}" /> plugin instead.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ExpandsDataModel
|
public bool ExpandsDataModel
|
||||||
|
|||||||
@ -10,6 +10,7 @@ using Artemis.Core.Models.Profile;
|
|||||||
using Artemis.Core.Models.Surface;
|
using Artemis.Core.Models.Surface;
|
||||||
using Artemis.Core.Plugins.DataModelExpansions;
|
using Artemis.Core.Plugins.DataModelExpansions;
|
||||||
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
|
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
|
||||||
|
using Artemis.Core.Plugins.DataModelExpansions.Internal;
|
||||||
using Artemis.Core.Utilities;
|
using Artemis.Core.Utilities;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@ using Artemis.Core.JsonConverters;
|
|||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Ninject;
|
using Artemis.Core.Ninject;
|
||||||
using Artemis.Core.Plugins.DataModelExpansions;
|
using Artemis.Core.Plugins.DataModelExpansions;
|
||||||
|
using Artemis.Core.Plugins.DataModelExpansions.Internal;
|
||||||
using Artemis.Core.Plugins.Settings;
|
using Artemis.Core.Plugins.Settings;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
using Artemis.Core.Services.Storage.Interfaces;
|
using Artemis.Core.Services.Storage.Interfaces;
|
||||||
|
|||||||
@ -9,6 +9,7 @@ using Artemis.Core.Models.Profile.Conditions;
|
|||||||
using Artemis.Core.Models.Profile.Conditions.Operators;
|
using Artemis.Core.Models.Profile.Conditions.Operators;
|
||||||
using Artemis.Core.Plugins;
|
using Artemis.Core.Plugins;
|
||||||
using Artemis.Core.Plugins.DataModelExpansions;
|
using Artemis.Core.Plugins.DataModelExpansions;
|
||||||
|
using Artemis.Core.Plugins.DataModelExpansions.Internal;
|
||||||
using Artemis.Core.Plugins.Exceptions;
|
using Artemis.Core.Plugins.Exceptions;
|
||||||
using Artemis.Core.Plugins.Modules;
|
using Artemis.Core.Plugins.Modules;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
|||||||
@ -52,6 +52,11 @@
|
|||||||
<Page Remove="publish\**" />
|
<Page Remove="publish\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<!-- TODO: Remove when moving to Nuget, this is so the plugin templates have the DLL to reference -->
|
||||||
|
<Reference Include="RGB.NET.Brushes">
|
||||||
|
<HintPath>..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Brushes.dll</HintPath>
|
||||||
|
<Private>true</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Core">
|
<Reference Include="RGB.NET.Core">
|
||||||
<HintPath>..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Core.dll</HintPath>
|
<HintPath>..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Artemis.Core.Plugins;
|
using Artemis.Core.Plugins;
|
||||||
using Artemis.Core.Plugins.DataModelExpansions;
|
using Artemis.Core.Plugins.DataModelExpansions;
|
||||||
|
using Artemis.Core.Plugins.DataModelExpansions.Internal;
|
||||||
using Artemis.Core.Plugins.DeviceProviders;
|
using Artemis.Core.Plugins.DeviceProviders;
|
||||||
using Artemis.Core.Plugins.LayerBrushes;
|
using Artemis.Core.Plugins.LayerBrushes;
|
||||||
using Artemis.Core.Plugins.LayerEffects;
|
using Artemis.Core.Plugins.LayerEffects;
|
||||||
|
|||||||
@ -74,8 +74,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LayerEffects", "LayerEffect
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.LayerEffects.Filter", "Plugins\Artemis.Plugins.LayerEffects.Filter\Artemis.Plugins.LayerEffects.Filter.csproj", "{62214042-667E-4B29-B64E-1A68CE6FE209}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.LayerEffects.Filter", "Plugins\Artemis.Plugins.LayerEffects.Filter\Artemis.Plugins.LayerEffects.Filter.csproj", "{62214042-667E-4B29-B64E-1A68CE6FE209}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DataModelExpansions", "DataModelExpansions", "{4E85F6B5-83FB-4830-8787-555103F26ECD}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.Devices.Debug", "Plugins\Artemis.Plugins.Devices.Debug\Artemis.Plugins.Devices.Debug.csproj", "{3D83760B-0A36-4C8F-978D-7949C3FC862B}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.Devices.Debug", "Plugins\Artemis.Plugins.Devices.Debug\Artemis.Plugins.Devices.Debug.csproj", "{3D83760B-0A36-4C8F-978D-7949C3FC862B}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
@ -288,7 +286,6 @@ Global
|
|||||||
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1} = {A311DC47-42A2-4DD4-B921-50FBF7A33F41}
|
{301C3AAA-9F79-46A5-9B9D-86F076C5BDD1} = {A311DC47-42A2-4DD4-B921-50FBF7A33F41}
|
||||||
{2C1477DC-7A5C-4B65-85DB-1F16A18FB2EC} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
{2C1477DC-7A5C-4B65-85DB-1F16A18FB2EC} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
||||||
{62214042-667E-4B29-B64E-1A68CE6FE209} = {2C1477DC-7A5C-4B65-85DB-1F16A18FB2EC}
|
{62214042-667E-4B29-B64E-1A68CE6FE209} = {2C1477DC-7A5C-4B65-85DB-1F16A18FB2EC}
|
||||||
{4E85F6B5-83FB-4830-8787-555103F26ECD} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
|
||||||
{3D83760B-0A36-4C8F-978D-7949C3FC862B} = {88792A7E-F037-4280-81D3-B131508EF1D8}
|
{3D83760B-0A36-4C8F-978D-7949C3FC862B} = {88792A7E-F037-4280-81D3-B131508EF1D8}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
|||||||
@ -6,17 +6,17 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
|||||||
{
|
{
|
||||||
public override void EnablePlugin()
|
public override void EnablePlugin()
|
||||||
{
|
{
|
||||||
AddLayerEffectDescriptor<BlurEffect>(
|
RegisterLayerEffectDescriptor<BlurEffect>(
|
||||||
"Blur",
|
"Blur",
|
||||||
"A layer effect providing a blur filter effect. \r\nNote: CPU intensive, best to only use on small layers or for a short period of time.",
|
"A layer effect providing a blur filter effect. \r\nNote: CPU intensive, best to only use on small layers or for a short period of time.",
|
||||||
"BlurOn"
|
"BlurOn"
|
||||||
);
|
);
|
||||||
AddLayerEffectDescriptor<DilateEffect>("Dilate", "A layer effect providing a dilation filter effect", "EyePlus");
|
RegisterLayerEffectDescriptor<DilateEffect>("Dilate", "A layer effect providing a dilation filter effect", "EyePlus");
|
||||||
AddLayerEffectDescriptor<OpacityEffect>("Opacity", "A layer effect letting you change the opacity of all children", "Opacity");
|
RegisterLayerEffectDescriptor<OpacityEffect>("Opacity", "A layer effect letting you change the opacity of all children", "Opacity");
|
||||||
AddLayerEffectDescriptor<ErodeEffect>("Erode", "A layer effect providing an erode filter effect", "EyeMinus");
|
RegisterLayerEffectDescriptor<ErodeEffect>("Erode", "A layer effect providing an erode filter effect", "EyeMinus");
|
||||||
AddLayerEffectDescriptor<GlowEffect>("Glow", "A layer effect providing a glow filter effect", "BoxShadow");
|
RegisterLayerEffectDescriptor<GlowEffect>("Glow", "A layer effect providing a glow filter effect", "BoxShadow");
|
||||||
AddLayerEffectDescriptor<GrayScaleEffect>("Gray-scale", "A layer effect providing a gray-scale filter effect", "InvertColors");
|
RegisterLayerEffectDescriptor<GrayScaleEffect>("Gray-scale", "A layer effect providing a gray-scale filter effect", "InvertColors");
|
||||||
AddLayerEffectDescriptor<ColorMatrixEffect>("Color matrix", "A layer effect allowing you to apply a custom color matrix", "Matrix");
|
RegisterLayerEffectDescriptor<ColorMatrixEffect>("Color matrix", "A layer effect allowing you to apply a custom color matrix", "Matrix");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DisablePlugin()
|
public override void DisablePlugin()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user