using System; using System.Collections.ObjectModel; using Artemis.Storage.Entities.Profile; namespace Artemis.Core; /// /// Represents a property on a layer. Properties are saved in storage and can optionally be modified from the UI. /// /// Note: You cannot initialize layer properties yourself. If properly placed and annotated, the Artemis core will /// initialize these for you. /// /// public interface ILayerProperty : IStorageModel, IDisposable, IPluginFeatureDependent { /// /// Gets the description attribute applied to this property /// PropertyDescriptionAttribute PropertyDescription { get; } /// /// Gets the profile element (such as layer or folder) this property is applied to /// RenderProfileElement ProfileElement { get; } /// /// The parent group of this layer property, set after construction /// LayerPropertyGroup LayerPropertyGroup { get; } /// /// Gets or sets whether the property is hidden in the UI /// public bool IsHidden { get; set; } /// /// Gets the data binding of this property /// IDataBinding BaseDataBinding { get; } /// /// Gets a boolean indicating whether the layer has any data binding properties /// public bool HasDataBinding { get; } /// /// Gets a boolean indicating whether data bindings are supported on this type of property /// public bool DataBindingsSupported { get; } /// /// Gets the unique path of the property on the render element /// string Path { get; } /// /// Gets a read-only list of all the keyframes on this layer property /// ReadOnlyCollection UntypedKeyframes { get; } /// /// Gets the type of the property /// Type PropertyType { get; } /// /// Indicates whether the BaseValue was loaded from storage, useful to check whether a default value must be applied /// bool IsLoadedFromStorage { get; } /// /// Initializes the layer property /// /// Note: This isn't done in the constructor to keep it parameterless which is easier for implementations of /// /// /// void Initialize(RenderProfileElement profileElement, LayerPropertyGroup group, PropertyEntity entity, bool fromStorage, PropertyDescriptionAttribute description); /// /// Attempts to create a keyframe for this property from the provided entity /// /// The entity representing the keyframe to create /// If succeeded the resulting keyframe, otherwise ILayerPropertyKeyframe? CreateKeyframeFromEntity(KeyframeEntity keyframeEntity); /// /// Overrides the property value with the default value /// void ApplyDefaultValue(); /// /// Updates the layer properties internal state /// /// The timeline to apply to the property void Update(Timeline timeline); /// /// Updates just the data binding instead of the entire layer /// void UpdateDataBinding(); /// /// Removes a keyframe from the layer property without knowing it's type. /// Prefer . /// /// void RemoveUntypedKeyframe(ILayerPropertyKeyframe keyframe); /// /// Adds a keyframe to the layer property without knowing it's type. /// Prefer . /// /// void AddUntypedKeyframe(ILayerPropertyKeyframe keyframe); /// /// Occurs when the layer property is disposed /// public event EventHandler Disposed; /// /// Occurs once every frame when the layer property is updated /// public event EventHandler? Updated; /// /// Occurs when the current value of the layer property was updated by some form of input /// public event EventHandler? CurrentValueSet; /// /// Occurs when the visibility value of the layer property was updated /// public event EventHandler? VisibilityChanged; /// /// Occurs when keyframes are enabled/disabled /// public event EventHandler? KeyframesToggled; /// /// Occurs when a new keyframe was added to the layer property /// public event EventHandler? KeyframeAdded; /// /// Occurs when a keyframe was removed from the layer property /// public event EventHandler? KeyframeRemoved; }