From 4ef208909762eae844da0488f2f113d007687a80 Mon Sep 17 00:00:00 2001 From: Miika Hamalainen Date: Fri, 11 Nov 2011 10:46:26 +0000 Subject: Dynamic Paint: * Renamed "Sharp" proximity falloff to "Constant". * Added a new "Negate Volume" option for "Volume + Proximity" brush. * Possible fix for random particle clipping errors. --- source/blender/blenkernel/intern/dynamicpaint.c | 75 +++++++++++++++---------- 1 file changed, 46 insertions(+), 29 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 354aa57e200..df7cd85e6a1 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3175,13 +3175,20 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, { float ray_start[3], ray_dir[3]; - float colorband[4] = {0.0f}; - float sample_factor; + float sample_factor = 0.0f; float sampleStrength = 0.0f; BVHTreeRayHit hit; BVHTreeNearest nearest; short hit_found = 0; + /* volume sample */ + float volume_factor = 0.0f; + /* proximity sample */ + float proximity_factor = 0.0f; + float prox_colorband[4] = {0.0f}; + int inner_proximity = (brush->flags & MOD_DPAINT_INVERSE_PROX && + brush->collision == MOD_DPAINT_COL_VOLDIST); + /* hit data */ float hitCoord[3]; int hitFace = -1; @@ -3236,7 +3243,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, if(hit.index != -1) { /* Add factor on supersample filter */ - sampleStrength += sample_factor; + volume_factor = 1.0f; hit_found = HIT_VOLUME; /* Mark hit info */ @@ -3256,8 +3263,6 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, float hitCo[3]; short hQuad; int face; - int inner_proximity = (brush->flags & MOD_DPAINT_INVERSE_PROX && - brush->collision == MOD_DPAINT_COL_VOLDIST); /* if inverse prox and no hit found, skip this sample */ if (inner_proximity && !hit_found) continue; @@ -3299,25 +3304,12 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, /* If a hit was found, calculate required values */ if (proxDist >= 0.0f && proxDist <= brush->paint_distance) { - float dist_rate = proxDist / brush->paint_distance; - float prox_influence = 0.0f; - - /* in case of inverse prox also undo volume effect */ - if (inner_proximity) { - sampleStrength -= sample_factor; - dist_rate = 1.0f - dist_rate; - } - - /* if using proximity color ramp use it's alpha */ - if (brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP && do_colorband(brush->paint_ramp, dist_rate, colorband)) - prox_influence = colorband[3]; - else if (brush->proximity_falloff == MOD_DPAINT_PRFALL_SMOOTH) { - prox_influence = (1.0f - dist_rate) * sample_factor; - } - else prox_influence = inner_proximity ? 0.0f : 1.0f; + proximity_factor = proxDist / brush->paint_distance; + CLAMP(proximity_factor, 0.0f, 1.0f); + if (!inner_proximity) + proximity_factor = 1.0f - proximity_factor; hit_found = HIT_PROXIMITY; - sampleStrength += prox_influence*sample_factor; /* if no volume hit, use prox point face info */ if (hitFace == -1) { @@ -3328,7 +3320,32 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, } } - if (!hit_found) continue; + /* mix final sample strength depending on brush settings */ + if (hit_found) { + /* if "negate volume" enabled, negate all factors within volume*/ + if (brush->collision == MOD_DPAINT_COL_VOLDIST && brush->flags & MOD_DPAINT_NEGATE_VOLUME) { + volume_factor = 1.0f - volume_factor; + if (inner_proximity) + proximity_factor = 1.0f - proximity_factor; + } + + /* apply final sample depending on final hit type */ + if (hit_found == HIT_VOLUME) { + sampleStrength = volume_factor; + } + else if (hit_found == HIT_PROXIMITY) { + /* apply falloff curve to the proximity_factor */ + if (brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP && do_colorband(brush->paint_ramp, (1.0f-proximity_factor), prox_colorband)) + proximity_factor = prox_colorband[3]; + else if (brush->proximity_falloff == MOD_DPAINT_PRFALL_CONSTANT) + proximity_factor = (!inner_proximity || brush->flags & MOD_DPAINT_NEGATE_VOLUME) ? 1.0f : 0.0f; + /* apply sample */ + sampleStrength = proximity_factor; + } + + sampleStrength *= sample_factor; + } + else continue; /* velocity brush, only do on main sample */ if (brush->flags & MOD_DPAINT_USES_VELOCITY && ss==0 && brushVelocity) { @@ -3395,9 +3412,9 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, /* Sample proximity colorband if required */ if ((hit_found == HIT_PROXIMITY) && (brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP)) { if (!(brush->flags & MOD_DPAINT_RAMP_ALPHA)) { - sampleColor[0] = colorband[0]; - sampleColor[1] = colorband[1]; - sampleColor[2] = colorband[2]; + sampleColor[0] = prox_colorband[0]; + sampleColor[1] = prox_colorband[1]; + sampleColor[2] = prox_colorband[2]; } } @@ -3478,7 +3495,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, float range = solidradius + smooth; float particle_timestep = 0.04f * part->timetweak; - Bounds3D part_bb; + Bounds3D part_bb = {0}; if (psys->totpart < 1) return 1; @@ -4482,7 +4499,7 @@ static int dynamicPaint_surfaceHasMoved(DynamicPaintSurface *surface, Object *ob return ret; } -static int surface_needsVelocityData(DynamicPaintSurface *surface, Scene *scene, Object *UNUSED(ob)) +static int surface_needsVelocityData(DynamicPaintSurface *surface, Scene *scene) { if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) return 1; @@ -4509,7 +4526,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc PaintBakeData *bData = sData->bData; DerivedMesh *dm = surface->canvas->dm; int index, new_bdata = 0; - int do_velocity_data = surface_needsVelocityData(surface, scene, ob); + int do_velocity_data = surface_needsVelocityData(surface, scene); int do_accel_data = surface_needsAccelerationData(surface); int canvasNumOfVerts = dm->getNumVerts(dm); -- cgit v1.2.3 From 094c9799f9926ae37515a1fe0380403ce3298a77 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 11 Nov 2011 12:00:08 +0000 Subject: quiet -Wdouble-promotion warnings --- source/blender/blenkernel/intern/boids.c | 4 ++-- source/blender/blenkernel/intern/cloth.c | 10 +++++----- source/blender/blenkernel/intern/collision.c | 22 +++++++++++----------- source/blender/blenkernel/intern/dynamicpaint.c | 16 ++++++++-------- source/blender/blenkernel/intern/nla.c | 2 +- source/blender/blenkernel/intern/particle.c | 2 +- source/blender/blenkernel/intern/softbody.c | 10 +++++----- source/blender/blenkernel/intern/tracking.c | 4 ++-- 8 files changed, 35 insertions(+), 35 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index c9868bd900f..6656d06e72e 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -175,7 +175,7 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, if(len2 > 0.0f && efd.distance - surface < len2) { len2 = (efd.distance - surface)/len2; - bbd->wanted_speed *= pow(len2, boids->landing_smoothness); + bbd->wanted_speed *= powf(len2, boids->landing_smoothness); } } @@ -242,7 +242,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * mul_v3_fl(bbd->wanted_co, (1.0f - t) * val->personal_space * pa->size); - bbd->wanted_speed = sqrt(t) * len_v3(pa->prev_state.vel); + bbd->wanted_speed = sqrtf(t) * len_v3(pa->prev_state.vel); bbd->wanted_speed = MAX2(bbd->wanted_speed, val->min_speed); return 1; diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index ae6a6ec012a..57a9dbcbc0f 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -1093,7 +1093,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) cloth->verts[spring->kl].spring_count++; spring->type = CLOTH_SPRING_TYPE_STRUCTURAL; spring->flags = 0; - spring->stiffness = (cloth->verts[spring->kl].struct_stiff + cloth->verts[spring->ij].struct_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].struct_stiff + cloth->verts[spring->ij].struct_stiff) / 2.0f; struct_springs++; BLI_linklist_prepend ( &cloth->springs, spring ); @@ -1110,7 +1110,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) for(i = 0; i < numverts; i++) { - cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49 / ((float)cloth->verts[i].spring_count); + cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49f / ((float)cloth->verts[i].spring_count); } // shear springs @@ -1132,7 +1132,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) spring->kl = MAX2(mface[i].v3, mface[i].v1); spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest); spring->type = CLOTH_SPRING_TYPE_SHEAR; - spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0f; BLI_linklist_append ( &edgelist[spring->ij], spring ); BLI_linklist_append ( &edgelist[spring->kl], spring ); @@ -1195,7 +1195,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) spring->kl = MAX2(tspring2->ij, index2); spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest); spring->type = CLOTH_SPRING_TYPE_BENDING; - spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f; BLI_edgehash_insert ( edgehash, spring->ij, spring->kl, NULL ); bend_springs++; @@ -1234,7 +1234,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) spring->kl = tspring->kl; spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest); spring->type = CLOTH_SPRING_TYPE_BENDING; - spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f; bend_springs++; BLI_linklist_prepend ( &cloth->springs, spring ); diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 09030575438..456c0c9fe3b 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -464,7 +464,7 @@ static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3 d = ( a * c - b * b ); - if ( ABS ( d ) < ALMOST_ZERO ) + if ( ABS ( d ) < (double)ALMOST_ZERO ) { *w1 = *w2 = *w3 = 1.0 / 3.0; return; @@ -554,14 +554,14 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // Decrease in magnitude of relative tangential velocity due to coulomb friction // in original formula "magrelVel" should be the "change of relative velocity in normal direction" - magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( INPR ( vrel_t_pre,vrel_t_pre ) ) ); + magtangent = MIN2 ( clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf( INPR ( vrel_t_pre,vrel_t_pre ) ) ); // Apply friction impulse. if ( magtangent > ALMOST_ZERO ) { normalize_v3( vrel_t_pre ); - impulse = magtangent / ( 1.0 + w1*w1 + w2*w2 + w3*w3 ); // 2.0 * + impulse = magtangent / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // 2.0 * VECADDMUL ( cloth1->verts[collpair->ap1].impulse, vrel_t_pre, w1 * impulse ); VECADDMUL ( cloth1->verts[collpair->ap2].impulse, vrel_t_pre, w2 * impulse ); VECADDMUL ( cloth1->verts[collpair->ap3].impulse, vrel_t_pre, w3 * impulse ); @@ -585,17 +585,17 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // I_r = -min(dt*kd, m(0,1d/dt - v_n)) spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale; - d = clmd->coll_parms->epsilon*8.0/9.0 + epsilon2*8.0/9.0 - collpair->distance; - if ( ( magrelVel < 0.1*d*spf ) && ( d > ALMOST_ZERO ) ) + d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance; + if ( ( magrelVel < 0.1f*d*spf ) && ( d > ALMOST_ZERO ) ) { - repulse = MIN2 ( d*1.0/spf, 0.1*d*spf - magrelVel ); + repulse = MIN2 ( d*1.0f/spf, 0.1f*d*spf - magrelVel ); // stay on the safe side and clamp repulse if ( impulse > ALMOST_ZERO ) repulse = MIN2 ( repulse, 5.0*impulse ); repulse = MAX2 ( impulse, repulse ); - impulse = repulse / ( 1.0 + w1*w1 + w2*w2 + w3*w3 ); // original 2.0 / 0.25 + impulse = repulse / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // original 2.0 / 0.25 VECADDMUL ( cloth1->verts[collpair->ap1].impulse, collpair->normal, impulse ); VECADDMUL ( cloth1->verts[collpair->ap2].impulse, collpair->normal, impulse ); VECADDMUL ( cloth1->verts[collpair->ap3].impulse, collpair->normal, impulse ); @@ -1492,8 +1492,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, collmd->current_xnew[collpair->bp2].co, collmd->current_xnew[collpair->bp3].co, &l, 0)) { - if (l >= 0.0 && l < sdis) { - mul_v3_fl(n2, (l-sdis)*cloth->verts[collpair->ap1].mass*dt*clmd->coll_parms->repel_force*0.1); + if (l >= 0.0f && l < sdis) { + mul_v3_fl(n2, (l-sdis)*cloth->verts[collpair->ap1].mass*dt*clmd->coll_parms->repel_force*0.1f); add_v3_v3(cloth->verts[collpair->ap1].tv, n2); add_v3_v3(cloth->verts[collpair->ap2].tv, n2); @@ -1507,7 +1507,7 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, verts1[collpair->ap1].txold, verts1[collpair->ap2].txold, verts1[collpair->ap3].txold, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, collpair->pa,collpair->pb,collpair->vector ); #else // just be sure that we don't add anything - distance = 2.0 * ( epsilon1 + epsilon2 + ALMOST_ZERO ); + distance = 2.0 * (double)( epsilon1 + epsilon2 + ALMOST_ZERO ); #endif if ( distance <= ( epsilon1 + epsilon2 + ALMOST_ZERO ) ) @@ -2534,7 +2534,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl } else { - mul_v3_fl( temp, -correction*0.5 ); + mul_v3_fl( temp, correction * -0.5 ); VECADD ( verts[j].tx, verts[j].tx, temp ); VECSUB ( verts[i].tx, verts[i].tx, temp ); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index df7cd85e6a1..40421c25607 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -677,7 +677,7 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface) volume = td[0]*td[1]*td[2]; /* determine final grid size by trying to fit average 10.000 points per grid cell */ - dim_factor = pow(volume / ((double)sData->total_points / 10000.f), 1.0f/axis); + dim_factor = (float)pow(volume / ((double)sData->total_points / 10000.0), 1.0/(double)axis); /* define final grid size using dim_factor, use min 3 for active axises */ for (i=0; i<3; i++) { @@ -3695,7 +3695,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE || surface->type == MOD_DPAINT_SURFACE_T_WAVE) { /* get displace depth */ - disp_intersect = (1.0f - sqrt(disp_intersect / radius)) * radius; + disp_intersect = (1.0f - sqrtf(disp_intersect / radius)) * radius; depth = (radius - disp_intersect) / bData->bNormal[index].normal_scale; if (depth<0.0f) depth = 0.0f; } @@ -3803,7 +3803,7 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE || surface->type == MOD_DPAINT_SURFACE_T_WAVE) { /* get displace depth */ - float disp_intersect = (1.0f - sqrt((brush->paint_distance-distance) / brush->paint_distance)) * brush->paint_distance; + float disp_intersect = (1.0f - sqrtf((brush->paint_distance-distance) / brush->paint_distance)) * brush->paint_distance; depth = (brush->paint_distance - disp_intersect) / bData->bNormal[index].normal_scale; if (depth<0.0f) depth = 0.0f; } @@ -3863,7 +3863,7 @@ static void dynamicPaint_prepareNeighbourData(DynamicPaintSurface *surface, int int numOfNeighs = adj_data->n_num[index]; for (i=0; iaverage_dist += bNeighs[adj_data->n_index[index]+i].dist; + bData->average_dist += (double)bNeighs[adj_data->n_index[index]+i].dist; } } bData->average_dist /= adj_data->total_targets; @@ -3922,18 +3922,18 @@ void surface_determineForceTargetPoints(PaintSurfaceData *sData, int index, floa /* get drip factor based on force dir in relation to angle between those neighbours */ temp = dot_v3v3(bNeighs[closest_id[0]].dir, force_proj); CLAMP(temp, -1.0f, 1.0f); /* float precision might cause values > 1.0f that return infinite */ - closest_d[1] = acos(temp)/neigh_diff; + closest_d[1] = acosf(temp)/neigh_diff; closest_d[0] = 1.0f - closest_d[1]; /* and multiply depending on how deeply force intersects surface */ temp = fabs(force_intersect); CLAMP(temp, 0.0f, 1.0f); - closest_d[0] *= acos(temp)/1.57079633f; - closest_d[1] *= acos(temp)/1.57079633f; + closest_d[0] *= acosf(temp)/1.57079633f; + closest_d[1] *= acosf(temp)/1.57079633f; } else { /* if only single neighbour, still linearize force intersection effect */ - closest_d[0] = 1.0f - acos(closest_d[0])/1.57079633f; + closest_d[0] = 1.0f - acosf(closest_d[0])/1.57079633f; } } diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index fd5c7912e1f..8a908097862 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -356,7 +356,7 @@ NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker) { AUD_SoundInfo info = AUD_getInfo(speaker->sound->playback_handle); - strip->end = ceil(info.length * FPS); + strip->end = (float)ceil((double)info.length * FPS); } else #endif diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index a86e819ae9f..d28fe8b8509 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -638,7 +638,7 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center w= co[2]*data->winmat[2][3] + data->winmat[3][3]; dx= data->winx*ortho2[0]*data->winmat[0][0]; dy= data->winy*ortho2[1]*data->winmat[1][1]; - w= sqrt(dx*dx + dy*dy)/w; + w= sqrtf(dx*dx + dy*dy)/w; /* w squared because we are working with area */ area= area*w*w; diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 5b02731050e..7f18db63c36 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2270,7 +2270,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo kd = sb->goalfrict * sb_fric_force_scale(ob) ; add_v3_v3v3(auxvect,velgoal,bp->vec); - if (forcetime > 0.0 ) { /* make sure friction does not become rocket motor on time reversal */ + if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */ bp->force[0]-= kd * (auxvect[0]); bp->force[1]-= kd * (auxvect[1]); bp->force[2]-= kd * (auxvect[2]); @@ -2675,7 +2675,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa kd = sb->goalfrict * sb_fric_force_scale(ob) ; add_v3_v3v3(auxvect,velgoal,bp->vec); - if (forcetime > 0.0 ) { /* make sure friction does not become rocket motor on time reversal */ + if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */ bp->force[0]-= kd * (auxvect[0]); bp->force[1]-= kd * (auxvect[1]); bp->force[2]-= kd * (auxvect[2]); @@ -3149,7 +3149,7 @@ static void apply_spring_memory(Object *ob) bp2 =&sb->bpoint[bs->v2]; l = len_v3v3(bp1->pos,bp2->pos); r = bs->len/l; - if (( r > 1.05f) || (r < 0.95)){ + if (( r > 1.05f) || (r < 0.95f)){ bs->len = ((100.0f - b) * bs->len + b*l)/100.0f; } } @@ -3952,7 +3952,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime) while ( (ABS(timedone) < ABS(dtime)) && (loops < 2000) ) { /* set goals in time */ - interpolate_exciter(ob,200,(int)(200.0*(timedone/dtime))); + interpolate_exciter(ob,200,(int)(200.0f*(timedone/dtime))); sb->scratch->flag &= ~SBF_DOFUZZY; /* do predictive euler step */ @@ -3993,7 +3993,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime) timedone += forcetime; newtime=MIN2(forcetimemax,MAX2(newtime,forcetimemin)); //if (newtime > forcetime) printf("up,"); - if (forcetime > 0.0) + if (forcetime > 0.0f) forcetime = MIN2(dtime - timedone,newtime); else forcetime = MAX2(dtime - timedone,newtime); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 38bb615896b..65b27f725bc 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1794,8 +1794,8 @@ static void calculate_stabdata(MovieTracking *tracking, int framenr, float width *angle*= stab->rotinf; /* convert to rotation around image center */ - loc[0]-= (x0 + (x-x0)*cos(*angle)-(y-y0)*sin(*angle) - x)*(*scale); - loc[1]-= (y0 + (x-x0)*sin(*angle)+(y-y0)*cos(*angle) - y)*(*scale); + loc[0]-= (x0 + (x-x0)*cosf(*angle)-(y-y0)*sinf(*angle) - x)*(*scale); + loc[1]-= (y0 + (x-x0)*sinf(*angle)+(y-y0)*cosf(*angle) - y)*(*scale); } } -- cgit v1.2.3 From e84c0980a3afb89301f8512acee64e525db3a49d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 11 Nov 2011 13:09:14 +0000 Subject: correct indentation and some whitespace edits (no functional changes) --- source/blender/blenkernel/BKE_DerivedMesh.h | 2 +- source/blender/blenkernel/BKE_bmfont.h | 14 +++++------ source/blender/blenkernel/BKE_fluidsim.h | 2 +- source/blender/blenkernel/BKE_mesh.h | 4 +-- source/blender/blenkernel/BKE_paint.h | 2 +- source/blender/blenkernel/BKE_sequencer.h | 4 +-- source/blender/blenkernel/intern/brush.c | 2 +- source/blender/blenkernel/intern/cdderivedmesh.c | 2 +- source/blender/blenkernel/intern/cloth.c | 6 ++--- source/blender/blenkernel/intern/curve.c | 4 +-- source/blender/blenkernel/intern/customdata.c | 2 +- source/blender/blenkernel/intern/depsgraph.c | 12 ++++----- source/blender/blenkernel/intern/implicit.c | 6 ++--- source/blender/blenkernel/intern/library.c | 4 +-- source/blender/blenkernel/intern/mball.c | 2 +- source/blender/blenkernel/intern/multires.c | 8 +++--- source/blender/blenkernel/intern/node.c | 4 +-- source/blender/blenkernel/intern/pointcache.c | 2 +- source/blender/blenkernel/intern/seqeffects.c | 6 ++--- source/blender/blenkernel/intern/sequencer.c | 31 ++++++++++++------------ source/blender/blenkernel/intern/softbody.c | 6 ++--- source/blender/blenkernel/intern/writeffmpeg.c | 4 +-- 22 files changed, 64 insertions(+), 65 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 0c5dc32f6d8..15fdc2fe307 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -347,7 +347,7 @@ void DM_init_funcs(DerivedMesh *dm); * sets up the custom data layers) */ void DM_init(DerivedMesh *dm, DerivedMeshType type, - int numVerts, int numEdges, int numFaces); + int numVerts, int numEdges, int numFaces); /* utility function to initialise a DerivedMesh for the desired number * of vertices, edges and faces, with a layer setup copied from source diff --git a/source/blender/blenkernel/BKE_bmfont.h b/source/blender/blenkernel/BKE_bmfont.h index 5f23121b802..71fd2ae3d67 100644 --- a/source/blender/blenkernel/BKE_bmfont.h +++ b/source/blender/blenkernel/BKE_bmfont.h @@ -44,19 +44,19 @@ struct bmFont; void printfGlyph(struct bmGlyph * glyph); void calcAlpha(struct ImBuf * ibuf); void readBitmapFontVersion0(struct ImBuf * ibuf, - unsigned char * rect, - int step); + unsigned char * rect, + int step); void detectBitmapFont(struct ImBuf *ibuf); int locateGlyph(struct bmFont *bmfont, unsigned short unicode); void matrixGlyph(struct ImBuf * ibuf, unsigned short unicode, - float *centerx, float *centery, - float *sizex, float *sizey, - float *transx, float *transy, - float *movex, float *movey, float *advance); + float *centerx, float *centery, + float *sizex, float *sizey, + float *transx, float *transy, + float *movex, float *movey, float *advance); #ifdef __cplusplus } #endif - + #endif diff --git a/source/blender/blenkernel/BKE_fluidsim.h b/source/blender/blenkernel/BKE_fluidsim.h index a68009dda37..2b2c7a4ff87 100644 --- a/source/blender/blenkernel/BKE_fluidsim.h +++ b/source/blender/blenkernel/BKE_fluidsim.h @@ -48,7 +48,7 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob, /* bounding box & memory estimate */ void fluid_get_bb(struct MVert *mvert, int totvert, float obmat[][4], - float start[3], float size[3]); + float start[3], float size[3]); void fluid_estimate_memory(struct Object *ob, struct FluidsimSettings *fss, char *value); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 07c6fb8b09c..900835940c7 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -128,9 +128,9 @@ typedef struct IndexNode { int index; } IndexNode; void create_vert_face_map(ListBase **map, IndexNode **mem, const struct MFace *mface, - const int totvert, const int totface); + const int totvert, const int totface); void create_vert_edge_map(ListBase **map, IndexNode **mem, const struct MEdge *medge, - const int totvert, const int totedge); + const int totvert, const int totedge); /* Partial Mesh Visibility */ struct PartialVisibility *mesh_pmv_copy(struct PartialVisibility *); diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index e14db31607a..081b79b44d6 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -91,7 +91,7 @@ typedef struct SculptSession { unsigned int texcache_side, *texcache, texcache_actual; /* Layer brush persistence between strokes */ - float (*layer_co)[3]; /* Copy of the mesh vertices' locations */ + float (*layer_co)[3]; /* Copy of the mesh vertices' locations */ struct SculptStroke *stroke; struct StrokeCache *cache; diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index a16e55ce8ff..715febf2fd1 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -198,8 +198,8 @@ int input_have_to_preprocess( SeqRenderData context, struct Sequence * seq, float cfra); void seq_proxy_rebuild(struct Main * bmain, - struct Scene *scene, struct Sequence * seq, - short *stop, short *do_update, float *progress); + struct Scene *scene, struct Sequence * seq, + short *stop, short *do_update, float *progress); /* ********************************************************************** diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 09021e71025..5303baddbca 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -333,7 +333,7 @@ void brush_reset_sculpt(Brush *br) /* enable this to see any non-default settings used by a brush: - brush_debug_print_state(br); + brush_debug_print_state(br); */ brush_set_defaults(br); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 6fb3922122e..1e38f666da7 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -231,7 +231,7 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) cddm->pbvh = BLI_pbvh_new(); cddm->pbvh_draw = can_pbvh_draw(ob, dm); BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert, - me->totface, me->totvert); + me->totface, me->totvert); if(ss->modifiers_active && ob->derivedDeform) { DerivedMesh *deformdm= ob->derivedDeform; diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 57a9dbcbc0f..4d5dce14b27 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -60,9 +60,9 @@ double tval( void ) } #else #include - static struct timeval _tstart, _tend; - static struct timezone tz; - void tstart ( void ) +static struct timeval _tstart, _tend; +static struct timezone tz; +void tstart ( void ) { gettimeofday ( &_tstart, &tz ); } diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 160f5703a01..8a6e8faf29a 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -67,8 +67,8 @@ /* local */ static int cu_isectLL(float *v1, float *v2, float *v3, float *v4, - short cox, short coy, - float *labda, float *mu, float *vec); + short cox, short coy, + float *labda, float *mu, float *vec); void unlink_curve(Curve *cu) { diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index c6b4cab6215..d7cc5376e21 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -90,7 +90,7 @@ typedef struct LayerTypeInfo { * count gives the number of elements in sources */ void (*interp)(void **sources, float *weights, float *sub_weights, - int count, void *dest); + int count, void *dest); /* a function to swap the data in corners of the element */ void (*swap)(void *data, const int *corner_indices); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 7f099c03d09..b1e39b1d768 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1148,8 +1148,8 @@ void graph_bfs(void) set_node_xy(node, node->BFS_dist*DEPSX*2, pos[node->BFS_dist]*DEPSY*2); node->color = DAG_BLACK; /* - fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y); - */ + fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y); + */ } } queue_delete(nqueue); @@ -1208,8 +1208,8 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a post_func(node->ob,data); node->color = DAG_BLACK; /* - fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y); - */ + fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y); + */ } } queue_delete(nqueue); @@ -1325,7 +1325,7 @@ DagNodeQueue * graph_dfs(void) set_node_xy(node, node->DFS_dist*DEPSX*2, pos[node->DFS_dist]*DEPSY*2); /* - fprintf(stderr,"DFS node : %20s %i %i %i %i\n",((ID *) node->ob)->name,node->BFS_dist, node->DFS_dist, node->DFS_dvtm, node->DFS_fntm ); + fprintf(stderr,"DFS node : %20s %i %i %i %i\n",((ID *) node->ob)->name,node->BFS_dist, node->DFS_dist, node->DFS_dvtm, node->DFS_fntm ); */ push_stack(retqueue,node); @@ -1574,7 +1574,7 @@ int is_acyclic( DagForest *dag) { void set_node_xy(DagNode *node, float x, float y) { - node->x = x; + node->x = x; node->y = y; } diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 313143f362b..df3694e0bf1 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -79,9 +79,9 @@ double itval(void) // #include // #include - static struct timeval _itstart, _itend; - static struct timezone itz; - void itstart(void) +static struct timeval _itstart, _itend; +static struct timezone itz; +void itstart(void) { gettimeofday(&_itstart, &itz); } diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 650f85da5b3..7332b89f629 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -671,10 +671,10 @@ static ID *alloc_libblock_notest(short type) break; case ID_PA: id = MEM_callocN(sizeof(ParticleSettings), "ParticleSettings"); - break; + break; case ID_WM: id = MEM_callocN(sizeof(wmWindowManager), "Window manager"); - break; + break; case ID_GD: id = MEM_callocN(sizeof(bGPdata), "Grease Pencil"); break; diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 5c82acde99b..d8628e526ef 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -776,7 +776,7 @@ void *new_pgn_element(int size) if(cur) { if(size+offs < blocksize) { adr= (void *) (cur->data+offs); - offs+= size; + offs+= size; return adr; } } diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 6579d7a01f4..ae0774eb34f 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1147,10 +1147,10 @@ static MultiresFace *find_old_face(ListBase *map, MultiresFace *faces, int v1, i IndexNode *n1; int v[4], i, j; - v[0]= v1; - v[1]= v2; - v[2]= v3; - v[3]= v4; + v[0]= v1; + v[1]= v2; + v[2]= v3; + v[3]= v4; for(n1 = map[v1].first; n1; n1 = n1->next) { int fnd[4] = {0, 0, 0, 0}; diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index fa023d8fb43..c4edddf587c 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -961,8 +961,8 @@ void ntreeSetOutput(bNodeTree *ntree) /* we need a check for which output node should be tagged like this, below an exception */ if(node->type==CMP_NODE_OUTPUT_FILE) - continue; - + continue; + /* there is more types having output class, each one is checked */ for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) { if(tnode->typeinfo->nclass==NODE_CLASS_OUTPUT) { diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index a9aeb37e478..dbfda18942a 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1127,7 +1127,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra) if (!BLI_exists(filename)) { return NULL; } - fp = fopen(filename, "rb"); + fp = fopen(filename, "rb"); } else if (mode==PTCACHE_FILE_WRITE) { BLI_make_existing_file(filename); /* will create the dir if needs be, same as //textures is created */ fp = fopen(filename, "wb"); diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 3699cf40aa8..e8e9c754806 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -2144,7 +2144,7 @@ static struct ImBuf * do_transform_effect( struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3); do_transform(context.scene, seq, facf0, - context.rectx, context.recty, ibuf1, out); + context.rectx, context.recty, ibuf1, out); return out; } @@ -2541,7 +2541,7 @@ static void RVIsolateHighlights_byte (unsigned char* in, unsigned char* out, for(y=0;y< height;y++) { for (x=0;x< width;x++) { - index= (x+y*width)*4; + index= (x+y*width)*4; /* Isolate the intensity */ intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold); @@ -2570,7 +2570,7 @@ static void RVIsolateHighlights_float (float* in, float* out, for(y=0;y< height;y++) { for (x=0;x< width;x++) { - index= (x+y*width)*4; + index= (x+y*width)*4; /* Isolate the intensity */ intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 3e9b570d104..53878176fec 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1160,13 +1160,13 @@ static void seq_open_anim_file(Sequence * seq) return; } - BLI_join_dirfile(name, sizeof(name), - seq->strip->dir, seq->strip->stripdata->name); + BLI_join_dirfile(name, sizeof(name), + seq->strip->dir, seq->strip->stripdata->name); BLI_path_abs(name, G.main->name); seq->anim = openanim(name, IB_rect | - ((seq->flag & SEQ_FILTERY) ? - IB_animdeinterlace : 0), seq->streamindex); + ((seq->flag & SEQ_FILTERY) ? + IB_animdeinterlace : 0), seq->streamindex); if (seq->anim == NULL) { return; @@ -1211,8 +1211,8 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, } if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { - BLI_join_dirfile(name, PROXY_MAXFILE, - dir, seq->strip->proxy->file); + BLI_join_dirfile(name, PROXY_MAXFILE, + dir, seq->strip->proxy->file); BLI_path_abs(name, G.main->name); return TRUE; @@ -1227,14 +1227,13 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, if (seq->type == SEQ_IMAGE) { BLI_snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir, - context.preview_render_size, - give_stripelem(seq, cfra)->name); + context.preview_render_size, + give_stripelem(seq, cfra)->name); frameno = 1; } else { - frameno = (int) give_stripelem_index(seq, cfra) - + seq->anim_startofs; + frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs; BLI_snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir, - context.preview_render_size); + context.preview_render_size); } BLI_path_abs(name, G.main->name); @@ -1504,7 +1503,7 @@ static void color_balance_byte_byte(Sequence * seq, ImBuf* ibuf, float mul) for (c = 0; c < 3; c++) { make_cb_table_byte(cb.lift[c], cb.gain[c], cb.gamma[c], - cb_tab[c], mul); + cb_tab[c], mul); } while (p < e) { @@ -1847,14 +1846,14 @@ static ImBuf* seq_render_effect_strip_impl( switch (early_out) { case EARLY_NO_INPUT: - out = sh.execute(context, seq, cfra, fac, facf, - NULL, NULL, NULL); + out = sh.execute(context, seq, cfra, fac, facf, + NULL, NULL, NULL); break; case EARLY_DO_EFFECT: for(i=0; i<3; i++) { if(input[i]) ibuf[i] = seq_render_strip( - context, input[i], cfra); + context, input[i], cfra); } if (ibuf[0] && ibuf[1]) { @@ -2909,7 +2908,7 @@ 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))); + get_sequence_effect_num_inputs(seq->type) == 0))); } /* check if the selected seq's reference unselected seq's */ diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 7f18db63c36..d3d6a658ede 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -561,7 +561,7 @@ static void ccd_build_deflector_hash(Scene *scene, Object *vertexowner, GHash *h }/*--- only with deflecting set */ }/* mesh && layer*/ - base = base->next; + base = base->next; } /* while (base) */ } @@ -589,7 +589,7 @@ static void ccd_update_deflector_hash(Scene *scene, Object *vertexowner, GHash * }/*--- only with deflecting set */ }/* mesh && layer*/ - base = base->next; + base = base->next; } /* while (base) */ } @@ -3356,7 +3356,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob) build_bps_springlist(ob); /* yes we need to do it again*/ } springs_from_mesh(ob); /* write the 'rest'-length of the springs */ - if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);} + if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);} } diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 2646f5164b2..036a52a1235 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -343,8 +343,8 @@ static AVFrame* generate_video_frame(uint8_t* pixels, ReportList *reports) if (c->pix_fmt != PIX_FMT_BGR32) { sws_scale(img_convert_ctx, (const uint8_t * const*) rgb_frame->data, - rgb_frame->linesize, 0, c->height, - current_frame->data, current_frame->linesize); + rgb_frame->linesize, 0, c->height, + current_frame->data, current_frame->linesize); delete_picture(rgb_frame); } return current_frame; -- cgit v1.2.3 From 8da281210063e3216d19848ecc82545fb1aeb58f Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 12 Nov 2011 04:40:53 +0000 Subject: Bugfix [#29125] Motion paths odd behaviour * Made it impossible to try to calculate/create new motion paths lasting 0 frames (i.e. 250 to 250) since we cannot allocate a zero-length array for these. Start frame can now be at most end-frame - 1, and end frame at least start frame + 1 * If an invalid configuration does occur, warnings/reports will now be issued in response to this instead of silently failing (as per this bugreport). --- source/blender/blenkernel/BKE_anim.h | 3 ++- source/blender/blenkernel/intern/anim.c | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index 44aebdf6205..c2b4e30ef3b 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -40,6 +40,7 @@ struct ListBase; struct bAnimVizSettings; struct bMotionPath; struct bPoseChannel; +struct ReportList; /* ---------------------------------------------------- */ /* Animation Visualisation */ @@ -49,7 +50,7 @@ void animviz_settings_init(struct bAnimVizSettings *avs); void animviz_free_motionpath_cache(struct bMotionPath *mpath); void animviz_free_motionpath(struct bMotionPath *mpath); -struct bMotionPath *animviz_verify_motionpaths(struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan); +struct bMotionPath *animviz_verify_motionpaths(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan); void animviz_get_object_motionpaths(struct Object *ob, ListBase *targets); void animviz_calc_motionpaths(struct Scene *scene, ListBase *targets); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index c1f294fb102..36df1101a24 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -67,6 +67,7 @@ #include "BKE_utildefines.h" #include "BKE_depsgraph.h" #include "BKE_anim.h" +#include "BKE_report.h" // XXX bad level call... @@ -147,7 +148,7 @@ void animviz_free_motionpath(bMotionPath *mpath) * - ob: object to add paths for (must be provided) * - pchan: posechannel to add paths for (optional; if not provided, object-paths are assumed) */ -bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel *pchan) +bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Object *ob, bPoseChannel *pchan) { bAnimVizSettings *avs; bMotionPath *mpath, **dst; @@ -170,6 +171,11 @@ bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel * /* avoid 0 size allocs */ if (avs->path_sf >= avs->path_ef) { + BKE_reportf(reports, RPT_ERROR, + "Motion Path frame extents invalid for %s (%d to %d).%s\n", + (pchan)? pchan->name : ob->id.name, + avs->path_sf, avs->path_ef, + (avs->path_sf == avs->path_ef)? " Cannot have single-frame paths." : ""); return NULL; } -- cgit v1.2.3