RaptorSuiteDisplayMenuItems
Module rows in the Suite's Display ▾ menu.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, since 0.1.0 |
Each row is a toggle with an icon, a label, a toggle action and an on-state check. It is placed after an anchor row, given by label, with fallbacks. Register(..., "Other row", "Model editing") places the row after Other row, or after Model editing if Other row is absent, or at the end of the first group (the view toggles) if neither exists. Anchors are resolved when the menu is built (RaptorAnchoredPlacement), so registration order between modules does not matter, and a row can anchor to another module's row. Rows with the same anchor are sorted by order, then registration.
The first registration of an id wins; a repeat returns false. A toggle or state callback that throws is logged once per id, and the row shows unticked. Registrations are editor-only and cleared on domain reload, after which registrants run again.
public static class RaptorSuiteDisplayMenuItemsFields
RenderAnchor
public const string RenderAnchor;The anchor for the view menu's Render group. Rows placed after it appear under the Render header.
RtPreviewId
public const string RtPreviewId;The ray-traced preview row's id. The 3D view chip's tooltip uses this row's state.
Properties
Count
public static int Count { get; }Gets the number of rows.
Ids
public static IReadOnlyList<string> Ids { get; }Gets the ids in menu order (order, then registration).
Version
public static int Version { get; }Gets a counter that increases by one on every change.
Methods
IsRegistered
public static bool IsRegistered(string id)Whether a row with this id is registered.
| Parameter | Type | Description |
|---|---|---|
id | string | The row's stable id. |
Returns: True when registered.
Pin
public static bool Pin(string id, Func<string> status = null, Func<string> widest = null, string label = null, Func<bool> closable = null, Action close = null)Also shows a registered row as a chip beside the 3D view's chip. Clicking the chip toggles the row. The chip is the row's icon alone, lit while the row is on, and its tooltip is the row's label. It holds no words: status, widest and label are kept for callers and are not shown. Only the first pinned row in menu order that can be used on this PC (SetUnavailable) gets a chip.
While closable returns true, the chip has a close button that runs close. Use this for a row that cannot run on this PC. close typically switches the row off and calls Unpin.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | The row's stable id. | |
status | Func<string> | null | Status words for the row. Kept, not shown on the chip. |
widest | Func<string> | null | The longest status to expect. Kept, not shown on the chip. |
label | string | null | A shorter word for the row. Kept, not shown on the chip. |
closable | Func<bool> | null | Returns true while the chip shows a close button. Null means never. |
close | Action | null | Runs when the close button is clicked. Null means no close button. |
Returns: False when no row has this id.
Call from an [InitializeOnLoad] static constructor on the main thread, after registering the row. Calling it again replaces the chip's text. A callback that throws does not affect other rows.
Register
public static bool Register(string id, string icon, string label, Action toggle, Func<bool> isOn, int order = 0, params string[] after)Registers a Display ▾ row. after lists anchor labels in fallback order. With none, the row goes at the end of the first group. Throws ArgumentException for a blank id or label, and ArgumentNullException for a null toggle.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | The row's stable id. | |
icon | string | The row's icon name. | |
label | string | The row's label. | |
toggle | Action | Runs when the row is selected. | |
isOn | Func<bool> | Returns whether the row is ticked; null means never ticked. | |
order | int | 0 | Lower comes first; ties keep registration order. |
after | params string[] | Anchor labels in fallback order. |
Returns: False when the id is taken.
Call from an [InitializeOnLoad] static constructor on the main thread.
SetUnavailable
public static bool SetUnavailable(string id, Func<string> reason)Says when a registered row cannot be used on this PC, because this Unity or this graphics card cannot run what it switches on. While reason returns words, the row is dim in the menu, cannot be chosen, and shows those words at its right (a few words, such as the Unity version it needs). Its chip (Pin) is not shown. Null or empty words mean the row works as usual.
| Parameter | Type | Description |
|---|---|---|
id | string | The row's stable id. |
reason | Func<string> | Returns the few words that say why, or null while the row can be used. Null means always usable. |
Returns: False when no row has this id.
Call from an [InitializeOnLoad] static constructor, after the row's own Register, on the main thread. Calling it again replaces the callback. A callback that throws is logged and does not affect other rows.
TryGet
public static bool TryGet(string id, out Item item)Gets the registered row with this id.
| Parameter | Type | Description |
|---|---|---|
id | string | The row's stable id. |
item | out Item | The row. |
Returns: False when the id is not registered.
Unpin
public static bool Unpin(string id)Removes a row's chip. The row stays in the menu.
| Parameter | Type | Description |
|---|---|---|
id | string | The row's stable id. |
Returns: False when the row had no chip.
Related types
- RaptorSuiteDisplayMenuItems.Item: A registered row (read-only).