Hi,<br><br>I need help with the particle module, the Python module works quite well now, but I'd like to export hairs with render parameters.<br><br>Here is the code I use to export:<br>___<br><br> hairstep = 1.0/pow(2.0,(float)psys->part->ren_step);<br>
<br> partlist = PyList_New( 0 );<br> if( !partlist )<br> return EXPP_ReturnPyObjError( PyExc_MemoryError, "PyList() failed" );<br><br> for (i = 0; i < psys->totpart + psys->totchild; i++){<br>
seglist = PyList_New( 0 );<br> for (l = 0.0; l < 1.0; l += hairstep){<br> state.time = l;<br> psys_get_particle_on_path(ob,psys,i,&state,1);<br> loc = PyTuple_New(3);<br>
PyTuple_SetItem(loc,0,PyFloat_FromDouble((double)<a href="http://state.co">state.co</a>[0]));<br> PyTuple_SetItem(loc,1,PyFloat_FromDouble((double)<a href="http://state.co">state.co</a>[1]));<br>
PyTuple_SetItem(loc,2,PyFloat_FromDouble((double)<a href="http://state.co">state.co</a>[2]));<br><br> if ( (PyList_Append(seglist,loc) < 0) ){<br> Py_DECREF(seglist);<br>
Py_DECREF(partlist);<br> Py_XDECREF(loc);<br> return EXPP_ReturnPyObjError( PyExc_RuntimeError,<br> "Couldn't append item to PyList" );<br>
}<br> Py_DECREF(loc); /* PyList_Append increfs */<br> }<br> if ( PyList_Append(partlist,seglist) < 0){<br> Py_DECREF(partlist);<br> Py_XDECREF(loc);<br>
return EXPP_ReturnPyObjError( PyExc_RuntimeError,<br> "Couldn't append item to PyList" ); <br> }<br> Py_DECREF(seglist);<br><br> }<br><br>
___<br><br>But I don'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 <<a href="mailto:jhkarh@utu.fi">jhkarh@utu.fi</a>>:<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'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's used to figure out how it works. It should also work for<br>
hair particles, but with the simplification that hair particle's life is<br>
always from frame 1 (or zero, don'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 <<a href="mailto:cedricpaille@gmail.com">cedricpaille@gmail.com</a>><br>
<div><div></div><div class="Wj3C7c">wrote:<br>
<br>
> Hi,<br>
><br>
> I understand that, but, can you tell me, roughly how to get particles<br>
> loc ?<br>
> I need it for my exporter, at least for making some tests.<br>
><br>
> Cheers.<br>
><br>
> 2008/2/11, Janne Karhu <<a href="mailto:jhkarh@utu.fi">jhkarh@utu.fi</a>>:<br>
>><br>
>> Hi Cédric,<br>
>><br>
>> atleast at some point during the physics sprint it was decided that the<br>
>> new particles would be in the first release without any python<br>
>> connections. There are a lot of new things to consider and afterwards<br>
>> probably many many more things will be possible through python compared<br>
>> to<br>
>> the old system. The first priority is to get everything working properly<br>
>> in the internal code, after that python can start poking around :) I<br>
>> realize that this will make some old scripts non-functional for the<br>
>> release, but as a perfect conversion from the old particle system is<br>
>> impossible even without python scripts in the system I don't think it's<br>
>> a<br>
>> big difference.<br>
>><br>
>> Janne<br>
>><br>
>><br>
>> On Fri, 08 Feb 2008 23:18:13 +0200, Cédric PAILLE<br>
>> <<a href="mailto:cedricpaille@gmail.com">cedricpaille@gmail.com</a>><br>
>> wrote:<br>
>><br>
>> > Hi all,<br>
>> ><br>
>> > At first, please excuse my poor englsh, I'm new to the mailing list.<br>
>> ><br>
>> > I was waiting since it's in the SVN for the new particle system python<br>
>> > module, but it seems that nobody's working on it...<br>
>> > So I've beginned to write it myself.<br>
>> ><br>
>> > It's almost finished, right now, but I need some pointers to code a<br>
>> > function<br>
>> > similar to the old getParticlesLoc() of the effect module.<br>
>> ><br>
>> > Can somebody tell me how to get the particles location and hair<br>
>> segments<br>
>> > ?<br>
>> ><br>
>> > I've tried to look at the "draw_object.c", but it's hard to<br>
>> understand.<br>
>> ><br>
>> > Hair drawing seems to use the particle cache, and particle uses a<br>
>> > function<br>
>> > to retrieve the location.<br>
>> ><br>
>> > Last question : Are you interested to integate it in the SVN ?<br>
>> ><br>
>> > Cheers.<br>
>> ><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>
>><br>
><br>
><br>
><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.