Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2006-12-11 06:23:17 +0300
committerCampbell Barton <ideasman42@gmail.com>2006-12-11 06:23:17 +0300
commitb69fdd21ba10194735f2526390077384bae54eba (patch)
tree87095d2c8eae1ba98e1d96b0eaf010731e0ceb70 /source/blender/python/api2_2x/Group.c
parentc4a15783ae9630c1ce5758a6e50721e8f306c873 (diff)
renamed objects.add() and .remove() to .link() and .unlink() for scene and group objects to be less pythonic and more like blender.
for scn.objects.new() a optional second argument can be used to spesify the name. We still need a way to add a new Empty (some constant)
Diffstat (limited to 'source/blender/python/api2_2x/Group.c')
-rwxr-xr-xsource/blender/python/api2_2x/Group.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/python/api2_2x/Group.c b/source/blender/python/api2_2x/Group.c
index 71d41ef2ee3..f9e01b85f04 100755
--- a/source/blender/python/api2_2x/Group.c
+++ b/source/blender/python/api2_2x/Group.c
@@ -755,9 +755,11 @@ static PyObject *GroupObSeq_getIter( BPy_GroupObSeq * self )
static PyObject *GroupObSeq_nextIter( BPy_GroupObSeq * self )
{
PyObject *object;
- if( !(self->iter) || !(self->bpygroup->group) )
+ if( !(self->iter) || !(self->bpygroup->group) ) {
+ self->iter = NULL; /* so we can add objects again */
return EXPP_ReturnPyObjError( PyExc_StopIteration,
"iterator at end" );
+ }
object= Object_CreatePyObject( self->iter->ob );
self->iter= self->iter->next;
@@ -765,7 +767,7 @@ static PyObject *GroupObSeq_nextIter( BPy_GroupObSeq * self )
}
-static PyObject *GroupObSeq_add( BPy_GroupObSeq * self, PyObject *args )
+static PyObject *GroupObSeq_link( BPy_GroupObSeq * self, PyObject *args )
{
PyObject *pyobj;
Object *blen_ob;
@@ -776,6 +778,12 @@ static PyObject *GroupObSeq_add( BPy_GroupObSeq * self, PyObject *args )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a python object as an argument" ) );
+ /*
+ if (self->iter != NULL)
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "Cannot modify group objects while iterating" );
+ */
+
blen_ob = ( ( BPy_Object * ) pyobj )->object;
add_to_group_wraper(self->bpygroup->group, blen_ob); /* this checks so as not to add the object into the group twice*/
@@ -785,7 +793,7 @@ static PyObject *GroupObSeq_add( BPy_GroupObSeq * self, PyObject *args )
-static PyObject *GroupObSeq_remove( BPy_GroupObSeq * self, PyObject *args )
+static PyObject *GroupObSeq_unlink( BPy_GroupObSeq * self, PyObject *args )
{
PyObject *pyobj;
Object *blen_ob;
@@ -815,10 +823,10 @@ static PyObject *GroupObSeq_remove( BPy_GroupObSeq * self, PyObject *args )
static struct PyMethodDef BPy_GroupObSeq_methods[] = {
- {"add", (PyCFunction)GroupObSeq_add, METH_VARARGS,
- "add object to group"},
- {"remove", (PyCFunction)GroupObSeq_remove, METH_VARARGS,
- "remove object from group"},
+ {"link", (PyCFunction)GroupObSeq_link, METH_VARARGS,
+ "make the object a part of this group"},
+ {"remove", (PyCFunction)GroupObSeq_unlink, METH_VARARGS,
+ "remove object from this group"},
{NULL, NULL, 0, NULL}
};