Get RAPTOR

RaptorBlockEdits

Inspector helpers for checking editability, finding owning models and editing in one undo step.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorclasspreview, since 0.1.0

Lets an Inspector block anchored to a component's section edit the selection the same way the built-in sections do.

public static class RaptorBlockEdits

Properties

ManipulationActive

public static bool ManipulationActive { get; }

Whether a Scene view manipulation, such as a handle drag, is in progress. Edits wait until it ends.

Methods

CanEdit

public static bool CanEdit(Component[] targets)

Returns whether every target can be edited from the Inspector now. Returns false in Play mode, or when a target is generated output, read-only, owned by a dedicated authoring tool, or of a different geometry kind from the current mode.

ParameterTypeDescription
targetsComponent[]The components.

Returns: True when every target can be edited.

OwningModels

public static RaptorModel[] OwningModels(IEnumerable<Component> components)

Returns the distinct RAPTOR models that own components (the nearest RaptorModel parent of each).

ParameterTypeDescription
componentsIEnumerable<Component>The components.

Returns: The models.

Transaction

public static bool Transaction(Object[] touched, RaptorModel[] models, string undoName, Action write)

Runs write as one undo step named undoName. Records touched, runs the write, rebuilds every model in models, marks changed objects dirty (recording prefab overrides) and collapses the step. If write throws, the step is reverted and the exception is rethrown.

ParameterTypeDescription
touchedObject[]The objects the write changes.
modelsRaptorModel[]The models to rebuild.
undoNamestringThe undo step's name.
writeActionThe edit to run.

Returns: Always true.

  • RaptorModel: The root of a RAPTOR model and its output container.