Skip to content

Commit

Permalink
Deployed 0d6383f with MkDocs version: 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kolibril13 committed Nov 5, 2024
1 parent 2d92abe commit f968f3f
Show file tree
Hide file tree
Showing 14 changed files with 1,533 additions and 47 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


<link rel="icon" href="/assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.42">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">



Expand Down
Binary file modified img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


<link rel="icon" href="assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.42">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">



Expand Down Expand Up @@ -362,9 +362,10 @@


<h1 id="bpy-gallery">Bpy Gallery</h1>
<p>Welcome to this Documentation, where you'll find curated examples on how to use Blender with python notebooks.
If you find these resources useful, you're welcome to give a ⭐ a on GitHub : https://github.com/kolibril13/ipyblender-experimental
You can also support my work by buying me a coffe:</p>
<p>Welcome to this documentation! 👋<br />
Here, you’ll find a collection of curated examples for using Blender within Python notebooks.<br />
If you find these resources helpful, feel free to leave a star ⭐ on GitHub:<br />
<a href="https://github.com/kolibril13/bpy-gallery">https://github.com/kolibril13/bpy-gallery</a></p>



Expand Down
Binary file added jupyterlab_setup.mp4
Binary file not shown.
103 changes: 72 additions & 31 deletions n0getting_started/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.42">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">



Expand Down Expand Up @@ -302,9 +302,27 @@
</li>

<li class="md-nav__item">
<a href="#using-in-headless-mode" class="md-nav__link">
<a href="#python-package-manger-uv" class="md-nav__link">
<span class="md-ellipsis">
Using in headless-mode
Python Package manger UV
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#using-headless-mode" class="md-nav__link">
<span class="md-ellipsis">
Using Headless Mode
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#using-gui-mode" class="md-nav__link">
<span class="md-ellipsis">
Using GUI Mode
</span>
</a>

Expand Down Expand Up @@ -414,9 +432,27 @@
</li>

<li class="md-nav__item">
<a href="#using-in-headless-mode" class="md-nav__link">
<a href="#python-package-manger-uv" class="md-nav__link">
<span class="md-ellipsis">
Python Package manger UV
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#using-headless-mode" class="md-nav__link">
<span class="md-ellipsis">
Using Headless Mode
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#using-gui-mode" class="md-nav__link">
<span class="md-ellipsis">
Using in headless-mode
Using GUI Mode
</span>
</a>

Expand All @@ -439,19 +475,22 @@

