Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,19 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y libx11-dev
- name: Build and run the D test suite
run: dub run --config=test --compiler=ldc2
# code.dlang.org serves the repository by its root dub.json, which hands over to bindings/d: a project
# that depends on the root (as `dub add blenderui` makes it) must resolve it, build the kit and link.
- name: A project that depends on the repository's root recipe
shell: bash
working-directory: .
run: |
mkdir -p .ci-consumer/source
cat > .ci-consumer/dub.json <<'EOF'
{ "name": "consumer", "targetType": "executable", "dependencies": { "blenderui": { "path": ".." } } }
EOF
printf 'import bui;\nvoid main() { auto r = BUI_KIT_VERSION_MAJOR; }\n' > .ci-consumer/source/app.d
cd .ci-consumer
dub build --compiler=ldc2

# bindings/go builds the C kit with cgo's compiler (gcc; MinGW on Windows) through
# `go generate`, then runs the tests of both packages and the examples'. They are
Expand Down
119 changes: 119 additions & 0 deletions .github/workflows/extras.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Extra checks that never hold back a release: release.yml runs ci.yml before it publishes, but not this
# file. A job here that is red tells you something to fix; it does not stop a tag from publishing. Once a
# job has been green for a while, move it into ci.yml to make it a gate.
#
# js the JavaScript packages' own tests (native, react, svelte, vue), which ci.yml does not run
# website the documentation website builds, and none of its internal links is broken
# lint cargo fmt and clippy (the warnings are counted in the run's summary, not failed on)
# rust-extras the demos and the addons (charts, panels) still compile

name: extras

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

concurrency:
group: extras-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
js:
name: JavaScript packages (npm test)
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- uses: oven-sh/setup-bun@v2 # the runtime tests build a Bun executable too (they skip it when Bun is missing)
continue-on-error: true
- uses: dtolnay/rust-toolchain@stable
- name: X11 headers and a virtual display
run: sudo apt-get update && sudo apt-get install -y libx11-dev xvfb
- name: Install workspace dependencies
working-directory: bindings
run: npm ci
- name: Build the Node.js addon
working-directory: bindings/node
run: npm run build
- name: Test every package
working-directory: bindings
run: xvfb-run -a npm test

website:
name: website builds, links resolve
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build
working-directory: website
run: |
bun install
bun run build
- name: Internal links
run: python tools/check_site_links.py

lint:
name: cargo fmt and clippy
runs-on: ubuntu-latest
timeout-minutes: 60
defaults:
run:
working-directory: bindings/rust
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: X11 headers
run: sudo apt-get update && sudo apt-get install -y libx11-dev
# the code has its own layout (long lines), so rustfmt's default would rewrite thousands of
# places: its differences are counted, not failed on
- name: cargo fmt (counted, not failed on)
continue-on-error: true
run: |
cargo fmt --all -- --check 2>&1 | tee "$RUNNER_TEMP/fmt.log" || true
{
echo "### rustfmt"
echo
echo "differences: $(grep -c '^Diff in' "$RUNNER_TEMP/fmt.log" || true)"
} >> "$GITHUB_STEP_SUMMARY"
- name: cargo clippy (counted, not failed on)
continue-on-error: true
run: |
cargo clippy --workspace --all-targets 2>&1 | tee "$RUNNER_TEMP/clippy.log"
{
echo "### clippy"
echo
echo "warnings: $(grep -c '^warning' "$RUNNER_TEMP/clippy.log" || true)"
echo "errors: $(grep -c '^error' "$RUNNER_TEMP/clippy.log" || true)"
} >> "$GITHUB_STEP_SUMMARY"

