Merged changes in the trunk up to revision 36757.

This commit is contained in:
2011-05-19 01:40:37 +00:00
275 changed files with 4189 additions and 3664 deletions

View File

@@ -45,12 +45,6 @@
#include "py_capi_utils.h"
#endif
PyObject * PyC_UnicodeFromByte(const char *str);
const char * PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerce must be NULL */
/*** Function to wrap ID properties ***/
PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent);
extern PyTypeObject IDArray_Type;
extern PyTypeObject IDGroup_Iter_Type;

View File

@@ -1674,7 +1674,7 @@ static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure))
return PyLong_FromLong((long) self->col_size);
}
static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure))
static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closure))
{
float mat[3][3];
@@ -1692,7 +1692,7 @@ static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure)
return PyFloat_FromDouble(mat3_to_scale(mat));
}
static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure))
static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure))
{
if(BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -1708,6 +1708,21 @@ static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure))
}
}
static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closure))
{
if(BaseMath_ReadCallback(self) == -1)
return NULL;
/*must be 3-4 cols, 3-4 rows, square matrix*/
if(self->col_size == 4 && self->row_size == 4)
return PyBool_FromLong(is_orthogonal_m4((float (*)[4])self->contigPtr));
else if(self->col_size == 3 && self->row_size == 3)
return PyBool_FromLong(is_orthogonal_m3((float (*)[3])self->contigPtr));
else {
PyErr_SetString(PyExc_AttributeError, "Matrix.is_orthogonal: inappropriate matrix size - expects 3x3 or 4x4 matrix");
return NULL;
}
}
/*****************************************************************************/
/* Python attributes get/set structure: */
@@ -1715,8 +1730,9 @@ static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure))
static PyGetSetDef Matrix_getseters[] = {
{(char *)"row_size", (getter)Matrix_getRowSize, (setter)NULL, (char *)"The row size of the matrix (readonly).\n\n:type: int", NULL},
{(char *)"col_size", (getter)Matrix_getColSize, (setter)NULL, (char *)"The column size of the matrix (readonly).\n\n:type: int", NULL},
{(char *)"median_scale", (getter)Matrix_getMedianScale, (setter)NULL, (char *)"The average scale applied to each axis (readonly).\n\n:type: float", NULL},
{(char *)"is_negative", (getter)Matrix_getIsNegative, (setter)NULL, (char *)"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
{(char *)"median_scale", (getter)Matrix_median_scale_get, (setter)NULL, (char *)"The average scale applied to each axis (readonly).\n\n:type: float", NULL},
{(char *)"is_negative", (getter)Matrix_is_negative_get, (setter)NULL, (char *)"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
{(char *)"is_orthogonal", (getter)Matrix_is_orthogonal_get, (setter)NULL, (char *)"True if this matrix is orthogonal, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
{(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL},
{(char *)"owner",(getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */

View File

@@ -76,7 +76,7 @@ static void bpy_lib_dealloc(BPy_Library *self)
}
PyTypeObject bpy_lib_Type= {
static PyTypeObject bpy_lib_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_lib", /* tp_name */
sizeof(BPy_Library), /* tp_basicsize */

View File

@@ -36,6 +36,7 @@
#include "RNA_types.h"
#include "BPY_extern.h"
#include "bpy_operator.h"
#include "bpy_operator_wrap.h"
#include "bpy_rna.h" /* for setting arg props only - pyrna_py_to_prop() */

View File

@@ -1,4 +1,3 @@
/*
* $Id$
*

View File

@@ -6040,17 +6040,18 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
bpy_context_set(C, &gilstate);
if (!is_static) {
/* exception, operators store their PyObjects for re-use */
/* some datatypes (operator, render engine) can store PyObjects for re-use */
if(ptr->data) {
if(RNA_struct_is_a(ptr->type, &RNA_Operator)) {
wmOperator *op= ptr->data;
if(op->py_instance) {
py_class_instance= op->py_instance;
void **instance = RNA_struct_instance(ptr);
if(instance) {
if(*instance) {
py_class_instance= *instance;
Py_INCREF(py_class_instance);
}
else {
/* store the instance here once its created */
py_class_instance_store= &op->py_instance;
py_class_instance_store= instance;
}
}
}
@@ -6418,7 +6419,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
identifier= ((PyTypeObject*)py_class)->tp_name;
srna_new= reg(C, &reports, py_class, identifier, bpy_class_validate, bpy_class_call, bpy_class_free);
srna_new= reg(CTX_data_main(C), &reports, py_class, identifier, bpy_class_validate, bpy_class_call, bpy_class_free);
if(BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
return NULL;
@@ -6568,7 +6569,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
C= BPy_GetContext();
/* call unregister */
unreg(C, srna); /* calls bpy_class_free, this decref's py_class */
unreg(CTX_data_main(C), srna); /* calls bpy_class_free, this decref's py_class */
PyDict_DelItemString(((PyTypeObject *)py_class)->tp_dict, "bl_rna");
if(PyErr_Occurred())

View File

@@ -187,12 +187,8 @@ int pyrna_write_check(void);
int pyrna_struct_validity_check(BPy_StructRNA *pysrna);
int pyrna_prop_validity_check(BPy_PropertyRNA *self);
void BPY_modules_update(struct bContext *C); //XXX temp solution
/* bpy.utils.(un)register_class */
extern PyMethodDef meth_bpy_register_class;
extern PyMethodDef meth_bpy_unregister_class;
void BPY_id_release(struct ID *id);
#endif