-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deployed ef1e69b with MkDocs version: 1.6.1
- Loading branch information
1 parent
bc9a67a
commit 7c47e57
Showing
3 changed files
with
10 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Blender Snippet Gallery 2","text":"<pre><code>import bpy\nfrom IPython.display import display, Image\n\npath = \"test.png\"\nbpy.context.scene.render.resolution_x = 500\nbpy.context.scene.render.resolution_y = 200\nbpy.ops.render.render()\nbpy.data.images[\"Render Result\"].save_render(filepath=path)\ndisplay(Image(filename=path))\n</code></pre> <p>and another one:</p>"},{"location":"getting_started/","title":"Getting Started","text":""},{"location":"getting_started/#how-can-i-use-blender-with-python","title":"How can I use Blender with Python?","text":"<p>It's amazing that Blender has an internal Python editor, but sometimes it can be useful to use a more advanced Python environment like Jupyter notebooks, or VS Code notebooks.</p> <p>There are two ways to use blender in a notebook: </p> <ol> <li>headless-mode. The Blender Python module \"bpy\" will be installed from PyPi and the Blender GUI won't open while using bpy in your notebook. It will work even if you don't have a Blender version installed.</li> <li>gui-mode. Here, we'll us the Blender version installe on your system, so that you can interact with Blender from the GUI and send commands from the notebook.</li> </ol>"},{"location":"getting_started/#using-in-headless-mode","title":"Using in headless-mode","text":"<p>We're using the package manager uv. On mac, you can install uv by <code>curl -LsSf https://astral.sh/uv/install.sh | sh</code></p> <p>The notebook starts now with: <code>uvx --python 3.11 --with bpy==4.2.0 jupyter lab</code></p> <p>The convenient thing about uv: We can run the same command again, and it uses the version that uv cached internally. No need to use vitual environments, and also no need to manage the python installation yourself.</p> <p></p> Code <pre><code>import bpy\nfrom IPython.display import display, Image\nbpy.ops.render.render()\nbpy.data.images[\"Render Result\"].save_render(filepath=\"test.png\")\ndisplay(Image(filename=\"test.png\"))\n</code></pre> <p>Note, that headless-mode will only run with Python 3.11. (as of Blender 4.2)</p>"},{"location":"getting_started/#using-in-gui-mode","title":"Using in GUI-mode","text":"<p>We first need to install blender_notebook in order to register the blender kernel to our notebook environment.</p> <p>Also here, we're using the package manager uv.</p> <p>On MacOS, that's done by <pre><code>uvx blender_notebook install --blender-exec=\"/Applications/Blender.app/Contents/MacOS/Blender\"\nuvx --python 3.11 jupyter lab\n</code></pre></p> <p>On Windows, that's #TODO: TEST THIS FIRST, MAYBE ADJUST PATH <pre><code>uvx blender_notebook install --blender-exec=\"C:\\Program Files\\Blender Foundation\\Blender 4.2\\blender.exe\"\nuvx --python 3.11 jupyter lab\n</code></pre></p> <p>Now you can select the Blender kernel in Jupyter Lab.</p> <p>Note: in GUI-mode, you can also use other notebook environments, e.g. VS Code notebooks or Saryrn notebooks.</p> <p></p> <p>Last try:</p>"}]} | ||
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Blender Snippet Gallery 2","text":"<pre><code>import bpy\nfrom IPython.display import display, Image\n\npath = \"test.png\"\nbpy.context.scene.render.resolution_x = 500\nbpy.context.scene.render.resolution_y = 200\nbpy.ops.render.render()\nbpy.data.images[\"Render Result\"].save_render(filepath=path)\ndisplay(Image(filename=path))\n</code></pre> <p>and another one:</p> <p>Version A)</p> <p>Version B)</p>"},{"location":"getting_started/","title":"Getting Started","text":""},{"location":"getting_started/#how-can-i-use-blender-with-python","title":"How can I use Blender with Python?","text":"<p>It's amazing that Blender has an internal Python editor, but sometimes it can be useful to use a more advanced Python environment like Jupyter notebooks, or VS Code notebooks.</p> <p>There are two ways to use blender in a notebook: </p> <ol> <li>headless-mode. The Blender Python module \"bpy\" will be installed from PyPi and the Blender GUI won't open while using bpy in your notebook. It will work even if you don't have a Blender version installed.</li> <li>gui-mode. Here, we'll us the Blender version installe on your system, so that you can interact with Blender from the GUI and send commands from the notebook.</li> </ol>"},{"location":"getting_started/#using-in-headless-mode","title":"Using in headless-mode","text":"<p>We're using the package manager uv. On mac, you can install uv by <code>curl -LsSf https://astral.sh/uv/install.sh | sh</code></p> <p>The notebook starts now with: <code>uvx --python 3.11 --with bpy==4.2.0 jupyter lab</code></p> <p>The convenient thing about uv: We can run the same command again, and it uses the version that uv cached internally. No need to use vitual environments, and also no need to manage the python installation yourself.</p> <p></p> Code <pre><code>import bpy\nfrom IPython.display import display, Image\nbpy.ops.render.render()\nbpy.data.images[\"Render Result\"].save_render(filepath=\"test.png\")\ndisplay(Image(filename=\"test.png\"))\n</code></pre> <p>Note, that headless-mode will only run with Python 3.11. (as of Blender 4.2)</p>"},{"location":"getting_started/#using-in-gui-mode","title":"Using in GUI-mode","text":"<p>We first need to install blender_notebook in order to register the blender kernel to our notebook environment.</p> <p>Also here, we're using the package manager uv.</p> <p>On MacOS, that's done by <pre><code>uvx blender_notebook install --blender-exec=\"/Applications/Blender.app/Contents/MacOS/Blender\"\nuvx --python 3.11 jupyter lab\n</code></pre></p> <p>On Windows, that's #TODO: TEST THIS FIRST, MAYBE ADJUST PATH <pre><code>uvx blender_notebook install --blender-exec=\"C:\\Program Files\\Blender Foundation\\Blender 4.2\\blender.exe\"\nuvx --python 3.11 jupyter lab\n</code></pre></p> <p>Now you can select the Blender kernel in Jupyter Lab.</p> <p>Note: in GUI-mode, you can also use other notebook environments, e.g. VS Code notebooks or Saryrn notebooks.</p> <p>Last try:</p> <p>Version A)</p> <p>Version B)</p>"}]} |