RaptorSuiteCommandHooks
Pre-handlers for edit commands in the RAPTOR window.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, 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 RaptorSuiteCommandHooksProperties
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.
| Parameter | Type | Description |
|---|---|---|
id | string | The hook's stable id. |
take | Func<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
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.
| Parameter | Type | Description |
|---|---|---|
id | string | The hook's stable id. |
Returns: False when no hook has this id.