How davidkingzyb/blenderslot works
Project type and purpose
• This is a Blender add‑on (a plugin) rather than a traditional front‑end/back‑end web app. Its purpose is to:
• Record user operations in Blender
• Let users name, edit, save, and execute those recorded scripts
• Integrate with an external AI service (Ollama) to generate new scripts
File structure
• Top level:
• __init__.py – Blender add‑on registration
• ui.py – UI panels and buttons in the Blender interface
• operators.py – Definitions of custom Blender operators (record, stop, execute, add)
• ollama_op.py – Logic for sending prompts to Ollama and retrieving AI‑generated scripts
• slot/ – Folder holding script management code
– exportFbx.py – A utility operator to export FBX (optional feature)
• No separate “backend” or “frontend” folders because everything lives as part of the Blender process.
README for additional insights
• Describes the workflow: name script → record operations → stop → edit → execute → save
• Calls out AI integration via Ollama as an optional “generate script” feature
a. Main components:
1. Blender Host Application (API)
2. BlenderSlot Add‑on
• UI Module (ui.py)
• Operator Module (operators.py)
• Slot Manager (slot/ __init__.py plus any storage mechanism)
• Export Utility (slot/exportFbx.py)
• AI Integration Module (ollama_op.py)
3. External Ollama Service
4. Script Storage (could be in‑memory, on‑disk, or Blender’s Text DataBlocks)
b. Relationships and interactions:
• UI Panel → invokes custom Operators
• Operators talk to Blender API to record or replay actions
• Slot Manager persists recorded scripts and retrieves them for execution
• “Generate with AI” operator calls Ollama service over HTTP/CLI → receives code → sends back to Slot Manager/UI
• Export module can pull Blender scene data and write an FBX file
c. Architectural patterns and principles:
• Modular separation: UI vs. business logic vs. external integration
• Single responsibility: Each operator handles one user action
• Event‑driven: Buttons trigger operators
d. Key technologies:
• Blender Python API
• Ollama CLI/HTTP endpoint
• Python standard library for file I/O
Putting it all together
1. UI Module (ui.py) – Blue
2. Operators Module (operators.py) – Green
3. Slot Manager + exportFbx (slot/) – Green
4. AI Integration (ollama_op.py) – Orange
• UI → Operators
• Operators → Blender API
• Operators ↔ Slot Manager → Storage
• AI Integration ↔ Ollama