-
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
enhancementNew feature or requestNew feature or requestui/uxUser interface and experienceUser interface and experience
Milestone
Description
Overview
Build a complete GPU-based UI layout system that mirrors Blender's UILayout API, enabling rich interactive panels, menus, and tooltips rendered via GPU.
This system provides:
- Declarative API similar to
bpy.types.UILayout - Interactive widgets (buttons, props, sliders)
- Hit testing for mouse interaction
- Theme integration with Blender's UI themes
Related Issues
- PME2: GPU-rendered description tooltip for Pie Menu #100 - GPU-rendered description tooltip (original feature request)
- PME2: description / description_expr implementation #81 - description/description_expr implementation
Architecture
ui/gpu/
├── __init__.py # Public exports
├── style.py # GPULayoutStyle, theme integration
├── drawing.py # GPUDrawing, BLFDrawing, IconDrawing
├── items.py # LayoutItem, LabelItem, ButtonItem, etc.
├── layout.py # GPULayout (main API)
├── tooltip.py # GPUTooltip
├── interactive.py # HitRect, HitTestManager, InteractionState
└── test_layout.py # Test operators
Sub-issues (Phases)
Phase A: Foundation
- GPU Layout: Multi-area rendering with region targeting #105 - Multi-area rendering (region targeting) ✅
- GPU Layout: UI scaling with over_scale pattern #106 - UI scaling (over_scale pattern)
Phase B: Interaction
- GPU Layout: Panel drag and close button #107 - Panel drag & close button ✅
- GPU Layout: Panel resize and position persistence #108 - Panel resize & position persistence
Phase C: Visual Quality
- GPU Layout: Text rendering improvements #109 - Text rendering improvements (shadow, clipping, ellipsis)
- GPU Layout: Complete theme integration #110 - Complete theme integration
Future: Widgets
- layout.prop() implementation (slider, checkbox, enum)
- layout.template_*() methods
Completed
- Basic GPULayout with label(), separator(), row(), column()
- ButtonItem with hover/press states
- HitTestManager for mouse interaction
- GPULayoutStyle.from_blender_theme()
- GPUTooltip for structured tooltips
- Region targeting - Draw only in invoking region (commit
160e33e) - Panel drag & close - Title bar with platform-aware close button (commit
4389902)
Design Principles
- UILayout-compatible API:
layout.label(),layout.operator(),layout.prop() - Automatic HitRect registration: Interactive items auto-register with HitTestManager
- Theme-aware: Colors from Blender theme, respects ui_scale
- Region-scoped: Draw only in the invoking region, not all regions of same type
Key Patterns Discovered
Position State Management (from #107)
When UI is rebuilt each frame, externalize mutable state to the operator:
# Store position in operator
self._panel_x = self._layout.x
self._panel_y = self._layout.y
# Use stored position on rebuild
layout = GPULayout(x=self._panel_x, y=self._panel_y, ...)References
- bl_ui_widgets (GPL-3.0): https://github.com/mmmrqs/bl_ui_widgets
Notes
- Tooltip via GPU is now optional since PME2: Macro operator improvements - description and argument-free invocation #102 found dynamic bl_description method
- Focus is on building a complete UI framework, not just tooltips
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestui/uxUser interface and experienceUser interface and experience