3.2 KiB
3.2 KiB
Bar icon dropdown: plugin API v95
Branch pr/bar-menu, from pr/web-panel (web panel, v94). Not deployed. The API number 95 is provisional, as
94 is (unmerged upstream branches also use these numbers; whichever merges second renumbers). The manifest is parsed here; the bar draws it (below).
What changed
- A plugin window in the sections manifest (
windows, with"bar": true) may declare"barMenu": up to 6 items of{ "id", "tooltip", "icon", "command" }.SectionManifest.csparses it intoSectionWindowDecl.BarMenu(SectionBarMenuItemrecords;Menuis the never-null view). - Validation, with the window always kept: the id is a short lower-case word and unique in the menu, the tooltip is
non-empty and capped at 48 characters, the command is a single
/...chat command (the same rule as a contribution's), the icon is one Phosphor glyph or empty (an icon that is not a glyph is kept as an empty icon, and the bar draws the tooltip's first letter). An item with a bad id, tooltip or command is dropped; items pastMaxBarMenuItems(6) are ignored; abarMenuthat is not an array is ignored. PluginContractVersion.Currentand the SDK'sRynthCoreSdkApiVersion(RynthCore.PluginSdk.targets) go to 95. No function table change. Engines before v95 ignore the key, so a plugin can declare it unconditionally.
Tests
tools/SectionsTests:
ManifestBarMenu: valid items in order with exact fields, rejected commands (no slash, a line break, over-long), empty id, duplicate id, empty tooltip, empty icon kept, 20 items capped to 6, a non-arraybarMenu, no key, and the 48-character tooltip cap.BarMenuHoverTiming: the 0.15 s open delay, a quick sweep never opening, the 0.30 s close delay covering the gap from icon to dropdown, switching to another icon at once, no reopen while still hovering after a click, and a clock jump or a gap over 0.5 s resetting.BarMenuReload: a change to onlybarMenuleaves the panel signature alone (no re-registration) and changes the menu signature (so the bar rebuilds).
tools/PluginManifestTests pins the SDK and engine numbers together, and that PluginContractVersion.BarMenu is at or
below Current.
Not yet tested in game.
The dropdown
- Hovering a plugin window's bar icon for 0.15 s drops a column of icon buttons flush below it (flush above when it would cross the bottom of the screen; clamped sideways). It stays while the mouse is over the icon or the column, and for 0.30 s after it leaves both. Another icon's dropdown replaces it at once. Clicking an item runs its command as a player chat command (the hotkey path) and closes the dropdown. The icon's own click still toggles the window.
- A plugin reload that changes only
barMenureaches the bar:PluginWindows.Syncrefreshes the hosted declaration (WindowPlan.MenuSignature) without re-registering the panel, and bumps the version so the bar rebuilds its buttons. - The dropdown is brought to the display front every frame (cimgui
igBringWindowToDisplayFront, no focus change), so a panel focused since does not cover it; without those exports it keeps its normal order and logs once. - Timing is
ImGui/BarMenuHover.cs(pure;SectionsTestsBarMenuHoverTiming). Drawing is in-game only.