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:
authorJoseph Eagar <joeedh@gmail.com>2006-11-17 07:46:48 +0300
committerJoseph Eagar <joeedh@gmail.com>2006-11-17 07:46:48 +0300
commit8768707610fbc1cea2bde069cdfd6d3f3e2fc522 (patch)
treefb8347ad36f60dede2883b587688184c3631cbcc /source/blender/python/api2_2x/Material.c
parent24f4440d05aa626f35c27758698af396ea94ff76 (diff)
=ID Properties=
This commit adds supports for per-ID properties to blender. See http://mediawiki.blender.org/index.php/BlenderDev/ID_Property for more information on how it all works. ID properties are accesable by python; but note that bindings have only been added to Object and Material thus far. However adding more bindings is easy and I plan on adding several more hopefully within an hour of this inital commit. A generic UI panel is also planned, that will go wherever its needed; for example in the material buttons, editing buttons, etc. I'll likely submit the initial code for that as a patch, though, so matt and ton and others can go over it and make sure it's all good. :) VERY important, if you intend to use ID properties please go to http://mediawiki.blender.org/index.php/BlenderDev/PropertyStandards and start writing the appropriate standards for it.
Diffstat (limited to 'source/blender/python/api2_2x/Material.c')
-rw-r--r--source/blender/python/api2_2x/Material.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index 74c93c47604..ae8eba049bb 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -41,6 +41,7 @@
#include "BKE_library.h"
#include "BKE_material.h"
#include "BKE_texture.h"
+#include "BKE_idprop.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BSE_editipo.h"
@@ -52,6 +53,7 @@
#include "Ipo.h"
#include "Group.h"
#include "gen_utils.h"
+#include "IDProp.h"
/*****************************************************************************/
/* Python BPy_Material defaults: */
@@ -602,6 +604,7 @@ static PyObject *Material_clearScriptLinks(BPy_Material *self, PyObject *args);
static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args );
static PyObject *Material_copy( BPy_Material * self );
+static PyObject *Material_getProperties( BPy_Material * self );
/*****************************************************************************/
@@ -609,6 +612,8 @@ static PyObject *Material_copy( BPy_Material * self );
/*****************************************************************************/
static PyMethodDef BPy_Material_methods[] = {
/* name, method, flags, doc */
+ {"getProperties", ( PyCFunction) Material_getProperties, METH_NOARGS,
+ "() Return Material's ID Properties"},
{"getName", ( PyCFunction ) Material_getName, METH_NOARGS,
"() - Return Material's name"},
{"getIpo", ( PyCFunction ) Material_getIpo, METH_NOARGS,
@@ -1080,6 +1085,8 @@ static PyGetSetDef BPy_Material_getseters[] = {
(getter)Material_getUsers, (setter)NULL,
"Number of material users",
NULL},
+ {"properties", (getter) Material_getProperties, (setter)NULL,
+ "Get material's ID properties"},
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
};
@@ -1280,6 +1287,12 @@ Material *GetMaterialByName( char *name )
/* Python BPy_Material methods: */
/*****************************************************************************/
+static PyObject *Material_getProperties( BPy_Material * self )
+{
+ /*sanity check, we set parent property type to Group here*/
+ return BPy_Wrap_IDProperty((ID*)self->material, IDP_GetProperties((ID*)self->material, 1));
+}
+
static PyObject *Material_getIpo( BPy_Material * self )
{
Ipo *ipo = self->material->ipo;