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-17 01:04:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2006-12-17 01:04:21 +0300
commita9447e4273c240151f9453a34c0ead0070628da6 (patch)
treea858d71cee651eb375ae6285c48da095a90ea36c /source/blender/python/api2_2x/Material.c
parentdfb811d73d382156d8d7bb139087b61eeb38d5b7 (diff)
Enable/Disable DupFaces from the Python API.
Fixed a (own) bug in fakeUsers and added fakeUsers to Objects and Materials as well as Mesh.
Diffstat (limited to 'source/blender/python/api2_2x/Material.c')
-rw-r--r--source/blender/python/api2_2x/Material.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index 91dc6bbb1be..d52f5caf949 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -527,12 +527,14 @@ static int Material_setRefracIndex( BPy_Material * self, PyObject * value );
static int Material_setRms( BPy_Material * self, PyObject * value );
static int Material_setFilter( BPy_Material * self, PyObject * value );
static int Material_setTranslucency( BPy_Material * self, PyObject * value );
+static int Material_setFakeUser( BPy_Material * self, PyObject * value );
static PyObject *Material_getColorComponent( BPy_Material * self,
void * closure );
static PyObject *Material_getOopsLoc( BPy_Material * self );
static PyObject *Material_getOopsSel( BPy_Material * self );
static PyObject *Material_getUsers( BPy_Material * self );
+static PyObject *Material_getFakeUser( BPy_Material * self );
/*static int Material_setSeptex( BPy_Material * self, PyObject * value );
static PyObject *Material_getSeptex( BPy_Material * self );*/
@@ -1086,6 +1088,10 @@ static PyGetSetDef BPy_Material_getseters[] = {
(getter)Material_getUsers, (setter)NULL,
"Number of material users",
NULL},
+ {"fakeUser",
+ (getter)Material_getFakeUser, (setter)Material_setFakeUser,
+ "The fake user status of this material",
+ NULL},
{"properties", (getter) Material_getProperties, (setter)NULL,
"Get material's ID properties"},
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
@@ -2853,6 +2859,39 @@ static PyObject *Material_getUsers( BPy_Material * self )
return PyInt_FromLong( self->material->id.us );
}
+static PyObject *Material_getFakeUser( BPy_Material * self )
+{
+ if (self->material->id.flag & LIB_FAKEUSER)
+ Py_RETURN_TRUE;
+ else
+ Py_RETURN_FALSE;
+}
+
+static int Material_setFakeUser( BPy_Material * self, PyObject * value )
+{
+ int param;
+ ID *id = &self->material->id;
+ param = PyObject_IsTrue( value );
+
+ if( param == -1 )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected int argument in range [0,1]" );
+
+ if (param) {
+ if (!(id->flag & LIB_FAKEUSER)) {
+ id->flag |= LIB_FAKEUSER;
+ id_us_plus(id);
+ }
+ } else {
+ if (id->flag & LIB_FAKEUSER) {
+ id->flag &= ~LIB_FAKEUSER;
+ id->us--;
+ }
+ }
+ return 0;
+}
+
+
/* #####DEPRECATED###### */
static PyObject *Matr_oldsetAdd( BPy_Material * self, PyObject * args )