Blender.Particle.New() wasnt documented.

Changed to accept Object as well as Object name to avoid name collisions with libraries.
This commit is contained in:
Campbell Barton 2009-06-06 04:56:22 +00:00
parent b6ea6d65c6
commit 99c0f8dcc0
2 changed files with 25 additions and 16 deletions

@ -57,7 +57,7 @@
/* Type Methods */
static PyObject *M_ParticleSys_New( PyObject * self, PyObject * args );
static PyObject *M_ParticleSys_New( PyObject * self, PyObject * value );
static PyObject *M_ParticleSys_Get( PyObject * self, PyObject * args );
/* Particle Methods */
@ -646,7 +646,7 @@ static PyGetSetDef BPy_ParticleSys_getseters[] = {
/* Python method structure definition for Blender.Particle module: */
/*****************************************************************************/
static struct PyMethodDef M_ParticleSys_methods[] = {
{"New", ( PyCFunction ) M_ParticleSys_New, METH_VARARGS, M_ParticleSys_New_doc},
{"New", ( PyCFunction ) M_ParticleSys_New, METH_O, M_ParticleSys_New_doc},
{"Get", M_ParticleSys_Get, METH_VARARGS, M_ParticleSys_Get_doc},
{NULL, NULL, 0, NULL}
};
@ -779,27 +779,27 @@ PyObject *ParticleSys_CreatePyObject( ParticleSystem * psystem, Object *ob )
}
PyObject *M_ParticleSys_New( PyObject * self, PyObject * args ){
PyObject *M_ParticleSys_New( PyObject * self, PyObject * value)
{
ParticleSystem *psys = 0;
ParticleSystem *rpsys = 0;
ModifierData *md;
ParticleSystemModifierData *psmd;
Object *ob = NULL;
char *name = NULL;
ID *id;
int nr;
if( !PyArg_ParseTuple( args, "s", &name ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected string argument" );
for( ob = G.main->object.first; ob; ob = ob->id.next )
if( !strcmp( name, ob->id.name + 2 ) )
break;
if( !ob )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"object does not exist" );
if ( PyString_Check( value ) ) {
char *name;
name = PyString_AsString ( value );
ob = ( Object * ) GetIdFromList( &( G.main->object ), name );
if( !ob )
return EXPP_ReturnPyObjError( PyExc_AttributeError, name );
} else if ( BPy_Object_Check(value) ) {
ob = (( BPy_Object * ) value)->object;
} else {
return EXPP_ReturnPyObjError( PyExc_TypeError, "expected object or string" );
}
id = (ID *)psys_new_settings("PSys", G.main);

@ -88,6 +88,15 @@ This module provides access to the B{Particle} in Blender.
- Z: set Z axis for offset
"""
def New(object):
"""
Create a new particle system applied to L{object}
@type object: string or L{Blender.Object.Object}
@param name: The name of an existing object.
@rtype: L{Particle}
@return: a new Particle system.
"""
class Particle:
"""
The Particle object