SDK · crate
kinogaki-studio-ui-api
Kinogaki Studio's UI layer for plugins.
- Repository
- SDK (kinogaki/studio-sdk)
- Folder
sdk/crates/ui-api- Source
- 42 files, 8,691 lines
- Tests
- 5 files, 1,783 lines
What it is
Kinogaki Studio's UI layer for plugins.
The host draws; plugins never see its UI toolkit. A plugin's panels, tool cards, overlays and settings pages are written against this crate's own types and traits, and Studio implements them over its private UI library. So the SDK stays self-contained (this crate depends on the standard library and kinogaki-studio-api alone), and Studio can change how it draws without breaking a plugin.
What a plugin uses, from the most declarative to the most direct:
- Data the host draws. A
sheet::Sheetof typed fields is an inspector, a tool's card body or a settings page (Ui::sheet,UiExt::sheet_keyed); aCardSpecor aPopoverSpecframes floating content;ValueFieldsare the heads-up boxes a drawing tool types into (Ui::value_fields). - Immediate widgets on
Ui: labels, buttons, toggles, number fields, sliders, text fields, choices, swatches, menus, and layout (horizontal,vertical,child,scroll_vertical,enabled). - **A
Painter** for overlays: segments, circles, rectangles, polylines, text and icons, single or in batches, measured text, and reservedSlots. Meshes and surfaces are not painted: they are the data types' display surfaces, drawn by the host's viewport. - **
UserInput**: this frame's pointer, keys and typing as plain data.
And the plain values they exchange: geom (points, vectors, rectangles, alignment, in f32 screen points), Color (premultiplied sRGBA bytes), the host-filled Theme, Fonts by role and icons by name (Studio's own, "cube", or a package's, "acme.trees/leaf": see kinogaki_studio_api::icon; an unknown name draws Studio's neutral icon), and Ids.
Pure viewport maths the host's own tools use is here too, so a plugin's tools behave exactly like Studio's: the transform gizmo's geometry and hit testing (gizmo) and point-label placement (labels), over a host-provided ViewProjection.
The host interface (host) is what a package's UI asks of Studio: undo and gestures, the session's slots, selections, the document, objects' networks, views, status, the shell, the transform tool and settings, reached through one call context (host::Cx). A package's UI (package) is its contexts, each a set of parts (levels, a viewport layer, an inspector, a vocabulary…) over the package's own state, which the host keeps and lends for one call at a time.
The companion crate kinogaki-studio-ui-api-testing (a dev-dependency only) has headless fakes (RecordingUi, RecordingPainter, and FakeHost with its in-memory FakeNetworks and Hosting for a package's parts) for plugin unit tests.
Depends on
| Crate | Repository | As | What it is |
|---|---|---|---|
kinogaki-studio-api | SDK | normal | Kinogaki Studio's headless plugin API. |
kinogaki-viewport-api | SDK | normal | Kinogaki's viewport packet contract: what a data type hands Studio's viewport to draw, with no GPU or UI API. |
Third-party
None.
Used by
| Crate | Repository | As | What it is |
|---|---|---|---|
example-box-node | SDK | tests | A Kinogaki Studio plugin that adds a Box node. |
example-pin-board | SDK | normal | A Kinogaki Studio plugin that brings a context with its UI. |
kinogaki-comp | Comp | tests | Comp as an SDK package (kinogaki.comp): what fills Studio's Comp context (kinogaki.core.comp, core declares it, inside a Render Output object). |
kinogaki-core-package | Core and the app | normal | Core's own SDK package (kinogaki.core): what Studio holds whatever plugins are installed. |
kinogaki-editor | Core and the app | normal | Kinogaki Studio's editor: the document and everything the window shows of it, as parts one frame borrows one by one. |
kinogaki-harness | Core and the app | normal | Studio's test harness: the real editor, its event routing and its background work, driven offscreen with only the packages a test names. |
kinogaki-layout | Layout | normal | The Layout context: a page on the 2D canvas and the pieces arranged on it, images and text, back to front in the order their nodes run. |
kinogaki-mesh | Mesh | normal | The Mesh plugin: polygon modelling, Maya's and Houdini's toolset on core's editing API (plugins/mesh/PLAN.md holds the inventory and its groups). |
kinogaki-sdk-ui | Core and the app | normal | The plugin SDK's UI layer over lib-ui: the SDK's Ui and Painter, its sheets and the host's services, implemented over lib-ui. |
kinogaki-shared | Core and the app | normal | The crates Studio and its plugins share, built once as a Rust dylib. |
kinogaki-spectre | Spectre | tests | Spectre, the spectral path tracer, as a Kinogaki Studio render plugin. |
kinogaki-studio | Core and the app | tests | Kinogaki Studio: the editor in a window, after the plugins load. |
kinogaki-studio-ui-api-testing | SDK | normal | The UI layer's test support (a dev-dependency only): headless fakes of the host's UI for plugin unit tests: RecordingUi and RecordingPainter record what a plugin asks to show and draw, and play back scripted user actions, with no window and no GPU ... |
kinogaki-testkit | Core and the app | normal | Kinogaki Studio's core testkit: toy packages written against the SDK alone, so core is tested with no real plugin. |
kinogaki-workflows | Workflows | tests | Tests alone: tests/workflows drives what a person does across the plugins the app ships, through the real editor offscreen. |
Modules
card(private)Floating panels the host draws around a plugin's content: a tool's card and a popover.112 linescolor(private)Color: what everything on screen is drawn in, premultiplied sRGBA bytes.411 linesgeomScreen geometry in points:Pos,Vec2,Rectand the alignmentsAlignandAlign2.492 linesgizmoThe transform gizmo's pure geometry: where its handles are on screen (GizmoFrame), which one the pointer is over (hit) and what a drag of one means (GizmoFrame::delta,scale,angle_change).53 linesgizmo::geometry(private)Handle geometry in screen space: the gizmo frame's projection, plane squares and rotation rings, and drag deltas along axes and planes.295 linesgizmo::hit(private)Which handle a screen point is over.207 linesgizmo::pivot(private)The transform pivot: the point the gizmo sits at and Rotate and Scale turn and scale about.36 linesgizmo::step(private)A transform drag the host runs for a context: the axes it works in (TransformSpace), where it is (TransformPhase) and what it has made of the pointer so far (TransformStep).105 lineshostThe host interface: what a package's UI asks of Studio.250 lineshost::capabilities(private)The host's capabilities, one trait each: what a package's UI may ask of Studio.324 lineshost::data(private)The plain values the host interface exchanges: references to objects and nodes, where the user is, one view as a package sees it, what a node's rows drawn by the host did, and the user's preferences.194 lineshost::network(private)HostNetwork: objects' networks, which core owns, as a package's UI reads and edits them.27 linesid(private)Id: what keeps a widget's state (focus, an open menu, a drag) apart from every other's.43 linesinput(private)UserInput: this frame's pointer, keys and typing, as plain data the host fills in before it calls a plugin.525 lineslabelsPoint numbers over a view (Houdini's point number display): where to put them so a dense mesh shows an evenly spread, readable subset at a bounded cost.227 linespackageA package's UI: its contexts and settings pages, and how the host keeps its state (UiPackage, added to a package withWithUi::with_ui).240 linespackage::data(private)The plain values a context's parts and the host exchange: levels, the stacked list's candidates, what live tools take and why they end, the gizmo shown, panels, the numeric bar and a context's time.155 linespackage::display(private)A context's display options (DisplayOption): what its views may show besides the value itself (labels, guides, a coloring), declared as data in itsViewportSpec.115 linespackage::edited(private)What a context adds over the open object in one view: the value itsDisplay::editedreturns each frame (overlays and guides; core draws the object's value itself, and marks the templated pieces a live tool picks from), and the ...111 linespackage::hostingWhat the host reads of a package's UI, its state's type erased: aRegisteredpackage (Registered::of) whose context parts take the state the host keeps (State) asdyn Anyand downcast it back.146 linespackage::library(private)A context's library (Library): what it offers the host's menus, keys, Tab and viewport chrome, as data.530 linespackage::parts(private)A context's parts, one trait each, over the package's stateS: the selectionLevels; in the viewport itsLiveTools,Panels,TransformsandDisplay; theInspectorand theVocabulary.129 linespackage::parts::content(private)A context's inspector (Inspector) and how its items run (Vocabulary).87 linespackage::parts::levels(private)A context's selection levels (Levels).107 linespackage::parts::viewport(private)What a context adds to the viewport, one capability a trait: its live tools' input (LiveTools), its floating panels (Panels), the host's transform gizmo over its selection (Transforms), what it draws over the open object (Display).173 linespackage::settings(private)A package's pages of the Settings window, over its stored values.99 linespackage::view(private)What a viewport layer's behaviour hooks exchange with the host: a key press (KeyPress) and what a live gesture holds (Holds).31 linespaint(private)ThePainter: a plugin's overlays (handles, guides, badges, labels) as a few primitives the host draws, andShapes, the same primitives as data for batches and reserved slots.433 linesprojectionHow a view maps the edited object's space to its pixels and back:ViewProjection(ofProjectivematrices), filled in by the host from its camera, for the pure viewport maths ingizmoandlabels.288 linesresponse(private)Response: what a widget or an interactive area reports, andSense: what it listens for.127 linessheetProperty sheets as data: what an inspector, a tool's card or a settings page shows, drawn by the host.98 linessheet::edits(private)Edits: what the user did to a sheet this frame, and theActions that are not new values.139 linessheet::from_params(private)A node's or format's parameterparams::Schemaas a sheet, keyed by parameter name: what the host shows for a node's parameters.356 linessheet::items(private)Sheet: bands, headings and fields, top to bottom.553 linessheet::keyed(private)FieldKey: the one key type the host's sheet takes, andKeyed, which turns any owner's keys into it and back.125 linessheet::kind(private)Kind: what a field holds and how it is presented, with the pieces some kinds carry (PathChoice,Chip,FileDialog), a material input's connection button (Socket) and the slot at a field's right edge (Trailing).327 linestext(private)Fonts and icons by role and name: the host owns the faces and the icon set (to which packages add their own icons); a plugin says what it means.76 linestheme(private)Theme: the colors, radii and sizes the host draws with, as plain data the host fills in, so a plugin's own drawing matches the host's.253 linesui(private)Ui: the host's immediate-mode interface, as a plugin sees it, andUiExt, its generic conveniences.287 linesvalue_fieldsHeads-up value fields: small boxes beside what they measure while a drawing tool runs (a line's length and angle, a rectangle's width and height).78 lineswidgets(private)What a plugin asks of the host's widgets:ButtonSpec,TextEditSpec,MenuItemandChoiceLook.283 lines
Public types and traits
At the crate root
Traits PainterUiUiExt
Structs Align2ButtonSpecCardResponseCardSpecCircleColorEditsFieldKeyFontIconShapeIdInnerResponseKeyFilterMenuItemMetricsModifiersPointerPopoverSpecPosRadiiRectRectShapeResponseScrollSpecSegmentSenseSheetStyleSlotStrokeTextEditSpecTextShapeTextStyleThemeUserInputValueFieldValueFieldsVec2ViewProjection
Enums AlignChoiceLookEventFontRoleKeyOrderPointerButtonPopoverLookScrollUnitShapeStrokeKind
Type aliases BodyRowMenu
By module: 159 public types and traits in 36 modules
card CardResponseCardSpecOrderPopoverLookPopoverSpec
color Color
geom AlignAlign2PosRectVec2
gizmo TransformTool
gizmo::geometry GizmoFrameHandle
gizmo::pivot PivotPivotFrame
gizmo::step TransformPhaseTransformSpaceTransformStep
host CxHostLatestExtInspectorCxLatestAskedLatestJobLatestKeyLatestResultSnapOnUnitsServiceViewCxWaker
host::capabilities HostDocHostDocExtHostSelectionHostShellHostSlotsHostSlotsExtHostStatusHostToolsHostTransformHostUndoHostView
host::data GroundHostPrefsInspectedNodeRowsPlacePointerOverViewViewCamera
host::network HostNetwork
id Id
input EventKeyKeyFilterModifiersPointerPointerButtonScrollUnitUserInput
labels Label
package ContextPartUiPackageWithUi
package::data CandidateEndedGizmoUseLevelPresetLevelSpecLiveHandlesPanelPanelScopeTakes
package::display DisplayKindDisplayOptionDisplayScope
package::edited EditedGhostGhostTone
package::hosting RegisteredState
package::library BarMenuBarSectionContextMenuSpecHeldKeyBindingKeysActiveKeyStoreLevelItemsLibraryMarkingDefaultMenuDefaultsMenuEntryObjectMenusPlacesSharedShelfShelfEntrySituationSuggestedTabSpecViewMenusViewportSpecVocabularyItemWhen
package::parts::content InvokedRowAction
package::settings SettingsPage
package::view HoldsKeyPress
paint CircleIconShapePainterRectShapeSegmentShapeSlotStrokeStrokeKindTextShape
projection ViewProjection
response InnerResponseResponseSense
sheet SheetStyleText
sheet::edits ActionEdits
sheet::items AnimationBandFieldItemSheet
sheet::keyed FieldKeyKeyed
sheet::kind ChipFileDialogFileFilterKindPathChoiceSocketSocketKindTrailing
text FontFontRoleTextStyle
theme MetricsRadiiTheme
ui BodyRowMenuUiUiExt
value_fields ValueFieldValueFields
widgets ButtonSpecChoiceLookMenuItemScrollSpecTextEditSpec
Besides these, 3 public functions at module level.
