Table of Contents

Class LayerProperty<T>

Namespace
Artemis.Core
Assembly
Artemis.Core.dll

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 class LayerProperty<T> : CorePropertyChanged, ILayerProperty, IStorageModel, IDisposable, IPluginFeatureDependent

Type Parameters

T

The type of property encapsulated in this layer property

Inheritance
object
CorePropertyChanged
LayerProperty<T>
Implements
Derived

Constructors

LayerProperty()

Creates a new instance of the LayerProperty<T> class

protected LayerProperty()

Properties

BaseDataBinding

Gets the data binding of this property

public IDataBinding BaseDataBinding { get; }

Property Value

IDataBinding

BaseValue

Gets or sets the base value of this layer property without any keyframes or data bindings applied

public T BaseValue { get; set; }

Property Value

T

CurrentKeyframe

Gets the current keyframe in the timeline according to the current progress

public LayerPropertyKeyframe<T>? CurrentKeyframe { get; protected set; }

Property Value

LayerPropertyKeyframe<T>

CurrentValue

Gets the current value of this property as it is affected by it's keyframes, updated once every frame

public T CurrentValue { get; set; }

Property Value

T

DataBinding

Gets the data binding of this property

public DataBinding<T> DataBinding { get; }

Property Value

DataBinding<T>

DataBindingsSupported

Gets a boolean indicating whether data bindings are supported on this type of property

public bool DataBindingsSupported { get; }

Property Value

bool

DefaultValue

Gets or sets the default value of this layer property. If set, this value is automatically applied if the property has no value in storage

public T DefaultValue { get; set; }

Property Value

T

HasDataBinding

Gets a boolean indicating whether the layer has any data binding properties

public bool HasDataBinding { get; }

Property Value

bool

IsHidden

Gets or sets whether the property is hidden in the UI

public bool IsHidden { get; set; }

Property Value

bool

IsLoadedFromStorage

Indicates whether the BaseValue was loaded from storage, useful to check whether a default value must be applied

public bool IsLoadedFromStorage { get; }

Property Value

bool

Keyframes

Gets a read-only list of all the keyframes on this layer property

public ReadOnlyCollection<LayerPropertyKeyframe<T>> Keyframes { get; }

Property Value

ReadOnlyCollection<LayerPropertyKeyframe<T>>

KeyframesEnabled

Gets or sets whether keyframes are enabled on this property, has no effect if KeyframesSupported is False

public bool KeyframesEnabled { get; set; }

Property Value

bool

KeyframesSupported

Gets whether keyframes are supported on this type of property

public bool KeyframesSupported { get; protected set; }

Property Value

bool

LayerPropertyGroup

The parent group of this layer property, set after construction

public LayerPropertyGroup LayerPropertyGroup { get; }

Property Value

LayerPropertyGroup

NextKeyframe

Gets the next keyframe in the timeline according to the current progress

public LayerPropertyKeyframe<T>? NextKeyframe { get; protected set; }

Property Value

LayerPropertyKeyframe<T>

Path

Gets the unique path of the property on the render element

public string Path { get; }

Property Value

string

ProfileElement

Gets the profile element (such as layer or folder) this property is applied to

public RenderProfileElement ProfileElement { get; }

Property Value

RenderProfileElement

PropertyDescription

Gets the description attribute applied to this property

public PropertyDescriptionAttribute PropertyDescription { get; }

Property Value

PropertyDescriptionAttribute

PropertyType

Gets the type of the property

public Type PropertyType { get; }

Property Value

Type

UntypedKeyframes

Gets a read-only list of all the keyframes on this layer property

public ReadOnlyCollection<ILayerPropertyKeyframe> UntypedKeyframes { get; }

Property Value

ReadOnlyCollection<ILayerPropertyKeyframe>

Methods

AddKeyframe(LayerPropertyKeyframe<T>)

Adds a keyframe to the layer property

public void AddKeyframe(LayerPropertyKeyframe<T> keyframe)

Parameters

keyframe LayerPropertyKeyframe<T>

The keyframe to add

AddUntypedKeyframe(ILayerPropertyKeyframe)

Adds a keyframe to the layer property without knowing it's type.

Prefer AddKeyframe(LayerPropertyKeyframe<T>).

public void AddUntypedKeyframe(ILayerPropertyKeyframe keyframe)

Parameters

keyframe ILayerPropertyKeyframe

ApplyDefaultValue()

Overrides the property value with the default value

public void ApplyDefaultValue()

CreateKeyframeFromEntity(KeyframeEntity)

Attempts to create a keyframe for this property from the provided entity

public ILayerPropertyKeyframe? CreateKeyframeFromEntity(KeyframeEntity keyframeEntity)

Parameters

keyframeEntity KeyframeEntity

The entity representing the keyframe to create

Returns

ILayerPropertyKeyframe

If succeeded the resulting keyframe, otherwise null

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

Releases the unmanaged resources used by the object and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetFeatureDependencies()

Gets the plugin features this class depends on, may contain the same plugin feature twice if depending on it in multiple ways.

public IEnumerable<PluginFeature> GetFeatureDependencies()

Returns

IEnumerable<PluginFeature>

A List<T> of PluginFeature this class depends on.

Initialize(RenderProfileElement, LayerPropertyGroup, PropertyEntity, bool, PropertyDescriptionAttribute)

Initializes the layer property

Note: This isn't done in the constructor to keep it parameterless which is easier for implementations of LayerProperty<T>

