Add your description here
Project description
BPY Widget
Interactive Blender 3D viewport widget for notebooks with real-time Eevee Next rendering.
🚀 Features
- Interactive 3D Viewport: Real-time camera control with mouse/touch
- 🖱️ Drag to rotate camera
- 📏 Scroll to zoom in/out
- 📱 Touch support for mobile devices
- High-Performance Rendering: Powered by Blender's Eevee Next engine
- Live Performance Metrics: FPS counter and render time display
- Seamless Notebook Integration: Reactive updates and state synchronization
- Easy to Use: Simple API with automatic scene setup
📋 Requirements
- Python 3.11+
🛠️ Installation
From Source
git clone https://github.com/yourusername/bpy-widget.git
cd bpy-widget
pip install -e .
Using UV (Recommended)
uv sync
🎯 Quick Start
import marimo as mo
from bpy_widget import BpyWidget
# Create widget with custom size
widget = BpyWidget(width=800, height=600)
# Display in notebook
widget
📚 Examples
Basic Usage
Run the example notebook:
marimo edit examples/basic_usage.py
Custom Scene
from bpy_widget import BlenderWidget
# Create widget
widget = BlenderWidget(width=1024, height=768)
# Access Blender API
widget.clear_scene()
widget.setup_camera(location=(10, -10, 8))
widget.setup_lighting()
# Add objects
widget.create_suzanne()
widget.create_test_cube()
# Render
widget.render()
Material Creation
# Apply to object
widget.objects["Suzanne"].data.materials.clear()
widget.objects["Suzanne"].data.materials.append(chrome)
# Update view
widget.render()
🔧 API Reference
BlenderWidget
Main widget class for interactive 3D viewport.
Constructor
BlenderWidget(width=512, height=512, auto_init=True)
width: Viewport width in pixelsheight: Viewport height in pixelsauto_init: Automatically initialize scene with defaults
Properties
scene: Current Blender sceneobjects: Dictionary of scene objectscontext: Blender contextdata: Blender dataops: Blender operators
Methods
clear_scene(): Remove all objects from scenesetup_camera(location, rotation): Position camerasetup_lighting(): Add default lightingcreate_material(name, base_color, metallic, roughness): Create PBR materialcreate_suzanne(): Add Suzanne meshcreate_test_cube(): Add test cuberender(): Update viewport renderingdebug_info(): Print scene information
🎨 Architecture
The widget uses a modular architecture:
widget.py: Main widget class with AnyWidget integrationcore/: Core Blender functionality modulescamera.py: Camera positioning and controlsrendering.py: Render pipeline setuplighting.py: Scene lighting utilitiesmaterials.py: Material creation helpers
static/: Frontend assetswidget.js: Interactive controls and displaywidget.css: Styling
⚡ Performance
- ** Rendering**: ~3 FPS interactive performance
- Smart Throttling: Updates batched
- Minimal Overhead: Direct pixel buffer access
- Responsive Controls: Local state for instant feedback
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Blender Foundation for the amazing bpy module
- Marimo team for the reactive notebook platform
- AnyWidget for the widget framework
🐛 Known Issues
- Initial audio warning from Blender can be ignored
- Performance may vary based on scene complexity
- Touch controls require modern browser support
📮 Support
For issues and questions:
- Open an issue on GitHub
- Check existing issues for solutions
- Include system info and error messages
Made with ❤️ for the Blender and Marimo communities
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bpy_widget-0.1.0.tar.gz.
File metadata
- Download URL: bpy_widget-0.1.0.tar.gz
- Upload date:
- Size: 78.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1d683b0dce47ebd736abbcc0f61d60588a35d0f428eb8d274933e2c6a5a5de5
|
|
| MD5 |
fff00258fdeba830ead55ffc038a8e5c
|
|
| BLAKE2b-256 |
1e3432d5dc3e689e9516a56c2b8b9f7b726cd0f4ecd1ccdca20cbca89b12456b
|
Provenance
The following attestation bundles were made for bpy_widget-0.1.0.tar.gz:
Publisher:
python-publish.yml on bjoernbethge/bpy-widget
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bpy_widget-0.1.0.tar.gz -
Subject digest:
c1d683b0dce47ebd736abbcc0f61d60588a35d0f428eb8d274933e2c6a5a5de5 - Sigstore transparency entry: 268146858
- Sigstore integration time:
-
Permalink:
bjoernbethge/bpy-widget@c8a054fe7f780dfc60ae2a9b44aef971bd3d3b76 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bjoernbethge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c8a054fe7f780dfc60ae2a9b44aef971bd3d3b76 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file bpy_widget-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bpy_widget-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f08ff5a3c60b2e0bd2b69c1deba971aca3eb45e12dfb3046d59d64e677d11d2
|
|
| MD5 |
f021de0d3202f112124c799480512059
|
|
| BLAKE2b-256 |
808ea9e1d5ea1e6b87f126281d1a4aa64a1cc0acc5a0f76229dd1860deaec18b
|
Provenance
The following attestation bundles were made for bpy_widget-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on bjoernbethge/bpy-widget
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bpy_widget-0.1.0-py3-none-any.whl -
Subject digest:
7f08ff5a3c60b2e0bd2b69c1deba971aca3eb45e12dfb3046d59d64e677d11d2 - Sigstore transparency entry: 268146859
- Sigstore integration time:
-
Permalink:
bjoernbethge/bpy-widget@c8a054fe7f780dfc60ae2a9b44aef971bd3d3b76 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bjoernbethge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c8a054fe7f780dfc60ae2a9b44aef971bd3d3b76 -
Trigger Event:
workflow_dispatch
-
Statement type: