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/gen_utils.h
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/gen_utils.h')
-rw-r--r--source/blender/python/api2_2x/gen_utils.h50
1 files changed, 49 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/gen_utils.h b/source/blender/python/api2_2x/gen_utils.h
index f464e626390..2ad7a9843d9 100644
--- a/source/blender/python/api2_2x/gen_utils.h
+++ b/source/blender/python/api2_2x/gen_utils.h
@@ -159,5 +159,53 @@ void EXPP_allqueue(unsigned short event, short val);
/* helper to keep dictionaries from causing memory leaks */
int EXPP_dict_set_item_str( PyObject *dict, char *key, PyObject *value);
-#endif /* EXPP_gen_utils_h */
+
+
+
+/* Dummy struct for getting the ID from a libdata BPyObject */
+typedef struct {
+ PyObject_HEAD /* required python macro */
+ ID *id;
+} BPy_GenericLib;
+
+
+
+/* ID functions for all libdata */
+#define GENERIC_LIB_GETSETATTR \
+ {"name",\
+ (getter)GenericLib_getName, (setter)GenericLib_setName,\
+ "name",\
+ NULL},\
+ {"lib",\
+ (getter)GenericLib_getLib, (setter)NULL,\
+ "external library path",\
+ NULL},\
+ {"users",\
+ (getter)GenericLib_getUsers, (setter)NULL,\
+ "user count",\
+ NULL},\
+ {"fakeUser",\
+ (getter)GenericLib_getFakeUser, (setter)GenericLib_setFakeUser,\
+ "fake user state",\
+ NULL},\
+ {"properties",\
+ (getter)GenericLib_getProperties, (setter)NULL,\
+ "properties",\
+ NULL}
+
+
+
+
+int GenericLib_setName( void *self, PyObject *value );
+PyObject *GenericLib_getName( void *self );
+PyObject *GenericLib_getFakeUser( void *self );
+int GenericLib_setFakeUser( void *self, PyObject *value );
+PyObject *GenericLib_getLib( void *self );
+PyObject *GenericLib_getUsers( void *self );
+PyObject *GenericLib_getProperties( void *self );
+
+/* use this for oldstyle somedata.getName("name") */
+PyObject * GenericLib_setName_with_method( void *self, PyObject *value );
+
+#endif /* EXPP_gen_utils_h */