rust-extras:
name: demos and addons compile
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
dir: [demos, addons/bui-charts, addons/bui-panels]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: X11 headers
run: sudo apt-get update && sudo apt-get install -y libx11-dev
- name: cargo check
working-directory: ${{ matrix.dir }}
run: cargo check
106 changes: 104 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
# CARGO_REGISTRY_TOKEN a crates.io API token (scopes: publish-new, publish-update)
# LUAROCKS_API_KEY a luarocks.org API key (luarocks.org > Settings > API keys), for the `luarocks` job
# NUGET_USER the nuget.org profile name (not an e-mail) that owns BlenderUI, for the `nuget` job
# RUBYGEMS_OWNER_ID (a repository *variable*, not a secret) the id of the rubygems.org account that owns the
# pending trusted publisher of `blenderui`, for the `rubygems` job
# Without NUGET_USER or the RubyGems trusted publisher those two jobs build their package and warn instead of failing.
# The `go-tag` job pushes the tag bindings/go/<tag> that Go needs to find the module in its folder.
# npm, PyPI and NuGet need no token: all three use trusted publishing (OIDC). On nuget.org
# (user menu > Trusted Publishing), a policy names this repository and release.yml. On npmjs.com, each of
# @blender-ui/native, its platform packages (@blender-ui/native-<tag>, bindings/node/platform.js)
Expand Down Expand Up @@ -345,16 +349,114 @@ jobs:
with:
name: nupkg
path: nupkg
# Without NUGET_USER the package is packed and checked but not pushed, with a warning, instead of
# failing the job (which would also skip the GitHub Release that waits for it).
- name: Is NuGet set up?
id: nuget
env:
NUGET_USER: ${{ secrets.NUGET_USER }}
run: |
if [ -n "$NUGET_USER" ]; then
echo "ready=true" >> "$GITHUB_OUTPUT"
else
echo "ready=false" >> "$GITHUB_OUTPUT"
echo "::warning::NUGET_USER is not set: BlenderUI was packed but not pushed (docs/publishing.md, 'NuGet')"
fi
- name: NuGet login (OIDC, a one-hour API key)
if: env.PUBLISH == 'true'
if: env.PUBLISH == 'true' && steps.nuget.outputs.ready == 'true'
id: login
uses: NuGet/login@v1
with:
user: ${{ secrets.NUGET_USER }}
- name: Push (a version already on nuget.org is skipped)
if: env.PUBLISH == 'true'
if: env.PUBLISH == 'true' && steps.nuget.outputs.ready == 'true'
run: dotnet nuget push "nupkg/*.nupkg" --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate

