Use AI to make changes to your blender scene in seconds! Completely free of charge.
PREREQUISITE: Make sure you have the requests
pyhon module installed on your system via pip. In a terminal, run the command pip install requests
to ensure that it is installed.
- Click on the green code button for this repository near the upper right hand corner and download the code as a ZIP file.
- Open the download and extract it using the file explorer to wherever you want to put it (just remember the location for later)
- Open blender
- Edit > Preferences > Add-ons
- Click the Install button in the upper right hand corner
- Navigate to the folder you extracted in step 2
- Open the folder and double click to open
ai_plugin.py
- Search for
Google AI Studio Script Executor
in your addons list and make sure it is enabled.
API Key Setup (Necessary):
- Visit https://aistudio.google.com/apikey and generate an api key. You might have to make a Google Cloud project first, but this is free (if you need help, ask an AI)
Option 1 (Set as environment variable, recommended): Windows:
- Search for "environment variables" using the windows search on your computer
- Click on
Edit the system enviroment variables
orEdit user enviroment variables
- A "system properties" window should appear, click on the
Environment Variables
button near the bottom - Two boxes will appear for user and environment variables, click on the
New...
button in the upper box - Enter
GOOGLE_AI_STUDIO_API_KEY
as the name and paste your api key in the value box. - Close out and restart blender for changes to take effect Linux:
- Append
export GOOGLE_AI_STUDIO_API_KEY="<your_api_key_here>"
to your bashrc - Restart blender and enjoy
Option 2 (Paste API key into box, not recommended):
- Paste your API key into the
API KEY
box in the plugin menu and use as normal
- When in the 3d viewport, press
n
to toggle the side menu on. In the menu that pops up, you should seeAI Studio
as one of the tabs. - Click on
AI Studio
to open the plugin menu. Sometimes it shows up compacted so make sure you click on the carrot if you need to expand it. - Make sure you have your API key configured then select a model from the dropdown
- Enter a prompt and then click
Generate and Execute Script
- Sometimes this will give errors, just try to adjusts your prompts as needed
- If something breaks or the AI starts getting confused, you can always click the
Clear Context
button. The AI will forget what it has done, but can still make new objects (and change existing ones if you tell it the name of the object) - Remember that this is not a production-grade product and there will likely be many bugs. I made this almost entirely using ChatGPT, so it can't be perfect. If you find any issues, you can edit the code yourself (it's only one python file, you got this!), ask an AI for assistance, or submit an issue on GitHub (although I might not be able to fix it)
- Enjoy 🗿
Any contributions are welcome! Just open a PR with your changes and as long as they seem beneficial and work well, I will probably merge them. If you have some spare time and want to contribute, it might be cool to have integrations for other model providers or the ability to send the model a screenshot of the current scene :)
This was heavily inspired by Polyfjord's youtube video on controlling blender using AI, go check it out!