From 5d2e4bb87e6d3db0a7978dd3bd3ec573a52c4ae9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 6 Sep 2012 01:31:15 +0000 Subject: code cleanup: capitalize defines. --- source/blender/blenkernel/BKE_shrinkwrap.h | 6 +++--- source/blender/blenkernel/intern/shrinkwrap.c | 4 ++-- source/blender/editors/curve/editcurve.c | 14 +++++++------- source/blender/editors/screen/glutil.c | 6 +++--- source/blender/modifiers/intern/MOD_weightvgproximity.c | 2 +- source/gameengine/Expressions/PyObjectPlus.cpp | 4 ++-- source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 10 +++++----- source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h | 6 +++--- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h index a7b03cef933..d1332ba937e 100644 --- a/source/blender/blenkernel/BKE_shrinkwrap.h +++ b/source/blender/blenkernel/BKE_shrinkwrap.h @@ -52,7 +52,7 @@ struct DerivedMesh *object_get_derived_final(struct Object *ob); * the matrix calculation. * * A SpaceTransform is initialized using: - * space_transform_setup( &data, ob1, ob2 ) + * SPACE_TRANSFORM_SETUP( &data, ob1, ob2 ) * * After that the following calls can be used: * space_transform_apply (&data, co); //converts a coordinate in ob1 coords space to the corresponding ob2 coords @@ -75,7 +75,7 @@ void space_transform_from_matrixs(struct SpaceTransform *data, float local[4][4] void space_transform_apply(const struct SpaceTransform *data, float co[3]); void space_transform_invert(const struct SpaceTransform *data, float co[3]); -#define space_transform_setup(data, local, target) space_transform_from_matrixs(data, (local)->obmat, (target)->obmat) +#define SPACE_TRANSFORM_SETUP(data, local, target) space_transform_from_matrixs(data, (local)->obmat, (target)->obmat) /* Shrinkwrap stuff */ #include "BKE_bvhutils.h" @@ -126,7 +126,7 @@ void shrinkwrapModifier_deform(struct ShrinkwrapModifierData *smd, struct Object /* * This function casts a ray in the given BVHTree.. but it takes into consideration the space_transform, that is: * - * if transf was configured with "space_transform_setup( &transf, ob1, ob2 )" + * if transf was configured with "SPACE_TRANSFORM_SETUP( &transf, ob1, ob2 )" * then the input (vert, dir, BVHTreeRayHit) must be defined in ob1 coordinates space * and the BVHTree must be built in ob2 coordinate space. * diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index f9399946570..9a8bcaabe0c 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -313,7 +313,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) auxMesh = object_get_derived_final(calc->smd->auxTarget); if (!auxMesh) return; - space_transform_setup(&local2aux, calc->ob, calc->smd->auxTarget); + SPACE_TRANSFORM_SETUP(&local2aux, calc->ob, calc->smd->auxTarget); } //After sucessufuly build the trees, start projection vertexs @@ -500,7 +500,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM //TODO there might be several "bugs" on non-uniform scales matrixs //because it will no longer be nearest surface, not sphere projection //because space has been deformed - space_transform_setup(&calc.local2target, ob, smd->target); + SPACE_TRANSFORM_SETUP(&calc.local2target, ob, smd->target); //TODO: smd->keepDist is in global units.. must change to local calc.keepDist = smd->keepDist; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index e2d15897233..d780429784f 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -107,7 +107,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short selstatus); /* still need to eradicate a few :( */ -#define callocstructN(x, y, name) (x *)MEM_callocN((y) * sizeof(x), name) +#define CALLOC_STRUCT_N(x, y, name) (x *)MEM_callocN((y) * sizeof(x), name) static float nurbcircle[8][2] = { {0.0, -1.0}, {-1.0, -1.0}, {-1.0, 0.0}, {-1.0, 1.0}, @@ -6265,7 +6265,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) nu->pntsu = 4; nu->pntsv = 1; nu->orderu = 4; - nu->bp = callocstructN(BPoint, 4, "addNurbprim3"); + nu->bp = CALLOC_STRUCT_N(BPoint, 4, "addNurbprim3"); bp = nu->bp; for (a = 0; a < 4; a++, bp++) { @@ -6301,7 +6301,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) nu->orderu = 5; nu->flagu = CU_NURB_ENDPOINT; /* endpoint */ nu->resolu = cu->resolu; - nu->bp = callocstructN(BPoint, 5, "addNurbprim3"); + nu->bp = CALLOC_STRUCT_N(BPoint, 5, "addNurbprim3"); bp = nu->bp; for (a = 0; a < 5; a++, bp++) { @@ -6334,7 +6334,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) if (cutype == CU_BEZIER) { if (!force_3d) nu->flag |= CU_2D; nu->pntsu = 4; - nu->bezt = callocstructN(BezTriple, 4, "addNurbprim1"); + nu->bezt = CALLOC_STRUCT_N(BezTriple, 4, "addNurbprim1"); nu->flagu = CU_NURB_CYCLIC; bezt = nu->bezt; @@ -6371,7 +6371,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) nu->pntsu = 8; nu->pntsv = 1; nu->orderu = 4; - nu->bp = callocstructN(BPoint, 8, "addNurbprim6"); + nu->bp = CALLOC_STRUCT_N(BPoint, 8, "addNurbprim6"); nu->flagu = CU_NURB_CYCLIC; bp = nu->bp; @@ -6404,7 +6404,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) nu->orderu = 4; nu->orderv = 4; nu->flag = CU_SMOOTH; - nu->bp = callocstructN(BPoint, 4 * 4, "addNurbprim6"); + nu->bp = CALLOC_STRUCT_N(BPoint, 4 * 4, "addNurbprim6"); nu->flagu = 0; nu->flagv = 0; bp = nu->bp; @@ -6471,7 +6471,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) nu->resolu = cu->resolu; nu->resolv = cu->resolv; nu->flag = CU_SMOOTH; - nu->bp = callocstructN(BPoint, 5, "addNurbprim6"); + nu->bp = CALLOC_STRUCT_N(BPoint, 5, "addNurbprim6"); nu->flagu = 0; bp = nu->bp; diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 967c6e85590..c93f4156eeb 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -298,13 +298,13 @@ void setlinestyle(int nr) /* Invert line handling */ -#define gl_toggle(mode, onoff) (((onoff) ? glEnable : glDisable)(mode)) +#define GL_TOGGLE(mode, onoff) (((onoff) ? glEnable : glDisable)(mode)) void set_inverted_drawing(int enable) { glLogicOp(enable ? GL_INVERT : GL_COPY); - gl_toggle(GL_COLOR_LOGIC_OP, enable); - gl_toggle(GL_DITHER, !enable); + GL_TOGGLE(GL_COLOR_LOGIC_OP, enable); + GL_TOGGLE(GL_DITHER, !enable); } void sdrawXORline(int x0, int y0, int x1, int y1) diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index d5deb50e1f9..22b1e33e2a6 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -474,7 +474,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der float *dists_e = use_trgt_edges ? MEM_mallocN(sizeof(float) * numIdx, "dists_e") : NULL; float *dists_f = use_trgt_faces ? MEM_mallocN(sizeof(float) * numIdx, "dists_f") : NULL; - space_transform_setup(&loc2trgt, ob, obr); + SPACE_TRANSFORM_SETUP(&loc2trgt, ob, obr); get_vert2geom_distance(numIdx, v_cos, dists_v, dists_e, dists_f, target_dm, &loc2trgt); for (i = 0; i < numIdx; i++) { diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index 5347aaafc65..a35cb4f9f69 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -262,7 +262,7 @@ PyMethodDef PyObjectPlus::Methods[] = { {NULL, NULL} /* Sentinel */ }; -#define attr_invalid (&(PyObjectPlus::Attributes[0])) +#define BGE_PY_ATTR_INVALID (&(PyObjectPlus::Attributes[0])) PyAttributeDef PyObjectPlus::Attributes[] = { KX_PYATTRIBUTE_RO_FUNCTION("invalid", PyObjectPlus, pyattr_get_invalid), {NULL} //Sentinel @@ -281,7 +281,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef * PyObjectPlus *ref= (BGE_PROXY_REF(self_py)); char* ptr = (attrdef->m_usePtr) ? (char*)BGE_PROXY_PTR(self_py) : (char*)ref; if (ptr == NULL || (BGE_PROXY_PYREF(self_py) && (ref==NULL || !ref->py_is_valid()))) { - if (attrdef == attr_invalid) + if (attrdef == BGE_PY_ATTR_INVALID) Py_RETURN_TRUE; // don't bother running the function PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG); diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index ea4ac1e150b..48fa3257d20 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -81,7 +81,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) return NULL; #else /* WITH_SDL */ if (joyindex < 0 || joyindex >= JOYINDEX_MAX) { - echo("Error-invalid joystick index: " << joyindex); + ECHO("Error-invalid joystick index: " << joyindex); return NULL; } @@ -96,7 +96,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) # else if (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ) { # endif - echo("Error-Initializing-SDL: " << SDL_GetError()); + ECHO("Error-Initializing-SDL: " << SDL_GetError()); return NULL; } @@ -242,7 +242,7 @@ bool SCA_Joystick::CreateJoystickDevice(void) if (m_isinit == false) { if (m_joyindex>=m_joynum) { // don't print a message, because this is done anyway - //echo("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)"); + //ECHO("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)"); // Need this so python args can return empty lists m_axismax = m_buttonmax = m_hatmax = 0; @@ -253,7 +253,7 @@ bool SCA_Joystick::CreateJoystickDevice(void) SDL_JoystickEventState(SDL_ENABLE); m_isinit = true; - echo("Joystick " << m_joyindex << " initialized"); + ECHO("Joystick " << m_joyindex << " initialized"); /* must run after being initialized */ m_axismax = SDL_JoystickNumAxes(m_private->m_joystick); @@ -279,7 +279,7 @@ void SCA_Joystick::DestroyJoystickDevice(void) #ifdef WITH_SDL if (m_isinit) { if (SDL_JoystickOpened(m_joyindex)) { - echo("Closing-joystick " << m_joyindex); + ECHO("Closing-joystick " << m_joyindex); SDL_JoystickClose(m_private->m_joystick); } m_isinit = false; diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h b/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h index 45766eb9057..148bdd0962e 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h +++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h @@ -37,10 +37,10 @@ #endif #ifndef _DEBUG -#define echo(x) +# define ECHO(x) #else -#include -#define echo(x) std::cout << x << std::endl; +# include +# define ECHO(x) std::cout << x << std::endl; #endif #define JOYINDEX_MAX 8 -- cgit v1.2.3