DataFieldOverrideSelectMenu

Popup menu that allows designers to select an overridable field from a FactorableData type and add it as a new DataFieldOverride to the current DataOverride. Filters out fields that are already overridden.

Definition

Namespace: Paragon.Core.ScriptableFactory.Editor Assembly: Paragon.Editor.dll

public class DataFieldOverrideSelectMenu

Remarks

This menu is instantiated by DataOverrideDrawer and opened when the designer clicks the "Add New Override" button. It uses Odin's GenericSelector<string> to present a popup window listing all eligible field names.

The menu enforces one filtering rule: fields already present in the DataOverride's fieldOverrides are excluded from the selection list via Except(). Only fields marked with [Overridable] on the FactorableData subclass appear in the list.

When the designer selects a field:

  1. DataOverride.AddFieldOverride(selectedField) is called to create the override entry.

  2. The parent drawer's property is marked dirty to trigger serialization.

Quick Lookup

Goal
How

Open the field picker

selectMenu.Show(buttonRect)

Eligible fields

All [Overridable] fields minus those already overridden

Popup dimensions

115 px wide, 20 px per item

Constructor

Parameter
Type
Description

drawer

DataOverrideDrawer

The parent drawer whose DataOverride will receive the new field override

Stores a reference to the parent drawer for accessing ValueEntry.SmartValue and marking the property tree dirty.

Methods

Show

Opens the popup menu anchored to the given button rect.

Parameter
Type
Description

buttonRect

Rect

The screen-space rect of the button that triggered the menu

Behavior:

  1. Reads the current DataOverride from the parent drawer's ValueEntry.SmartValue.

  2. Creates a GenericSelector<string> populated with GetOverridableFields().

  3. Configures the selector: double-click to confirm, no search toolbar, 20 px item height.

  4. Opens the selector in a popup window positioned just below the triggering button.

  5. Subscribes to SelectionConfirmed and window OnClose events.

OnSelectionConfirmed

Callback invoked when the designer double-clicks or confirms a field selection.

Behavior:

  • Extracts the first selected field name.

  • Calls dataOverride.AddFieldOverride(selectedField) to create the override.

  • Marks the parent drawer's serialization root dirty via drawer.Property.MarkSerializationRootDirty().

GetOverridableFields

Returns the list of field names available for override selection.

Returns: All [Overridable] field names from the DataOverride's data type, minus field names already present in the override dictionary.

OnClose

Cleanup callback invoked when the popup window closes. Clears the selector's selection state and nullifies the window reference.

Constants

width

Fixed width of the popup window in pixels.

item_height

Height of each selectable item in the popup list.

Common Pitfalls

circle-exclamation
circle-exclamation

See Also

Last updated