<h1 id="getting-started">Getting Started</h1>
<h2 id="how-can-i-use-blender-with-python">How can I use Blender with Python?</h2>
<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>
<p>Blender has a built-in Python editor, but sometimes it’s useful to work in environments like Jupyter notebooks or VS Code notebooks.</p>
<p>There are two ways to use Blender in a notebook: </p>
<ol>
<li><strong>headless-mode</strong>. 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><strong>gui-mode</strong>. 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>
<li>Headless Mode: In this mode, you install the Blender Python module bpy from PyPi. The Blender GUI doesn’t open, so you can run it even without a Blender installation. </li>
<li>GUI Mode: This mode uses your installed Blender version, so you can work in the Blender GUI while sending commands from the notebook.</li>
</ol>
<h2 id="using-in-headless-mode">Using in headless-mode</h2>
<p>We're using the package manager <a href="https://docs.astral.sh/uv/getting-started/installation/">uv</a>.<br />
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:
<h2 id="python-package-manger-uv">Python Package manger UV</h2>
<p>For the installation, we use the package manager <a href="https://docs.astral.sh/uv/getting-started/installation/">uv</a>.</p>
<p>The advantage of <code>uv</code> is that it automatically manages and caches your environment. You can run the same command multiple times without needing virtual environments or handling Python installations manually.</p>
<p>Installation <strong>macOS</strong>:
<code>curl -LsSf https://astral.sh/uv/install.sh | sh</code></p>
<p>Installation <strong>Windows</strong>:
<code>powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"</code></p>
<h2 id="using-headless-mode">Using Headless Mode</h2>
<p>To start the notebook, run:
<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><img alt="alt text" src="../first_render.png" /></p>
<details class="code">
<summary>Code</summary>
Expand All @@ -462,22 +501,24 @@ <h2 id="using-in-headless-mode">Using in headless-mode</h2>
</span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="n">display</span><span class="p">(</span><span class="n">Image</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s2">&quot;img.png&quot;</span><span class="p">))</span>
</span></code></pre></div>
</details>
<p>Note, that <em><em>headless-mode will </em>only</em> run with Python 3.11. (as of Blender 4.2)</p>
<h1 id="using-in-gui-mode">Using in GUI-mode</h1>
<p>We first need to install <a href="https://github.com/cheng-chi/blender_notebook">blender_notebook</a> in order to register the blender kernel to our notebook environment.</p>
<p>Also here, we're using the package manager <a href="https://docs.astral.sh/uv/getting-started/installation/">uv</a>.</p>
<p>On <strong>MacOS</strong>, that's done by
<div class="language-text highlight"><pre><span></span><code><span id="__span-1-1"><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a>uvx blender_notebook install --blender-exec=&quot;/Applications/Blender.app/Contents/MacOS/Blender&quot;
</span><span id="__span-1-2"><a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a>uvx --python 3.11 jupyter lab
</span></code></pre></div></p>
<p>On <strong>Windows</strong>, that's #TODO: TEST THIS FIRST, MAYBE ADJUST PATH
<div class="language-py highlight"><pre><span></span><code><span id="__span-2-1"><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a><span class="n">uvx</span> <span class="n">blender_notebook</span> <span class="n">install</span> <span class="o">--</span><span class="n">blender</span><span class="o">-</span><span class="n">exec</span><span class="o">=</span><span class="s2">&quot;C:\Program Files\Blender Foundation\Blender 4.2</span><span class="se">\b</span><span class="s2">lender.exe&quot;</span>
</span><span id="__span-2-2"><a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a><span class="n">uvx</span> <span class="o">--</span><span class="n">python</span> <span class="mf">3.11</span> <span class="n">jupyter</span> <span class="n">lab</span>
</span></code></pre></div></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>Here's how you can select the Blender Kernel in VS Code notebooks:</p>
<video controls src="../video.mp4" title="Title"></video>
<p><strong>Note:</strong> The headless mode will <em>only</em> run with Python 3.11 (as of Blender 4.2).</p>
<h2 id="using-gui-mode">Using GUI Mode</h2>
<p>To set up Blender in GUI mode, we first register the Blender kernel with your notebook environment.</p>
<p>On <strong>macOS</strong>, run:<br />
<code>uvx blender_notebook install --blender-exec="/Applications/Blender.app/Contents/MacOS/Blender"</code></p>
<p><code>uvx --python 3.11 jupyter lab</code></p>
<p>(under the hood, this is using <a href="https://github.com/cheng-chi/blender_notebook">blender_notebook</a>)</p>
<p>On <strong>Windows</strong>, run:<br />
<code>uvx blender_notebook install --blender-exec="C:\Program Files\Blender Foundation\Blender 4.2\blender.exe"</code></p>
<p><code>uvx --python 3.11 jupyter lab</code>
(Windows installation is not yet tested)</p>
<p>Once set up, you can select the Blender kernel in Jupyter Lab.</p>
<p>Select the Blender kernel in <strong>JupyterLab</strong> like this:</p>
<video controls src="../jupyterlab_setup.mp4" title="Title"></video>

<p><strong>Note</strong>: GUI mode also works with other notebook environments, such as VS Code notebooks and Satyrn notebooks.</p>
<p>Select the Blender kernel in <strong>VS Code</strong> like this:</p>
<video controls src="../vscode_setup.mp4" title="Title"></video>



Expand Down
2 changes: 1 addition & 1 deletion n1objects/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.42">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">



Expand Down
2 changes: 1 addition & 1 deletion n2data_simple/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.42">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">



Expand Down
2 changes: 1 addition & 1 deletion n3data_attributes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.42">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">



Expand Down
Loading

0 comments on commit f968f3f

Please sign in to comment.