snipt

Ctrl+h for KB shortcuts

Python

Blender - Hair set start end simulation

1
2
3
4
5
import bpy
scene = bpy.context.scene
obj = bpy.data.groups["Group_name"].objects["Object_name"]
obj.particle_systems["ParticleSystem"].point_cache.frame_start = scene.frame_start
obj.particle_systems["ParticleSystem"].point_cache.frame_end = scene.frame_end
https://snipt.net/embed/e87e319974b0dbac89ec5c6660c8a824/
https://snipt.net/raw/e87e319974b0dbac89ec5c6660c8a824/
e87e319974b0dbac89ec5c6660c8a824
python
Python
5
2016-02-11T14:50:46
True
True
Aug 06, 2015 at 02:55 PM
/api/public/snipt/140567/
blender-hair-set-start-end-simulation
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="kn">import</span> <span class="nn">bpy</span> </span><span id="L-2"><a name="L-2"></a><span class="n">scene</span> <span class="o">=</span> <span class="n">bpy</span><span class="o">.</span><span class="n">context</span><span class="o">.</span><span class="n">scene</span> </span><span id="L-3"><a name="L-3"></a><span class="n">obj</span> <span class="o">=</span> <span class="n">bpy</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">groups</span><span class="p">[</span><span class="s">&quot;Group_name&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">objects</span><span class="p">[</span><span class="s">&quot;Object_name&quot;</span><span class="p">]</span> </span><span id="L-4"><a name="L-4"></a><span class="n">obj</span><span class="o">.</span><span class="n">particle_systems</span><span class="p">[</span><span class="s">&quot;ParticleSystem&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">point_cache</span><span class="o">.</span><span class="n">frame_start</span> <span class="o">=</span> <span class="n">scene</span><span class="o">.</span><span class="n">frame_start</span> </span><span id="L-5"><a name="L-5"></a><span class="n">obj</span><span class="o">.</span><span class="n">particle_systems</span><span class="p">[</span><span class="s">&quot;ParticleSystem&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">point_cache</span><span class="o">.</span><span class="n">frame_end</span> <span class="o">=</span> <span class="n">scene</span><span class="o">.</span><span class="n">frame_end</span> </span></pre></div> </td></tr></table>
blender, python

Python

Blender - Point Cache set (softBody)

1
2
3
4
5
6
import bpy
scene = bpy.context.scene
obj = bpy.data.groups["OBJ_GROUP"].objects["Mesh_with_modifier"]

obj.modifiers["Softbody"].point_cache.frame_start = scene.frame_start
obj.modifiers["Softbody"].point_cache.frame_end = scene.frame_end
https://snipt.net/embed/33095c12d1ca550969e663b1441b6c3b/
https://snipt.net/raw/33095c12d1ca550969e663b1441b6c3b/
33095c12d1ca550969e663b1441b6c3b
python
Python
6
2016-02-11T13:15:51
True
True
Aug 06, 2015 at 01:58 PM
/api/public/snipt/140565/
blender-point-cache-set-softbody
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="kn">import</span> <span class="nn">bpy</span> </span><span id="L-2"><a name="L-2"></a><span class="n">scene</span> <span class="o">=</span> <span class="n">bpy</span><span class="o">.</span><span class="n">context</span><span class="o">.</span><span class="n">scene</span> </span><span id="L-3"><a name="L-3"></a><span class="n">obj</span> <span class="o">=</span> <span class="n">bpy</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">groups</span><span class="p">[</span><span class="s">&quot;OBJ_GROUP&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">objects</span><span class="p">[</span><span class="s">&quot;Mesh_with_modifier&quot;</span><span class="p">]</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="n">obj</span><span class="o">.</span><span class="n">modifiers</span><span class="p">[</span><span class="s">&quot;Softbody&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">point_cache</span><span class="o">.</span><span class="n">frame_start</span> <span class="o">=</span> <span class="n">scene</span><span class="o">.</span><span class="n">frame_start</span> </span><span id="L-6"><a name="L-6"></a><span class="n">obj</span><span class="o">.</span><span class="n">modifiers</span><span class="p">[</span><span class="s">&quot;Softbody&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">point_cache</span><span class="o">.</span><span class="n">frame_end</span> <span class="o">=</span> <span class="n">scene</span><span class="o">.</span><span class="n">frame_end</span> </span></pre></div> </td></tr></table>
blender, python

Python 3

Require Root

1
2
3
4
5
6
import sys
import os

def check_root():
	if not os.geteuid() == 0:
		sys.exit('Script must be run as root')
https://snipt.net/embed/728cb9dd75d145ab1e81bb0f50e07208/
https://snipt.net/raw/728cb9dd75d145ab1e81bb0f50e07208/
728cb9dd75d145ab1e81bb0f50e07208
python3
Python 3
6
2016-02-09T01:49:32
True
False
Oct 09, 2014 at 08:59 PM
/api/public/snipt/136703/
require-root-6f3e82c3
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="kn">import</span> <span class="nn">sys</span> </span><span id="L-2"><a name="L-2"></a><span class="kn">import</span> <span class="nn">os</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="k">def</span> <span class="nf">check_root</span><span class="p">():</span> </span><span id="L-5"><a name="L-5"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">geteuid</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> </span><span id="L-6"><a name="L-6"></a> <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s">&#39;Script must be run as root&#39;</span><span class="p">)</span> </span></pre></div> </td></tr></table>
python
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.