Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI
objc docs
Preetham Pemmasani3ad6b072554e
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex 59151d0..a59c55a 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -67,7 +67,7 @@ include `ui/`.)| `ui/` | The toolkit sources from `editors/interface`: interface.cc family, widgets, handlers, regions, view2d, views, textbox. Kept for reference and porting work; **not compiled by default** (`-DBUI_BUILD_UI=ON` builds it as `bui_ui`). `kit/` re-ports what it needs in C. | **Compiles + links** (opt-in) || `kit/` | Blender's UI as a retained-mode C runtime: node tree, uiLayout-style layout, `interface_handlers.cc` interaction rules, widget drawing ported from `interface_widgets.cc` (widget-base shader parameters rendered by `gpu/` raster), menus, color picker, views, editors; Tk-style pack/grid/place geometry managers, canvas display list, multi-line text area; UI undo/redo, Tab field traversal, vertical multi-drag, panel animation; Blender's file browser; images (`kit/intern/image`: Blender's imbuf design, one format table over Wuffs, libjpeg-turbo, libwebp and BUI's HDR/PNM/SVG readers in `kit/extern`, decode at the drawn size, a worker pool and a memory-budgeted cache; see [the Images page](https://bui.preetham.top/docs/concepts/images/)); damage-driven rendering; Blender's Dark and Light themes (`kit_theme_presets.c`, generated by `tools/gen_theme.py` from Blender's `Blender_Dark.xml` / `Blender_Light.xml` presets over `userdef_default_theme.c`; `BK_set_theme`); native window hosts for Win32, X11 and Cocoa (`kit_window_win32.c`, `kit_window_x11.c`, `kit_window_cocoa.m`; `kit_window_null.c` elsewhere). The Win32 host is BUI's own; the X11 host follows Blender's GHOST input mapping, and the Cocoa host (experimental: checked by CI and tried by hand on two Apple Silicon Macs) is ported from GHOST's Cocoa backend. `kit/intern/blender/` holds Blender files copied in and edited for the kit (each edit marked `BUI:`): `interface_string_search.cc` (menu search with recent searches), `interface_undo.cc` (text-edit undo), `interface_utils.cc` (float display precision). C API: `kit/include/BUI_kit.h`. | **Builds + tested** || `api/` | `bui_c_api.h` — small stable C ABI: version info + sink/viewport plumbing for hosts and bindings. | **Builds + tested** |-| `bindings/python/` | `buipy` CPython extension (no third-party deps) + `bui` package: `bui.components` (Blender component library), `bui.qtsyntax` / `bui.tksyntax` (Qt / tkinter APIs as thin facades over the kit), `bui.host` (native or Tk windows), `SvgSink` headless renderer, `bui.qt.BuiCanvas` PySide6/PyQt6 widget. | **Builds + tested** |+| `bindings/python/` | `buipy` CPython extension (no third-party deps; Dear ImGui is compiled into it, `blenderui.imgui`, so a process holds one kit) + `bui` package: `bui.components` (Blender component library), `bui.qtsyntax` / `bui.tksyntax` (Qt / tkinter APIs as thin facades over the kit), `bui.host` (native or Tk windows), `SvgSink` headless renderer, `bui.qt.BuiCanvas` PySide6/PyQt6 widget. | **Builds + tested** || `bindings/imgui/` | Dear ImGui (vendored, 1.93.1 WIP) on BUI: `imgui_impl_bui` platform + renderer backend hosted in a kit `custom` node (input, cursors, clipboard, DPI, damage-driven frames) drawing through `BUI_raster_mesh` and BUI textures; Blender style and Inter font; the C API (`cimgui.h`) and the generator behind the Python and Rust bindings; the Blender-widgets build (`blender/`, `-DBUI_IMGUI_BLENDER_WIDGETS=ON`). Gate: `-DBUI_BUILD_IMGUI` (ON with C++). | **Builds + tested** || `bindings/rust/` | `blenderui` (HTML/CSS/Tailwind, `rsx!` and gpui-style builders, hooks, Blender components; layout by taffy) over `blenderui-sys`; `blenderui-macros`, `blenderui-tailwind`, `blenderui-imgui`, and the JavaScript runtimes `blenderui-jsview`, `blenderui-node` (napi-rs) and `blenderui-qjs` (QuickJS). | **Builds + tested** || `bindings/node/`, `bindings/react/` | `@blender-ui/native` (DOM-like API, signals) and `@blender-ui/react` (React 19.3 renderer) on `blenderui-node`. | **Builds + tested** |diff --git a/CHANGELOG.md b/CHANGELOG.mdindex af02122..5e1a764 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,13 +6,23 @@ All notable changes to **blenderui** (BUI). The format follows## [Unreleased]+### Fixed+- **macOS:** Python printed `objc: Class BUIKitView is implemented in both buipy... and+ _buiimgui...` (also `BUIKitNSWindow`, `BUIKitWindowDelegate`, `BUIKitAppDelegate`) when both+ extensions were loaded: each linked the whole kit, Cocoa host included, so the classes were+ registered twice (reported by [DanNoby](https://github.com/DanNoby), issue #6). A process now+ holds one kit: `buipy` and Dear ImGui are one binary on every platform, which also means one+ theme and one set of kit state instead of two.+### Changed- **macOS:** the testing guide now lists both testers ([Krish Kalaria](https://github.com/krishkalaria12): issue #3, fixed bypull request #4; [DanNoby](https://github.com/DanNoby): 17/17 tests, issue #6), explains the Command Line Tools versusSDK mismatch (`ld: tapi error: malformed file`: select the full Xcode toolchain and delete- `build/`), and records a known bug from his log: the Python extensions `buipy` and- `_buiimgui` each embed the Cocoa host, so Objective-C prints "Class BUIKitView is implemented- in both". The docs and the website say two Apple Silicon Macs.+ `build/`), and records a bug from his log (fixed below: Objective-C printed "Class BUIKitView is+ implemented in both"). The docs and the website say two Apple Silicon Macs.+- **Python:** Dear ImGui (`blenderui.imgui`) is compiled into the `buipy` extension; the separate+ `_buiimgui` extension is gone (the module is still named `_buiimgui`, created by+ `buipy.imgui_module()`). The public API is unchanged.- **CI:** the Apple Silicon runner is `macos-15` (GitHub retired `macos-14`).## [0.4.0] - 2026-11-06diff --git a/README.md b/README.mdindex 95d4e02..3387b27 100644--- a/README.md+++ b/README.md@@ -1298,7 +1298,7 @@ JavaScript after BUI handled them (no native `preventDefault`), and| -------- | ------------------------------------------ | --------------------------------------- || C++ | `imgui.h` + `imgui_impl_bui.h` | CMake target `bui_imgui` (`bui::imgui`) || C | `cimgui.h` + `cimgui_impl_bui.h` | CMake target `bui_cimgui` |-| Python | `import blenderui.imgui as imgui` | The `_buiimgui` extension, in the wheel |+| Python | `import blenderui.imgui as imgui` | Compiled into `buipy`, in the wheel || Rust | the `blenderui-imgui` crate (on crates.io) | Cargo |The C, Python and Rust bindings are generated from `imgui.h`. ImGui isdiff --git a/bindings/imgui/README.md b/bindings/imgui/README.mdindex bc3d9a7..81d0f88 100644--- a/bindings/imgui/README.md+++ b/bindings/imgui/README.md@@ -15,7 +15,7 @@ Blender's UI font (Inter, embedded in BUI).- **C, Python, Rust:** generated from `imgui.h` by `gen/gen.py`(`py -3 -I bindings/imgui/gen/gen.py`): the C API `c/cimgui.h` (CMake `bui_cimgui`, with- `c/cimgui_impl_bui.h` for this backend), `blenderui.imgui` for Python (`_buiimgui`) and the+ `c/cimgui_impl_bui.h` for this backend), `blenderui.imgui` for Python (inside `buipy`) and the`blenderui-imgui` crate. See [docs/imgui.md](../../docs/imgui.md).- **Blender widgets:** `-DBUI_IMGUI_BLENDER_WIDGETS=ON` (default OFF) compiles`blender/imgui_widgets_blender.cpp` instead of `imgui_widgets.cpp`: ImGui's widgets arediff --git a/docs/imgui.md b/docs/imgui.mdindex ddf7a69..7708814 100644--- a/docs/imgui.md+++ b/docs/imgui.md@@ -12,7 +12,7 @@ Every public Dear ImGui function and type can be used from four languages:|---|---|---|| C++ | `imgui.h` + `imgui_impl_bui.h` | CMake target `bui_imgui` || C | `cimgui.h` + `cimgui_impl_bui.h` (`bindings/imgui/c`) | CMake target `bui_cimgui` |-| Python | `import blenderui.imgui as imgui` (or `bui.imgui`) | CMake target `_buiimgui` (next to `buipy`) |+| Python | `import blenderui.imgui as imgui` (or `bui.imgui`) | CMake target `buipy` (compiled in) || Rust | crate `blenderui-imgui` (`bindings/rust/blenderui-imgui`) | Cargo (blenderui-sys builds the C++ through CMake) |The C, Python and Rust bindings are **generated** from `imgui.h`; see@@ -146,8 +146,10 @@ pyimgui-style:`imgui.HeadlessApp` renders without a window ([below](#headless-rendering-and-tests)).- `help(imgui.begin)` shows the Python signature and the C++ function.-The extension `_buiimgui` is built next to `buipy` (`cmake --build build --target-_buiimgui`) and installed with the wheel.+Dear ImGui is compiled into the `buipy` extension (`cmake --build build --target buipy`, and+the wheel), not built as a second extension: a process loads one copy of the kit (two copies+registered the Cocoa classes twice on macOS). `bui.imgui` gets its module from+`buipy.imgui_module()`, which creates it on first use; it is also importable as `_buiimgui`.## Rustdiff --git a/docs/macos-testing.md b/docs/macos-testing.mdindex aff8888..ebb48b3 100644--- a/docs/macos-testing.md+++ b/docs/macos-testing.md@@ -228,13 +228,16 @@ Blender's Ctrl** (Cmd+C, Cmd+V, Cmd+Z, Cmd+wheel) and **Option is Alt**.- **No input method (IME) support yet:** composed input such as Japanese orChinese, and possibly dead-key accents, is not expected to work.- Fonts are Blender's (Inter, drawn with FreeType like Blender), not the system font.-- **Python prints `objc: Class BUIKitView is implemented in both buipy... and _buiimgui...`**- (also `BUIKitNSWindow`, `BUIKitWindowDelegate`, `BUIKitAppDelegate`) when both extensions are- loaded, for example in the Dear ImGui test. Each of the two Python extensions embeds the Cocoa- host, so its Objective-C classes exist twice. The tests pass with it (17/17 on [DanNoby](https://github.com/DanNoby)'s Mac),- but the Objective-C runtime warns it "may cause spurious casting failures and mysterious- crashes", so treat it as a known bug until the host is shared or renamed. It needs a Mac to- verify the fix. Reported through [DanNoby](https://github.com/DanNoby)'s test log. Also expected in that log:+- **Fixed (next release, unreleased): Python printed `objc: Class BUIKitView is implemented in both buipy... and _buiimgui...`**+ (also `BUIKitNSWindow`, `BUIKitWindowDelegate`, `BUIKitAppDelegate`) when both extensions were+ loaded, for example in the Dear ImGui test. Each of the two Python extensions embedded the+ whole kit, including the Cocoa host, so its Objective-C classes existed twice (the tests passed,+ 17/17 on [DanNoby](https://github.com/DanNoby)'s Mac, but the Objective-C runtime warned it "may+ cause spurious casting failures and mysterious crashes"). Dear ImGui is now compiled into+ `buipy` (`buipy.imgui_module()` is behind `blenderui.imgui`), so a process holds one kit and+ there is no `_buiimgui` binary. `buipy_imgui` checks, on a Mac, that the four classes come from+ `buipy` and that nothing is registered twice; it needs a Mac to confirm. Reported through+ [DanNoby](https://github.com/DanNoby)'s test log. Still expected in that log:`gpu_parity: no GPU device, skipped` (there is no Metal renderer) and`[imgui-error] Missing End()` (a test of error reporting).- Python: when tkinter is importable, BUI starts a hidden Tk first (Tk insists ondiff --git a/website/src/content/docs/project/publishing.mdx b/website/src/content/docs/project/publishing.mdxindex 2145824..71ab373 100644--- a/website/src/content/docs/project/publishing.mdx+++ b/website/src/content/docs/project/publishing.mdx@@ -26,8 +26,8 @@ BUI ships to three registries: **PyPI** (`blenderui`), **npm** (`@blender-ui/nat```textsite-packages/- buipy.<abi>.pyd|.so the C kit + raster engine (one extension module)- _buiimgui.<abi>.pyd|.so Dear ImGui for blenderui.imgui (when CMake builds bui_cimgui)+ buipy.<abi>.pyd|.so the C kit + raster engine, with Dear ImGui (blenderui.imgui) when+ CMake builds bui_cimgui: one extension module, one kit per processbui/ tksyntax/, qtsyntax.py, components/, host.py ...blenderui/ alias package: blenderui.X is bui.Xblenderui-<v>.dist-info/