From 1b76c638ad4a438028c3b76a67f22b7c0fec1ea6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 26 Jun 2014 16:09:59 +1000 Subject: Code cleanup: remove MAT3/4_UNITY defines, just call unit_m3/4 --- source/blender/blenkernel/intern/constraint.c | 7 +++++-- source/blender/blenlib/BLI_math_matrix.h | 13 ------------- source/blender/editors/curve/editcurve_add.c | 5 ++++- source/blender/editors/interface/interface_draw.c | 4 +++- source/blender/editors/physics/particle_edit.c | 9 +++++++-- 5 files changed, 19 insertions(+), 19 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index a2fb06e9797..b27655c8c19 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1158,7 +1158,6 @@ static void followpath_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVE)) { Curve *cu = ct->tar->data; float vec[4], dir[3], radius; - float totmat[4][4] = MAT4_UNITY; float curvetime; unit_m4(ct->matrix); @@ -1206,6 +1205,9 @@ static void followpath_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra } if (where_on_path(ct->tar, curvetime, vec, dir, (data->followflag & FOLLOWPATH_FOLLOW) ? quat : NULL, &radius, NULL) ) { /* quat_pt is quat or NULL*/ + float totmat[4][4]; + unit_m4(totmat); + if (data->followflag & FOLLOWPATH_FOLLOW) { #if 0 float x1, q[4]; @@ -3039,11 +3041,12 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVE)) { float obmat[4][4], ownLoc[3]; float curveMin[3], curveMax[3]; - float targetMatrix[4][4] = MAT4_UNITY; + float targetMatrix[4][4]; copy_m4_m4(obmat, cob->matrix); copy_v3_v3(ownLoc, obmat[3]); + unit_m4(targetMatrix); INIT_MINMAX(curveMin, curveMax); /* XXX - don't think this is good calling this here - campbell */ BKE_object_minmax(ct->tar, curveMin, curveMax, true); diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index d149ad73b04..49183934412 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -36,19 +36,6 @@ extern "C" { /********************************* Init **************************************/ -#define MAT4_UNITY { \ - { 1.0, 0.0, 0.0, 0.0}, \ - { 0.0, 1.0, 0.0, 0.0}, \ - { 0.0, 0.0, 1.0, 0.0}, \ - { 0.0, 0.0, 0.0, 1.0} \ -} - -#define MAT3_UNITY { \ - { 1.0, 0.0, 0.0}, \ - { 0.0, 1.0, 0.0}, \ - { 0.0, 0.0, 1.0} \ -} - void zero_m3(float R[3][3]); void zero_m4(float R[4][4]); diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c index 1cd690c29d6..8a3d4f3f4f5 100644 --- a/source/blender/editors/curve/editcurve_add.c +++ b/source/blender/editors/curve/editcurve_add.c @@ -115,7 +115,7 @@ Nurb *add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4], int type BPoint *bp; Curve *cu = (Curve *)obedit->data; float vec[3], zvec[3] = {0.0f, 0.0f, 1.0f}; - float umat[4][4] = MAT4_UNITY, viewmat[4][4] = MAT4_UNITY; + float umat[4][4], viewmat[4][4]; float fac; int a, b; const float grid = 1.0f; @@ -123,6 +123,9 @@ Nurb *add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4], int type const int stype = (type & CU_PRIMITIVE); const int force_3d = ((Curve *)obedit->data)->flag & CU_3D; /* could be adding to an existing 3D curve */ + unit_m4(umat); + unit_m4(viewmat); + if (rv3d) { copy_m4_m4(viewmat, rv3d->viewmat); copy_v3_v3(zvec, rv3d->viewinv[2]); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 47334d6f77c..cc9f8ff00a9 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -587,7 +587,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), int i, c; float w, w3, h, alpha, yofs; GLint scissor[4]; - float colors[3][3] = MAT3_UNITY; + float colors[3][3]; float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}}; float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */ float min, max; @@ -609,6 +609,8 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), /* log scale for alpha */ alpha = scopes->wavefrm_alpha * scopes->wavefrm_alpha; + unit_m3(colors); + for (c = 0; c < 3; c++) { for (i = 0; i < 3; i++) { colors_alpha[c][i] = colors[c][i] * alpha; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 3c6bdf86a50..5432f059405 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -616,7 +616,10 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected ParticleSystemModifierData *psmd = NULL; ParticleEditSettings *pset= PE_settings(data->scene); POINT_P; KEY_K; - float mat[4][4] = MAT4_UNITY, imat[4][4] = MAT4_UNITY; + float mat[4][4], imat[4][4]; + + unit_m4(mat); + unit_m4(imat); if (edit->psys) psmd= psys_get_modifier(data->ob, edit->psys); @@ -1710,11 +1713,13 @@ int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, bool ParticleSystem *psys = edit->psys; ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); POINT_P; KEY_K; - float co[3], mat[4][4] = MAT4_UNITY; + float co[3], mat[4][4]; int screen_co[2]; PEData data; + unit_m4(mat); + if (!PE_start_edit(edit)) return OPERATOR_CANCELLED; -- cgit v1.2.3