Index: source/blender/python/api2_2x/doc/Object.py =================================================================== --- source/blender/python/api2_2x/doc/Object.py (revision 14641) +++ source/blender/python/api2_2x/doc/Object.py (working copy) @@ -641,7 +641,14 @@ @ivar upAxis: Up axis. Return string 'Y' | 'Y' | 'Z' (readonly) @type upAxis: string """ - + + def addvGroupFromArmature(object): + """ + Computes distance from the vertices to the bones of the selected armature and adds these vertices to a vertex groups in the current object. + This method can be only used with an Object of the type Mesh. + @type object: a bpy armature + """ + def buildParts(): """ Recomputes the particle system. This method only applies to an Object of Index: source/blender/python/api2_2x/Object.c =================================================================== --- source/blender/python/api2_2x/Object.c (revision 14641) +++ source/blender/python/api2_2x/Object.c (working copy) @@ -335,7 +335,7 @@ /*****************************************************************************/ static int setupSB(Object* ob); /*Make sure Softbody Pointer is initialized */ static int setupPI(Object* ob); - +static PyObject *Object_addvGroupFromArmature( BPy_Object * self, PyObject * args); static PyObject *Object_buildParts( BPy_Object * self ); static PyObject *Object_clearIpo( BPy_Object * self ); static PyObject *Object_clrParent( BPy_Object * self, PyObject * args ); @@ -465,6 +465,8 @@ /*****************************************************************************/ static PyMethodDef BPy_Object_methods[] = { /* name, method, flags, doc */ + {"addvGroupFromArmature" , ( PyCFunction ) Object_addvGroupFromArmature, METH_VARARGS, + "(add vertex group from the selected armature with heat method)"}, {"buildParts", ( PyCFunction ) Object_buildParts, METH_NOARGS, "Recalcs particle system (if any), (depricated, will always return an empty list in version 2.46)"}, {"getIpo", ( PyCFunction ) Object_getIpo, METH_NOARGS, @@ -1026,12 +1028,45 @@ /* Python BPy_Object methods: */ /*****************************************************************************/ +/*****************************************************************************/ +/* attribute: addvGroupFromArmature */ +/* Description: evaluate and add vertex groups to the current object */ +/* for each bone of the selected armature */ +/* Data: self Object, Bpy armature */ +/* Return: nothing */ +/*****************************************************************************/ +static PyObject *Object_addvGroupFromArmature( BPy_Object * self, PyObject * args) +{ + + Object *ob = self->object; + BPy_Object *arm; + + if( ob->type == OB_MESH ) + { + /* Check if the arguments passed to makeParent are valid. */ + if( !PyArg_ParseTuple( args, "O!",&Object_Type, &arm ) ) + return EXPP_ReturnPyObjError( PyExc_TypeError, + " A pyobject is expected." ); + + if( arm->object->type != OB_ARMATURE ) + return EXPP_ReturnPyObjError( PyExc_TypeError, + "an armature object is expected." ); + + add_verts_to_dgroups(ob, arm->object, 1, 0); + ob->recalc |= OB_RECALC_OB; + } + + Py_RETURN_NONE; + + } + static PyObject *Object_buildParts( BPy_Object * self ) { /* This is now handles by modifiers */ Py_RETURN_NONE; } + static PyObject *Object_clearIpo( BPy_Object * self ) { Object *ob = self->object; @@ -6008,3 +6043,4 @@ return PyString_FromString(cup); } +; \ No newline at end of file