[Bf-blender-cvs] [41a2b97] master: Minor changes needed for standalone mathutils

Campbell Barton noreply at git.blender.org
Mon Dec 7 01:19:05 CET 2015


Commit: 41a2b97c30ecf3c0d67303b7a27419bf31bf5e4f
Author: Campbell Barton
Date:   Mon Dec 7 11:07:26 2015 +1100
Branches: master
https://developer.blender.org/rB41a2b97c30ecf3c0d67303b7a27419bf31bf5e4f

Minor changes needed for standalone mathutils

===================================================================

M	source/blender/blenlib/intern/math_matrix.c
M	source/blender/python/generic/py_capi_utils.c

===================================================================

diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 19d1169..52ff6fd 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -1569,6 +1569,7 @@ void mat4_decompose(float loc[3], float quat[4], float size[3], float wmat[4][4]
  *
  * See https://en.wikipedia.org/wiki/Polar_decomposition for more.
  */
+#ifndef MATH_STANDALONE
 void mat3_polar_decompose(float mat3[3][3], float r_U[3][3], float r_P[3][3])
 {
 	/* From svd decomposition (M = WSV*), we have:
@@ -1586,7 +1587,7 @@ void mat3_polar_decompose(float mat3[3][3], float r_U[3][3], float r_P[3][3])
 	mul_m3_m3m3(r_U, W, Vt);
 	mul_m3_series(r_P, V, S, Vt);
 }
-
+#endif
 
 void scale_m3_fl(float m[3][3], float scale)
 {
@@ -1727,6 +1728,8 @@ void blend_m4_m4m4(float out[4][4], float dst[4][4], float src[4][4], const floa
 	loc_quat_size_to_mat4(out, floc, fquat, fsize);
 }
 
+/* for builds without Eigen */
+#ifndef MATH_STANDALONE
 /**
  * A polar-decomposition-based interpolation between matrix A and matrix B.
  *
@@ -1795,6 +1798,7 @@ void interp_m4_m4m4(float R[4][4], float A[4][4], float B[4][4], const float t)
 	copy_m4_m3(R, R3);
 	copy_v3_v3(R[3], loc);
 }
+#endif  /* MATH_STANDALONE */
 
 bool is_negative_m3(float mat[3][3])
 {
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index f2e48cb..89c3ed2 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -38,8 +38,10 @@
 
 #include "python_utildefines.h"
 
+#ifndef MATH_STANDALONE
 /* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */
 #include "BLI_string_utf8.h"
+#endif
 
 #ifdef _WIN32
 #include "BLI_path_util.h"  /* BLI_setenv() */
@@ -199,6 +201,27 @@ void PyC_List_Fill(PyObject *list, PyObject *value)
 	}
 }
 
+/**
+ * Use with PyArg_ParseTuple's "O&" formatting.
+ */
+int PyC_ParseBool(PyObject *o, void *p)
+{
+	bool *bool_p = p;
+	long value;
+	if (((value = PyLong_AsLong(o)) == -1) || !ELEM(value, 0, 1)) {
+		PyErr_Format(PyExc_ValueError,
+		             "expected a bool or int (0/1), got %s",
+		             Py_TYPE(o)->tp_name);
+		return 0;
+	}
+
+	*bool_p = value ? true : false;
+	return 1;
+}
+
+
+#ifndef MATH_STANDALONE
+
 /* for debugging */
 void PyC_ObSpit(const char *name, PyObject *var)
 {
@@ -1016,20 +1039,4 @@ int PyC_RunString_AsNumber(const char *expr, double *value, const char *filename
 	return error_ret;
 }
 
-/**
- * Use with PyArg_ParseTuple's "O&" formatting.
- */
-int PyC_ParseBool(PyObject *o, void *p)
-{
-	bool *bool_p = p;
-	long value;
-	if (((value = PyLong_AsLong(o)) == -1) || !ELEM(value, 0, 1)) {
-		PyErr_Format(PyExc_ValueError,
-		             "expected a bool or int (0/1), got %s",
-		             Py_TYPE(o)->tp_name);
-		return 0;
-	}
-
-	*bool_p = value ? true : false;
-	return 1;
-}
+#endif  /* #ifndef MATH_STANDALONE */




More information about the Bf-blender-cvs mailing list