style cleanup: if's on the same line.

This commit is contained in:
2012-11-18 02:41:55 +00:00
parent b867f9f17e
commit 973cb29d84
9 changed files with 46 additions and 28 deletions

View File

@@ -1591,13 +1591,17 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
if ((dx == 0) && (dy == 0)) break;
/* Quadratic acceleration */
dx = dx*(fabs(dx)+0.5);
if (dx<0.0) dx-=0.5; else dx+=0.5;
if (dx< -deltaMax) dx= -deltaMax; else if (dx>deltaMax) dx=deltaMax;
dx = dx*(fabs(dx) + 0.5);
if (dx < 0.0) dx -= 0.5;
else dx += 0.5;
if (dx < -deltaMax) dx = -deltaMax;
else if (dx > deltaMax) dx = deltaMax;
dy = dy*(fabs(dy)+0.5);
if (dy<0.0) dy-=0.5; else dy+=0.5;
if (dy< -deltaMax) dy= -deltaMax; else if (dy>deltaMax) dy=deltaMax;
dy = dy*(fabs(dy) + 0.5);
if (dy < 0.0) dy -= 0.5;
else dy += 0.5;
if (dy < -deltaMax) dy= -deltaMax;
else if (dy > deltaMax) dy= deltaMax;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
dy = -dy;

View File

@@ -98,7 +98,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf
buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
rowstride = movie->header->Width * 3;
if (bits != 16) if (movie->header->Width % 2) rowstride++;
if ((bits != 16) && (movie->header->Width % 2)) rowstride++;
for (y = 0; y < movie->header->Height; y++) {
memcpy(&buf[y * movie->header->Width * 3], &buffer[((movie->header->Height - 1) - y) * rowstride], movie->header->Width * 3);

View File

@@ -1116,7 +1116,7 @@ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *
*fp = basisu[i] * bp->vec[3];
sumdiv += *fp;
}
if (sumdiv != 0.0f) if (sumdiv < 0.999f || sumdiv > 1.001f) {
if ((sumdiv != 0.0f) && (sumdiv < 0.999f || sumdiv > 1.001f)) {
/* is normalizing needed? */
fp = sum;
for (i = istart; i <= iend; i++, fp++) {

View File

@@ -1520,7 +1520,9 @@ void test_idbutton(char *name)
/* search for id */
idtest = BLI_findstring(lb, name, offsetof(ID, name) + 2);
if (idtest) if (new_id(lb, idtest, name) == 0) id_sort_by_name(lb, idtest);
if (idtest && (new_id(lb, idtest, name) == 0)) {
id_sort_by_name(lb, idtest);
}
}
void text_idbutton(struct ID *id, char *text)

View File

@@ -3786,14 +3786,22 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co
return 1;
}
#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \
if ((event & mtex->mapto) & type) { pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } (void)0
#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \
if ((event & mtex->mapto) & type) { \
pvalue = texture_value_blend(def, pvalue, value, texfac, blend); \
} (void)0
#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \
if (event & type) { if (pvalue < 0.0f) pvalue = 1.0f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } (void)0
#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \
if (event & type) { \
if (pvalue < 0.0f) \
pvalue = 1.0f + pvalue; \
CLAMP(pvalue, 0.0f, 1.0f); \
} (void)0
#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \
if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } (void)0
#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \
if (event & type) { \
CLAMP(pvalue, -1.0f, 1.0f); \
} (void)0
static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra)
{
@@ -3802,8 +3810,8 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
float value, rgba[4], texvec[3];
ptex->ivel = ptex->life = ptex->exist = ptex->size = ptex->damp =
ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink =
ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.f;
ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink =
ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.0f;
ptex->length = 1.0f - part->randlength * PSYS_FRAND(child_index + 26);
ptex->length *= part->clength_thres < PSYS_FRAND(child_index + 27) ? part->clength : 1.0f;

View File

@@ -398,7 +398,8 @@ static float orgBlenderNoise(float x, float y, float z)
h = hashvectf + 3 * hash[b21 + b11];
n += i * (h[0] * jx + h[1] * jy + h[2] * jz);
if (n < 0.0f) n = 0.0f; else if (n > 1.0f) n = 1.0f;
if (n < 0.0f) n = 0.0f;
else if (n > 1.0f) n = 1.0f;
return n;
}
@@ -1890,7 +1891,8 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity
y *= lacunarity;
z *= lacunarity;
weight = signal * gain;
if (weight > 1.0f) weight = 1.0f; else if (weight < 0.0f) weight = 0.0f;
if (weight > 1.0f) weight = 1.0f;
else if (weight < 0.0f) weight = 0.0f;
signal = offset - fabsf(noisefunc(x, y, z));
signal *= signal;
signal *= weight;

View File

@@ -3678,10 +3678,12 @@ static int is_u_selected(Nurb *nu, int u)
/* what about resolu == 2? */
bp = &nu->bp[u];
for (v = 0; v < nu->pntsv - 1; v++, bp += nu->pntsu) {
if (v) if (bp->f1 & SELECT) return 1;
if ((v != 0) && (bp->f1 & SELECT)) {
return TRUE;
}
}
return 0;
return FALSE;
}
typedef struct NurbSort {
@@ -6464,7 +6466,7 @@ Nurb *add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4], int type
bp->vec[0] += fac * grid;
fac = (float)b - 1.5f;
bp->vec[1] += fac * grid;
if (a == 1 || a == 2) if (b == 1 || b == 2) {
if ((a == 1 || a == 2) && (b == 1 || b == 2)) {
bp->vec[2] += grid;
}
mul_m4_v3(mat, bp->vec);

View File

@@ -1409,8 +1409,8 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
dir1 &= (UI_TOP | UI_DOWN);
}
if (dir2 == 0) if (dir1 == UI_LEFT || dir1 == UI_RIGHT) dir2 = UI_DOWN;
if (dir2 == 0) if (dir1 == UI_TOP || dir1 == UI_DOWN) dir2 = UI_LEFT;
if ((dir2 == 0) && (dir1 == UI_LEFT || dir1 == UI_RIGHT)) dir2 = UI_DOWN;
if ((dir2 == 0) && (dir1 == UI_TOP || dir1 == UI_DOWN)) dir2 = UI_LEFT;
/* no space at all? don't change */
if (left || right) {

View File

@@ -1467,10 +1467,10 @@ struct ImBuf *IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int
return ibuf;
}
if (newx < ibuf->x) if (newx) scaledownx(ibuf, newx);
if (newy < ibuf->y) if (newy) scaledowny(ibuf, newy);
if (newx > ibuf->x) if (newx) scaleupx(ibuf, newx);
if (newy > ibuf->y) if (newy) scaleupy(ibuf, newy);
if (newx && (newx < ibuf->x)) scaledownx(ibuf, newx);
if (newy && (newy < ibuf->y)) scaledowny(ibuf, newy);
if (newx && (newx > ibuf->x)) scaleupx(ibuf, newx);
if (newy && (newy > ibuf->y)) scaleupy(ibuf, newy);
return(ibuf);
}