diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-06-16 16:24:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-06-16 16:24:41 +0400 |
commit | 39a526a963e9e0a0f206556a8b740fab56ba2654 (patch) | |
tree | 69290c8f2186c5dbc4673da0a6de60a874e18ab2 /source/blender/python/api2_2x/Group.c | |
parent | 5135ed7b0e5c09c77a54e4359d7ff0b92003f4f0 (diff) |
Python PyMethodDef supports single argument methods (METH_O) but was using METH_VARARGS everywhere and getting the single args from the tuple.
Use METH_O where applicable.
Diffstat (limited to 'source/blender/python/api2_2x/Group.c')
-rwxr-xr-x | source/blender/python/api2_2x/Group.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/source/blender/python/api2_2x/Group.c b/source/blender/python/api2_2x/Group.c index 7a6a1562d8b..012e0cb540c 100755 --- a/source/blender/python/api2_2x/Group.c +++ b/source/blender/python/api2_2x/Group.c @@ -58,7 +58,7 @@ /*****************************************************************************/ static PyObject *M_Group_New( PyObject * self, PyObject * args ); PyObject *M_Group_Get( PyObject * self, PyObject * args ); -PyObject *M_Group_Unlink( PyObject * self, PyObject * args ); +PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp ); /* internal */ static PyObject *GroupObSeq_CreatePyObject( BPy_Group *self, GroupObject *iter ); @@ -72,7 +72,7 @@ struct PyMethodDef M_Group_methods[] = { {"Get", ( PyCFunction ) M_Group_Get, METH_VARARGS, "(name) - return the group with the name 'name',\ returns None if notfound.\nIf 'name' is not specified, it returns a list of all groups."}, - {"Unlink", ( PyCFunction ) M_Group_Unlink, METH_VARARGS, + {"Unlink", ( PyCFunction ) M_Group_Unlink, METH_O, "(group) - Unlink (delete) this group from Blender."}, {NULL, NULL, 0, NULL} }; @@ -447,17 +447,13 @@ PyObject *M_Group_Get( PyObject * self, PyObject * args ) /* Function: M_Group_Unlink */ /* Python equivalent: Blender.Group.Unlink */ /*****************************************************************************/ -PyObject *M_Group_Unlink( PyObject * self, PyObject * args ) +PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp ) { - PyObject *pyob=NULL; - BPy_Group *pygrp=NULL; Group *group; - if( !PyArg_ParseTuple( args, "O!", &Group_Type, &pyob) ) + if( !BPy_Group_Check(pygrp) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected a group" ) ); - pygrp= (BPy_Group *)pyob; - GROUP_DEL_CHECK_PY(pygrp); group= pygrp->group; @@ -661,14 +657,13 @@ static PyObject *GroupObSeq_nextIter( BPy_GroupObSeq * self ) } -static PyObject *GroupObSeq_link( BPy_GroupObSeq * self, PyObject *args ) +static PyObject *GroupObSeq_link( BPy_GroupObSeq * self, BPy_Object *value ) { - PyObject *pyobj; Object *blen_ob; GROUP_DEL_CHECK_PY(self->bpygroup); - if( !PyArg_ParseTuple( args, "O!", &Object_Type, &pyobj ) ) + if( !BPy_Object_Check(value) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected a python object as an argument" ) ); @@ -678,26 +673,25 @@ static PyObject *GroupObSeq_link( BPy_GroupObSeq * self, PyObject *args ) "Cannot modify group objects while iterating" ); */ - blen_ob = ( ( BPy_Object * ) pyobj )->object; + blen_ob = value->object; add_to_group_wraper(self->bpygroup->group, blen_ob); /* this checks so as not to add the object into the group twice*/ Py_RETURN_NONE; } -static PyObject *GroupObSeq_unlink( BPy_GroupObSeq * self, PyObject *args ) +static PyObject *GroupObSeq_unlink( BPy_GroupObSeq * self, BPy_Object *value ) { - PyObject *pyobj; Object *blen_ob; Base *base= NULL; GROUP_DEL_CHECK_PY(self->bpygroup); - if( !PyArg_ParseTuple( args, "O!", &Object_Type, &pyobj ) ) + if( !BPy_Object_Check(value) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected a python object as an argument" ) ); - blen_ob = ( ( BPy_Object * ) pyobj )->object; + blen_ob = value->object; @@ -714,9 +708,9 @@ static PyObject *GroupObSeq_unlink( BPy_GroupObSeq * self, PyObject *args ) } static struct PyMethodDef BPy_GroupObSeq_methods[] = { - {"link", (PyCFunction)GroupObSeq_link, METH_VARARGS, + {"link", (PyCFunction)GroupObSeq_link, METH_O, "make the object a part of this group"}, - {"unlink", (PyCFunction)GroupObSeq_unlink, METH_VARARGS, + {"unlink", (PyCFunction)GroupObSeq_unlink, METH_O, "unlink an object from this group"}, {NULL, NULL, 0, NULL} }; |