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

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

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

@ -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 ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
{ {
if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) &&
&& ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) ) ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
{ {
continue; continue;
} }

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

@ -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); BKE_ptcache_id_time(&pid, scene, (float)scene->r.cfra, NULL, NULL, NULL);
/* reset non-baked cache at first frame */ /* 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; cache->flag |= PTCACHE_REDO_NEEDED;
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED); BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
cache->flag &= ~PTCACHE_REDO_NEEDED; 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); BKE_ptcache_validate(cache, (int)scene->r.cfra);
} }
/* if read failed and we're on surface range do recalculate */ /* if read failed and we're on surface range do recalculate */
else if ((int)scene->r.cfra == current_frame else if ((int)scene->r.cfra == current_frame && !(cache->flag & PTCACHE_BAKED)) {
&& !(cache->flag & PTCACHE_BAKED)) {
/* calculate surface frame */ /* calculate surface frame */
canvas->flags |= MOD_DPAINT_BAKING; canvas->flags |= MOD_DPAINT_BAKING;
dynamicPaint_calculateFrame(surface, scene, ob, current_frame); dynamicPaint_calculateFrame(surface, scene, ob, current_frame);

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

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

@ -76,7 +76,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
types_init= 0; 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') { if (type < NUM_MODIFIER_TYPES && types[type]->name[0] != '\0') {
return types[type]; return types[type];
} }

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

@ -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); state->time = psys_get_child_time(psys, cpa, cfra, NULL, NULL);
if (!always) if (!always) {
if ((state->time < 0.0f && !(part->flag & PART_UNBORN)) if ((state->time < 0.0f && !(part->flag & PART_UNBORN)) ||
|| (state->time > 1.0f && !(part->flag & PART_DIED))) (state->time > 1.0f && !(part->flag & PART_DIED)))
{
return 0; return 0;
}
}
state->time= (cfra - (part->sta + (part->end - part->sta) * PSYS_FRAND(p + 23))) / (part->lifetime * PSYS_FRAND(p + 24)); 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 (pa) {
if (!always) if (!always) {
if ((cfra < pa->time && (part->flag & PART_UNBORN)==0) if ((cfra < pa->time && (part->flag & PART_UNBORN) == 0) ||
|| (cfra > pa->dietime && (part->flag & PART_DIED)==0)) (cfra > pa->dietime && (part->flag & PART_DIED) == 0))
{
return 0; return 0;
}
}
cfra = MIN2(cfra, pa->dietime); cfra = MIN2(cfra, pa->dietime);
} }

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

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

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

@ -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) */ * since they work a bit differently to normal image seq's (during transform) */
int seq_single_check(Sequence *seq) int seq_single_check(Sequence *seq)
{ {
return (seq->len == 1 && ( return ((seq->len == 1) &&
seq->type == SEQ_IMAGE (seq->type == SEQ_IMAGE ||
|| ((seq->type & SEQ_EFFECT) && ((seq->type & SEQ_EFFECT) &&
get_sequence_effect_num_inputs(seq->type) == 0))); get_sequence_effect_num_inputs(seq->type) == 0)));
} }
/* check if the selected seq's reference unselected seq's */ /* check if the selected seq's reference unselected seq's */

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

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

@ -1328,8 +1328,8 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
else else
{ {
//adjust heap size //adjust heap size
if (heap_size >= max_heap_size if ((heap_size >= max_heap_size) &&
&& ADJUST_MEMORY(default_heap, (void**)&heap, heap_size+1, &max_heap_size, sizeof(heap[0])) == FALSE) 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"); 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) if (data->ray_dot_axis[i] == 0.0f)
{ {
//axis aligned ray //axis aligned ray
if (data->ray.origin[i] < bv[0] - data->ray.radius if (data->ray.origin[i] < bv[0] - data->ray.radius ||
|| data->ray.origin[i] > bv[1] + data->ray.radius) data->ray.origin[i] > bv[1] + data->ray.radius)
{
return FLT_MAX; return FLT_MAX;
}
} }
else else
{ {

@ -119,7 +119,7 @@ void rng_shuffleArray(RNG *rng, void *data, int elemSize, int numElems)
temp = malloc(elemSize); 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 */ * Else we have no guaranty first (0) element has a chance to be shuffled... --mont29 */
while (--i) { while (--i) {
int j = rng_getInt(rng)%numElems; int j = rng_getInt(rng)%numElems;

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

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

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

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

@ -471,7 +471,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
Object *camera = NULL; Object *camera = NULL;
/* update animated image textures for gpu, etc, /* 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); ED_image_update_frame(bmain, scene->r.cfra);
/* go to next frame */ /* go to next frame */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -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! */ /* Return immediately, if we have nothing to do! */
/* Also security checks... */ /* Also security checks... */
if (((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL)) if (((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL)) ||
|| !ELEM7(falloff_type, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH, !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_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM,
MOD_WVG_MAPPING_STEP)) MOD_WVG_MAPPING_STEP))
return; return;
/* Map each weight (vertex) to its new value, accordingly to the chosen mode. */ /* Map each weight (vertex) to its new value, accordingly to the chosen mode. */

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

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

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

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