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:
-rwxr-xr-xsource/blender/python/api2_2x/Group.c42
-rw-r--r--source/blender/python/api2_2x/doc/Group.py1
2 files changed, 42 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Group.c b/source/blender/python/api2_2x/Group.c
index 2512d573661..71d41ef2ee3 100755
--- a/source/blender/python/api2_2x/Group.c
+++ b/source/blender/python/api2_2x/Group.c
@@ -253,6 +253,43 @@ static PyObject *Group_getUsers( BPy_Group * self )
return PyInt_FromLong( self->group->id.us );
}
+
+
+
+
+
+
+
+/*****************************************************************************/
+/* Python BPy_Group methods: */
+/*****************************************************************************/
+static int Group_setLayers( BPy_Group * self, PyObject * value )
+{
+ unsigned int laymask = 0;
+
+ GROUP_DEL_CHECK_INT(self);
+
+ if( !PyInt_CheckExact( value ) )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected an integer (bitmask) as argument" );
+
+ laymask = ( unsigned int )PyInt_AS_LONG( value );
+
+ if( laymask <= 0 )
+ return EXPP_ReturnIntError( PyExc_ValueError,
+ "layer value cannot be zero or below" );
+
+ self->group->layer= laymask & ((1<<20) - 1);
+
+ return 0;
+}
+
+static PyObject *Group_getLayers( BPy_Group * self )
+{
+ return PyInt_FromLong( self->group->layer );
+}
+
+
/*****************************************************************************/
/* Python attributes get/set structure: */
/*****************************************************************************/
@@ -265,6 +302,10 @@ static PyGetSetDef BPy_Group_getseters[] = {
(getter)Group_getUsers, (setter)NULL,
"Number of group users",
NULL},
+ {"layers",
+ (getter)Group_getLayers, (setter)Group_setLayers,
+ "Number of group users",
+ NULL},
{"objects",
(getter)Group_getObjects, (setter)Group_setObjects,
"objects in this group",
@@ -728,7 +769,6 @@ static PyObject *GroupObSeq_add( BPy_GroupObSeq * self, PyObject *args )
{
PyObject *pyobj;
Object *blen_ob;
- Base *base= NULL;
GROUP_DEL_CHECK_PY(self->bpygroup);
diff --git a/source/blender/python/api2_2x/doc/Group.py b/source/blender/python/api2_2x/doc/Group.py
index af712f40d8b..22fdf47ef31 100644
--- a/source/blender/python/api2_2x/doc/Group.py
+++ b/source/blender/python/api2_2x/doc/Group.py
@@ -92,6 +92,7 @@ class Group:
This object gives access to Groups in Blender.
@ivar name: The name of this Group object.
@ivar users: Number of users this group has (read only)
+ @ivar layers: Layer mask for this group.
@ivar objects: Objects that this group uses.
This is an iterator with list like access so use list(gp.objects) if you need to use a list. (where gp is a group object).
The groups objects can be set by assigning a list or iterator of objects to the groups objects.