Merge with trunk/2.5 at r25563

Most likely will not compile for others, I'd appreciate any build errors
and missing files reports (I can never seem to get everything committed
and all the build systems working without help).

Porting over the sculpt/multires tools was a breeze,
thanks goes to brecht for a design that didn't exclude
ngons and was easy to port.

Note that I've not tested externally-backed multires
file support yet.  Also, I still need to write version
patch code for some cases.

Some notes:

* Like trunk, topological changes don't update multires right,
  so e.g. subdivide will duplicate multires data on the new faces,
  instead of subdividing it.
* If you set the debug value (ctrl-alt-d) to 1 it'll turn on
  my experiments in speeding up sculpting on higher-res multires
  meshes (but note it makes partial redraw not completely accurate).
* There's a bug where you have to go through editmode to get out
  of sculpt mode, not sure if I inherited or created this myself.
This commit is contained in:
Joseph Eagar
2010-01-05 22:33:41 +00:00
668 changed files with 74341 additions and 49628 deletions

View File

@@ -48,6 +48,7 @@ static PyObject *Vector_Negate( VectorObject * self );
static PyObject *Vector_Resize2D( VectorObject * self );
static PyObject *Vector_Resize3D( VectorObject * self );
static PyObject *Vector_Resize4D( VectorObject * self );
static PyObject *Vector_ToTuple( VectorObject * self, PyObject *value );
static PyObject *Vector_ToTrackQuat( VectorObject * self, PyObject * args );
static PyObject *Vector_Reflect( VectorObject *self, VectorObject *value );
static PyObject *Vector_Cross( VectorObject * self, VectorObject * value );
@@ -61,6 +62,7 @@ static struct PyMethodDef Vector_methods[] = {
{"resize2D", (PyCFunction) Vector_Resize2D, METH_NOARGS, NULL},
{"resize3D", (PyCFunction) Vector_Resize3D, METH_NOARGS, NULL},
{"resize4D", (PyCFunction) Vector_Resize4D, METH_NOARGS, NULL},
{"toTuple", (PyCFunction) Vector_ToTuple, METH_O, NULL},
{"toTrackQuat", ( PyCFunction ) Vector_ToTrackQuat, METH_VARARGS, NULL},
{"reflect", ( PyCFunction ) Vector_Reflect, METH_O, NULL},
{"cross", ( PyCFunction ) Vector_Cross, METH_O, NULL},
@@ -236,6 +238,33 @@ static PyObject *Vector_Resize4D(VectorObject * self)
Py_INCREF(self);
return (PyObject*)self;
}
/*----------------------------Vector.resize4D() ------------------
resize the vector to x,y,z,w */
static PyObject *Vector_ToTuple(VectorObject * self, PyObject *value)
{
int ndigits= PyLong_AsSsize_t(value);
int x;
PyObject *ret;
if(ndigits > 22 || ndigits < 0) { /* accounts for non ints */
PyErr_SetString(PyExc_TypeError, "vector.key(ndigits): ndigits must be between 0 and 21");
return NULL;
}
if(!BaseMath_ReadCallback(self))
return NULL;
ret= PyTuple_New(self->size);
for(x = 0; x < self->size; x++) {
PyTuple_SET_ITEM(ret, x, PyFloat_FromDouble(double_round((double)self->vec[x], ndigits)));
}
return ret;
}
/*----------------------------Vector.toTrackQuat(track, up) ----------------------
extract a quaternion from the vector and the track and up axis */
static PyObject *Vector_ToTrackQuat( VectorObject * self, PyObject * args )
@@ -626,36 +655,30 @@ static PyObject *Vector_add(PyObject * v1, PyObject * v2)
static PyObject *Vector_iadd(PyObject * v1, PyObject * v2)
{
int i;
VectorObject *vec1 = NULL, *vec2 = NULL;
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
PyErr_SetString(PyExc_AttributeError, "Vector addition: arguments not valid for this operation....\n");
return NULL;
}
vec1 = (VectorObject*)v1;
vec2 = (VectorObject*)v2;
if VectorObject_Check(v1)
vec1= (VectorObject *)v1;
if VectorObject_Check(v2)
vec2= (VectorObject *)v2;
/* make sure v1 is always the vector */
if (vec1 && vec2 ) {
if(!BaseMath_ReadCallback(vec1) || !BaseMath_ReadCallback(vec2))
return NULL;
/*VECTOR + VECTOR*/
if(vec1->size != vec2->size) {
PyErr_SetString(PyExc_AttributeError, "Vector addition: vectors must have the same dimensions for this operation\n");
return NULL;
}
for(i = 0; i < vec1->size; i++) {
vec1->vec[i] += vec2->vec[i];
}
Py_INCREF( v1 );
return v1;
if(vec1->size != vec2->size) {
PyErr_SetString(PyExc_AttributeError, "Vector addition: vectors must have the same dimensions for this operation\n");
return NULL;
}
if(!BaseMath_ReadCallback(vec1) || !BaseMath_ReadCallback(vec2))
return NULL;
for(i = 0; i < vec1->size; i++) {
vec1->vec[i] = vec1->vec[i] + vec2->vec[i];
}
BaseMath_WriteCallback(vec1);
PyErr_SetString(PyExc_AttributeError, "Vector addition: arguments not valid for this operation....\n");
return NULL;
Py_INCREF( v1 );
return v1;
}
/*------------------------obj - obj------------------------------