From f580d9c33b30e2338c63c9997ca47abca5559053 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 21 Nov 2010 09:06:27 +0000 Subject: - some more rna range corrections - correct exception messages for mathutils constructors. --- source/blender/makesrna/intern/rna_curve.c | 4 +-- source/blender/makesrna/intern/rna_sculpt_paint.c | 2 +- source/blender/python/generic/mathutils_matrix.c | 30 +++++++++++------------ 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index ef7910745a7..1972abfd3ec 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -1449,14 +1449,14 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "resolu"); - RNA_def_property_range(prop, 1, INT_MAX); + RNA_def_property_range(prop, 1, SHRT_MAX); RNA_def_property_ui_range(prop, 1, 64, 1, 0); RNA_def_property_ui_text(prop, "Resolution U", "Curve or Surface subdivisions per segment"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop= RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "resolv"); - RNA_def_property_range(prop, 1, INT_MAX); + RNA_def_property_range(prop, 1, SHRT_MAX); RNA_def_property_ui_range(prop, 1, 64, 1, 0); RNA_def_property_ui_text(prop, "Resolution V", "Surface subdivisions per segment"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 0b4d87ed642..735dd58252b 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -467,7 +467,7 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush"); prop= RNA_def_property(srna, "size", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 1, INT_MAX); + RNA_def_property_range(prop, 1, SHRT_MAX); RNA_def_property_ui_range(prop, 1, 100, 10, 3); RNA_def_property_ui_text(prop, "Size", "Brush size"); diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c index 34a31768b69..232d24714c5 100644 --- a/source/blender/python/generic/mathutils_matrix.c +++ b/source/blender/python/generic/mathutils_matrix.c @@ -325,11 +325,11 @@ static PyObject *C_Matrix_Translation(PyObject *cls, VectorObject * vec) 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; if(!VectorObject_Check(vec)) { - PyErr_SetString(PyExc_TypeError, "mathutils.TranslationMatrix(): expected vector\n"); + PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.Translation(): expected vector\n"); return NULL; } if(vec->size != 3 && vec->size != 4) { - PyErr_SetString(PyExc_TypeError, "mathutils.TranslationMatrix(): vector must be 3D or 4D\n"); + PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.Translation(): vector must be 3D or 4D\n"); return NULL; } @@ -344,7 +344,7 @@ static PyObject *C_Matrix_Translation(PyObject *cls, VectorObject * vec) return newMatrixObject(mat, 4, 4, Py_NEW, (PyTypeObject *)cls); } -//----------------------------------mathutils.ScaleMatrix() ------------- +//----------------------------------mathutils.Matrix.Scale() ------------- //mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc. static char C_Matrix_Scale_doc[] = ".. classmethod:: Scale(factor, size, axis)\n" @@ -369,16 +369,16 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args) 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; if(!PyArg_ParseTuple(args, "fi|O!", &factor, &matSize, &vector_Type, &vec)) { - PyErr_SetString(PyExc_TypeError, "mathutils.ScaleMatrix(): expected float int and optional vector\n"); + PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.Scale(): expected float int and optional vector\n"); return NULL; } if(matSize != 2 && matSize != 3 && matSize != 4) { - PyErr_SetString(PyExc_AttributeError, "mathutils.ScaleMatrix(): can only return a 2x2 3x3 or 4x4 matrix\n"); + PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.Scale(): can only return a 2x2 3x3 or 4x4 matrix\n"); return NULL; } if(vec) { if(vec->size > 2 && matSize == 2) { - PyErr_SetString(PyExc_AttributeError, "mathutils.ScaleMatrix(): please use 2D vectors when scaling in 2D\n"); + PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.Scale(): please use 2D vectors when scaling in 2D\n"); return NULL; } @@ -435,7 +435,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args) //pass to matrix creation return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); } -//----------------------------------mathutils.OrthoProjectionMatrix() --- +//----------------------------------mathutils.Matrix.OrthoProjection() --- //mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc. static char C_Matrix_OrthoProjection_doc[] = ".. classmethod:: OrthoProjection(plane, size, axis)\n" @@ -460,16 +460,16 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; if(!PyArg_ParseTuple(args, "si|O!", &plane, &matSize, &vector_Type, &vec)) { - PyErr_SetString(PyExc_TypeError, "mathutils.OrthoProjectionMatrix(): expected string and int and optional vector\n"); + PyErr_SetString(PyExc_TypeError, "mathutils.Matrix.OrthoProjection(): expected string and int and optional vector\n"); return NULL; } if(matSize != 2 && matSize != 3 && matSize != 4) { - PyErr_SetString(PyExc_AttributeError,"mathutils.OrthoProjectionMatrix(): can only return a 2x2 3x3 or 4x4 matrix\n"); + PyErr_SetString(PyExc_AttributeError,"mathutils.Matrix.OrthoProjection(): can only return a 2x2 3x3 or 4x4 matrix\n"); return NULL; } if(vec) { if(vec->size > 2 && matSize == 2) { - PyErr_SetString(PyExc_AttributeError, "mathutils.OrthoProjectionMatrix(): please use 2D vectors when scaling in 2D\n"); + PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.OrthoProjection(): please use 2D vectors when scaling in 2D\n"); return NULL; } @@ -492,7 +492,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) mat[4] = 1.0f; mat[8] = 1.0f; } else { - PyErr_SetString(PyExc_AttributeError, "mathutils.OrthoProjectionMatrix(): unknown plane - expected: X, Y, XY, XZ, YZ\n"); + PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.OrthoProjection(): unknown plane - expected: X, Y, XY, XZ, YZ\n"); return NULL; } } else { //arbitrary plane @@ -520,7 +520,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) mat[7] = -(vec->vec[1] * vec->vec[2]); mat[8] = 1 - (vec->vec[2] * vec->vec[2]); } else { - PyErr_SetString(PyExc_AttributeError, "mathutils.OrthoProjectionMatrix(): unknown plane - expected: 'r' expected for axis designation\n"); + PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.OrthoProjection(): unknown plane - expected: 'r' expected for axis designation\n"); return NULL; } } @@ -562,11 +562,11 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args) 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; if(!PyArg_ParseTuple(args, "sfi", &plane, &factor, &matSize)) { - PyErr_SetString(PyExc_TypeError,"mathutils.ShearMatrix(): expected string float and int\n"); + PyErr_SetString(PyExc_TypeError,"mathutils.Matrix.Shear(): expected string float and int\n"); return NULL; } if(matSize != 2 && matSize != 3 && matSize != 4) { - PyErr_SetString(PyExc_AttributeError,"mathutils.ShearMatrix(): can only return a 2x2 3x3 or 4x4 matrix\n"); + PyErr_SetString(PyExc_AttributeError,"mathutils.Matrix.Shear(): can only return a 2x2 3x3 or 4x4 matrix\n"); return NULL; } @@ -597,7 +597,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args) mat[4] = 1.0f; mat[8] = 1.0f; } else { - PyErr_SetString(PyExc_AttributeError, "mathutils.ShearMatrix(): expected: x, y, xy, xz, yz or wrong matrix size for shearing plane\n"); + PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.Shear(): expected: x, y, xy, xz, yz or wrong matrix size for shearing plane\n"); return NULL; } if(matSize == 4) { -- cgit v1.2.3