[Bf-python] Effect module : New function modified
Austin Benesh
bfdeveloper at gmail.com
Mon Oct 31 01:09:21 CET 2005
jean-michel soler wrote:
> Hi,
> the Effect.New function return currently (2.40alpha) None .
> But it could return a particule effect, and, in the same time, add
> this effect to a mesh object pointed by its name .
>
> /*****************************************************************************/
>
> /* Function:
> M_Effect_New */
> /* Python equivalent:
> Blender.Effect.New */
> /* args : string, mesh object
> name */
> /* in : create and add a new particule effect to the given
> mesh */
> /* return : an particule
> effect */
> /*****************************************************************************/
>
> PyObject *M_Effect_New( PyObject * self, PyObject * args )
> {
> void BLI_addtail(struct ListBase *listbase, void *vlink);
> struct Effect *add_effect(int type);
>
> Object *ob;
>
> BPy_Effect *pyeffect;
> Effect *bleffect = 0;
> int type = -1;
> char *name = NULL;
>
> /*Py_INCREF( Py_None );
> return Py_None;*/
>
> if( !PyArg_ParseTuple( args, "s", &name ) )
> return ( EXPP_ReturnPyObjError( PyExc_TypeError,
> "expected string : mesh object name )" ) );
> bleffect = add_effect( EFF_PARTICLE );
> if( bleffect == NULL )
> return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
> "couldn't create Effect Data in Blender" ) );
>
> ob = G.main->object.first;
> while( ob ) {
> if( !strcmp( name, ob->id.name + 2 ) ) {
> if( ob->type != OB_MESH )
> return ( EXPP_ReturnPyObjError( PyExc_TypeError,
> "couldn't create a particule effect on object of
> this kind . Use an object mesh's name " ) );
> BLI_addtail(&ob->effect, bleffect);
> }
> ob = ob->id.next;
> }
>
> pyeffect = ( BPy_Effect * ) PyObject_NEW( BPy_Effect, &Effect_Type );
>
> if( pyeffect == NULL )
> return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
> "couldn't create Effect Data object" ) );
>
> pyeffect->effect = bleffect;
>
> return ( PyObject * ) pyeffect;
> }
>
> best regards ,
> jm
>
>
>
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
>
Hi Jean-Michel!
It's very good that you are making patches for the source; however, you
should submit them to the patch tracker at projects.blender.org. Many
people search through the patches daily and all patches are considered
there. Thanks for being involved in Blender! :)
More information about the Bf-python
mailing list