Get RAPTOR

RaptorSuiteCommandHooks

Pre-handlers for edit commands in the RAPTOR window.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorclasspreview, since 0.1.0

Editor commands (Delete, Duplicate, Copy, Paste, Select All, Frame Selected and others, sent as ValidateCommand and ExecuteCommand events) go to every registered hook first, in registration order. Hooks run in the window's edit command handler before external toolbar tools and Mesh tools, and at the start of the Mesh tools' handler after its mode check. A hook returns true to take the command, which then goes no further.

Registering an existing id replaces its hook in place.

public static class RaptorSuiteCommandHooks

Properties

Ids

public static IReadOnlyList<string> Ids { get; }

Gets the registered hook ids in call order.

Methods

Register

public static void Register(string id, Func<Event, bool> take)

Registers a pre-handler, or replaces the hook with the same id.

ParameterTypeDescription
idstringThe hook's stable id.
takeFunc<Event, bool>Receives the command event; returns true to take it.

Call from an [InitializeOnLoad] static constructor on the main thread. A hook that throws is logged and the command goes to the next hook.

Scratch

public static IDisposable Scratch()

Experimental

This member may change in any release.

Removes all hooks until the returned scope is disposed, then restores the previous hooks. Scopes can be nested.

Returns: The scope. Dispose it to restore the hooks.

Unregister

public static bool Unregister(string id)

Removes a hook.

ParameterTypeDescription
idstringThe hook's stable id.

Returns: False when no hook has this id.