RaptorHotspotPatchRoutes
Routes for the Face panel's Patches button and its Edit sheet chip.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, since 0.1.0 |
The Patches button opens the Patches panel. A module can Register a route that handles an Edit sheet press, for example to open its own patch editor for the face's sheet. DefaultMemberTab chooses the member tab the Patch Picker opens a combo sheet on.
Routes are keyed by id, so registering again from an [InitializeOnLoad] constructor on every domain reload is safe. Routes are read when used, so a late registration applies from the next press or tooltip. With nothing registered, an Edit sheet press opens the Patch Picker, the tooltip is BaseTooltip, and combo sheets open on tab 0.
public static class RaptorHotspotPatchRoutesFields
BaseTooltip
public const string BaseTooltip;The first line of the Patches button's tooltip. Route suffixes follow it.
Properties
DefaultMemberTab
public static Func<IReadOnlyList<RaptorHotspotAtlas>, int> DefaultMemberTab { get; set; }Chooses the member tab, as an index into the sheet's members, that the Patch Picker opens a combo sheet on when nothing more specific applies. Tab 0 is used when the property is null, or when the function returns an out-of-range index or throws.
Ids
public static IReadOnlyList<string> Ids { get; }The registered route ids, in registration order.
Tooltip
public static string Tooltip { get; }The Patches button's tooltip, made of BaseTooltip followed by each route's suffix in registration order. The same string instance is returned until a route changes.
Methods
Open
public static void Open()Opens the Patches panel, as the Patches button does.
Register
public static void Register(string id, Func<RaptorPatchContext, bool> tryOpen, string tooltipSuffix)Registers a Patches route. Routes are tried in registration order. tryOpen receives the press's context and returns true to handle the press, in which case later routes and the Patch Picker do not open. tooltipSuffix is appended to the button's tooltip unchanged and may be null. Registering an existing id replaces its route and suffix in place. Throws ArgumentException when id is null or empty, and ArgumentNullException when tryOpen is null.
| Parameter | Type | Description |
|---|---|---|
id | string | The route's stable id. |
tryOpen | Func<RaptorPatchContext, bool> | Returns true to handle the press. |
tooltipSuffix | string | Text appended to the button's tooltip, or null. |
Call from an [InitializeOnLoad] static constructor on the main thread. A callback that throws is logged and does not stop the others.
Scratch
public static IDisposable Scratch()Experimental
Clears the routes and the default-tab rule until the returned scope is disposed, then restores what was registered before. Intended for tests and dry runs. Scopes nest.
Returns: A scope. Dispose it to restore the routes.
Unregister
public static bool Unregister(string id)Removes a route.
| Parameter | Type | Description |
|---|---|---|
id | string | The route's stable id. |
Returns: False when there is no such id.
Related types
- RaptorHotspotAtlas: Authoring data for a hotspot sheet: a trim or panel material and its patches.
- RaptorPatchContext: The RAPTOR window, hotspot sheet and patch passed to a Patches route (RaptorHotspotPatchRoutes).