public void Initialize(RenderProfileElement profileElement, LayerPropertyGroup group, PropertyEntity entity, bool fromStorage, PropertyDescriptionAttribute description)

Parameters

profileElement RenderProfileElement
group LayerPropertyGroup
entity PropertyEntity
fromStorage bool
description PropertyDescriptionAttribute

IsHiddenWhen<TP>(TP, Func<TP, bool>)

Set up a condition to hide the provided layer property when the condition evaluates to true

Note: overrides previous calls to IsHiddenWhen and IsVisibleWhen

public void IsHiddenWhen<TP>(TP layerProperty, Func<TP, bool> condition) where TP : ILayerProperty

Parameters

layerProperty TP

The target layer property

condition Func<TP, bool>

The condition to evaluate to determine whether to hide the current layer property

Type Parameters

TP

The type of the target layer property

IsVisibleWhen<TP>(TP, Func<TP, bool>)

Set up a condition to show the provided layer property when the condition evaluates to true

Note: overrides previous calls to IsHiddenWhen and IsVisibleWhen

public void IsVisibleWhen<TP>(TP layerProperty, Func<TP, bool> condition) where TP : ILayerProperty

Parameters

layerProperty TP

The target layer property

condition Func<TP, bool>

The condition to evaluate to determine whether to hide the current layer property

Type Parameters

TP

The type of the target layer property

Load()

Loads the model from its associated entity

public void Load()

OnCurrentValueSet()

Invokes the CurrentValueSet event

protected virtual void OnCurrentValueSet()

OnInitialize()

Called when the layer property has been initialized

protected virtual void OnInitialize()

OnKeyframeAdded(ILayerPropertyKeyframe)

Invokes the KeyframeAdded event

protected virtual void OnKeyframeAdded(ILayerPropertyKeyframe keyframe)

Parameters

keyframe ILayerPropertyKeyframe

OnKeyframeRemoved(ILayerPropertyKeyframe)

Invokes the KeyframeRemoved event

protected virtual void OnKeyframeRemoved(ILayerPropertyKeyframe keyframe)

Parameters

keyframe ILayerPropertyKeyframe

OnKeyframesToggled()

Invokes the KeyframesToggled event

protected virtual void OnKeyframesToggled()

OnUpdated()

Invokes the Updated event

protected virtual void OnUpdated()

OnVisibilityChanged()

Invokes the VisibilityChanged event

protected virtual void OnVisibilityChanged()

RemoveKeyframe(LayerPropertyKeyframe<T>)

Removes a keyframe from the layer property

public void RemoveKeyframe(LayerPropertyKeyframe<T> keyframe)

Parameters

keyframe LayerPropertyKeyframe<T>

The keyframe to remove

RemoveUntypedKeyframe(ILayerPropertyKeyframe)

Removes a keyframe from the layer property without knowing it's type.

Prefer RemoveKeyframe(LayerPropertyKeyframe<T>).

public void RemoveUntypedKeyframe(ILayerPropertyKeyframe keyframe)

Parameters

keyframe ILayerPropertyKeyframe

Save()

Saves the property to the underlying property entity

public void Save()

SetCurrentValue(T, TimeSpan?)

Sets the current value, using either keyframes if enabled or the base value.

public LayerPropertyKeyframe<T>? SetCurrentValue(T value, TimeSpan? time = null)

Parameters

value T

The value to set.

time TimeSpan?

An optional time to set the value add, if provided and property is using keyframes the value will be set to an new or existing keyframe.

Returns

LayerPropertyKeyframe<T>

The keyframe if one was created or updated.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Update(Timeline)

Updates the layer properties internal state

public void Update(Timeline timeline)

Parameters

timeline Timeline

The timeline to apply to the property

UpdateCurrentValue(float, float)

Called every update (if keyframes are both supported and enabled) to determine the new CurrentValue based on the provided progress

protected virtual void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)

Parameters

keyframeProgress float

The linear current keyframe progress

keyframeProgressEased float

The current keyframe progress, eased with the current easing function

UpdateDataBinding()

Updates just the data binding instead of the entire layer

public void UpdateDataBinding()

Events

CurrentValueSet

Occurs when the current value of the layer property was updated by some form of input

public event EventHandler<LayerPropertyEventArgs>? CurrentValueSet

Event Type

EventHandler<LayerPropertyEventArgs>

Disposed

Occurs when the layer property is disposed

public event EventHandler? Disposed

Event Type

EventHandler

KeyframeAdded

Occurs when a new keyframe was added to the layer property

public event EventHandler<LayerPropertyKeyframeEventArgs>? KeyframeAdded

Event Type

EventHandler<LayerPropertyKeyframeEventArgs>

KeyframeRemoved

Occurs when a keyframe was removed from the layer property

public event EventHandler<LayerPropertyKeyframeEventArgs>? KeyframeRemoved

Event Type

EventHandler<LayerPropertyKeyframeEventArgs>

KeyframesToggled

Occurs when keyframes are enabled/disabled

public event EventHandler<LayerPropertyEventArgs>? KeyframesToggled

Event Type

EventHandler<LayerPropertyEventArgs>

Updated

Occurs once every frame when the layer property is updated

public event EventHandler<LayerPropertyEventArgs>? Updated

Event Type

EventHandler<LayerPropertyEventArgs>

VisibilityChanged

Occurs when the visibility value of the layer property was updated

public event EventHandler<LayerPropertyEventArgs>? VisibilityChanged

Event Type

EventHandler<LayerPropertyEventArgs>