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
path: root/source
diff options
context:
space:
mode:
authorWillian Padovani Germano <wpgermano@gmail.com>2005-05-27 09:39:41 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2005-05-27 09:39:41 +0400
commit7625378e6daa5304d1faac62d8ea16ecb021ff1f (patch)
tree5726366a45031295e8982ed06e681b203e820370 /source
parent53082cf0f150eb9c815027cf316922df11fce352 (diff)
BPython:
- Fix for bug #2621 reported by Yann Cointepas (material.setMode didn't accept integer param, only strings, making it inconsistent with material.getMode): http://projects.blender.org/tracker/index.php?func=detail&aid=2621&group_id=9&atid=125 Applied patch #2626 by Ken Hughes to both Material.c and doc (Material.py): http://projects.blender.org/tracker/index.php?func=detail&aid=2626&group_id=9&atid=127 - Small C doc strings update I forgot to add before, for Render slinks (reminder about Render slinks docs also by Ken). Thanks both -- btw, Ken Hughes has contributed considerably improving bpy documentation and fixing bugs for this release.
Diffstat (limited to 'source')
-rw-r--r--source/blender/python/api2_2x/Camera.c4
-rw-r--r--source/blender/python/api2_2x/Lamp.c4
-rw-r--r--source/blender/python/api2_2x/Material.c162
-rw-r--r--source/blender/python/api2_2x/Object.c4
-rw-r--r--source/blender/python/api2_2x/Scene.c4
-rw-r--r--source/blender/python/api2_2x/World.c4
-rw-r--r--source/blender/python/api2_2x/doc/Material.py29
7 files changed, 122 insertions, 89 deletions
diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c
index b3e71fdda17..ecf9ba57333 100644
--- a/source/blender/python/api2_2x/Camera.c
+++ b/source/blender/python/api2_2x/Camera.c
@@ -180,11 +180,11 @@ static PyMethodDef BPy_Camera_methods[] = {
{"getScriptLinks", ( PyCFunction ) Camera_getScriptLinks, METH_VARARGS,
"(eventname) - Get a list of this camera's scriptlinks (Text names) "
"of the given type\n"
- "(eventname) - string: FrameChanged or Redraw."},
+ "(eventname) - string: FrameChanged, Redraw or Render."},
{"addScriptLink", ( PyCFunction ) Camera_addScriptLink, METH_VARARGS,
"(text, evt) - Add a new camera scriptlink.\n"
"(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged or Redraw."},
+ "(evt) string: FrameChanged, Redraw or Render."},
{"clearScriptLinks", ( PyCFunction ) Camera_clearScriptLinks,
METH_NOARGS,
"() - Delete all scriptlinks from this camera.\n"
diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c
index b474f7bb7b8..f3eefd8675c 100644
--- a/source/blender/python/api2_2x/Lamp.c
+++ b/source/blender/python/api2_2x/Lamp.c
@@ -298,11 +298,11 @@ static PyMethodDef BPy_Lamp_methods[] = {
{"getScriptLinks", ( PyCFunction ) Lamp_getScriptLinks, METH_VARARGS,
"(eventname) - Get a list of this lamp's scriptlinks (Text names) "
"of the given type\n"
- "(eventname) - string: FrameChanged or Redraw."},
+ "(eventname) - string: FrameChanged, Redraw or Render."},
{"addScriptLink", ( PyCFunction ) Lamp_addScriptLink, METH_VARARGS,
"(text, evt) - Add a new lamp scriptlink.\n"
"(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged or Redraw."},
+ "(evt) string: FrameChanged, Redraw or Render."},
{"clearScriptLinks", ( PyCFunction ) Lamp_clearScriptLinks,
METH_VARARGS,
"() - Delete all scriptlinks from this lamp.\n"
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index 6d40df057b1..309889f3310 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -660,11 +660,11 @@ static PyMethodDef BPy_Material_methods[] = {
METH_VARARGS,
"(eventname) - Get a list of this material's scriptlinks (Text names) "
"of the given type\n"
- "(eventname) - string: FrameChanged or Redraw."},
+ "(eventname) - string: FrameChanged, Redraw or Render."},
{"addScriptLink", ( PyCFunction ) Material_addScriptLink, METH_VARARGS,
"(text, evt) - Add a new material scriptlink.\n"
"(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged or Redraw."},
+ "(evt) string: FrameChanged, Redraw or Render."},
{"clearScriptLinks", ( PyCFunction ) Material_clearScriptLinks,
METH_VARARGS,
"() - Delete all scriptlinks from this material.\n"
@@ -1363,89 +1363,109 @@ static PyObject *Material_setName( BPy_Material * self, PyObject * args )
* haloShaded, haloFlare */
static PyObject *Material_setMode( BPy_Material * self, PyObject * args )
{
- int i, flag = 0;
+ unsigned int i, flag = 0, ok = 0;
+
char *m[28] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL
};
- if( !PyArg_ParseTuple( args, "|ssssssssssssssssssssssssssss",
+ /*
+ * check for a single integer argument; do a quick check for now
+ * that the value is not larger than double the highest flag bit
+ */
+
+ if ( (PySequence_Size( args ) == 1)
+ && PyInt_Check ( PySequence_Fast_GET_ITEM ( args , 0 ) )
+ && PyArg_ParseTuple( args, "i", &flag )
+ && flag < (EXPP_MAT_MODE_RAYMIRROR >> 1) ) {
+ ok = 1;
+
+ /*
+ * check for either an empty argument list, or up to 22 strings
+ */
+
+ } else if( PyArg_ParseTuple( args, "|ssssssssssssssssssssssssssss",
&m[0], &m[1], &m[2], &m[3], &m[4], &m[5], &m[6],
&m[7], &m[8], &m[9], &m[10], &m[11], &m[12],
&m[13], &m[14], &m[15], &m[16], &m[17], &m[18],
&m[19], &m[20], &m[21], &m[22], &m[23], &m[24],
&m[25], &m[26], &m[27] ) ) {
+ for( i = 0; i < 28; i++ ) {
+ if( m[i] == NULL )
+ break;
+ if( strcmp( m[i], "Traceable" ) == 0 )
+ flag |= EXPP_MAT_MODE_TRACEABLE;
+ else if( strcmp( m[i], "Shadow" ) == 0 )
+ flag |= EXPP_MAT_MODE_SHADOW;
+ else if( strcmp( m[i], "Shadeless" ) == 0 )
+ flag |= EXPP_MAT_MODE_SHADELESS;
+ else if( strcmp( m[i], "Wire" ) == 0 )
+ flag |= EXPP_MAT_MODE_WIRE;
+ else if( strcmp( m[i], "VColLight" ) == 0 )
+ flag |= EXPP_MAT_MODE_VCOL_LIGHT;
+ else if( strcmp( m[i], "VColPaint" ) == 0 )
+ flag |= EXPP_MAT_MODE_VCOL_PAINT;
+ else if( strcmp( m[i], "Halo" ) == 0 )
+ flag |= EXPP_MAT_MODE_HALO;
+ else if( strcmp( m[i], "ZTransp" ) == 0 )
+ flag |= EXPP_MAT_MODE_ZTRANSP;
+ else if( strcmp( m[i], "ZInvert" ) == 0 )
+ flag |= EXPP_MAT_MODE_ZINVERT;
+ else if( strcmp( m[i], "HaloRings" ) == 0 )
+ flag |= EXPP_MAT_MODE_HALORINGS;
+ else if( strcmp( m[i], "HaloLines" ) == 0 )
+ flag |= EXPP_MAT_MODE_HALOLINES;
+ else if( strcmp( m[i], "OnlyShadow" ) == 0 )
+ flag |= EXPP_MAT_MODE_ONLYSHADOW;
+ else if( strcmp( m[i], "HaloXAlpha" ) == 0 )
+ flag |= EXPP_MAT_MODE_HALOXALPHA;
+ else if( strcmp( m[i], "HaloStar" ) == 0 )
+ flag |= EXPP_MAT_MODE_HALOSTAR;
+ else if( strcmp( m[i], "TexFace" ) == 0 )
+ flag |= EXPP_MAT_MODE_TEXFACE;
+ else if( strcmp( m[i], "HaloTex" ) == 0 )
+ flag |= EXPP_MAT_MODE_HALOTEX;
+ else if( strcmp( m[i], "HaloPuno" ) == 0 )
+ flag |= EXPP_MAT_MODE_HALOPUNO;
+ else if( strcmp( m[i], "NoMist" ) == 0 )
+ flag |= EXPP_MAT_MODE_NOMIST;
+ else if( strcmp( m[i], "HaloShaded" ) == 0 )
+ flag |= EXPP_MAT_MODE_HALOSHADE;
+ else if( strcmp( m[i], "HaloFlare" ) == 0 )
+ flag |= EXPP_MAT_MODE_HALOFLARE;
+ else if( strcmp( m[i], "Radio" ) == 0 )
+ flag |= EXPP_MAT_MODE_RADIO;
+ /* ** Mirror ** */
+ else if( strcmp( m[i], "RayMirr" ) == 0 )
+ flag |= EXPP_MAT_MODE_RAYMIRROR;
+ else if( strcmp( m[i], "ZTransp" ) == 0 )
+ flag |= EXPP_MAT_MODE_ZTRA;
+ else if( strcmp( m[i], "RayTransp" ) == 0 )
+ flag |= EXPP_MAT_MODE_RAYTRANSP;
+ else if( strcmp( m[i], "OnlyShadow" ) == 0 )
+ flag |= EXPP_MAT_MODE_ONLYSHADOW;
+ else if( strcmp( m[i], "NoMist" ) == 0 )
+ flag |= EXPP_MAT_MODE_NOMIST;
+ else if( strcmp( m[i], "Env" ) == 0 )
+ flag |= EXPP_MAT_MODE_ENV;
+ /* ** */
+ else
+ return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+ "unknown Material mode argument" ) );
+ }
+ ok = 1;
+ }
+
+ /* if neither input method worked, then throw an exception */
+
+ if ( ok == 0 )
return ( EXPP_ReturnPyObjError
( PyExc_AttributeError,
- "expected from none to 22 string argument(s)" ) );
- }
+ "expected nothing, an integer or up to 22 string argument(s)" ) );
- for( i = 0; i < 28; i++ ) {
- if( m[i] == NULL )
- break;
- if( strcmp( m[i], "Traceable" ) == 0 )
- flag |= EXPP_MAT_MODE_TRACEABLE;
- else if( strcmp( m[i], "Shadow" ) == 0 )
- flag |= EXPP_MAT_MODE_SHADOW;
- else if( strcmp( m[i], "Shadeless" ) == 0 )
- flag |= EXPP_MAT_MODE_SHADELESS;
- else if( strcmp( m[i], "Wire" ) == 0 )
- flag |= EXPP_MAT_MODE_WIRE;
- else if( strcmp( m[i], "VColLight" ) == 0 )
- flag |= EXPP_MAT_MODE_VCOL_LIGHT;
- else if( strcmp( m[i], "VColPaint" ) == 0 )
- flag |= EXPP_MAT_MODE_VCOL_PAINT;
- else if( strcmp( m[i], "Halo" ) == 0 )
- flag |= EXPP_MAT_MODE_HALO;
- else if( strcmp( m[i], "ZTransp" ) == 0 )
- flag |= EXPP_MAT_MODE_ZTRANSP;
- else if( strcmp( m[i], "ZInvert" ) == 0 )
- flag |= EXPP_MAT_MODE_ZINVERT;
- else if( strcmp( m[i], "HaloRings" ) == 0 )
- flag |= EXPP_MAT_MODE_HALORINGS;
- else if( strcmp( m[i], "Env" ) == 0 )
- flag |= EXPP_MAT_MODE_ENV;
- else if( strcmp( m[i], "HaloLines" ) == 0 )
- flag |= EXPP_MAT_MODE_HALOLINES;
- else if( strcmp( m[i], "OnlyShadow" ) == 0 )
- flag |= EXPP_MAT_MODE_ONLYSHADOW;
- else if( strcmp( m[i], "HaloXAlpha" ) == 0 )
- flag |= EXPP_MAT_MODE_HALOXALPHA;
- else if( strcmp( m[i], "HaloStar" ) == 0 )
- flag |= EXPP_MAT_MODE_HALOSTAR;
- else if( strcmp( m[i], "TexFace" ) == 0 )
- flag |= EXPP_MAT_MODE_TEXFACE;
- else if( strcmp( m[i], "HaloTex" ) == 0 )
- flag |= EXPP_MAT_MODE_HALOTEX;
- else if( strcmp( m[i], "HaloPuno" ) == 0 )
- flag |= EXPP_MAT_MODE_HALOPUNO;
- else if( strcmp( m[i], "NoMist" ) == 0 )
- flag |= EXPP_MAT_MODE_NOMIST;
- else if( strcmp( m[i], "HaloShaded" ) == 0 )
- flag |= EXPP_MAT_MODE_HALOSHADE;
- else if( strcmp( m[i], "HaloFlare" ) == 0 )
- flag |= EXPP_MAT_MODE_HALOFLARE;
- else if( strcmp( m[i], "Radio" ) == 0 )
- flag |= EXPP_MAT_MODE_RADIO;
- /* ** Mirror ** */
- else if( strcmp( m[i], "RayMirr" ) == 0 )
- flag |= EXPP_MAT_MODE_RAYMIRROR;
- else if( strcmp( m[i], "ZTransp" ) == 0 )
- flag |= EXPP_MAT_MODE_ZTRA;
- else if( strcmp( m[i], "RayTransp" ) == 0 )
- flag |= EXPP_MAT_MODE_RAYTRANSP;
- else if( strcmp( m[i], "OnlyShadow" ) == 0 )
- flag |= EXPP_MAT_MODE_ONLYSHADOW;
- else if( strcmp( m[i], "NoMist" ) == 0 )
- flag |= EXPP_MAT_MODE_NOMIST;
- else if( strcmp( m[i], "Env" ) == 0 )
- flag |= EXPP_MAT_MODE_ENV;
- /* ** */
- else
- return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
- "unknown Material mode argument" ) );
- }
+ /* update the mode flag, return None */
self->material->mode = flag;
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index facd578521d..8b73189a00a 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -504,11 +504,11 @@ works only if self and the object specified are of the same type."},
{"getScriptLinks", ( PyCFunction ) Object_getScriptLinks, METH_VARARGS,
"(eventname) - Get a list of this object's scriptlinks (Text names) "
"of the given type\n"
- "(eventname) - string: FrameChanged or Redraw."},
+ "(eventname) - string: FrameChanged, Redraw or Render."},
{"addScriptLink", ( PyCFunction ) Object_addScriptLink, METH_VARARGS,
"(text, evt) - Add a new object scriptlink.\n"
"(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged or Redraw."},
+ "(evt) string: FrameChanged, Redraw or Render."},
{"clearScriptLinks", ( PyCFunction ) Object_clearScriptLinks,
METH_VARARGS,
"() - Delete all scriptlinks from this object.\n"
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c
index d4a24656bf4..4b65aa72321 100644
--- a/source/blender/python/api2_2x/Scene.c
+++ b/source/blender/python/api2_2x/Scene.c
@@ -156,11 +156,11 @@ static PyMethodDef BPy_Scene_methods[] = {
{"getScriptLinks", ( PyCFunction ) Scene_getScriptLinks, METH_VARARGS,
"(eventname) - Get a list of this scene's scriptlinks (Text names) "
"of the given type\n"
- "(eventname) - string: FrameChanged, OnLoad or Redraw."},
+ "(eventname) - string: FrameChanged, OnLoad, OnSave, Redraw or Render."},
{"addScriptLink", ( PyCFunction ) Scene_addScriptLink, METH_VARARGS,
"(text, evt) - Add a new scene scriptlink.\n"
"(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged, OnLoad or Redraw."},
+ "(evt) string: FrameChanged, OnLoad, OnSave, Redraw or Render."},
{"clearScriptLinks", ( PyCFunction ) Scene_clearScriptLinks,
METH_VARARGS,
"() - Delete all scriptlinks from this scene.\n"
diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c
index fa8b57bd809..55c0f5baf72 100644
--- a/source/blender/python/api2_2x/World.c
+++ b/source/blender/python/api2_2x/World.c
@@ -211,11 +211,11 @@ static PyMethodDef BPy_World_methods[] = {
{"getScriptLinks", ( PyCFunction ) World_getScriptLinks, METH_VARARGS,
"(eventname) - Get a list of this world's scriptlinks (Text names) "
"of the given type\n"
- "(eventname) - string: FrameChanged or Redraw."},
+ "(eventname) - string: FrameChanged, Redraw or Render."},
{"addScriptLink", ( PyCFunction ) World_addScriptLink, METH_VARARGS,
"(text, evt) - Add a new world scriptlink.\n"
"(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged or Redraw."},
+ "(evt) string: FrameChanged, Redraw or Render."},
{"clearScriptLinks", ( PyCFunction ) World_clearScriptLinks,
METH_VARARGS,
"() - Delete all scriptlinks from this world.\n"
diff --git a/source/blender/python/api2_2x/doc/Material.py b/source/blender/python/api2_2x/doc/Material.py
index 79d28b1162b..c8d85096b67 100644
--- a/source/blender/python/api2_2x/doc/Material.py
+++ b/source/blender/python/api2_2x/doc/Material.py
@@ -196,14 +196,27 @@ class Material:
print "Not a halo"
"""
- def setMode(m = None, m2 = None, m3 = None, and_so_on = None,
- up_to_21 = None):
- """
- Set this Material's mode flags. Mode strings given are turned 'on'.
- Those not provided are turned 'off', so mat.setMode() -- without
- arguments -- turns off all mode flags for Material mat.
- @type m: string
- @param m: A mode flag. From 1 to 21 can be set at the same time.
+ def setMode(param, stringN=None):
+ """
+ Set this Material's mode flags. Up to 22 mode strings can be given
+ and specify the modes which are turned 'on'. Those not provided are
+ turned 'off', so mat.setMode() -- without arguments -- turns off all
+ mode flags for Material mat. Valid mode strings are "Traceable",
+ "Shadow", "Shadeless", "Wire", "VColLight", "VColPaint", "Halo",
+ "ZTransp", "ZInvert", "HaloRings", "HaloLines", "OnlyShadow",
+ "HaloXAlpha", "HaloStar", "TexFace", "HaloTex", "HaloPuno", "NoMist",
+ "HaloShaded", "HaloFlare", "Radio", "RayMirr", "ZTransp", "RayTransp",
+ "OnlyShadow", "NoMist", "Env"
+
+ An integer can also be given, which directly sets the mode flag. The
+ Modes dictionary keys can (and should) be added or ORed to specify
+ which modes to turn 'on'. The value returned from getMode() can
+ also be modified and input to this method.
+
+ @type param: string, None or int
+ @param param: A mode value (int) or flag (string). Can also be None.
+ @type stringN: string
+ @param stringN: A mode flag. Up to 22 flags can be set at the same time.
"""
def getRGBCol():