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>2007-02-25 10:36:50 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-02-25 10:36:50 +0300
commit436e1697fdf07f5a17bcfbdde8b18e89e44e9cf1 (patch)
tree6e7695edfd05e95a01d4772f24afb84303a8ee0e /source/blender/python/api2_2x/Group.c
parente64b887fad611917916b2ce30bbcf2aa55593ea5 (diff)
made attributes (name, property, users, fakeUser, lib) into functions all python types can use.
removed a lot of code duplication when moving to this. Also removed unused functions GetMaterialByName(), same for Mesh, Object, World etc.
Diffstat (limited to 'source/blender/python/api2_2x/Group.c')
-rwxr-xr-xsource/blender/python/api2_2x/Group.c116
1 files changed, 3 insertions, 113 deletions
diff --git a/source/blender/python/api2_2x/Group.c b/source/blender/python/api2_2x/Group.c
index 413f069305f..79ecf99b86d 100755
--- a/source/blender/python/api2_2x/Group.c
+++ b/source/blender/python/api2_2x/Group.c
@@ -212,75 +212,7 @@ static PyObject *Group_repr( BPy_Group * obj );
static int Group_compare( BPy_Group * a, BPy_Group * b );
/*****************************************************************************/
-/* Python BPy_Group methods: */
-/*****************************************************************************/
-static PyObject *Group_getName( BPy_Group * self )
-{
- PyObject *attr;
- GROUP_DEL_CHECK_PY(self);
-
- attr = PyString_FromString( self->group->id.name + 2 );
-
- if( attr )
- return attr;
-
- return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "couldn't get Group.name attribute" ) );
-}
-
-static int Group_setName( BPy_Group * self, PyObject * value )
-{
- char *name = NULL;
-
- GROUP_DEL_CHECK_INT(self);
-
- name = PyString_AsString ( value );
- if( !name )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected string argument" );
-
- rename_id( &self->group->id, name );
-
- return 0;
-}
-
-static PyObject *Group_getLib( BPy_Group * self )
-{
- GROUP_DEL_CHECK_PY(self);
- return EXPP_GetIdLib((ID *)self->group);
-
-}
-
-static PyObject *Group_getUsers( BPy_Group * self )
-{
- GROUP_DEL_CHECK_PY(self);
- return PyInt_FromLong( self->group->id.us );
-}
-
-static PyObject *Group_getFakeUser( BPy_Group * self )
-{
- GROUP_DEL_CHECK_PY(self);
- if (self->group->id.flag & LIB_FAKEUSER)
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
-}
-
-static int Group_setFakeUser( BPy_Group * self, PyObject * value )
-{
- GROUP_DEL_CHECK_INT(self);
- return SetIdFakeUser(&self->group->id, value);
-}
-
-static PyObject *Group_getProperties( BPy_Group * self )
-{
- /*sanity check, we set parent property type to Group here*/
- return BPy_Wrap_IDProperty( (ID*)self->group, IDP_GetProperties((ID*)self->group, 1), NULL );
-}
-
-
-/*****************************************************************************/
-/* Python BPy_Group methods: */
+/* Python BPy_Group getsetattr funcs: */
/*****************************************************************************/
static int Group_setLayers( BPy_Group * self, PyObject * value )
{
@@ -313,28 +245,10 @@ static PyObject *Group_getLayers( BPy_Group * self )
/* Python attributes get/set structure: */
/*****************************************************************************/
static PyGetSetDef BPy_Group_getseters[] = {
- {"name",
- (getter)Group_getName, (setter)Group_setName,
- "Group name",
- NULL},
- {"lib",
- (getter)Group_getLib, (setter)NULL,
- "Group linked library",
- NULL},
- {"users",
- (getter)Group_getUsers, (setter)NULL,
- "Number of group users",
- NULL},
- {"fakeUser",
- (getter)Group_getFakeUser, (setter)Group_setFakeUser,
- "Groups fake user state",
- NULL},
- {"properties",
- (getter)Group_getProperties, NULL,
- "get the ID properties associated with this group"},
+ GENERIC_LIB_GETSETATTR,
{"layers",
(getter)Group_getLayers, (setter)Group_setLayers,
- "Number of group users",
+ "layer mask for this group",
NULL},
{"objects",
(getter)Group_getObjects, (setter)Group_setObjects,
@@ -630,30 +544,6 @@ Group *Group_FromPyObject( PyObject * py_grp )
}
/*****************************************************************************/
-/* Description: Returns the object with the name specified by the argument */
-/* name. Note that the calling function has to remove the first */
-/* two characters of the object name. These two characters */
-/* specify the type of the object (OB, ME, WO, ...) */
-/* The function will return NULL when no object with the given */
-/* name is found. */
-/*****************************************************************************/
-Group *GetGroupByName( char *name )
-{
- Group *grp_iter;
-
- grp_iter = G.main->group.first;
- while( grp_iter ) {
- if( StringEqual( name, GetIdName( &( grp_iter->id ) ) ) ) {
- return ( grp_iter );
- }
- grp_iter = grp_iter->id.next;
- }
-
- /* There is no object with the given name */
- return ( NULL );
-}
-
-/*****************************************************************************/
/* Function: Group_dealloc */
/* Description: This is a callback function for the BlenObject type. It is */
/* the destructor function. */