Skip to content

TextStudioCodeEffectAsset<TState, TParameters>

ClassTextStudioTextStudio
public abstract class TextStudioCodeEffectAsset<TState, TParameters> : TextStudioCodeEffectAsset, ITextStudioEffectCapabilitiesProvider, ITextStudioEffectFactory, ITextStudioEffectDefinition, ITextStudioEffectMetadataProvider where TState : struct where TParameters : struct

Typed Code Effect asset with one default parameter struct and isolated per-glyph state.

public override sealed ITextStudioEffect CreateEffect(in TextStudioTagParameters parameters)

Creates an invocation-specific evaluator from parsed tag parameters.

Parameters

Name Type Description
parameters TextStudio.TextStudioTagParameters Read-only parsed parameters for one effect occurrence.

Returns

TextStudio.ITextStudioEffect: A detached evaluator, or null when binding fails.

protected virtual TParameters CreateDefaultParameters()

Creates the typed parameter defaults stored by a newly initialized Code Effect asset.

Returns

{TParameters}

protected virtual TState CreateDefaultState()

Creates isolated initial state for one glyph in one effect invocation.

Returns

{TState}

TryBindParameters(ref TParameters, in TextStudioTagParameters, out string)

Section titled “TryBindParameters(ref TParameters, in TextStudioTagParameters, out string)”
protected virtual bool TryBindParameters(ref TParameters parameters, in TextStudioTagParameters values, out string error)

Binds parsed parameters once for an invocation. Override for custom validation or syntax; the default binder supports Text Studio’s published primitive parameter types.

Parameters

Name Type
parameters {TParameters}
values TextStudio.TextStudioTagParameters
error System.String

Returns

System.Boolean

EvaluateEffect(ref EvaluatedGlyphState, ref TState, in TParameters, in EffectEvaluationContext, EffectBlendMode)

Section titled “EvaluateEffect(ref EvaluatedGlyphState, ref TState, in TParameters, in EffectEvaluationContext, EffectBlendMode)”
protected abstract void EvaluateEffect(ref EvaluatedGlyphState glyphState, ref TState effectState, in TParameters parameters, in EffectEvaluationContext context, EffectBlendMode blendMode)

Evaluates the Code Effect for one glyph using the invocation’s bound parameters and isolated state.

Parameters

Name Type
glyphState TextStudio.EvaluatedGlyphState
effectState {TState}
parameters {TParameters}
context TextStudio.EffectEvaluationContext
blendMode TextStudio.EffectBlendMode
protected override sealed void ValidatePublishedParameters()

Validates that the typed parameter struct can be published through Text Studio metadata.

protected TextStudioCodeEffectAsset()

public TParameters DefaultParameters { get; }

Returns

{TParameters}

public override sealed TextStudioEffectMetadata Metadata { get; }

Returns

TextStudio.TextStudioEffectMetadata

protected virtual bool HandlesUnsupportedPublishedParameters { get; }

Reports whether a custom binder intentionally handles unsupported published fields.

Returns

System.Boolean