From a6e8137983d74ebff785ee134f635e1a08f58237 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 30 Mar 2014 13:03:30 +1100 Subject: Convenience macro for print_ funcs, saves passing id each time --- source/blender/blenlib/BLI_math_matrix.h | 3 +++ source/blender/blenlib/BLI_math_rotation.h | 2 ++ source/blender/blenlib/BLI_math_vector.h | 5 +++++ source/blender/blenlib/BLI_rect.h | 3 +++ 4 files changed, 13 insertions(+) diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index e59c557b327..e3d9e40d272 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -215,6 +215,9 @@ bool is_zero_m4(float mat[4][4]); void print_m3(const char *str, float M[3][3]); void print_m4(const char *str, float M[3][4]); +#define print_m3_id(M) print_m3(STRINGIFY(M), M) +#define print_m4_id(M) print_m4(STRINGIFY(M), M) + #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index 477b3280d09..eb4579887f7 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -97,6 +97,8 @@ void mat3_to_quat_is_ok(float q[4], float mat[3][3]); /* other */ void print_qt(const char *str, const float q[4]); +#define print_qt_id(q) print_qt(STRINGIFY(q), q) + /******************************** Axis Angle *********************************/ /* conversion */ diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 9b73ca553d6..e6e46a4d8cd 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -266,6 +266,11 @@ void print_v3(const char *str, const float a[3]); void print_v4(const char *str, const float a[4]); void print_vn(const char *str, const float v[], const int n); +#define print_v2_id(v) print_v2(STRINGIFY(v), v) +#define print_v3_id(v) print_v3(STRINGIFY(v), v) +#define print_v4_id(v) print_v4(STRINGIFY(v), v) +#define print_vn_id(v, n) print_vn(STRINGIFY(v), v, n) + MINLINE void normal_short_to_float_v3(float r[3], const short n[3]); MINLINE void normal_float_to_short_v3(short r[3], const float n[3]); diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index b86a5bc51b0..a132ac40206 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -92,6 +92,9 @@ void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src); void print_rctf(const char *str, const struct rctf *rect); void print_rcti(const char *str, const struct rcti *rect); +#define print_rctf_id(rect) print_rctf(STRINGIFY(rect), rect) +#define print_rcti_id(rect) print_rcti(STRINGIFY(rect), rect) + BLI_INLINE float BLI_rcti_cent_x_fl(const struct rcti *rct) { return (float)(rct->xmin + rct->xmax) / 2.0f; } BLI_INLINE float BLI_rcti_cent_y_fl(const struct rcti *rct) { return (float)(rct->ymin + rct->ymax) / 2.0f; } BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct) { return (rct->xmin + rct->xmax) / 2; } -- cgit v1.2.3