Saturday merger of bf-blender in orange branch.

This commit is contained in:
2005-12-17 20:25:41 +00:00
19 changed files with 219 additions and 200 deletions

View File

@@ -31,6 +31,7 @@
*/
#include "BezTriple.h" /*This must come first */
#include "DNA_ipo_types.h"
#include "MEM_guardedalloc.h"
#include "gen_utils.h"
@@ -303,6 +304,8 @@ static PyObject *BezTripleGetAttr( BPy_BezTriple * self, char *name )
return BezTriple_getTriple( self );
else if( strcmp( name, "tilt" ) == 0 )
return PyFloat_FromDouble(self->beztriple->alfa);
else if( strcmp( name, "hide" ) == 0 )
return PyFloat_FromDouble(self->beztriple->hide);
else if( strcmp( name, "__members__" ) == 0 )
return Py_BuildValue( "[s,s,s]", "pt", "vec", "tilt" );
@@ -329,7 +332,17 @@ static int BezTripleSetAttr( BPy_BezTriple * self, char *name, PyObject * value
return 0; /* normal exit */
#endif
if( strcmp( name, "tilt" ) == 0 ) {
if( !strcmp( name, "hide" ) ) {
int param;
if( !PyInt_CheckExact( value ) )
return EXPP_ReturnIntError( PyExc_TypeError,
"expected int argument" );
param = (int)PyInt_AS_LONG( value );
self->beztriple->hide = (param == 0) ? 0 : IPO_BEZ;
return 0;
}
if( !strcmp( name, "tilt" ) ) {
if (!PyFloat_Check( value ) )
return EXPP_ReturnIntError( PyExc_TypeError, "expected a float" );
@@ -337,8 +350,8 @@ static int BezTripleSetAttr( BPy_BezTriple * self, char *name, PyObject * value
return 0;
}
return ( EXPP_ReturnIntError( PyExc_AttributeError,
"cannot set a read-only attribute" ) );
return EXPP_ReturnIntError( PyExc_AttributeError,
"cannot set a read-only attribute" );
}
/*****************************************************************************/
@@ -356,12 +369,11 @@ static PyObject *BezTripleRepr( BPy_BezTriple * self )
*/
char str[1000];
sprintf( str,
"BezTriple %f %f %f %f %f %f %f %f %f %f\n %d %d %d %d %d %d\n",
"BezTriple (%f %f) (%f %f) (%f %f) %f\n (%d %d %d) (%d %d) %d\n",
self->beztriple->vec[0][0], self->beztriple->vec[0][1],
self->beztriple->vec[0][2], self->beztriple->vec[1][0],
self->beztriple->vec[1][1], self->beztriple->vec[1][2],
self->beztriple->vec[1][0], self->beztriple->vec[1][1],
self->beztriple->vec[2][0], self->beztriple->vec[2][1],
self->beztriple->vec[2][2], self->beztriple->alfa,
self->beztriple->alfa,
self->beztriple->h1, self->beztriple->h2, self->beztriple->f1,
self->beztriple->f2, self->beztriple->f3,
self->beztriple->hide );

View File

@@ -100,7 +100,7 @@ returns None if not found.\n";
struct PyMethodDef M_Image_methods[] = {
{"New", M_Image_New, METH_VARARGS, M_Image_New_doc},
{"Get", M_Image_Get, METH_VARARGS, M_Image_Get_doc},
{"GetCurrent", M_Image_GetCurrent, METH_NOARGS, M_Image_GetCurrent_doc},
{"GetCurrent", ( PyCFunction ) M_Image_GetCurrent, METH_NOARGS, M_Image_GetCurrent_doc},
{"get", M_Image_Get, METH_VARARGS, M_Image_Get_doc},
{"Load", M_Image_Load, METH_VARARGS, M_Image_Load_doc},
{NULL, NULL, 0, NULL}
@@ -126,7 +126,7 @@ static PyObject *M_Image_New( PyObject * self, PyObject * args)
if( !img )
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
"couldn't create PyObject Image_Type" ) );
image_changed(img, 0);
// image_changed(img, 0);
return Image_CreatePyObject( img );
}
@@ -663,7 +663,7 @@ static PyMethodDef BPy_Image_methods[] = {
"(int) - Change Image object animation start value"},
{"setEnd", ( PyCFunction ) Image_setEnd, METH_VARARGS,
"(int) - Change Image object animation end value"},
{"setSpeed", ( PyCFunction ) Image_setEnd, METH_VARARGS,
{"setSpeed", ( PyCFunction ) Image_setSpeed, METH_VARARGS,
"(int) - Change Image object animation speed (fps)"},
{"save", ( PyCFunction ) Image_save, METH_NOARGS,
"() - Write image buffer to file"},
@@ -1104,12 +1104,11 @@ static PyObject *Image_getAttr( BPy_Image * self, char *name )
attr = PyInt_FromLong( self->image->animspeed );
else if( strcmp( name, "packed" ) == 0 ) {
if (self->image->packedfile) {
//Py_INCREF(Py_True);
attr = Py_True;
} else {
//Py_INCREF(Py_False);
attr = Py_False;
}
Py_INCREF(attr);
} else if( strcmp( name, "bindcode" ) == 0 )
attr = PyInt_FromLong( self->image->bindcode );

View File

@@ -405,9 +405,11 @@ static PyObject *IpoCurve_addBezier( C_IpoCurve * self, PyObject * args )
bzt->vec[0][1] = y - 1;
bzt->vec[1][1] = y;
bzt->vec[2][1] = y + 1;
bzt->vec[0][2] = bzt->vec[1][2] = bzt->vec[2][2] = 0.0;
/* set handle type to Auto */
bzt->h1 = HD_AUTO;
bzt->h2 = HD_AUTO;
bzt->h1 = bzt->h2 = HD_AUTO;
bzt->f1 = bzt->f2 = bzt->f3= 0;
bzt->hide = IPO_BEZ;
Py_INCREF( Py_None );
return Py_None;

View File

@@ -324,6 +324,13 @@ static PyObject *Material_ModesDict( void )
PyConstant_Insert(c, "TRACEABLE", PyInt_FromLong(MA_TRACEBLE));
PyConstant_Insert(c, "SHADOW", PyInt_FromLong(MA_SHADOW));
PyConstant_Insert(c, "SHADOWBUF", PyInt_FromLong(MA_SHADBUF));
PyConstant_Insert(c, "TANGENTSTR", PyInt_FromLong(MA_TANGENT_STR));
PyConstant_Insert(c, "FULLOSA", PyInt_FromLong(MA_FULL_OSA));
PyConstant_Insert(c, "RAYBIAS", PyInt_FromLong(MA_RAYBIAS));
PyConstant_Insert(c, "TRANSPSHADOW", PyInt_FromLong(MA_SHADOW_TRA));
PyConstant_Insert(c, "RAMPCOL", PyInt_FromLong(MA_RAMP_COL));
PyConstant_Insert(c, "RAMPSPEC", PyInt_FromLong(MA_RAMP_SPEC));
PyConstant_Insert(c, "SHADELESS", PyInt_FromLong(MA_SHLESS));
PyConstant_Insert(c, "WIRE", PyInt_FromLong(MA_WIRE));
PyConstant_Insert(c, "VCOL_LIGHT", PyInt_FromLong(MA_VERTEXCOL));
@@ -1912,46 +1919,20 @@ static int Material_setName( BPy_Material * self, PyObject * value )
static int Material_setMode( BPy_Material * self, PyObject * value )
{
int param;
int bitmask = MA_TRACEBLE
| MA_SHADOW
| MA_SHLESS
| MA_WIRE
| MA_VERTEXCOL
| MA_VERTEXCOLP
| MA_HALO
| MA_ZTRA
| MA_ZINV
| MA_HALO_RINGS
| MA_HALO_LINES
| MA_ONLYSHADOW
| MA_HALO_XALPHA
| MA_STAR
| MA_FACETEXTURE
| MA_HALOTEX
| MA_HALOPUNO
| MA_NOMIST
| MA_HALO_SHADE
| MA_HALO_FLARE
| MA_RADIO
| MA_RAYMIRROR
| MA_ZTRA
| MA_RAYTRANSP
| MA_ONLYSHADOW
| MA_NOMIST
| MA_ENV;
if( !PyInt_CheckExact ( value ) ) {
char errstr[128];
sprintf ( errstr , "expected int bitmask of 0x%08x", bitmask );
sprintf ( errstr , "expected int bitmask of 0x%08x", MA_MODE_MASK );
return EXPP_ReturnIntError( PyExc_TypeError, errstr );
}
param = PyInt_AS_LONG ( value );
if ( ( param & bitmask ) != param )
if ( ( param & MA_MODE_MASK ) != param )
return EXPP_ReturnIntError( PyExc_ValueError,
"invalid bit(s) set in mask" );
self->material->mode = param;
self->material->mode &= ( MA_RAMP_COL | MA_RAMP_SPEC );
self->material->mode |= param & ~( MA_RAMP_COL | MA_RAMP_SPEC );
return 0;
}
@@ -2938,34 +2919,6 @@ static PyObject *Matr_oldsetMode( BPy_Material * self, PyObject * args )
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL
};
static int bitmask = MA_TRACEBLE
| MA_SHADOW
| MA_SHLESS
| MA_WIRE
| MA_VERTEXCOL
| MA_VERTEXCOLP
| MA_HALO
| MA_ZTRA
| MA_ZINV
| MA_HALO_RINGS
| MA_HALO_LINES
| MA_ONLYSHADOW
| MA_HALO_XALPHA
| MA_STAR
| MA_FACETEXTURE
| MA_HALOTEX
| MA_HALOPUNO
| MA_NOMIST
| MA_HALO_SHADE
| MA_HALO_FLARE
| MA_RADIO
| MA_RAYMIRROR
| MA_ZTRA
| MA_RAYTRANSP
| MA_ONLYSHADOW
| MA_NOMIST
| MA_ENV;
/*
* check for a single integer argument; do a quick check for now
@@ -2975,7 +2928,7 @@ static PyObject *Matr_oldsetMode( BPy_Material * self, PyObject * args )
if ( (PySequence_Size( args ) == 1)
&& PyInt_Check ( PyTuple_GET_ITEM ( args , 0 ) )
&& PyArg_ParseTuple( args, "i", &flag )
&& (flag & bitmask) == flag ) {
&& (flag & MA_MODE_MASK ) == flag ) {
ok = 1;
/*

View File

@@ -68,7 +68,6 @@ void types_InitAll( void )
NMFace_Type.ob_type = &PyType_Type;
NMVert_Type.ob_type = &PyType_Type;
NMesh_Type.ob_type = &PyType_Type;
Mesh_Type.ob_type = &PyType_Type;
MFace_Type.ob_type = &PyType_Type;
MVert_Type.ob_type = &PyType_Type;
PVert_Type.ob_type = &PyType_Type;

View File

@@ -402,8 +402,12 @@ class BezTriple:
The BezTriple object
====================
This object gives access to generic data from all beztriple objects in Blender. If an attribute is listed as being 'read-only' that means you cannot write to it. Use the set*() methods instead.
@ivar pt : a list of the [x,y] coordinates for knot point of this BezTriple. read-only.
@ivar vec : a list of the 3 points [ handle, knot, handle ] that comprise a BezTriple. See the getTriple() method for an example of the format. read-only.
@ivar pt : the [x,y] coordinates for knot point of this BezTriple. Read-only.
@type pt: list of floats
@ivar vec : a list of the 3 points [ handle, knot, handle ] that comprise a BezTriple. See the getTriple() method for an example of the format. Read-only.
@type vec: list of points
@ivar hide: the visibility status of the control point.
@type hide: int
"""
def getPoints():

View File

@@ -25,8 +25,18 @@ Example::
@type Modes: readonly dictionary
@var Modes: The available Material Modes.
B{Note}: Some Modes are only available when the 'Halo' mode is I{off} and
others only when it is I{on}. But these two subsets of modes share the same
numerical values in their Blender C #defines. So, for example, if 'Halo' is
on, then 'NoMist' is actually interpreted as 'HaloShaded'. We marked all
such possibilities in the Modes dict below: each halo-related mode that
uses an already taken value is preceded by "+" and appear below the normal
mode which also uses that value.
- TRACEABLE - Make Material visible for shadow lamps.
- SHADOW - Enable Material for shadows.
- SHADOWBUF - Enable Material to cast shadows with shadow buffers.
- SHADELESS - Make Material insensitive to light or shadow.
- WIRE - Render only the edges of faces.
- VCOL_LIGHT - Add vertex colors as extra light.
@@ -34,28 +44,26 @@ Example::
- HALO - Render as a halo.
- ZTRANSP - Z-buffer transparent faces.
- ZINVERT - Render with inverted Z-buffer.
- - HALORINGS - Render rings over the basic halo.
- + HALORINGS - Render rings over the basic halo.
- ENV - Do not render Material.
- - HALOLINES - Render star shaped lines over the basic halo.
- + HALOLINES - Render star shaped lines over the basic halo.
- ONLYSHADOW - Let alpha be determined on the degree of shadow.
- - HALOXALPHA - Use extreme alpha.
- TEXFACE - UV-Editor assigned texture gives color and texture info
for faces.
- - HALOSTAR - Render halo as a star.
- + HALOXALPHA - Use extreme alpha.
- TEXFACE - UV-Editor assigned texture gives color and texture info for faces.
- + HALOSTAR - Render halo as a star.
- NOMIST - Set the Material insensitive to mist.
- - HALOSHADED - Let halo receive light.
- + HALOSHADED - Let halo receive light.
- HALOTEX - Give halo a texture.
- HALOPUNO - Use the vertex normal to specify the dimension of the halo.
- HALOFLARE - Render halo as a lens flare.
- RAYMIRROR - Enables raytracing for mirror reflection rendering.
- RAYTRANSP - Enables raytracing for transparency rendering.
@warn: Some Modes are only available when the 'Halo' mode is I{off} and
others only when it is I{on}. But these two subsets of modes share the same
numerical values in their Blender C #defines. So, for example, if 'Halo' is
on, then 'NoMist' is actually interpreted as 'HaloShaded'. We marked all
such possibilities in the Modes dict below: each halo-related mode that
uses an already taken value is preceded by "-" and appear below the normal
mode which also uses that value.
- RAYBIAS - Prevent ray traced shadow errors with Phong interpolated normals.
- RAMPCOL - Status of colorband ramp for Material's diffuse color. This is a read-only bit.
- RAMPSPEC - Status of colorband ramp for Material's specular color. This is a read-only bit.
- TANGENTSTR - Uses direction of strands as normal for tangent-shading.
- TRANSPSHADOW - Lets Material receive transparent shadows based on material color and alpha.
- FULLOSA - Force rendering of all OSA samples.
@type Shaders: readonly dictionary
@var Shaders: The available Material Shaders.