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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-03-25 12:20:19 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-03-25 12:20:19 +0400
commit3b711a6ed009b35bb69cd0ca878eeb8d55fa0e77 (patch)
treeb3fdb366cb49bdea5b57dfa6ba4a82635c68d0ee /source/blender/python/mathutils/mathutils.c
parenta2ebfc82dbe954acc432ae017ac62a30a11b6a16 (diff)
parente99a23fc6b33b5097eab44aac19c2a089ddebce6 (diff)
Merged changes in the trunk up to revision 45133.
Conflicts resolved: source/blender/blenloader/intern/readfile.c source/blender/blenloader/intern/writefile.c source/blender/bmesh/intern/bmesh_construct.c source/blender/bmesh/intern/bmesh_mesh_conv.c source/blender/bmesh/intern/bmesh_mesh_conv.h source/blender/editors/interface/interface_templates.c source/blender/editors/interface/resources.c source/blender/editors/mesh/bmesh_select.c source/blender/editors/mesh/bmesh_tools.c source/blender/editors/space_view3d/drawobject.c source/blender/render/intern/source/shadeoutput.c
Diffstat (limited to 'source/blender/python/mathutils/mathutils.c')
-rw-r--r--source/blender/python/mathutils/mathutils.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 8e4d3955c80..ff551206fae 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -52,8 +52,8 @@ static int mathutils_array_parse_fast(float *array,
i = size;
do {
i--;
- if ( ((array[i] = PyFloat_AsDouble((item = PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
- PyErr_Occurred())
+ if (((array[i] = PyFloat_AsDouble((item = PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
+ PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"%.200s: sequence index %d expected a number, "
@@ -75,10 +75,10 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *
#if 1 /* approx 6x speedup for mathutils types */
- if ( (size = VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
- (size = EulerObject_Check(value) ? 3 : 0) ||
- (size = QuaternionObject_Check(value) ? 4 : 0) ||
- (size = ColorObject_Check(value) ? 3 : 0))
+ if ((size = VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
+ (size = EulerObject_Check(value) ? 3 : 0) ||
+ (size = QuaternionObject_Check(value) ? 4 : 0) ||
+ (size = ColorObject_Check(value) ? 3 : 0))
{
if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
@@ -139,10 +139,10 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c
#if 1 /* approx 6x speedup for mathutils types */
- if ( (size = VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
- (size = EulerObject_Check(value) ? 3 : 0) ||
- (size = QuaternionObject_Check(value) ? 4 : 0) ||
- (size = ColorObject_Check(value) ? 3 : 0))
+ if ((size = VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
+ (size = EulerObject_Check(value) ? 3 : 0) ||
+ (size = QuaternionObject_Check(value) ? 4 : 0) ||
+ (size = ColorObject_Check(value) ? 3 : 0))
{
if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
@@ -284,18 +284,21 @@ PyObject *mathutils_dynstr_to_py(struct DynStr *ds)
/* Mathutils Callbacks */
/* for mathutils internal use only, eventually should re-alloc but to start with we only have a few users */
-static Mathutils_Callback *mathutils_callbacks[8] = {NULL};
+#define MATHUTILS_TOT_CB 8
+static Mathutils_Callback *mathutils_callbacks[MATHUTILS_TOT_CB] = {NULL};
-int Mathutils_RegisterCallback(Mathutils_Callback *cb)
+unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb)
{
- int i;
+ unsigned char i;
/* find the first free slot */
for (i = 0; mathutils_callbacks[i]; i++) {
if (mathutils_callbacks[i] == cb) /* already registered? */
return i;
}
-
+
+ BLI_assert(i < MATHUTILS_TOT_CB);
+
mathutils_callbacks[i] = cb;
return i;
}