diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2003-07-31 01:15:41 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2003-07-31 01:15:41 +0400 |
commit | fe07b232b7e7e80569733de2b42e391874de6477 (patch) | |
tree | 5c6d95e7869855163aea95d38fff9b485d5d6d12 /source/blender/python/api2_2x/Material.c | |
parent | 35c4c3222caea20d603e51191b3e85790cd76202 (diff) |
* got rid of a warning in editipo.c:
changed "get_ipo(key, ..." to "get_ipo((ID *)key, ..." in line 107.
* changed insert_meshkey(Mesh *me) to insert_meshkey(Mesh *me, short offline):
To call this function from a script, so that it doesn't pop the
"relative / absolute" dialog window when the "offline" arg is non-zero.
Exppython:
* NMesh module:
- Added method NMesh.addMaterial(mat) to the NMesh module:
alternative safer (aka slower) way to add materials.
- Added optional arg to NMesh_update():
if given and equal to 1, the mesh normals are recalculated.
- Fixed NMesh.getVertexInfluences: it was segfaulting when a NULL bone was
linked to the vertex. Thanks to Jiba on the bf-python mailing list for
bug report and sample .blend file. Also made this method give an IndexError
when the vertex index is out of range.
* Material module:
Added specR, specG, specB vars for compatibility with the 2.25 API.
Pointed by Manuel Bastioni.
* Image module:
Exposed image width, height and depth parameters.
From a suggestion by jms.
* BPython Ref Doc:
- Small updates to reflect the above additions.
- Added info for the Bone type in the Armature doc.
Diffstat (limited to 'source/blender/python/api2_2x/Material.c')
-rw-r--r-- | source/blender/python/api2_2x/Material.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c index ee66097994f..f51fd7c4b32 100644 --- a/source/blender/python/api2_2x/Material.c +++ b/source/blender/python/api2_2x/Material.c @@ -584,6 +584,16 @@ int Material_CheckPyObject (PyObject *pyobj) } /*****************************************************************************/ +/* Function: Material_FromPyObject */ +/* Description: This function returns the Blender material from the given */ +/* PyObject. */ +/*****************************************************************************/ +Material *Material_FromPyObject (PyObject *pyobj) +{ + return ((BPy_Material *)pyobj)->material; +} + +/*****************************************************************************/ /* 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 */ @@ -988,6 +998,12 @@ static PyObject *Material_setColorComponent(BPy_Material *self, char *key, self->material->g = value; else if (!strcmp(key, "B")) self->material->b = value; + else if (!strcmp(key, "specR")) + self->material->specr = value; + else if (!strcmp(key, "specG")) + self->material->specg = value; + else if (!strcmp(key, "specB")) + self->material->specb = value; return EXPP_incr_ret (Py_None); } @@ -1287,6 +1303,12 @@ static PyObject *Material_getAttr (BPy_Material *self, char *name) attr = PyFloat_FromDouble((double)self->material->g); else if (strcmp(name, "B") == 0) attr = PyFloat_FromDouble((double)self->material->b); + else if (strcmp(name, "specR") == 0) + attr = PyFloat_FromDouble((double)self->material->specr); + else if (strcmp(name, "specG") == 0) + attr = PyFloat_FromDouble((double)self->material->specg); + else if (strcmp(name, "specB") == 0) + attr = PyFloat_FromDouble((double)self->material->specb); else if (strcmp(name, "amb") == 0) attr = PyFloat_FromDouble((double)self->material->amb); else if (strcmp(name, "emit") == 0) @@ -1389,6 +1411,12 @@ static int Material_setAttr (BPy_Material *self, char *name, PyObject *value) error = Material_setColorComponent (self, "G", valtuple); else if (strcmp (name, "B") == 0) error = Material_setColorComponent (self, "B", valtuple); + else if (strcmp (name, "specR") == 0) + error = Material_setColorComponent (self, "specR", valtuple); + else if (strcmp (name, "specG") == 0) + error = Material_setColorComponent (self, "specG", valtuple); + else if (strcmp (name, "specB") == 0) + error = Material_setColorComponent (self, "specB", valtuple); else if (strcmp (name, "amb") == 0) error = Material_setAmb (self, valtuple); else if (strcmp (name, "emit") == 0) |