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:
authorWillian Padovani Germano <wpgermano@gmail.com>2005-02-09 08:19:24 +0300
committerWillian Padovani Germano <wpgermano@gmail.com>2005-02-09 08:19:24 +0300
commit05bf482f6a50bd711fc6bb7ad986919741d478ae (patch)
tree92954a8c8840ff02afec41a7b728f549dc5de6a6
parent955d5aa6eb1a2d3763fd6e3d98e10357cf58fd03 (diff)
BPython:
- NMesh: made nmesh.update accept an optional 'vertex_shade' param to init vcols with shading info, like when you enter vpaint mode or press the relevant "make" button for a mesh without vcols. This is still a test, the functionality was requested by Manuel Bastioni for the SSS script they are working on: http://www.dedalo-3d.com/index.php?filename=SXCOL/makehuman/articles/subsurface_scattering_in_python.html - sys: made makename() accept files with max FILE_MAXDIR+FILE_MAXFILE name length, should fix #2192. Was only FILE_MAXFILE, a mistake; - Image: added .setFilename(), contributed by Campbell Barton; - Camera: added camera.get/setScale for the new param added by Ton for ortho cameras. Requested by Jean-Michel Soler for the Texture Baker script; - related doc updates.
-rw-r--r--source/blender/python/api2_2x/Camera.c47
-rw-r--r--source/blender/python/api2_2x/Camera.h2
-rw-r--r--source/blender/python/api2_2x/Image.c22
-rw-r--r--source/blender/python/api2_2x/NMesh.c66
-rw-r--r--source/blender/python/api2_2x/NMesh.h8
-rw-r--r--source/blender/python/api2_2x/Object.c14
-rw-r--r--source/blender/python/api2_2x/Sys.c4
-rw-r--r--source/blender/python/api2_2x/doc/API_intro.py10
-rw-r--r--source/blender/python/api2_2x/doc/Camera.py26
-rw-r--r--source/blender/python/api2_2x/doc/Image.py11
-rw-r--r--source/blender/python/api2_2x/doc/NMesh.py36
-rw-r--r--source/blender/python/api2_2x/doc/Object.py8
12 files changed, 201 insertions, 53 deletions
diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c
index f1ff823f050..3c37d1c22be 100644
--- a/source/blender/python/api2_2x/Camera.c
+++ b/source/blender/python/api2_2x/Camera.c
@@ -65,7 +65,7 @@ Example::\n\
\n\
from Blender import Camera, Object, Scene\n\
c = Camera.New('ortho') # create new ortho camera data\n\
- c.lens = 35.0 # set lens value\n\
+ c.scale = 6.0 # set scale value\n\
cur = Scene.getCurrent() # get current Scene\n\
ob = Object.New('Camera') # make camera object\n\
ob.link(c) # link camera data with this object\n\
@@ -103,6 +103,7 @@ static PyObject *Camera_getLens( BPy_Camera * self );
static PyObject *Camera_getClipStart( BPy_Camera * self );
static PyObject *Camera_getClipEnd( BPy_Camera * self );
static PyObject *Camera_getDrawSize( BPy_Camera * self );
+static PyObject *Camera_getScale( BPy_Camera * self );
static PyObject *Camera_setIpo( BPy_Camera * self, PyObject * args );
static PyObject *Camera_clearIpo( BPy_Camera * self );
static PyObject *Camera_setName( BPy_Camera * self, PyObject * args );
@@ -114,6 +115,7 @@ static PyObject *Camera_setLens( BPy_Camera * self, PyObject * args );
static PyObject *Camera_setClipStart( BPy_Camera * self, PyObject * args );
static PyObject *Camera_setClipEnd( BPy_Camera * self, PyObject * args );
static PyObject *Camera_setDrawSize( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_setScale( BPy_Camera * self, PyObject * args );
static PyObject *Camera_getScriptLinks( BPy_Camera * self, PyObject * args );
static PyObject *Camera_addScriptLink( BPy_Camera * self, PyObject * args );
static PyObject *Camera_clearScriptLinks( BPy_Camera * self );
@@ -133,7 +135,9 @@ static PyMethodDef BPy_Camera_methods[] = {
"() - Return Camera mode flags (or'ed value) -\n"
" 'showLimits':1, 'showMist':2"},
{"getLens", ( PyCFunction ) Camera_getLens, METH_NOARGS,
- "() - Return Camera lens value"},
+ "() - Return *perspective* Camera lens value"},
+ {"getScale", ( PyCFunction ) Camera_getScale, METH_NOARGS,
+ "() - Return *ortho* Camera scale value"},
{"getClipStart", ( PyCFunction ) Camera_getClipStart, METH_NOARGS,
"() - Return Camera clip start value"},
{"getClipEnd", ( PyCFunction ) Camera_getClipEnd, METH_NOARGS,
@@ -151,7 +155,9 @@ static PyMethodDef BPy_Camera_methods[] = {
{"setMode", ( PyCFunction ) Camera_setMode, METH_VARARGS,
"(<s<,s>>) - Set Camera mode flag(s): 'showLimits' and 'showMist'"},
{"setLens", ( PyCFunction ) Camera_setLens, METH_VARARGS,
- "(f) - Set Camera lens value"},
+ "(f) - Set *perpective* Camera lens value"},
+ {"setScale", ( PyCFunction ) Camera_setScale, METH_VARARGS,
+ "(f) - Set *ortho* Camera scale value"},
{"setClipStart", ( PyCFunction ) Camera_setClipStart, METH_VARARGS,
"(f) - Set Camera clip start value"},
{"setClipEnd", ( PyCFunction ) Camera_setClipEnd, METH_VARARGS,
@@ -457,6 +463,17 @@ static PyObject *Camera_getLens( BPy_Camera * self )
"couldn't get Camera.lens attribute" );
}
+static PyObject *Camera_getScale( BPy_Camera * self )
+{
+ PyObject *attr = PyFloat_FromDouble( self->camera->ortho_scale );
+
+ if( attr )
+ return attr;
+
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Camera.scale attribute" );
+}
+
static PyObject *Camera_getClipStart( BPy_Camera * self )
{
PyObject *attr = PyFloat_FromDouble( self->camera->clipsta );
@@ -680,6 +697,22 @@ static PyObject *Camera_setLens( BPy_Camera * self, PyObject * args )
return Py_None;
}
+static PyObject *Camera_setScale( BPy_Camera * self, PyObject * args )
+{
+ float value;
+
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" );
+
+ self->camera->ortho_scale = EXPP_ClampFloat( value,
+ EXPP_CAM_SCALE_MIN,
+ EXPP_CAM_SCALE_MAX );
+
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
static PyObject *Camera_setClipStart( BPy_Camera * self, PyObject * args )
{
float value;
@@ -788,6 +821,8 @@ static PyObject *Camera_getAttr( BPy_Camera * self, char *name )
attr = PyInt_FromLong( self->camera->flag );
else if( strcmp( name, "lens" ) == 0 )
attr = PyFloat_FromDouble( self->camera->lens );
+ else if( strcmp( name, "scale" ) == 0 )
+ attr = PyFloat_FromDouble( self->camera->ortho_scale );
else if( strcmp( name, "clipStart" ) == 0 )
attr = PyFloat_FromDouble( self->camera->clipsta );
else if( strcmp( name, "clipEnd" ) == 0 )
@@ -815,8 +850,8 @@ static PyObject *Camera_getAttr( BPy_Camera * self, char *name )
}
else if( strcmp( name, "__members__" ) == 0 ) {
- attr = Py_BuildValue( "[s,s,s,s,s,s,s,s,s,s,s]",
- "name", "type", "mode", "lens",
+ attr = Py_BuildValue( "[s,s,s,s,s,s,s,s,s,s,s,s]",
+ "name", "type", "mode", "lens", "scale",
"clipStart", "ipo", "clipEnd",
"drawSize", "Types", "Modes", "users" );
}
@@ -859,6 +894,8 @@ static int Camera_setAttr( BPy_Camera * self, char *name, PyObject * value )
error = Camera_setIntMode( self, valtuple ); /* special case */
else if( strcmp( name, "lens" ) == 0 )
error = Camera_setLens( self, valtuple );
+ else if( strcmp( name, "scale" ) == 0 )
+ error = Camera_setScale( self, valtuple );
else if( strcmp( name, "clipStart" ) == 0 )
error = Camera_setClipStart( self, valtuple );
else if( strcmp( name, "clipEnd" ) == 0 )
diff --git a/source/blender/python/api2_2x/Camera.h b/source/blender/python/api2_2x/Camera.h
index 81457e12878..afa32513193 100644
--- a/source/blender/python/api2_2x/Camera.h
+++ b/source/blender/python/api2_2x/Camera.h
@@ -66,6 +66,8 @@ typedef struct {
#define EXPP_CAM_LENS_MIN 1.0
#define EXPP_CAM_LENS_MAX 250.0
+#define EXPP_CAM_SCALE_MIN 0.01
+#define EXPP_CAM_SCALE_MAX 1000.0
#define EXPP_CAM_CLIPSTART_MIN 0.0
#define EXPP_CAM_CLIPSTART_MAX 100.0
#define EXPP_CAM_CLIPEND_MIN 1.0
diff --git a/source/blender/python/api2_2x/Image.c b/source/blender/python/api2_2x/Image.c
index d4debde9000..b651745256f 100644
--- a/source/blender/python/api2_2x/Image.c
+++ b/source/blender/python/api2_2x/Image.c
@@ -247,6 +247,7 @@ static PyObject *Image_getXRep( BPy_Image * self );
static PyObject *Image_getYRep( BPy_Image * self );
static PyObject *Image_getBindCode( BPy_Image * self );
static PyObject *Image_setName( BPy_Image * self, PyObject * args );
+static PyObject *Image_setFilename( BPy_Image * self, PyObject * args );
static PyObject *Image_setXRep( BPy_Image * self, PyObject * args );
static PyObject *Image_setYRep( BPy_Image * self, PyObject * args );
static PyObject *Image_reload( BPy_Image * self ); /* by Campbell */
@@ -282,6 +283,8 @@ static PyMethodDef BPy_Image_methods[] = {
see also image.glLoad()."},
{"setName", ( PyCFunction ) Image_setName, METH_VARARGS,
"(str) - Change Image object name"},
+ {"setFilename", ( PyCFunction ) Image_setFilename, METH_VARARGS,
+ "(str) - Change Image file name"},
{"setXRep", ( PyCFunction ) Image_setXRep, METH_VARARGS,
"(int) - Change Image object x repetition value"},
{"setYRep", ( PyCFunction ) Image_setYRep, METH_VARARGS,
@@ -546,6 +549,23 @@ static PyObject *Image_setName( BPy_Image * self, PyObject * args )
return Py_None;
}
+static PyObject *Image_setFilename( BPy_Image * self, PyObject * args )
+{
+ char *name;
+ char buf[160];
+
+ if( !PyArg_ParseTuple( args, "s", &name ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected string argument" ) );
+
+ PyOS_snprintf( buf, sizeof( buf ), "%s", name );
+
+ strcpy(self->image->name, buf);
+
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
static PyObject *Image_setXRep( BPy_Image * self, PyObject * args )
{
short value;
@@ -648,6 +668,8 @@ static int Image_setAttr( BPy_Image * self, char *name, PyObject * value )
if( strcmp( name, "name" ) == 0 )
error = Image_setName( self, valtuple );
+ if( strcmp( name, "filename" ) == 0 )
+ error = Image_setFilename( self, valtuple );
else if( strcmp( name, "xrep" ) == 0 )
error = Image_setXRep( self, valtuple );
else if( strcmp( name, "yrep" ) == 0 )
diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c
index 95e7b535b41..50a477f7629 100644
--- a/source/blender/python/api2_2x/NMesh.c
+++ b/source/blender/python/api2_2x/NMesh.c
@@ -115,8 +115,8 @@ static char NMesh_printDebug_doc[] =
static char NMesh_addEdge_doc[] =
"create an edge between two vertices.\n\
-If an edge already exists between those vertices, it is returned. (in blender, only zero \
-or one edge can link two vertices.\n\
+If an edge already exists between those vertices, it is returned.\n\
+(In Blender, only zero or one edge can link two vertices.)\n\
Created edge is automatically added to edges list.";
static char NMesh_findEdge_doc[] =
@@ -241,9 +241,12 @@ specified by index. The list contains pairs with the \n\
bone name and the weight.";
-static char NMesh_update_doc[] = "(recalc_normals = 0, store_edges = 0) - updates the Mesh.\n\
-if recalc_normals is given and is equal to 1, normal vectors are recalculated.\n\
-if store_edges is given qnd is equal to 1, egdes data are stored.";
+static char NMesh_update_doc[] = \
+"(recalc_normals = 0, store_edges = 0, vertex_shade = 0) - Updates the Mesh.\n\
+Optional arguments: if given and nonzero:\n\
+'recalc_normals': normal vectors are recalculated;\n\
+'store_edges': edges data is stored.\n\
+'vertex_shade': vertex colors are added based on the current lamp setup.";
static char NMesh_getMode_doc[] =
"() - get the mode flags of this nmesh as an or'ed int value.";
@@ -1269,19 +1272,19 @@ static PyObject *NMesh_hasVertexColours( PyObject * self, PyObject * args )
return EXPP_incr_ret( Py_False );
}
-static PyObject *NMesh_update( PyObject * self, PyObject * args )
+static PyObject *NMesh_update( PyObject *self, PyObject *a, PyObject *kwd )
{
- int recalc_normals = 0, store_edges = 0;
BPy_NMesh *nmesh = ( BPy_NMesh * ) self;
Mesh *mesh = nmesh->mesh;
+ int recalc_normals = 0, store_edges = 0, vertex_shade = 0;
+ static char *kwlist[] = {"recalc_normals", "store_edges",
+ "vertex_shade", NULL};
+ int needs_redraw = 1;
- if( !PyArg_ParseTuple( args, "|ii", &recalc_normals, &store_edges ) )
+ if (!PyArg_ParseTupleAndKeywords(a, kwd, "|iii", kwlist, &recalc_normals,
+ &store_edges, &vertex_shade ) )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected nothing, one or two int(s) (0 or 1) as argument" );
-
- if( recalc_normals && recalc_normals != 1 )
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected 0 or 1 as argument" );
+ "expected nothing or one to three bool(s) (0 or 1) as argument" );
if( mesh ) {
unlink_existingMeshData( mesh );
@@ -1302,7 +1305,33 @@ static PyObject *NMesh_update( PyObject * self, PyObject * args )
new_id( &( G.main->mesh ), &mesh->id,
PyString_AsString( nmesh->name ) );
- if( !during_script( ) )
+ if (vertex_shade) {
+ Base *base = FIRSTBASE;
+
+ if (!nmesh->object)
+ return EXPP_ReturnPyObjError(PyExc_RuntimeError,
+ "link this mesh to an object first with ob.link(mesh)" );
+
+ if (G.obedit)
+ return EXPP_ReturnPyObjError(PyExc_RuntimeError,
+ "can't shade vertices while in edit mode" );
+
+ while (base) {
+ if (base->object == nmesh->object) {
+ base->flag |= SELECT;
+ nmesh->object->flag = base->flag;
+ set_active_base (base);
+ needs_redraw = 0; /* already done in make_vertexcol */
+ break;
+ }
+ base = base->next;
+ }
+ make_vertexcol();
+
+ countall();
+ }
+
+ if( !during_script( ) && needs_redraw)
allqueue( REDRAWVIEW3D, 0 );
return PyInt_FromLong( 1 );
@@ -1527,7 +1556,6 @@ static struct PyMethodDef NMesh_methods[] = {
MethodDef( addMaterial ),
MethodDef( insertKey ),
MethodDef( removeAllKeys ),
- MethodDef( update ),
MethodDef( setMode ),
MethodDef( setMaxSmoothAngle ),
MethodDef( setSubDivLevels ),
@@ -1544,6 +1572,14 @@ static struct PyMethodDef NMesh_methods[] = {
MethodDef( getMode ),
MethodDef( getMaxSmoothAngle ),
MethodDef( getSubDivLevels ),
+
+/* METH_VARARGS | METH_KEYWORDS:
+ * function(PyObject *self, PyObject *args, PyObject *keywords) */
+#undef MethodDef
+#define MethodDef(func) {#func, (PyCFunction)NMesh_##func,\
+ METH_VARARGS | METH_KEYWORDS, NMesh_##func##_doc}
+
+ MethodDef( update ),
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/api2_2x/NMesh.h b/source/blender/python/api2_2x/NMesh.h
index 588a7db7aa1..3041f9f0447 100644
--- a/source/blender/python/api2_2x/NMesh.h
+++ b/source/blender/python/api2_2x/NMesh.h
@@ -41,8 +41,12 @@
#include <config.h>
#endif
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
+#include <DNA_mesh_types.h>
+#include <DNA_meshdata_types.h>
+
+#include <BIF_editview.h> /* for set_active_base */
+#include <BSE_edit.h> /* for countall */
+#include <BDR_vpaint.h> /* for make_vertexcol */
#include "Material.h"
#include "Image.h"
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index f7c0c6c33e7..97476eb1fe0 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -166,9 +166,9 @@ hierarchy (faster)"},
mode\n\t2: Keep object transform\nfast\n\t>0: Don't update scene \
hierarchy (faster)"},
{"getData", ( PyCFunction ) Object_getData, METH_VARARGS | METH_KEYWORDS,
- "(only_name = 0) - Returns the datablock object containing the object's \
+ "(name_only = 0) - Returns the datablock object containing the object's \
data, e.g. Mesh.\n\
-If 'only_name' is nonzero or True, only the name of the datablock is returned"},
+If 'name_only' is nonzero or True, only the name of the datablock is returned"},
{"getDeltaLocation", ( PyCFunction ) Object_getDeltaLocation,
METH_NOARGS,
"Returns the object's delta location (x, y, z)"},
@@ -734,12 +734,12 @@ static PyObject *Object_getData( BPy_Object *self, PyObject *a, PyObject *kwd )
{
PyObject *data_object;
Object *object = self->object;
- int only_name = 0;
- static char *kwlist[] = {"only_name", NULL};
+ int name_only = 0;
+ static char *kwlist[] = {"name_only", NULL};
- if (!PyArg_ParseTupleAndKeywords(a, kwd, "|i", kwlist, &only_name))
+ if (!PyArg_ParseTupleAndKeywords(a, kwd, "|i", kwlist, &name_only))
return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "expected nothing or an int (keyword 'only_name') as argument" );
+ "expected nothing or an int (keyword 'name_only') as argument" );
/* if there's no obdata, try to create it */
if( object->data == NULL ) {
@@ -750,7 +750,7 @@ static PyObject *Object_getData( BPy_Object *self, PyObject *a, PyObject *kwd )
}
/* user wants only the name of the data object */
- if (only_name) {
+ if (name_only) {
ID *id = &object->id;
data_object = Py_BuildValue("s", id->name+2);
diff --git a/source/blender/python/api2_2x/Sys.c b/source/blender/python/api2_2x/Sys.c
index 708c9c8fbb1..2d8ae8febfc 100644
--- a/source/blender/python/api2_2x/Sys.c
+++ b/source/blender/python/api2_2x/Sys.c
@@ -303,7 +303,7 @@ static PyObject *M_sys_makename( PyObject * self, PyObject * args,
char *path = G.sce, *ext = NULL;
int strip = 0;
static char *kwlist[] = { "path", "ext", "strip", NULL };
- char *dot = NULL, *p = NULL, basename[FILE_MAXFILE];
+ char *dot = NULL, *p = NULL, basename[FILE_MAXDIR + FILE_MAXFILE];
char sep;
int n, len, lenext = 0;
PyObject *c;
@@ -317,7 +317,7 @@ static PyObject *M_sys_makename( PyObject * self, PyObject * args,
if( ext )
lenext = strlen( ext ) + 1;
- if( ( len + lenext ) > FILE_MAXFILE )
+ if( ( len + lenext ) > FILE_MAXDIR + FILE_MAXFILE )
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"path too long" );
diff --git a/source/blender/python/api2_2x/doc/API_intro.py b/source/blender/python/api2_2x/doc/API_intro.py
index f3dd7ab65a5..197fbaee875 100644
--- a/source/blender/python/api2_2x/doc/API_intro.py
+++ b/source/blender/python/api2_2x/doc/API_intro.py
@@ -15,8 +15,8 @@ The Blender Python API Reference
- L{Bone}
- L{NLA}
- L{BGL}
- - L{Camera}
- - L{Curve}
+ - L{Camera} (*)
+ - L{Curve} (*)
- L{Draw}
- L{Effect}
- L{Image} (*)
@@ -25,11 +25,11 @@ The Blender Python API Reference
- L{Lattice}
- L{Library}
- L{Material}
- - L{Mathutils}
+ - L{Mathutils} (*)
- L{Metaball}
- - L{NMesh}
+ - L{NMesh} (*)
- L{Noise}
- - L{Object}
+ - L{Object} (*)
- L{Registry}
- L{Scene}
- L{Radio}
diff --git a/source/blender/python/api2_2x/doc/Camera.py b/source/blender/python/api2_2x/doc/Camera.py
index 70c7aee2a8a..11b01d388af 100644
--- a/source/blender/python/api2_2x/doc/Camera.py
+++ b/source/blender/python/api2_2x/doc/Camera.py
@@ -3,7 +3,7 @@
"""
The Blender.Camera submodule.
-B{New}: scriptLink methods: L{Camera.getScriptLinks}, ...
+B{New}: L{Camera.getScale}, L{Camera.setScale} for ortho cameras.
Camera Data
===========
@@ -14,7 +14,7 @@ Example::
from Blender import Camera, Object, Scene
c = Camera.New('ortho') # create new ortho camera data
- c.lens = 35.0 # set lens value
+ c.scale = 6.0 # set scale value
cur = Scene.getCurrent() # get current scene
ob = Object.New('Camera') # make camera object
ob.link(c) # link camera data with this object
@@ -52,7 +52,10 @@ class Camera:
@cvar name: The Camera Data name.
@cvar type: The Camera type: 'persp':0 or 'ortho':1.
@cvar mode: The mode flags: B{or'ed value}: 'showLimits':1, 'showMist':2.
- @cvar lens: The lens value in [1.0, 250.0].
+ @cvar lens: The lens value in [1.0, 250.0], only relevant to *persp*
+ cameras.
+ @cvar scale: The scale value in [0.01, 1000.00], only relevant to *ortho*
+ cameras.
@cvar clipStart: The clip start value in [0.0, 100.0].
@cvar clipEnd: The clip end value in [1.0, 5000.0].
@cvar drawSize: The draw size value in [0.1, 10.0].
@@ -133,6 +136,7 @@ class Camera:
"""
Get the lens value.
@rtype: float
+ @warn: lens is only relevant for perspective (L{getType}) cameras.
"""
def setLens(lens):
@@ -140,6 +144,22 @@ class Camera:
Set the lens value.
@type lens: float
@param lens: The new lens value.
+ @warn: lens is only relevant for perspective (L{getType}) cameras.
+ """
+
+ def getScale():
+ """
+ Get the scale value.
+ @rtype: float
+ @warn: scale is only relevant for ortho (L{getType}) cameras.
+ """
+
+ def setScale(scale):
+ """
+ Set the scale value.
+ @type scale: float
+ @param scale: The new scale value in [0.01, 1000.00].
+ @warn: scale is only relevant for ortho (L{getType}) cameras.
"""
def getClipStart():
diff --git a/source/blender/python/api2_2x/doc/Image.py b/source/blender/python/api2_2x/doc/Image.py
index df4b5c6a65c..917474484c6 100644
--- a/source/blender/python/api2_2x/doc/Image.py
+++ b/source/blender/python/api2_2x/doc/Image.py
@@ -6,7 +6,7 @@ The Blender.Image submodule.
Image
=====
-B{New}: L{Image.glLoad}, L{Image.glFree}.
+B{New}: L{Image.setFilename}.
This module provides access to B{Image} objects in Blender.
@@ -155,6 +155,15 @@ class Image:
@param name: The new name.
"""
+ def setFilename(name):
+ """
+ Change the filename of this Image object.
+ @type name: string
+ @param name: The new full filename.
+ @warn: use this with caution and note that the filename is truncated if
+ larger than 160 characters.
+ """
+
def setXRep(xrep):
"""
Texture tiling: set the number of x repetitions for this Image.
diff --git a/source/blender/python/api2_2x/doc/NMesh.py b/source/blender/python/api2_2x/doc/NMesh.py
index fbfa745229c..4683efe1e67 100644
--- a/source/blender/python/api2_2x/doc/NMesh.py
+++ b/source/blender/python/api2_2x/doc/NMesh.py
@@ -3,7 +3,8 @@
"""
The Blender.NMesh submodule.
-B{New}: L{NMesh.getMaterials}, L{NMesh.setMaterials}.
+B{New}: edges class (L{NMEdge}) and nmesh methods (L{NMesh.addEdge},
+L{NMesh.addEdgesData}, etc.); new optional arguments to L{NMesh.update}.
Mesh Data
=========
@@ -13,8 +14,11 @@ This module provides access to B{Mesh Data} objects in Blender.
Example::
import Blender
- from Blender import NMesh, Material
- #
+ from Blender import NMesh, Material, Window
+
+ editmode = Window.EditMode() # are we in edit mode? If so ...
+ if editmode: Window.EditMode(0) # leave edit mode before getting the mesh
+
me = NMesh.GetRaw("Plane") # get the mesh data called "Plane"
if not me.materials: # if there are no materials ...
@@ -30,6 +34,8 @@ Example::
v.co[2] *= 2.5
me.update() # update the real mesh in Blender
+ if editmode: Window.EditMode(1) # optional, just being nice
+
@type Modes: readonly dictionary
@type FaceFlags: readonly dictionary
@type FaceModes: readonly dictionary
@@ -532,16 +538,28 @@ class NMesh:
add them.
"""
- def update(recalc_normals = 0, store_edges = 0):
+ def update(recalc_normals = 0, store_edges = 0, vertex_shade = 0):
"""
Update the mesh in Blender. The changes made are put back to the mesh in
Blender, if available, or put in a newly created mesh object if this NMesh
wasn't already linked to one.
- @type recalc_normals: int
- @param recalc_normals: If given and equal to 1, the vertex normals are
- recalculated.
- @type store_edges: int
- @param store_edges: if not 0, then edge data are stored.
+ @type recalc_normals: int (bool)
+ @param recalc_normals: if nonzero the vertex normals are recalculated.
+ @type store_edges: int (bool)
+ @param store_edges: if nonzero, then edge data is stored.
+ @type vertex_shade: int (bool)
+ @param vertex_shade: if nonzero vertices are colored based on the
+ current lighting setup. To use it, be out of edit mode or else
+ an error will be returned.
+ @warn: edit mesh and normal mesh are two different structures in Blender,
+ synchronized upon leaving or entering edit mode. Always remember to
+ leave edit mode (L{Window.EditMode}) before calling this update
+ method, or your changes will be lost. Even better: for the same reason
+ programmers should leave EditMode B{before} getting a mesh, or changes
+ made to the editmesh in Blender may not be visible to your script
+ (check the example at the top of NMesh module doc).
+ @note: this method also redraws the 3d view and -- if 'vertex_shade' is
+ nonzero -- the edit buttons window.
@note: if your mesh disappears after it's updated, try
L{Object.Object.makeDisplayList}. 'Subsurf' meshes (see L{getMode},
L{setMode}) need their display lists updated, too.
diff --git a/source/blender/python/api2_2x/doc/Object.py b/source/blender/python/api2_2x/doc/Object.py
index ddf8269fbae..f8b7864dba1 100644
--- a/source/blender/python/api2_2x/doc/Object.py
+++ b/source/blender/python/api2_2x/doc/Object.py
@@ -186,16 +186,16 @@ class Object:
other value, or no value at all will update the scene hierarchy.
"""
- def getData(only_name = False):
+ def getData(name_only = False):
"""
Returns the Datablock object (new: or just its name) containing the
object's data. For example the Mesh, Lamp or the Camera.
- @type only_name: bool
- @param only_name: if True on nonzero, only the name of the data object
+ @type name_only: bool
+ @param name_only: if True on nonzero, only the name of the data object
is returned.
@rtype: Object type specific or string
@return: Depending on the type of the Object, it returns a specific object
- for the data requested. If only_name is True, it returns a string.
+ for the data requested. If name_only is True, it returns a string.
"""
def getDeltaLocation():