rubygems:
name: RubyGems
needs: [versions, ci]
if: ${{ !cancelled() && needs.versions.result == 'success' && (needs.ci.result == 'success' || needs.ci.result == 'skipped') }}
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
id-token: write # the OIDC token RubyGems trusts
defaults:
run:
working-directory: bindings/ruby
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5 # `rake gem` vendors the kit's C sources with a Python script
with:
python-version: "3.12"
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
working-directory: bindings/ruby
- name: Build the gem (the kit's C sources are inside it)
run: bundle exec rake gem
# Trusted publishing (OIDC, no token). Until the gem exists, the pending trusted publisher on
# rubygems.org needs the id of the account that will own it: the repository variable RUBYGEMS_OWNER_ID.
- name: Configure RubyGems credentials (trusted publishing)
id: creds
if: env.PUBLISH == 'true'
continue-on-error: true # a missing trusted publisher warns below instead of failing the release
uses: rubygems/[email protected]
with:
owner: ${{ vars.RUBYGEMS_OWNER_ID }}
- name: Push (a version already on RubyGems is skipped)
env:
CREDS: ${{ steps.creds.outcome }}
run: |
gem_file=$(ls blenderui-*.gem)
version=${gem_file#blenderui-}
version=${version%.gem}
if [ "$PUBLISH" != true ]; then
echo "::notice::dry run: $gem_file was built; not pushed"
exit 0
fi
if [ "$CREDS" != success ]; then
echo "::warning::RubyGems trusted publishing is not set up: $gem_file was built but not pushed (docs/publishing.md, 'RubyGems')"
exit 0
fi
if gem search --remote --exact blenderui 2>/dev/null | grep -q "blenderui ($version"; then
echo "::notice::blenderui $version is already on RubyGems; skipping"
exit 0
fi
gem push "$gem_file"

go-tag:
name: Go module tag
needs: [versions, ci]
if: ${{ !cancelled() && needs.versions.result == 'success' && (needs.ci.result == 'success' || needs.ci.result == 'skipped') }}
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write # pushes the tag
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Go finds a module that lives in a folder by a tag with the folder as its prefix: the module
# github.com/ppmpreetham/BUI/bindings/go at v0.6.0 is the tag bindings/go/v0.6.0, on the release commit.
- name: Tag bindings/go
run: |
go_tag="bindings/go/$TAG"
if git rev-parse -q --verify "refs/tags/$go_tag" >/dev/null; then
echo "::notice::$go_tag already exists; skipping"
exit 0
fi
commit=$(git rev-parse "refs/tags/$TAG^{commit}")
if [ "$PUBLISH" != true ]; then
echo "::notice::dry run: would tag $go_tag at $commit"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag "$go_tag" "$commit"
git push origin "$go_tag"

github-release:
name: GitHub Release
needs: [crates, npm, luarocks, nuget]
Expand Down
4 changes: 2 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ include `ui/`.)
| `gpu/` | The draw surface used by the toolkit (`GPU_*`, `imm*`) behind seam headers + a null backend that *records and forwards*: with a sink installed it emits screen-space primitives (`GPU_backend_sink.h`); without one it discards them. Theme colors reach the GPU layer through function-pointer hooks. | **Builds + tested** |
| `compat/` | Seam headers carrying upstream API names (`RNA_access.hh`, `BLF_api.hh`, …) with BUI-owned opaque types and stub implementations (`intern/bui_stubs.cc`). | **Builds** |
| `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; Blender's screen layout (`kit/intern/screen`, ported from `editors/screen`: areas on a graph of shared edges that split, join, dock and resize, regions that resize, hide and flip, saved as JSON); 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, libtiff, OpenEXRCore, libavif, libjxl, the OS's HEIC decoder 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, Wayland, Cocoa and Android (`kit_window_win32.c`, `kit_window_x11.c`, `kit_window_wayland.c`, `kit_window_cocoa.m`, `kit_window_android.c`; `kit_window_null.c` elsewhere); the desktop shell (`kit/intern/shell`: tray icons, notifications, taskbar progress, recent files); one accessibility tree per window (`kit/intern/a11y`, served to screen readers by `a11y/`). Touch screens and trackpad gestures live in the kit, not the hosts: `kit/intern/kit_touch.c` is one state machine (Android's model: taps, long presses, scrolls past the touch slop, a second finger's pan, pinch and turn as Blender's `MOUSEPAN` / `MOUSEZOOM` / `MOUSEROTATE`) with the fling in `kit_fling.c` (`VelocityTracker`, `OverScroller`), and every host (Win32 `WM_POINTER`, X11 XInput 2, Wayland `wl_touch` and pointer gestures, Cocoa's magnify and rotate, Android) only forwards contacts to `BK_touch` and trackpad gestures to `BK_magnify` / `BK_rotate` ([docs/touch.md](docs/touch.md)). The Win32 host is BUI's own; the X11 host follows Blender's GHOST input mapping, and the Cocoa host (checked by CI and tried by hand on three Macs: two Apple Silicon, one Intel) 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** |
| `a11y/` | `bui-a11y`, a Rust crate: the kit's accessibility trees as AccessKit trees, served to UI Automation on Windows through the window's `WM_GETOBJECT`. The only code that uses AccessKit; C API in `a11y/include/bui_a11y.h`. Gate: `-DBUI_A11Y=ON` (needs cargo); on for Rust and Node. | **Builds + tested** (Windows) |
| `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; Blender's screen layout (`kit/intern/screen`, ported from `editors/screen`: areas on a graph of shared edges that split, join, dock and resize, regions that resize, hide and flip, saved as JSON); 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, libtiff, OpenEXRCore, libavif, libjxl, the OS's HEIC decoder 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, Wayland, Cocoa and Android (`kit_window_win32.c`, `kit_window_x11.c`, `kit_window_wayland.c`, `kit_window_cocoa.m`, `kit_window_android.c`; `kit_window_null.c` elsewhere); the desktop shell (`kit/intern/shell`: tray icons, notifications, taskbar progress, recent files); one accessibility tree per window (`kit/intern/a11y`, served to screen readers by `platform/a11y/`). Touch screens and trackpad gestures live in the kit, not the hosts: `kit/intern/kit_touch.c` is one state machine (Android's model: taps, long presses, scrolls past the touch slop, a second finger's pan, pinch and turn as Blender's `MOUSEPAN` / `MOUSEZOOM` / `MOUSEROTATE`) with the fling in `kit_fling.c` (`VelocityTracker`, `OverScroller`), and every host (Win32 `WM_POINTER`, X11 XInput 2, Wayland `wl_touch` and pointer gestures, Cocoa's magnify and rotate, Android) only forwards contacts to `BK_touch` and trackpad gestures to `BK_magnify` / `BK_rotate` ([docs/touch.md](docs/touch.md)). The Win32 host is BUI's own; the X11 host follows Blender's GHOST input mapping, and the Cocoa host (checked by CI and tried by hand on three Macs: two Apple Silicon, one Intel) 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** |
| `platform/a11y/` | `bui-a11y`, a Rust crate: the kit's accessibility trees as AccessKit trees, served to UI Automation on Windows through the window's `WM_GETOBJECT`. The only code that uses AccessKit; C API in `platform/a11y/include/bui_a11y.h`. Gate: `-DBUI_A11Y=ON` (needs cargo); on for Rust and Node. | **Builds + tested** (Windows) |
| `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; 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** |
Expand Down
Loading
Loading