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 DataFieldOverrideSelectMenuRemarks
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:
DataOverride.AddFieldOverride(selectedField)is called to create the override entry.The parent drawer's property is marked dirty to trigger serialization.
Quick Lookup
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
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.
buttonRect
Rect
The screen-space rect of the button that triggered the menu
Behavior:
Reads the current
DataOverridefrom the parent drawer'sValueEntry.SmartValue.Creates a
GenericSelector<string>populated withGetOverridableFields().Configures the selector: double-click to confirm, no search toolbar, 20 px item height.
Opens the selector in a popup window positioned just below the triggering button.
Subscribes to
SelectionConfirmedand windowOnCloseevents.
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
Empty popup when all fields are overridden
If every [Overridable] field already has an override, the popup will appear empty. The menu does not prevent opening in this case — it simply shows no items.
Popup positioning
The popup is positioned using GUIUtility.GUIToScreenPoint() relative to the triggering button. If the Inspector is docked in an unusual layout, the popup may appear offset. The 3 px padding (AddPosition(3, 3)) accounts for standard toolbar margins.
See Also
DataOverrideDrawer — parent drawer that owns this menu
DataOverride — runtime class receiving the new override
DataFieldOverride — runtime class created for each selected field
OverridableAttribute — attribute that marks eligible fields
Variant Editor — editor subsystem overview
Last updated