using System;
namespace Artemis.Core.LayerEffects
{
///
/// Represents an effect that applies preprocessing and/or postprocessing to a layer
///
///
public abstract class LayerEffect : BaseLayerEffect where T : LayerPropertyGroup
{
private T _properties;
///
/// Gets whether all properties on this effect are initialized
///
public bool PropertiesInitialized { get; internal set; }
///
public override LayerPropertyGroup BaseProperties => Properties;
///
/// Gets the properties of this effect.
///
public T Properties
{
get
{
// I imagine a null reference here can be confusing, so lets throw an exception explaining what to do
if (_properties == null)
throw new ArtemisPluginException("Cannot access effect properties until OnPropertiesInitialized has been called");
return _properties;
}
internal set => _properties = value;
}
internal void InitializeProperties()
{
Properties = Activator.CreateInstance();
Properties.LayerEffect = this;
Properties.Initialize(ProfileElement, PropertyRootPath, PluginInfo);
PropertiesInitialized = true;
EnableLayerEffect();
}
internal override void Initialize()
{
InitializeProperties();
}
}
}