RaptorModelLifecycle
Model lifecycle events and hooks for modules that store their own data on a model.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, 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 RaptorModelLifecycleFields
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.
| Parameter | Type | Description |
|---|---|---|
model | RaptorModel | The model. |
Returns: True when a rule vetoes it.
RaiseFreshened
public static void RaiseFreshened(RaptorModel copy)Raises Freshened. Does nothing when copy is null.
| Parameter | Type | Description |
|---|---|---|
copy | RaptorModel | The 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.
| Parameter | Type | Description |
|---|---|---|
model | RaptorModel | The new part's model. |
kind | RaptorModelPartKind | The 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.
Related types
- RaptorSuiteModelVariant: Creates a variant copy of a model (Duplicate as variant).
- RaptorModelPartKind: The kind of part a new model was created for (RaptorModelLifecycle.PartCreated).