style cleanup: multi-line if statements.

This commit is contained in:
Campbell Barton 2012-04-21 15:11:03 +00:00
parent 8765dfccf7
commit b56aabf815
45 changed files with 213 additions and 168 deletions

View File

@ -424,17 +424,18 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges
else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
int prevstart = 0;
int prevdraw = 1;
int draw = 1;
int draw = TRUE;
GPU_edge_setup(dm);
if ( !GPU_buffer_legacy(dm) ) {
if (!GPU_buffer_legacy(dm)) {
for (i = 0; i < dm->numEdgeData; i++, medge++) {
if ((drawAllEdges || (medge->flag&ME_EDGEDRAW))
&& (drawLooseEdges || !(medge->flag&ME_LOOSEEDGE))) {
draw = 1;
if ((drawAllEdges || (medge->flag & ME_EDGEDRAW)) &&
(drawLooseEdges || !(medge->flag & ME_LOOSEEDGE)))
{
draw = TRUE;
}
else {
draw = 0;
draw = FALSE;
}
if ( prevdraw != draw ) {
if ( prevdraw > 0 && (i-prevstart) > 0 ) {
@ -539,8 +540,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
new_matnr = mface->mat_nr + 1;
new_shademodel = (mface->flag & ME_SMOOTH)?GL_SMOOTH:GL_FLAT;
if (new_glmode != glmode || new_matnr != matnr
|| new_shademodel != shademodel) {
if (new_glmode != glmode || new_matnr != matnr || new_shademodel != shademodel) {
glEnd();
drawCurrentMat = setMaterial(matnr = new_matnr, NULL);

View File

@ -446,9 +446,9 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
BKE_ptcache_id_time(&pid, scene, framenr, &startframe, &endframe, &timescale);
clmd->sim_parms->timescale= timescale;
if (clmd->sim_parms->reset
|| (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0)
|| (clmd->clothObject && dm->getNumVerts(dm) != clmd->clothObject->numverts))
if (clmd->sim_parms->reset ||
(framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0) ||
(clmd->clothObject && dm->getNumVerts(dm) != clmd->clothObject->numverts))
{
clmd->sim_parms->reset = 0;
cache->flag |= PTCACHE_OUTDATED;
@ -1176,8 +1176,8 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
// check for existing spring
// check also if startpoint is equal to endpoint
if ( !BLI_edgehash_haskey ( edgehash, MIN2(tspring2->ij, index2), MAX2(tspring2->ij, index2) )
&& ( index2!=tspring2->ij ) )
if (!BLI_edgehash_haskey(edgehash, MIN2(tspring2->ij, index2), MAX2(tspring2->ij, index2)) &&
(index2 != tspring2->ij))
{
spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );

View File

@ -2502,8 +2502,8 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
{
if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
&& ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) &&
( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
{
continue;
}

View File

@ -1810,9 +1810,9 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
/* find the first dest layer with type >= the source type
* (this should work because layers are ordered by type)
*/
while (dest_i < dest->totlayer
&& dest->layers[dest_i].type < source->layers[src_i].type)
while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
++dest_i;
}
/* if there are no more dest layers, we're done */
if (dest_i >= dest->totlayer) return;
@ -1901,9 +1901,9 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
/* find the first dest layer with type >= the source type
* (this should work because layers are ordered by type)
*/
while (dest_i < dest->totlayer
&& dest->layers[dest_i].type < source->layers[src_i].type)
while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
++dest_i;
}
/* if there are no more dest layers, we're done */
if (dest_i >= dest->totlayer) return;
@ -2272,9 +2272,9 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
/* find the first dest layer with type >= the source type
* (this should work because layers are ordered by type)
*/
while (dest_i < dest->totlayer
&& dest->layers[dest_i].type < source->layers[src_i].type)
while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
++dest_i;
}
/* if there are no more dest layers, we're done */
if (dest_i >= dest->totlayer) return;
@ -2504,9 +2504,9 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
/* find the first dest layer with type >= the source type
* (this should work because layers are ordered by type)
*/
while (dest_i < dest->totlayer
&& dest->layers[dest_i].type < source->layers[src_i].type)
while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
++dest_i;
}
/* if there are no more dest layers, we're done */
if (dest_i >= dest->totlayer) return;
@ -2547,9 +2547,9 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
/* find the first dest layer with type >= the source type
* (this should work because layers are ordered by type)
*/
while (dest_i < dest->totlayer
&& dest->layers[dest_i].type < source->layers[src_i].type)
while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
++dest_i;
}
/* if there are no more dest layers, we're done */
if (dest_i >= dest->totlayer) return;

View File

@ -1844,8 +1844,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
BKE_ptcache_id_time(&pid, scene, (float)scene->r.cfra, NULL, NULL, NULL);
/* reset non-baked cache at first frame */
if ((int)scene->r.cfra == surface->start_frame && !(cache->flag & PTCACHE_BAKED))
{
if ((int)scene->r.cfra == surface->start_frame && !(cache->flag & PTCACHE_BAKED)) {
cache->flag |= PTCACHE_REDO_NEEDED;
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
cache->flag &= ~PTCACHE_REDO_NEEDED;
@ -1856,8 +1855,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
BKE_ptcache_validate(cache, (int)scene->r.cfra);
}
/* if read failed and we're on surface range do recalculate */
else if ((int)scene->r.cfra == current_frame
&& !(cache->flag & PTCACHE_BAKED)) {
else if ((int)scene->r.cfra == current_frame && !(cache->flag & PTCACHE_BAKED)) {
/* calculate surface frame */
canvas->flags |= MOD_DPAINT_BAKING;
dynamicPaint_calculateFrame(surface, scene, ob, current_frame);

View File

@ -1148,8 +1148,9 @@ int BKE_add_image_extension(char *string, const char imtype)
if (extension) {
/* prefer this in many cases to avoid .png.tga, but in certain cases it breaks */
/* remove any other known image extension */
if (BLI_testextensie_array(string, imb_ext_image)
|| (G.have_quicktime && BLI_testextensie_array(string, imb_ext_image_qt))) {
if (BLI_testextensie_array(string, imb_ext_image) ||
(G.have_quicktime && BLI_testextensie_array(string, imb_ext_image_qt)))
{
return BLI_replace_extension(string, FILE_MAX, extension);
}
else {

View File

@ -1260,8 +1260,8 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
/*
if (length>L)
{
if ((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)
&& ((((length-L)*100.0f/L) > clmd->sim_parms->maxspringlen))) // cut spring!
if ((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) &&
((((length-L)*100.0f/L) > clmd->sim_parms->maxspringlen))) // cut spring!
{
s->flags |= CSPRING_FLAG_DEACTIVATE;
return;

View File

@ -76,7 +76,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
types_init= 0;
}
/* type unsigned, no need to chech < 0 */
/* type unsigned, no need to check < 0 */
if (type < NUM_MODIFIER_TYPES && types[type]->name[0] != '\0') {
return types[type];
}

View File

@ -2631,9 +2631,11 @@ void object_handle_update(Scene *scene, Object *ob)
if (psys_check_enabled(ob, psys)) {
/* check use of dupli objects here */
if (psys->part && (psys->part->draw_as == PART_DRAW_REND || G.rendering) &&
((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob)
|| (psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group)))
((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob) ||
(psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group)))
{
ob->transflag |= OB_DUPLIPARTS;
}
particle_system_update(scene, ob, psys);
psys= psys->next;
@ -2664,9 +2666,11 @@ void object_handle_update(Scene *scene, Object *ob)
BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
for (pid=pidlist.first; pid; pid=pid->next) {
if ((pid->cache->flag & PTCACHE_BAKED)
|| (pid->cache->flag & PTCACHE_QUICK_CACHE)==0)
if ((pid->cache->flag & PTCACHE_BAKED) ||
(pid->cache->flag & PTCACHE_QUICK_CACHE) == 0)
{
continue;
}
if (pid->cache->flag & PTCACHE_OUTDATED || (pid->cache->flag & PTCACHE_SIMULATION_VALID)==0) {
scene->physics_settings.quick_cache_step =

View File

@ -4276,10 +4276,13 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
state->time = psys_get_child_time(psys, cpa, cfra, NULL, NULL);
if (!always)
if ((state->time < 0.0f && !(part->flag & PART_UNBORN))
|| (state->time > 1.0f && !(part->flag & PART_DIED)))
if (!always) {
if ((state->time < 0.0f && !(part->flag & PART_UNBORN)) ||
(state->time > 1.0f && !(part->flag & PART_DIED)))
{
return 0;
}
}
state->time= (cfra - (part->sta + (part->end - part->sta) * PSYS_FRAND(p + 23))) / (part->lifetime * PSYS_FRAND(p + 24));
@ -4296,10 +4299,13 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
}
if (pa) {
if (!always)
if ((cfra < pa->time && (part->flag & PART_UNBORN)==0)
|| (cfra > pa->dietime && (part->flag & PART_DIED)==0))
if (!always) {
if ((cfra < pa->time && (part->flag & PART_UNBORN) == 0) ||
(cfra > pa->dietime && (part->flag & PART_DIED) == 0))
{
return 0;
}
}
cfra = MIN2(cfra, pa->dietime);
}

View File

@ -126,10 +126,12 @@ static int psys_get_current_display_percentage(ParticleSystem *psys)
{
ParticleSettings *part=psys->part;
if ((psys->renderdata && !particles_are_dynamic(psys)) /* non-dynamic particles can be rendered fully */
|| (part->child_nbr && part->childtype) /* display percentage applies to children */
|| (psys->pointcache->flag & PTCACHE_BAKING)) /* baking is always done with full amount */
if ((psys->renderdata && !particles_are_dynamic(psys)) || /* non-dynamic particles can be rendered fully */
(part->child_nbr && part->childtype) || /* display percentage applies to children */
(psys->pointcache->flag & PTCACHE_BAKING)) /* baking is always done with full amount */
{
return 100;
}
return psys->part->disp;
}
@ -1862,9 +1864,11 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
/* and gravity in r_ve */
bpa->gravity[0] = bpa->gravity[1] = 0.0f;
bpa->gravity[2] = -1.0f;
if ((sim->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY)
&& sim->scene->physics_settings.gravity[2]!=0.0f)
if ((sim->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) &&
(sim->scene->physics_settings.gravity[2] != 0.0f))
{
bpa->gravity[2] = sim->scene->physics_settings.gravity[2];
}
bpa->data.health = part->boids->health;
bpa->data.mode = eBoidMode_InAir;
@ -2683,9 +2687,10 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
efdata.sim = sim;
/* add global acceleration (gravitation) */
if (psys_uses_gravity(sim)
if (psys_uses_gravity(sim) &&
/* normal gravity is too strong for hair so it's disabled by default */
&& (part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR)) {
(part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR))
{
zero_v3(gr);
madd_v3_v3fl(gr, sim->scene->physics_settings.gravity, part->effector_weights->global_gravity * efdata.ptex.gravity);
gravity = gr;
@ -3892,11 +3897,12 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
}
/* only reset unborn particles if they're shown or if the particle is born soon*/
if (pa->alive==PARS_UNBORN
&& (part->flag & PART_UNBORN || cfra + psys->pointcache->step > pa->time))
if (pa->alive==PARS_UNBORN && (part->flag & PART_UNBORN || (cfra + psys->pointcache->step > pa->time))) {
reset_particle(sim, pa, dtime, cfra);
else if (part->phystype == PART_PHYS_NO)
}
else if (part->phystype == PART_PHYS_NO) {
reset_particle(sim, pa, dtime, cfra);
}
if (ELEM(pa->alive, PARS_ALIVE, PARS_DYING)==0 || (pa->flag & (PARS_UNEXIST|PARS_NO_DISP)))
pa->state.time = -1.f;

View File

@ -821,9 +821,12 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p
if (psys->part->flag & PART_ROTATIONS) {
pid->data_types|= (1<<BPHYS_DATA_ROTATION);
if (psys->part->rotmode!=PART_ROT_VEL
|| psys->part->avemode==PART_AVE_RAND || psys->part->avefac!=0.0f)
pid->data_types|= (1<<BPHYS_DATA_AVELOCITY);
if (psys->part->rotmode != PART_ROT_VEL ||
psys->part->avemode == PART_AVE_RAND ||
psys->part->avefac != 0.0f)
{
pid->data_types |= (1 << BPHYS_DATA_AVELOCITY);
}
}
pid->info_types= (1<<BPHYS_DATA_TIMES);

View File

@ -3076,8 +3076,9 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
fallback_fac = 1.0;
if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
if (seq->seq1->enddisp != seq->seq1->start
&& seq->seq1->len != 0) {
if ((seq->seq1->enddisp != seq->seq1->start) &&
(seq->seq1->len != 0))
{
fallback_fac = (float) seq->seq1->len /
(float) (seq->seq1->enddisp - seq->seq1->start);
flags = SEQ_SPEED_INTEGRATE;

View File

@ -3067,10 +3067,10 @@ void seq_tx_set_final_right(Sequence *seq, int val)
* since they work a bit differently to normal image seq's (during transform) */
int seq_single_check(Sequence *seq)
{
return (seq->len == 1 && (
seq->type == SEQ_IMAGE
|| ((seq->type & SEQ_EFFECT) &&
get_sequence_effect_num_inputs(seq->type) == 0)));
return ((seq->len == 1) &&
(seq->type == SEQ_IMAGE ||
((seq->type & SEQ_EFFECT) &&
get_sequence_effect_num_inputs(seq->type) == 0)));
}
/* check if the selected seq's reference unselected seq's */

View File

@ -325,8 +325,8 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
}
//After sucessufuly build the trees, start projection vertexs
if ( bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 4, 6)
&& (auxMesh == NULL || bvhtree_from_mesh_faces(&auxData, auxMesh, 0.0, 4, 6)))
if (bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 4, 6) &&
(auxMesh == NULL || bvhtree_from_mesh_faces(&auxData, auxMesh, 0.0, 4, 6)))
{
#ifndef __APPLE__

View File

@ -206,8 +206,7 @@ static int handle_request(RenderData *rd, char * req)
*p = 0;
if (strcmp(path, "/index.html") == 0
|| strcmp(path, "/") == 0) {
if (strcmp(path, "/index.html") == 0 || strcmp(path, "/") == 0) {
safe_puts(index_page);
return -1;
}

View File

@ -1328,8 +1328,8 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
else
{
//adjust heap size
if (heap_size >= max_heap_size
&& ADJUST_MEMORY(default_heap, (void**)&heap, heap_size+1, &max_heap_size, sizeof(heap[0])) == FALSE)
if ((heap_size >= max_heap_size) &&
ADJUST_MEMORY(default_heap, (void**)&heap, heap_size+1, &max_heap_size, sizeof(heap[0])) == FALSE)
{
printf("WARNING: bvh_find_nearest got out of memory\n");
@ -1429,9 +1429,11 @@ static float ray_nearest_hit(BVHRayCastData *data, float *bv)
if (data->ray_dot_axis[i] == 0.0f)
{
//axis aligned ray
if (data->ray.origin[i] < bv[0] - data->ray.radius
|| data->ray.origin[i] > bv[1] + data->ray.radius)
if (data->ray.origin[i] < bv[0] - data->ray.radius ||
data->ray.origin[i] > bv[1] + data->ray.radius)
{
return FLT_MAX;
}
}
else
{

View File

@ -119,7 +119,7 @@ void rng_shuffleArray(RNG *rng, void *data, int elemSize, int numElems)
temp = malloc(elemSize);
/* XXX Shouldnt it rather be "while (i--) {" ?
/* XXX Shouldn't it rather be "while (i--) {" ?
* Else we have no guaranty first (0) element has a chance to be shuffled... --mont29 */
while (--i) {
int j = rng_getInt(rng)%numElems;

View File

@ -11231,9 +11231,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* Add default gravity to scenes */
for (sce= main->scene.first; sce; sce= sce->id.next) {
if ((sce->physics_settings.flag & PHYS_GLOBAL_GRAVITY) == 0
&& len_v3(sce->physics_settings.gravity) == 0.0f) {
if ((sce->physics_settings.flag & PHYS_GLOBAL_GRAVITY) == 0 &&
len_v3(sce->physics_settings.gravity) == 0.0f)
{
sce->physics_settings.gravity[0] = sce->physics_settings.gravity[1] = 0.0f;
sce->physics_settings.gravity[2] = -9.81f;
sce->physics_settings.flag = PHYS_GLOBAL_GRAVITY;

View File

@ -2580,9 +2580,12 @@ static short nurb_has_selected_cps(ListBase *editnurb)
bezt= nu->bezt;
while (a--) {
if (bezt->hide==0) {
if ((bezt->f1 & SELECT)
|| (bezt->f2 & SELECT)
|| (bezt->f3 & SELECT)) return 1;
if ((bezt->f1 & SELECT) ||
(bezt->f2 & SELECT) ||
(bezt->f3 & SELECT))
{
return 1;
}
}
bezt++;
}

View File

@ -763,8 +763,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
/* mode enabling buttons */
uiBlockBeginAlign(block);
/* Softbody not allowed in this situation, enforce! */
if ( ((md->type != eModifierType_Softbody && md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect))
&& (md->type != eModifierType_Surface) )
if (((md->type != eModifierType_Softbody && md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) &&
(md->type != eModifierType_Surface) )
{
uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);

View File

@ -3471,8 +3471,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
pset->flag &= ~PE_LOCK_FIRST;
if (((pset->brushtype == PE_BRUSH_ADD) ?
(sqrt(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0))
|| bedit->first) {
(sqrt(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0)) || bedit->first) {
PEData data= bedit->data;
view3d_operator_needs_opengl(C);

View File

@ -471,7 +471,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
Object *camera = NULL;
/* update animated image textures for gpu, etc,
* call before scene_update_for_newframe so modifiers with textuers don't lag 1 frame */
* call before scene_update_for_newframe so modifiers with textures don't lag 1 frame */
ED_image_update_frame(bmain, scene->r.cfra);
/* go to next frame */

View File

@ -5217,8 +5217,8 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
float alpha = 0.5f;
ts = scene->toolsettings;
use_zoom = get_imapaint_zoom(C, &zoomx, &zoomy)
&& !(ts->use_uv_sculpt && (scene->basact->object->mode == OB_MODE_EDIT));
use_zoom = get_imapaint_zoom(C, &zoomx, &zoomy) &&
!(ts->use_uv_sculpt && (scene->basact->object->mode == OB_MODE_EDIT));
if (use_zoom) {
pixel_size = MAX2(size * zoomx, size * zoomy);

View File

@ -537,8 +537,9 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
/* Count 'unique' uvs */
for (i = 0; i < data->elementMap->totalUVs; i++) {
if (data->elementMap->buf[i].separate
&& (!do_island_optimization || data->elementMap->buf[i].island == island_index)) {
if (data->elementMap->buf[i].separate &&
(!do_island_optimization || data->elementMap->buf[i].island == island_index))
{
counter++;
}
}

View File

@ -155,8 +155,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
btn_margin + UI_GetStringWidth(params->title));
}
if (available_w <= loadbutton + separator + input_minw
|| params->title[0] == 0) {
if (available_w <= loadbutton + separator + input_minw || params->title[0] == 0) {
loadbutton = 0;
}
else {

View File

@ -767,16 +767,18 @@ static int file_extension_type(const char *relname)
else if (BLI_testextensie(relname, ".py")) {
return PYSCRIPTFILE;
}
else if (BLI_testextensie(relname, ".txt")
|| BLI_testextensie(relname, ".glsl")
|| BLI_testextensie(relname, ".data")) {
else if (BLI_testextensie(relname, ".txt") ||
BLI_testextensie(relname, ".glsl") ||
BLI_testextensie(relname, ".data"))
{
return TEXTFILE;
}
else if ( BLI_testextensie(relname, ".ttf")
|| BLI_testextensie(relname, ".ttc")
|| BLI_testextensie(relname, ".pfb")
|| BLI_testextensie(relname, ".otf")
|| BLI_testextensie(relname, ".otc")) {
else if (BLI_testextensie(relname, ".ttf") ||
BLI_testextensie(relname, ".ttc") ||
BLI_testextensie(relname, ".pfb") ||
BLI_testextensie(relname, ".otf") ||
BLI_testextensie(relname, ".otc"))
{
return FTFONTFILE;
}
else if (BLI_testextensie(relname, ".btx")) {
@ -785,8 +787,9 @@ static int file_extension_type(const char *relname)
else if (BLI_testextensie(relname, ".dae")) {
return COLLADAFILE;
}
else if (BLI_testextensie_array(relname, imb_ext_image)
|| (G.have_quicktime && BLI_testextensie_array(relname, imb_ext_image_qt))) {
else if (BLI_testextensie_array(relname, imb_ext_image) ||
(G.have_quicktime && BLI_testextensie_array(relname, imb_ext_image_qt)))
{
return IMAGEFILE;
}
else if (BLI_testextensie_array(relname, imb_ext_movie)) {
@ -838,8 +841,9 @@ static void filelist_setfiletypes(struct FileList* filelist)
}
file->flags = file_extension_type(file->relname);
if (filelist->filter_glob
&& BLI_testextensie_glob(file->relname, filelist->filter_glob)) {
if (filelist->filter_glob &&
BLI_testextensie_glob(file->relname, filelist->filter_glob))
{
file->flags= OPERATORFILE;
}

View File

@ -3228,8 +3228,8 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo
}
sub= uiLayoutRow(row, 0);
uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states")
&& RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states") &&
RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
if (RNA_boolean_get(ptr, "show_expanded")==0) {
@ -3253,8 +3253,8 @@ static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "use_pulse_false_level", 0, "", ICON_DOTSDOWN);
sub=uiLayoutRow(row, 0);
uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level")
|| RNA_boolean_get(ptr, "use_pulse_false_level")));
uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level") ||
RNA_boolean_get(ptr, "use_pulse_false_level")));
uiItemR(sub, ptr, "frequency", 0, "Freq", ICON_NONE);
row= uiLayoutRow(split, 1);
@ -3677,8 +3677,8 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *
}
sub= uiLayoutRow(row, 0);
uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states")
&& RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states") &&
RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
if (RNA_boolean_get(ptr, "show_expanded")==0) {

View File

@ -695,8 +695,10 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
static int inside_rctf(rctf *bounds, rctf *rect)
{
return (bounds->xmin <= rect->xmin && bounds->xmax >= rect->xmax
&& bounds->ymin <= rect->ymin && bounds->ymax >= rect->ymax);
return (bounds->xmin <= rect->xmin &&
bounds->xmax >= rect->xmax &&
bounds->ymin <= rect->ymin &&
bounds->ymax >= rect->ymax);
}
static void node_frame_attach_nodes(bNodeTree *UNUSED(ntree), bNode *frame)
@ -1893,8 +1895,10 @@ static int outside_group_rect(SpaceNode *snode)
{
bNode *gnode= node_tree_get_editgroup(snode->nodetree);
if (gnode) {
return (snode->mx < gnode->totr.xmin || snode->mx >= gnode->totr.xmax
|| snode->my < gnode->totr.ymin || snode->my >= gnode->totr.ymax);
return (snode->mx < gnode->totr.xmin ||
snode->mx >= gnode->totr.xmax ||
snode->my < gnode->totr.ymin ||
snode->my >= gnode->totr.ymax);
}
return 0;
}
@ -2192,8 +2196,9 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
/* This creates new links between copied nodes.
* If keep_inputs is set, also copies input links from unselected (when fromnode==NULL)!
*/
if (link->tonode && (link->tonode->flag & NODE_SELECT)
&& (keep_inputs || (link->fromnode && (link->fromnode->flag & NODE_SELECT)))) {
if (link->tonode && (link->tonode->flag & NODE_SELECT) &&
(keep_inputs || (link->fromnode && (link->fromnode->flag & NODE_SELECT))))
{
newlink = MEM_callocN(sizeof(bNodeLink), "bNodeLink");
newlink->flag = link->flag;
newlink->tonode = link->tonode->new_node;

View File

@ -1096,10 +1096,12 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
/* Ignore all seqs already selected! */
/* Ignore all seqs not sharing some time with active one. */
/* Ignore all seqs of incompatible types (audio vs video). */
if ((seq->flag & SELECT) || (seq->startdisp >= enddisp) || (seq->enddisp < startdisp)
|| (!is_audio && SEQ_IS_SOUND(seq))
|| (is_audio && !((seq->type == SEQ_META) || SEQ_IS_SOUND(seq))))
if ((seq->flag & SELECT) || (seq->startdisp >= enddisp) || (seq->enddisp < startdisp) ||
(!is_audio && SEQ_IS_SOUND(seq)) ||
(is_audio && !((seq->type == SEQ_META) || SEQ_IS_SOUND(seq))))
{
continue;
}
/* If the seq is an effect one, we need extra cheking! */
if (SEQ_IS_EFFECT(seq) && ((seq->seq1 && seq->seq1->tmp) ||

View File

@ -4341,8 +4341,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
normalize_v3(imat[1]);
}
if (ELEM3(draw_as, PART_DRAW_DOT, PART_DRAW_CROSS, PART_DRAW_LINE)
&& part->draw_col > PART_DRAW_COL_MAT)
if (ELEM3(draw_as, PART_DRAW_DOT, PART_DRAW_CROSS, PART_DRAW_LINE) &&
(part->draw_col > PART_DRAW_COL_MAT))
{
create_cdata = 1;
}

View File

@ -294,10 +294,7 @@ static char *view3d_modeselect_pup(Scene *scene)
if (!((ID *)ob->data)->lib) {
/* if active object is editable */
if ( ((ob->type == OB_MESH)
|| (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
|| (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
if (ELEM6(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE)) {
str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
}
else if (ob->type == OB_ARMATURE) {

View File

@ -6005,8 +6005,7 @@ void createTransData(bContext *C, TransInfo *t)
}
}
else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)
&& PE_start_edit(PE_get_current(scene, ob))) {
else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_start_edit(PE_get_current(scene, ob))) {
createTransParticleVerts(C, t);
t->flag |= T_POINTS;

View File

@ -1629,7 +1629,8 @@ void calculatePropRatio(TransInfo *t)
(td->flag & TD_NOTCONNECTED || td->dist > t->prop_size))
||
(connected == 0 &&
td->rdist > t->prop_size)) {
td->rdist > t->prop_size))
{
/*
* The elements are sorted according to their dist member in the array,
* that means we can stop when it finds one element outside of the propsize.

View File

@ -636,8 +636,9 @@ static void ffmpeg_postprocess(struct anim * anim)
/* This means the data wasnt read properly,
* this check stops crashing */
if (input->data[0]==0 && input->data[1]==0
&& input->data[2]==0 && input->data[3]==0) {
if (input->data[0]==0 && input->data[1]==0 &&
input->data[2]==0 && input->data[3]==0)
{
fprintf(stderr, "ffmpeg_fetchibuf: "
"data not read properly...\n");
return;
@ -945,10 +946,11 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
return anim->last_frame;
}
if (position > anim->curposition + 1
&& anim->preseek
&& !tc_index
&& position - (anim->curposition + 1) < anim->preseek) {
if (position > anim->curposition + 1 &&
anim->preseek &&
!tc_index &&
position - (anim->curposition + 1) < anim->preseek)
{
av_log(anim->pFormatCtx, AV_LOG_DEBUG,
"FETCH: within preseek interval (no index)\n");

View File

@ -372,24 +372,26 @@ int IMB_isanim(const char *filename)
if (U.uiflag & USER_FILTERFILEEXTS) {
if (G.have_quicktime) {
if ( BLI_testextensie(filename, ".avi")
|| BLI_testextensie(filename, ".flc")
|| BLI_testextensie(filename, ".dv")
|| BLI_testextensie(filename, ".r3d")
|| BLI_testextensie(filename, ".mov")
|| BLI_testextensie(filename, ".movie")
|| BLI_testextensie(filename, ".mv")) {
if (BLI_testextensie(filename, ".avi") ||
BLI_testextensie(filename, ".flc") ||
BLI_testextensie(filename, ".dv") ||
BLI_testextensie(filename, ".r3d") ||
BLI_testextensie(filename, ".mov") ||
BLI_testextensie(filename, ".movie") ||
BLI_testextensie(filename, ".mv"))
{
type = imb_get_anim_type(filename);
}
else {
return(FALSE);
}
}
else { // no quicktime
if ( BLI_testextensie(filename, ".avi")
|| BLI_testextensie(filename, ".dv")
|| BLI_testextensie(filename, ".r3d")
|| BLI_testextensie(filename, ".mv")) {
else { /* no quicktime */
if (BLI_testextensie(filename, ".avi") ||
BLI_testextensie(filename, ".dv") ||
BLI_testextensie(filename, ".r3d") ||
BLI_testextensie(filename, ".mv"))
{
type = imb_get_anim_type(filename);
}
else {
@ -397,7 +399,7 @@ int IMB_isanim(const char *filename)
}
}
}
else { // no FILTERFILEEXTS
else { /* no FILTERFILEEXTS */
type = imb_get_anim_type(filename);
}

View File

@ -360,8 +360,9 @@ static int add_name(const char *str)
* */
buf[i] = 0;
if (debugSDNA > 3) printf("Name before chomping: %s\n", buf);
if ( (strncmp(buf,"(*headdraw", 10) == 0)
|| (strncmp(buf,"(*windraw", 9) == 0) ) {
if ((strncmp(buf,"(*headdraw", 10) == 0) ||
(strncmp(buf,"(*windraw", 9) == 0) )
{
buf[i] = ')';
buf[i+1] = '(';
buf[i+2] = 'v';

View File

@ -370,8 +370,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
/* calculate the maximum number of copies which will fit within the
* prescribed length */
if (amd->fit_type == MOD_ARR_FITLENGTH
|| amd->fit_type == MOD_ARR_FITCURVE) {
if (amd->fit_type == MOD_ARR_FITLENGTH || amd->fit_type == MOD_ARR_FITCURVE) {
float dist = sqrt(dot_v3v3(offset[3], offset[3]));
if (dist > 1e-6f)

View File

@ -1007,10 +1007,10 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
if (psmd->dm==NULL) return derivedData;
/* 1. find faces to be exploded if needed */
if (emd->facepa == NULL
|| psmd->flag&eParticleSystemFlag_Pars
|| emd->flag&eExplodeFlag_CalcFaces
|| MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumTessFaces(dm))
if (emd->facepa == NULL ||
psmd->flag&eParticleSystemFlag_Pars ||
emd->flag&eExplodeFlag_CalcFaces ||
MEM_allocN_len(emd->facepa) / sizeof(int) != dm->getNumTessFaces(dm))
{
if (psmd->flag & eParticleSystemFlag_Pars)
psmd->flag &= ~eParticleSystemFlag_Pars;

View File

@ -86,10 +86,12 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
if (smd->vgroup_name[0])
dataMask |= CD_MASK_MDEFORMVERT;
if (smd->shrinkType == MOD_SHRINKWRAP_PROJECT
&& smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL)
if ((smd->shrinkType == MOD_SHRINKWRAP_PROJECT) &&
(smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL))
{
dataMask |= CD_MASK_MVERT;
}
return dataMask;
}

View File

@ -65,10 +65,10 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
/* Return immediately, if we have nothing to do! */
/* Also security checks... */
if (((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL))
|| !ELEM7(falloff_type, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH,
MOD_WVG_MAPPING_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM,
MOD_WVG_MAPPING_STEP))
if (((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL)) ||
!ELEM7(falloff_type, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH,
MOD_WVG_MAPPING_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM,
MOD_WVG_MAPPING_STEP))
return;
/* Map each weight (vertex) to its new value, accordingly to the chosen mode. */

View File

@ -1376,11 +1376,13 @@ void shade_samples_do_AO(ShadeSample *ssamp)
ShadeInput *shi= &ssamp->shi[0];
int sample;
if (((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
|| (shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
if (((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) ||
(shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
{
for (sample=0; sample<ssamp->tot; shi++, sample++)
if (!(shi->mode & MA_SHLESS))
ambient_occlusion(shi); /* stores in shi->ao[] */
}
}
}

View File

@ -1731,8 +1731,9 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
/* AO pass */
if (R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) {
if (((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
|| (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) {
if (((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) ||
(passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
{
if (R.r.mode & R_SHADOW) {
/* AO was calculated for scanline already */
if (shi->depth || shi->volume_depth)

View File

@ -976,10 +976,16 @@ StrandSurface *cache_strand_surface(Render *re, ObjectRen *obr, DerivedMesh *dm,
totvert= dm->getNumVerts(dm);
totface= dm->getNumTessFaces(dm);
for (mesh=re->strandsurface.first; mesh; mesh=mesh->next)
if (mesh->obr.ob == obr->ob && mesh->obr.par == obr->par
&& mesh->obr.index == obr->index && mesh->totvert==totvert && mesh->totface==totface)
for (mesh = re->strandsurface.first; mesh; mesh = mesh->next) {
if ((mesh->obr.ob == obr->ob) &&
(mesh->obr.par == obr->par) &&
(mesh->obr.index == obr->index) &&
(mesh->totvert == totvert) &&
(mesh->totface == totface))
{
break;
}
}
if (!mesh) {
mesh= MEM_callocN(sizeof(StrandSurface), "StrandSurface");

View File

@ -783,8 +783,8 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o
static int using_lightcache(Material *ma)
{
return (((ma->vol.shadeflag & MA_VOL_PRECACHESHADING) && (ma->vol.shade_type == MA_VOL_SHADE_SHADED))
|| (ELEM(ma->vol.shade_type, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)));
return (((ma->vol.shadeflag & MA_VOL_PRECACHESHADING) && (ma->vol.shade_type == MA_VOL_SHADE_SHADED)) ||
(ELEM(ma->vol.shade_type, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)));
}
/* loop through all objects (and their associated materials)