Skip to content

armgit / BUI

Public Imported from GitHub
0

Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI

Update README.md

Preetham Pemmasani085b6e6f937c
diff --git a/README.md b/README.md
index 6b83887..4a3a703 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,8 @@
# BUI
+> ![NOTE]
+> This repository is built entirely using LLMs. No Human written code.
+
A modular UI toolkit extracted from the Blender project. Core in C, widgets in
C++, no Blender application logic — just the interface machinery. Renderable
from C++, **Qt**, and **Python (PySide6 / PyQt6)** through one stable
@@ -27,15 +30,15 @@ cmake --build build-ui --target bui_svg_demo
## Modules
-- `core/` – pure C11 foundation (containers, memory, math, strings)
-- `types/` – shared data-type shapes (DNA structs, verbatim)
-- `gpu/` – drawing abstraction: null backend + primitive **sink dispatch**
-- `compat/` – seam headers replacing Blender-app APIs (RNA/WM/ED/BLF/IMB/CTX)
-- `ui/` – the widget toolkit sources extracted from Blender (blocks/buttons, layout, handlers, views)
-- `kit/` – **Blender's UI as a C runtime**: nodes, layout, input, widget drawing ported from `interface_widgets.cc`, damage-driven rendering
-- `api/` – stable C ABI (`bui_c_api.h`) for hosts and bindings
+- `core/` – pure C11 foundation (containers, memory, math, strings)
+- `types/` – shared data-type shapes (DNA structs, verbatim)
+- `gpu/` – drawing abstraction: null backend + primitive **sink dispatch**
+- `compat/` – seam headers replacing Blender-app APIs (RNA/WM/ED/BLF/IMB/CTX)
+- `ui/` – the widget toolkit sources extracted from Blender (blocks/buttons, layout, handlers, views)
+- `kit/` – **Blender's UI as a C runtime**: nodes, layout, input, widget drawing ported from `interface_widgets.cc`, damage-driven rendering
+- `api/` – stable C ABI (`bui_c_api.h`) for hosts and bindings
- `bindings/python/` – `buipy` CPython extension + `bui` package (SVG sink, Qt canvas)
-- `backends/qt/` – C++ Qt/QPainter backend (`BuiWidget`, `BUI::QtSink`)
+- `backends/qt/` – C++ Qt/QPainter backend (`BuiWidget`, `BUI::QtSink`)
## Rendering from any stack
@@ -43,13 +46,13 @@ BUI never opens a window itself. Hosts install a **render sink** — a table of
function pointers (`BuiGpuSink`) — and receive every primitive the toolkit
draws (triangles, lines, points, text, scissor). One API, any renderer:
-| Host stack | What to use |
-|---|---|
-| C / C++ (any renderer) | `bui_set_render_sink()` from `api/bui_c_api.h` |
-| Qt (C++) | `BUI::QtSink` + `BUI::BuiWidget` in `backends/qt/` |
-| Python (PySide6/PyQt6) | `bui.qt.BuiCanvas` from `bindings/python/bui/qt.py` |
-| Python (headless/CI) | `bui.svg.SvgSink` renders frames to SVG |
-| Any (no GPU) | `buipy.Raster` / `GPU_raster.h` — native frame renderer |
+| Host stack | What to use |
+| ---------------------- | ------------------------------------------------------- |
+| C / C++ (any renderer) | `bui_set_render_sink()` from `api/bui_c_api.h` |
+| Qt (C++) | `BUI::QtSink` + `BUI::BuiWidget` in `backends/qt/` |
+| Python (PySide6/PyQt6) | `bui.qt.BuiCanvas` from `bindings/python/bui/qt.py` |
+| Python (headless/CI) | `bui.svg.SvgSink` renders frames to SVG |
+| Any (no GPU) | `buipy.Raster` / `GPU_raster.h` — native frame renderer |
### The fast path: native raster + damage-only present
@@ -77,11 +80,11 @@ r.present_native(hwnd) # Windows; or r.ppm(...) / r.rgb32()
## Blender component library — `bui.components` (runs in C)
-Blender's UI as composable components: Blender's look *and* Blender's
+Blender's UI as composable components: Blender's look _and_ Blender's
interactions. Every component is a node of the C kit (`kit/`); Python only
builds the tree and receives callbacks.
-* **Blender's code**: the widget drawing is a C port of
+- **Blender's code**: the widget drawing is a C port of
`interface_widgets.cc` — `round_box_edges`, `widgetbase_draw`, the shape
tables (number arrows, checkmark, menu chevron), `widget_state` /
`widget_active_color` (Blender's HSL hover tint), `widget_numbut`,
@@ -89,7 +92,7 @@ builds the tree and receives callbacks.
software implementation of the `GPU_SHADER_2D_WIDGET_BASE` parameters.
The HSV wheel uses `hsvcircle_vals_from_pos` / `hsv_cursor`; color math,
rects and the UTF-8 word-jump text cursor are blenlib (`core/`), linked.
-* **Fast**: rendering is damage driven — state changes mark only the
+- **Fast**: rendering is damage driven — state changes mark only the
widget's rect, a frame redraws and diffs just those regions, and an idle
UI draws nothing. Measured on the full demo (520×900): **~0.7 ms** for a
complete frame, **~0.05 ms** for a hover/scrub frame, **~0.18 ms**
@@ -109,35 +112,35 @@ App("Demo", (420, 600),
).run()
```
-| | |
-|---|---|
-| Layout | `Column`, `Row` (`align=True` joins; `weight=0` keeps natural width), `Split`, `Grid`, `Box`, `Panel` (sub-panels, header checkbox, icon), `Tabs`, `SideTabs` (properties-editor icon tabs), `ScrollView` |
-| Values | `NumberField`, `NumberSlider`, `VectorField`, `TextField`, `SearchField`, `HotkeyField`, `Checkbox`, `Toggle` (icon toggles), `Decorator`, `Dropdown` (icons), `EnumRow` (icons, vertical, icon-only), `ColorSwatch` |
-| Buttons | `Button` (icon, `emboss=False`), `IconButton`, `Popover`, `MenuButton` |
-| Views | `ListView` (UI list), `TreeView` + `TreeItem` (outliner, toggle columns), `GridView` (preview tiles) |
-| Menus | `Menu` / `MenuItem` (icons, shortcuts, checkboxes, submenus, type-to-search), `MenuBar`, `PieMenu`, right-click context menus |
-| Color | `ColorSwatch` picker: HSV wheel + value strip or SV square + hue strip, RGB/HSV/HSL sliders, hex, eyedropper |
-| Editors | `ColorRamp`, `CurveMapping` (channels), `NormalBall`, `Histogram` |
-| Templates | `IDSelector` (`template_ID`), `PathField` |
-| Other | `Label` (icon), `ProgressBar`, `Separator`, `Spacer`, tooltips, 120 vector icon names from Blender (`buipy.kit_icon_names()`) |
+| | |
+| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Layout | `Column`, `Row` (`align=True` joins; `weight=0` keeps natural width), `Split`, `Grid`, `Box`, `Panel` (sub-panels, header checkbox, icon), `Tabs`, `SideTabs` (properties-editor icon tabs), `ScrollView` |
+| Values | `NumberField`, `NumberSlider`, `VectorField`, `TextField`, `SearchField`, `HotkeyField`, `Checkbox`, `Toggle` (icon toggles), `Decorator`, `Dropdown` (icons), `EnumRow` (icons, vertical, icon-only), `ColorSwatch` |
+| Buttons | `Button` (icon, `emboss=False`), `IconButton`, `Popover`, `MenuButton` |
+| Views | `ListView` (UI list), `TreeView` + `TreeItem` (outliner, toggle columns), `GridView` (preview tiles) |
+| Menus | `Menu` / `MenuItem` (icons, shortcuts, checkboxes, submenus, type-to-search), `MenuBar`, `PieMenu`, right-click context menus |
+| Color | `ColorSwatch` picker: HSV wheel + value strip or SV square + hue strip, RGB/HSV/HSL sliders, hex, eyedropper |
+| Editors | `ColorRamp`, `CurveMapping` (channels), `NormalBall`, `Histogram` |
+| Templates | `IDSelector` (`template_ID`), `PathField` |
+| Other | `Label` (icon), `ProgressBar`, `Separator`, `Spacer`, tooltips, 120 vector icon names from Blender (`buipy.kit_icon_names()`) |
Interactions, as in Blender:
-* **Numbers** — the cursor turns into Blender's ↔ arrows over number
+- **Numbers** — the cursor turns into Blender's ↔ arrows over number
fields; dragging hides it with a continuous grab (it never hits the
window edge and returns where it started). Shift = precise, Ctrl = snap,
Alt = edit X/Y/Z together. Click to type (`2*pi` works).
-* **Any value** — Ctrl+Wheel steps, Ctrl+C / Ctrl+V copy/paste, Backspace
+- **Any value** — Ctrl+Wheel steps, Ctrl+C / Ctrl+V copy/paste, Backspace
resets, Minus negates, right-click for Copy/Paste/Reset; Ctrl+Alt+C/V
copies a whole vector.
-* **Toggles & panels** — drag across checkboxes or panel headers to set them
+- **Toggles & panels** — drag across checkboxes or panel headers to set them
all; Ctrl+click a header to solo it; drag a panel's grip to reorder.
-* **Menus** — press-drag-release picks; hover switches between menu-bar
+- **Menus** — press-drag-release picks; hover switches between menu-bar
menus and opens submenus; typing searches every item; `PieMenu.show()` on
a hotkey (`app.bind("q", ...)`).
-* **Views** — double-click / F2 renames, arrows navigate, Left/Right
+- **Views** — double-click / F2 renames, arrows navigate, Left/Right
collapse/expand trees, drag down outliner toggle columns.
-* **Color** — wheel with red at the bottom and Blender's cursor; the
+- **Color** — wheel with red at the bottom and Blender's cursor; the
eyedropper samples any pixel of the window.
See `examples/components_demo.py` (every component, properties-editor style).