Get RAPTOR

RaptorModelLifecycle

Model lifecycle events and hooks for modules that store their own data on a model.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorclasspreview, since 0.1.0

Subscribe from an [InitializeOnLoad] class, and unsubscribe first to avoid duplicate subscriptions. A listener that throws is logged and does not stop other listeners or the caller.

public static class RaptorModelLifecycle

Fields

FreshVetoes

public static readonly List<Func<RaptorModel, bool>> FreshVetoes;

Rules that mark a model as no longer fresh. A rule returns true when its module has data keyed to the model. RaptorSuiteModelVariant.IsFresh is false when any rule returns true.

Methods

IsFreshVetoed

public static bool IsFreshVetoed(RaptorModel model)

Whether any FreshVetoes rule marks the model as not fresh. A rule that throws is logged and ignored.

ParameterTypeDescription
modelRaptorModelThe model.

Returns: True when a rule vetoes it.

RaiseFreshened

public static void RaiseFreshened(RaptorModel copy)

Raises Freshened. Does nothing when copy is null.

ParameterTypeDescription
copyRaptorModelThe fresh copy.

RaisePartCreated

public static void RaisePartCreated(RaptorModel model, RaptorModelPartKind kind)

Raises PartCreated. Call it from code that creates a part model. Does nothing when model is null.

ParameterTypeDescription
modelRaptorModelThe new part's model.
kindRaptorModelPartKindThe kind of part.

Events

Freshened

public static event Action<RaptorModel> Freshened;

Raised when a model is copied as a fresh source. RAPTOR has already reset its own state on the copy. Listeners should reset their own data on it the same way. The copy keeps every other value of the original.

PartCreated

public static event Action<RaptorModel, RaptorModelPartKind> PartCreated;

Raised when RAPTOR creates a part's model. It is raised inside the creating gesture, so a listener's changes join that gesture's undo step.