RaptorSuiteHierarchyDrag.NestRules
Registers module rules for Hierarchy drops.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, since 0.1.0 |
Within each NestSlot, rules are asked by order, then in registration order. The first rule that returns true decides the drop, and later rules are not asked. When no rule returns true, the Hierarchy's built-in rules decide. A rule that throws is logged once per id and treated as returning false. A domain reload clears the rules, and [InitializeOnLoad] registrations run again.
public static class NestRulesProperties
Count
public static int Count { get; }The number of registered rules.
Ids
public static IReadOnlyList<string> Ids { get; }A snapshot of every rule id, in the order rules are asked across both slots.
Version
public static int Version { get; }Incremented on every change.
Methods
IsRegistered
public static bool IsRegistered(string id)Whether a rule with this id is registered.
| Parameter | Type | Description |
|---|---|---|
id | string | The rule's stable id. |
Returns: True when registered.
Register
public static bool Register(string id, NestRule rule, NestSlot slot = NestSlot.First, int order = 0)Adds a rule in slot. Throws on a blank id, a null rule or an unknown slot.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | The rule's stable id. | |
rule | NestRule | Decides a drop. | |
slot | NestSlot | NestSlot.First | The slot the rule runs in. |
order | int | 0 | Lower runs first; ties keep registration order. |
Returns: False when the id is already registered. The existing rule is kept.
Call from an [InitializeOnLoad] static constructor on the main thread.
TryGetSlot
public static bool TryGetSlot(string id, out NestSlot slot)Gets the slot a rule was registered in.
| Parameter | Type | Description |
|---|---|---|
id | string | The rule's stable id. |
slot | out NestSlot | The rule's slot. |
Returns: False when the id is not registered.
Related types
- RaptorSuiteHierarchyDrag: Drag and drop in the Suite's Hierarchy panel.