Overview
Use these instructions for Blender add-ons, render-studio automation, and configurator asset pipelines.
API and Scripting Rules
- Use
bpy.data,bpy.context, andbpy.opsthrough the stable API — avoid internal/undocumented modules - Register operators and panels with proper
bl_idname,bl_label, andbl_options - Always provide
poll()methods on operators to prevent invalid context execution - Use
bpy.app.handlersfor persistent callbacks; clean up handlers on add-on unregister
Asset Pipeline Rules
- Treat large GLB, EXR, HDR, and render files as assets, not chat context — summarize metadata instead
- Prefer metadata summaries and small config files before reading generated output
- Use relative paths in
.blendfiles for portability across machines
Subprocess and Rendering
- Keep subprocess execution deterministic and logged without exposing secrets
- Use
--backgroundand--pythonflags for headless Blender rendering:blender --background scene.blend --python render_script.py -- --output /tmp/render - Parse arguments after
--usingsys.argv[sys.argv.index("--") + 1:] - Validate with focused scripts or tests before broad render runs
Common Pitfalls
- Do not call
bpy.opsoutside the correct context — use context overrides ortemp_override() - Do not block the UI thread with long operations — use modal operators or background threads for heavy work
- Always check
bpy.app.versionwhen targeting multiple Blender versions