Hi,<br><br>I need help with the particle module, the Python module works quite well now, but I&#39;d like to export hairs with render parameters.<br><br>Here is the code I use to export:<br>___<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; hairstep = 1.0/pow(2.0,(float)psys-&gt;part-&gt;ren_step);<br>
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; partlist = PyList_New( 0 );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if( !partlist )<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return EXPP_ReturnPyObjError( PyExc_MemoryError, &quot;PyList() failed&quot; );<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (i = 0; i &lt; psys-&gt;totpart + psys-&gt;totchild; i++){<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; seglist = PyList_New( 0 );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (l = 0.0; l &lt; 1.0; l += hairstep){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; state.time = l;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; psys_get_particle_on_path(ob,psys,i,&amp;state,1);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; loc = PyTuple_New(3);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PyTuple_SetItem(loc,0,PyFloat_FromDouble((double)<a href="http://state.co">state.co</a>[0]));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PyTuple_SetItem(loc,1,PyFloat_FromDouble((double)<a href="http://state.co">state.co</a>[1]));<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PyTuple_SetItem(loc,2,PyFloat_FromDouble((double)<a href="http://state.co">state.co</a>[2]));<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( (PyList_Append(seglist,loc) &lt; 0) ){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Py_DECREF(seglist);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Py_DECREF(partlist);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Py_XDECREF(loc);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return EXPP_ReturnPyObjError( PyExc_RuntimeError,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;Couldn&#39;t append item to PyList&quot; );<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Py_DECREF(loc); /* PyList_Append increfs */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( PyList_Append(partlist,seglist) &lt; 0){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Py_DECREF(partlist);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Py_XDECREF(loc);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return EXPP_ReturnPyObjError( PyExc_RuntimeError,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;Couldn&#39;t append item to PyList&quot; );&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Py_DECREF(seglist);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>
___<br><br>But I don&#39;t get the amount of childs defined for rendering, only for interactive view.<br><br>Could you help me with this ?<br><br>Cheers.<br><br>Cedric PAILLE.<br><br><div class="gmail_quote">2008/2/11 Janne Karhu &lt;<a href="mailto:jhkarh@utu.fi">jhkarh@utu.fi</a>&gt;:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Sure,<br>
<br>
the basic way (i.e. should give correct result in most cases) to get a<br>
particle&#39;s location (child or actual particle) is<br>
psys_get_particle_state(...) in particle.c. You can probably look at the<br>
places where it&#39;s used to figure out how it works. It should also work for<br>
hair particles, but with the simplification that hair particle&#39;s life is<br>
always from frame 1 (or zero, don&#39;t remember right now) to frame 100.<br>
<br>
Cheers,<br>
<br>
Janne.<br>
<br>
<br>
On Mon, 11 Feb 2008 13:09:34 +0200, Cédric PAILLE &lt;<a href="mailto:cedricpaille@gmail.com">cedricpaille@gmail.com</a>&gt;<br>
<div><div></div><div class="Wj3C7c">wrote:<br>
<br>
&gt; Hi,<br>
&gt;<br>
&gt; I understand that, but, can you tell me, roughly how to get particles<br>
&gt; loc ?<br>
&gt; I need it for my exporter, at least for making some tests.<br>
&gt;<br>
&gt; Cheers.<br>
&gt;<br>
&gt; 2008/2/11, Janne Karhu &lt;<a href="mailto:jhkarh@utu.fi">jhkarh@utu.fi</a>&gt;:<br>
&gt;&gt;<br>
&gt;&gt; Hi Cédric,<br>
&gt;&gt;<br>
&gt;&gt; atleast at some point during the physics sprint it was decided that the<br>
&gt;&gt; new particles would be in the first release without any python<br>
&gt;&gt; connections. There are a lot of new things to consider and afterwards<br>
&gt;&gt; probably many many more things will be possible through python compared<br>
&gt;&gt; to<br>
&gt;&gt; the old system. The first priority is to get everything working properly<br>
&gt;&gt; in the internal code, after that python can start poking around :) I<br>
&gt;&gt; realize that this will make some old scripts non-functional for the<br>
&gt;&gt; release, but as a perfect conversion from the old particle system is<br>
&gt;&gt; impossible even without python scripts in the system I don&#39;t think it&#39;s<br>
&gt;&gt; a<br>
&gt;&gt; big difference.<br>
&gt;&gt;<br>
&gt;&gt; Janne<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Fri, 08 Feb 2008 23:18:13 +0200, Cédric PAILLE<br>
&gt;&gt; &lt;<a href="mailto:cedricpaille@gmail.com">cedricpaille@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; &gt; Hi all,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; At first, please excuse my poor englsh, I&#39;m new to the mailing list.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I was waiting since it&#39;s in the SVN for the new particle system python<br>
&gt;&gt; &gt; module, but it seems that nobody&#39;s working on it...<br>
&gt;&gt; &gt; So I&#39;ve beginned to write it myself.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; It&#39;s almost finished, right now, but I need some pointers to code a<br>
&gt;&gt; &gt; function<br>
&gt;&gt; &gt; similar to the old getParticlesLoc() of the effect module.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Can somebody tell me how to get the particles location and hair<br>
&gt;&gt; segments<br>
&gt;&gt; &gt; ?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I&#39;ve tried to look at the &quot;draw_object.c&quot;, but it&#39;s hard to<br>
&gt;&gt; understand.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Hair drawing seems to use the particle cache, and particle uses a<br>
&gt;&gt; &gt; function<br>
&gt;&gt; &gt; to retrieve the location.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Last question : Are you interested to integate it in the SVN ?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Cheers.<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Bf-committers mailing list<br>
&gt;&gt; <a href="mailto:Bf-committers@blender.org">Bf-committers@blender.org</a><br>
&gt;&gt; <a href="http://lists.blender.org/mailman/listinfo/bf-committers" target="_blank">http://lists.blender.org/mailman/listinfo/bf-committers</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
_______________________________________________<br>
Bf-committers mailing list<br>
<a href="mailto:Bf-committers@blender.org">Bf-committers@blender.org</a><br>
<a href="http://lists.blender.org/mailman/listinfo/bf-committers" target="_blank">http://lists.blender.org/mailman/listinfo/bf-committers</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Cedric PAILLE.