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 ++++++++++++++--------- source/blender/makesdna/DNA_dynamicpaint_types.h | 3 +- source/blender/makesrna/intern/rna_dynamicpaint.c | 7 ++- 3 files changed, 54 insertions(+), 31 deletions(-) (limited to 'source/blender') 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); diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h index 04d50c78652..22a0462985c 100644 --- a/source/blender/makesdna/DNA_dynamicpaint_types.h +++ b/source/blender/makesdna/DNA_dynamicpaint_types.h @@ -144,6 +144,7 @@ typedef struct DynamicPaintCanvasSettings { #define MOD_DPAINT_RAMP_ALPHA (1<<4) /* only read falloff ramp alpha */ #define MOD_DPAINT_PROX_PROJECT (1<<5) /* do proximity check only in defined dir */ #define MOD_DPAINT_INVERSE_PROX (1<<6) /* inverse proximity painting */ +#define MOD_DPAINT_NEGATE_VOLUME (1<<7) /* negates volume influence on "volume + prox" mode */ #define MOD_DPAINT_DO_SMUDGE (1<<8) /* brush smudges existing paint */ #define MOD_DPAINT_VELOCITY_ALPHA (1<<9) /* multiply brush influence by velocity */ @@ -160,7 +161,7 @@ typedef struct DynamicPaintCanvasSettings { #define MOD_DPAINT_COL_POINT 4 /* use distance to object center point */ /* proximity_falloff */ -#define MOD_DPAINT_PRFALL_SHARP 0 /* no-falloff */ +#define MOD_DPAINT_PRFALL_CONSTANT 0 /* no-falloff */ #define MOD_DPAINT_PRFALL_SMOOTH 1 /* smooth, linear falloff */ #define MOD_DPAINT_PRFALL_RAMP 2 /* use color ramp */ diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 754ed82e010..00a73afb789 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -695,7 +695,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) static EnumPropertyItem prop_dynamicpaint_prox_falloff[] = { {MOD_DPAINT_PRFALL_SMOOTH, "SMOOTH", ICON_SPHERECURVE, "Smooth", ""}, - {MOD_DPAINT_PRFALL_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""}, + {MOD_DPAINT_PRFALL_CONSTANT, "CONSTANT", ICON_NOCURVE, "Constant", ""}, {MOD_DPAINT_PRFALL_RAMP, "RAMP", ICON_COLOR, "Color Ramp", ""}, {0, NULL, 0, NULL, NULL}}; @@ -847,6 +847,11 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_INVERSE_PROX); RNA_def_property_ui_text(prop, "Inner Proximity", "Proximity falloff is applied inside the volume"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); + + prop= RNA_def_property(srna, "negate_volume", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_NEGATE_VOLUME); + RNA_def_property_ui_text(prop, "Negate Volume", "Negate influence inside the volume"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); /* -- cgit v1.2.3 From eb7bccb39a639683275ed0b80b927cd5eb8264fa Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 11 Nov 2011 11:42:29 +0000 Subject: Fix #29220 & #29221: missing cycles updates when switching scenes. --- source/blender/editors/screen/screen_edit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index a76be0c3c42..3a0202ad546 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -59,6 +59,7 @@ #include "ED_screen_types.h" #include "ED_fileselect.h" #include "ED_clip.h" +#include "ED_render.h" #include "UI_interface.h" @@ -1425,6 +1426,7 @@ void ED_screen_delete(bContext *C, bScreen *sc) /* only call outside of area/region loops */ void ED_screen_set_scene(bContext *C, Scene *scene) { + Main *bmain= CTX_data_main(C); bScreen *sc; bScreen *curscreen= CTX_wm_screen(C); @@ -1484,9 +1486,10 @@ void ED_screen_set_scene(bContext *C, Scene *scene) } CTX_data_scene_set(C, scene); - set_scene_bg(CTX_data_main(C), scene); + set_scene_bg(bmain, scene); - ED_update_for_newframe(CTX_data_main(C), scene, curscreen, 1); + ED_render_engine_changed(bmain); + ED_update_for_newframe(bmain, scene, curscreen, 1); /* complete redraw */ WM_event_add_notifier(C, NC_WINDOW, NULL); -- 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 +- source/blender/blenlib/intern/math_matrix.c | 6 +-- source/blender/blenlib/intern/math_rotation.c | 28 +++++------ source/blender/blenloader/intern/readfile.c | 4 +- .../editors/armature/editarmature_retarget.c | 24 +++++----- .../blender/editors/armature/editarmature_sketch.c | 10 ++-- source/blender/editors/armature/reeb.c | 4 +- source/blender/editors/interface/interface_draw.c | 8 ++-- .../blender/editors/interface/interface_handlers.c | 6 +-- source/blender/editors/mesh/editmesh_loop.c | 14 +++--- source/blender/editors/object/object_vgroup.c | 4 +- source/blender/editors/space_clip/clip_ops.c | 4 +- source/blender/editors/space_clip/tracking_ops.c | 12 ++--- source/blender/editors/space_view3d/drawobject.c | 6 +-- source/blender/editors/space_view3d/view3d_view.c | 8 ++-- source/blender/editors/transform/transform.c | 8 ++-- .../blender/editors/transform/transform_generics.c | 11 +++-- source/blender/gpu/intern/gpu_draw.c | 4 +- source/blender/gpu/intern/gpu_material.c | 8 ++-- source/blender/ikplugin/intern/iksolver_plugin.c | 24 +++++----- .../blender/nodes/composite/node_composite_tree.c | 2 +- .../blender/nodes/composite/node_composite_util.c | 10 ++-- .../composite/nodes/node_composite_bilateralblur.c | 15 +++--- .../nodes/composite/nodes/node_composite_blur.c | 2 +- .../composite/nodes/node_composite_channelMatte.c | 12 ++--- .../composite/nodes/node_composite_chromaMatte.c | 40 ++++++++-------- .../composite/nodes/node_composite_colorMatte.c | 6 +-- .../composite/nodes/node_composite_colorbalance.c | 2 +- .../nodes/composite/nodes/node_composite_curves.c | 6 +-- .../nodes/composite/nodes/node_composite_defocus.c | 54 +++++++++++----------- .../composite/nodes/node_composite_diffMatte.c | 2 +- .../nodes/node_composite_directionalblur.c | 8 ++-- .../composite/nodes/node_composite_displace.c | 2 +- .../nodes/composite/nodes/node_composite_gamma.c | 2 +- .../nodes/composite/nodes/node_composite_glare.c | 2 +- .../composite/nodes/node_composite_hueSatVal.c | 4 +- .../composite/nodes/node_composite_huecorrect.c | 4 +- .../nodes/composite/nodes/node_composite_invert.c | 2 +- .../nodes/composite/nodes/node_composite_levels.c | 8 ++-- .../nodes/composite/nodes/node_composite_mapUV.c | 24 +++++----- .../nodes/composite/nodes/node_composite_math.c | 6 +-- .../nodes/composite/nodes/node_composite_rotate.c | 2 +- .../composite/nodes/node_composite_sepcombYCCA.c | 24 +++++----- .../python/mathutils/mathutils_Quaternion.c | 2 +- .../blender/render/intern/source/convertblender.c | 18 ++++---- source/blender/render/intern/source/envmap.c | 10 ++-- source/blender/render/intern/source/pixelshading.c | 14 +++--- .../blender/render/intern/source/render_texture.c | 31 ++++++------- source/blender/render/intern/source/shadeoutput.c | 20 ++++---- 56 files changed, 300 insertions(+), 297 deletions(-) (limited to 'source/blender') 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); } } diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 241ab62e175..b2c9a5706a3 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -426,9 +426,9 @@ void mul_m3_v3_double(float mat[][3], double vec[3]) x=vec[0]; y=vec[1]; - vec[0]= x*mat[0][0] + y*mat[1][0] + mat[2][0]*vec[2]; - vec[1]= x*mat[0][1] + y*mat[1][1] + mat[2][1]*vec[2]; - vec[2]= x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2]; + vec[0]= x*(double)mat[0][0] + y*(double)mat[1][0] + (double)mat[2][0]*vec[2]; + vec[1]= x*(double)mat[0][1] + y*(double)mat[1][1] + (double)mat[2][1]*vec[2]; + vec[2]= x*(double)mat[0][2] + y*(double)mat[1][2] + (double)mat[2][2]*vec[2]; } void add_m3_m3m3(float m1[][3], float m2[][3], float m3[][3]) diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 7fecbae8229..1637cd16161 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -211,7 +211,7 @@ void quat_to_mat4(float m[][4], const float q[4]) double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc; #ifdef DEBUG - if(!((q0=dot_qtqt(q, q))==0.0f || (fabs(q0-1.0) < QUAT_EPSILON))) { + if(!((q0=dot_qtqt(q, q))==0.0f || (fabsf(q0-1.0) < QUAT_EPSILON))) { fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0); } #endif @@ -257,7 +257,7 @@ void mat3_to_quat(float *q, float wmat[][3]) /* work on a copy */ copy_m3_m3(mat, wmat); - normalize_m3(mat); /* this is needed AND a NormalQuat in the end */ + normalize_m3(mat); /* this is needed AND a 'normalize_qt' in the end */ tr= 0.25* (double)(1.0f+mat[0][0]+mat[1][1]+mat[2][2]); @@ -271,31 +271,31 @@ void mat3_to_quat(float *q, float wmat[][3]) } else { if(mat[0][0] > mat[1][1] && mat[0][0] > mat[2][2]) { - s= 2.0*sqrtf(1.0f + mat[0][0] - mat[1][1] - mat[2][2]); + s= 2.0f*sqrtf(1.0f + mat[0][0] - mat[1][1] - mat[2][2]); q[1]= (float)(0.25*s); s= 1.0/s; - q[0]= (float)((mat[2][1] - mat[1][2])*s); - q[2]= (float)((mat[1][0] + mat[0][1])*s); - q[3]= (float)((mat[2][0] + mat[0][2])*s); + q[0]= (float)((double)(mat[2][1] - mat[1][2])*s); + q[2]= (float)((double)(mat[1][0] + mat[0][1])*s); + q[3]= (float)((double)(mat[2][0] + mat[0][2])*s); } else if(mat[1][1] > mat[2][2]) { - s= 2.0*sqrtf(1.0f + mat[1][1] - mat[0][0] - mat[2][2]); + s= 2.0f*sqrtf(1.0f + mat[1][1] - mat[0][0] - mat[2][2]); q[2]= (float)(0.25*s); s= 1.0/s; - q[0]= (float)((mat[2][0] - mat[0][2])*s); - q[1]= (float)((mat[1][0] + mat[0][1])*s); - q[3]= (float)((mat[2][1] + mat[1][2])*s); + q[0]= (float)((double)(mat[2][0] - mat[0][2])*s); + q[1]= (float)((double)(mat[1][0] + mat[0][1])*s); + q[3]= (float)((double)(mat[2][1] + mat[1][2])*s); } else { - s= 2.0*sqrtf(1.0 + mat[2][2] - mat[0][0] - mat[1][1]); + s= 2.0f*sqrtf(1.0f + mat[2][2] - mat[0][0] - mat[1][1]); q[3]= (float)(0.25*s); s= 1.0/s; - q[0]= (float)((mat[1][0] - mat[0][1])*s); - q[1]= (float)((mat[2][0] + mat[0][2])*s); - q[2]= (float)((mat[2][1] + mat[1][2])*s); + q[0]= (float)((double)(mat[1][0] - mat[0][1])*s); + q[1]= (float)((double)(mat[2][0] + mat[0][2])*s); + q[2]= (float)((double)(mat[2][1] + mat[1][2])*s); } } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 852b4adcfda..65e047ceb22 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12366,10 +12366,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { Camera *cam; for(cam= main->camera.first; cam; cam= cam->id.next) { - if (cam->sensor_x < 0.01) + if (cam->sensor_x < 0.01f) cam->sensor_x = DEFAULT_SENSOR_WIDTH; - if (cam->sensor_y < 0.01) + if (cam->sensor_y < 0.01f) cam->sensor_y = DEFAULT_SENSOR_HEIGHT; } } diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index b1651886620..ccc375a03f9 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -708,7 +708,7 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link) sub_v3_v3v3(offset, ctrl->bone->head, link->head); /* if root matches, check for direction too */ - if (dot_v3v3(offset, offset) < 0.0001) + if (dot_v3v3(offset, offset) < 0.0001f) { float vbone[3], vparent[3]; @@ -726,7 +726,7 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link) cross_v3_v3v3(nor, vbone, vparent); len = dot_v3v3(nor, nor); - if (len < 0.0001) + if (len < 0.0001f) { flag |= RIG_CTRL_FIT_BONE; } @@ -859,8 +859,8 @@ static void RIG_reconnectControlBones(RigGraph *rg) { int fit = 0; - fit = len_v3v3(ctrl->bone->head, edge->bone->head) < 0.0001; - fit = fit || len_v3v3(ctrl->bone->tail, edge->bone->tail) < 0.0001; + fit = len_v3v3(ctrl->bone->head, edge->bone->head) < 0.0001f; + fit = fit || len_v3v3(ctrl->bone->tail, edge->bone->tail) < 0.0001f; if (fit) { @@ -1016,13 +1016,13 @@ static void RIG_reconnectControlBones(RigGraph *rg) /* don't link with parent */ if (bone->parent != ctrl->bone) { - if (len_v3v3(ctrl->bone->tail, bone->head) < 0.01) + if (len_v3v3(ctrl->bone->tail, bone->head) < 0.01f) { ctrl->tail_mode = TL_HEAD; ctrl->link_tail = bone; break; } - else if (len_v3v3(ctrl->bone->tail, bone->tail) < 0.01) + else if (len_v3v3(ctrl->bone->tail, bone->tail) < 0.01f) { ctrl->tail_mode = TL_TAIL; ctrl->link_tail = bone; @@ -1122,14 +1122,14 @@ static void RIG_removeUneededOffsets(RigGraph *rg) if (first_edge->bone == NULL) { - if (first_edge->bone == NULL && len_v3v3(first_edge->tail, arc->head->p) <= 0.001) + if (first_edge->bone == NULL && len_v3v3(first_edge->tail, arc->head->p) <= 0.001f) { BLI_remlink(&arc->edges, first_edge); MEM_freeN(first_edge); } else if (arc->head->degree == 1) { - RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, first_edge->tail, 0.001); + RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, first_edge->tail, 0.001f); if (new_node) { @@ -1252,14 +1252,14 @@ static void RIG_removeUneededOffsets(RigGraph *rg) if (last_edge->bone == NULL) { - if (len_v3v3(last_edge->head, arc->tail->p) <= 0.001) + if (len_v3v3(last_edge->head, arc->tail->p) <= 0.001f) { BLI_remlink(&arc->edges, last_edge); MEM_freeN(last_edge); } else if (arc->tail->degree == 1) { - RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, last_edge->head, 0.001); + RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, last_edge->head, 0.001f); if (new_node) { @@ -2013,11 +2013,11 @@ static float costAngle(float original_angle, float vec_first[3], float vec_secon { current_angle = saacos(dot_v3v3(vec_first, vec_second)); - return angle_weight * fabs(current_angle - original_angle); + return angle_weight * fabsf(current_angle - original_angle); } else { - return angle_weight * M_PI; + return angle_weight * (float)M_PI; } } else diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index b97e843529a..f16771b624c 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -508,7 +508,7 @@ static void sk_drawEdge(GLUquadric *quad, SK_Point *pt0, SK_Point *pt1, float si angle = angle_normalized_v3v3(vec2, vec1); - glRotatef(angle * 180 / M_PI + 180, axis[0], axis[1], axis[2]); + glRotatef(angle * (float)(180.0/M_PI) + 180.0f, axis[0], axis[1], axis[2]); gluCylinder(quad, sk_clampPointSize(pt1, size), sk_clampPointSize(pt0, size), length, 8, 8); } @@ -529,7 +529,7 @@ static void sk_drawNormal(GLUquadric *quad, SK_Point *pt, float size, float heig angle = angle_normalized_v3v3(vec2, pt->no); - glRotatef(angle * 180 / M_PI, axis[0], axis[1], axis[2]); + glRotatef(angle * (float)(180.0/M_PI), axis[0], axis[1], axis[2]); glColor3f(0, 1, 1); gluCylinder(quad, sk_clampPointSize(pt, size), 0, sk_clampPointSize(pt, height), 10, 2); @@ -1817,7 +1817,7 @@ int sk_detectTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE sub_v3_v3v3(s1, gest->segments->points[1].p, gest->segments->points[0].p); sub_v3_v3v3(s2, gest->segments->points[2].p, gest->segments->points[1].p); - angle = RAD2DEG(angle_v2v2(s1, s2)); + angle = RAD2DEGF(angle_v2v2(s1, s2)); if (angle > 60 && angle < 120) { @@ -1935,7 +1935,7 @@ int sk_detectDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNU sub_v3_v3v3(s1, gest->segments->points[1].p, gest->segments->points[0].p); sub_v3_v3v3(s2, gest->segments->points[2].p, gest->segments->points[1].p); - angle = RAD2DEG(angle_v2v2(s1, s2)); + angle = RAD2DEGF(angle_v2v2(s1, s2)); if (angle > 120) { @@ -2067,7 +2067,7 @@ int sk_detectReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN sub_v3_v3v3(end_v, sk_lastStrokePoint(gest->stk)->p, isect->p); } - angle = RAD2DEG(angle_v2v2(start_v, end_v)); + angle = RAD2DEGF(angle_v2v2(start_v, end_v)); if (angle > 120) { diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index ce4092b2b84..6a43564e5f1 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -545,12 +545,12 @@ static void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc) } } - if (ceil(head->weight) != arc->buckets[0].val) + if (ceilf(head->weight) != arc->buckets[0].val) { printArc(arc); printf("alloc error in first bucket: %f should be %f \n", arc->buckets[0].val, ceil(head->weight)); } - if (floor(tail->weight) != arc->buckets[arc->bcount - 1].val) + if (floorf(tail->weight) != arc->buckets[arc->bcount - 1].val) { printArc(arc); printf("alloc error in last bucket: %f should be %f \n", arc->buckets[arc->bcount - 1].val, floor(tail->weight)); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 4bc0963aad4..67030f1aca7 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1560,11 +1560,11 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc /* draw content of pattern area */ glScissor(ar->winrct.xmin+rect.xmin, ar->winrct.ymin+rect.ymin, scissor[2], scissor[3]); - zoomx= (rect.xmax-rect.xmin) / (scopes->track_preview->x-2.f); - zoomy= (rect.ymax-rect.ymin) / (scopes->track_preview->y-2.f); + zoomx= (rect.xmax-rect.xmin) / (scopes->track_preview->x-2.0f); + zoomy= (rect.ymax-rect.ymin) / (scopes->track_preview->y-2.0f); - off_x= ((int)scopes->track_pos[0]-scopes->track_pos[0]-0.5)*zoomx; - off_y= ((int)scopes->track_pos[1]-scopes->track_pos[1]-0.5)*zoomy; + off_x= ((int)scopes->track_pos[0]-scopes->track_pos[0]-0.5f)*zoomx; + off_y= ((int)scopes->track_pos[1]-scopes->track_pos[1]-0.5f)*zoomy; drawibuf= scale_trackpreview_ibuf(scopes->track_preview, zoomx, zoomy); glaDrawPixelsSafe(off_x+rect.xmin, off_y+rect.ymin, rect.xmax-rect.xmin+1.f-off_x, rect.ymax-rect.ymin+1.f-off_y, drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 06a05740585..7338aa1983f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3231,7 +3231,7 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF { float *hsv= ui_block_hsv_get(but->block); float rgb[3]; - float sensitivity = (shift?0.15:0.3) * ndof->dt; + float sensitivity = (shift ? 0.15f : 0.3f) * ndof->dt; int color_profile = but->block->color_profile; @@ -3426,7 +3426,7 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); /* Convert current colour on hue/sat disc to circular coordinates phi, r */ - phi = fmodf(hsv[0]+0.25f, 1.0f) * -2.0f*M_PI; + phi = fmodf(hsv[0] + 0.25f, 1.0f) * -2.0f * (float)M_PI; r = hsv[1]; /* sqr= r>0.f?sqrtf(r):1; */ /* UNUSED */ @@ -3439,7 +3439,7 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND v[1] += ndof->rx * sensitivity; /* convert back to polar coords on circle */ - phi = atan2(v[0], v[1])/(2.0f*(float)M_PI) + 0.5f; + phi = atan2f(v[0], v[1])/(2.0f*(float)M_PI) + 0.5f; /* use ndof z rotation to additionally rotate hue */ phi -= ndof->rz * sensitivity * 0.5f; diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index a671de71636..70cbbf5a93c 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -546,21 +546,21 @@ static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct m1=MAXSLOPE; b1=x12; } - x2max=MAX2(x21,x22)+0.001; /* prevent missed edges */ - x2min=MIN2(x21,x22)-0.001; /* due to round off error */ - y2max=MAX2(y21,y22)+0.001; - y2min=MIN2(y21,y22)-0.001; + x2max=MAX2(x21,x22)+0.001f; /* prevent missed edges */ + x2min=MIN2(x21,x22)-0.001f; /* due to round off error */ + y2max=MAX2(y21,y22)+0.001f; + y2min=MIN2(y21,y22)-0.001f; /* Found an intersect, calc intersect point */ if (m1==m2){ /* co-incident lines */ /* cut at 50% of overlap area*/ x1max=MAX2(x11, x12); x1min=MIN2(x11, x12); - xi= (MIN2(x2max,x1max)+MAX2(x2min,x1min))/2.0; + xi= (MIN2(x2max,x1max)+MAX2(x2min,x1min))/2.0f; y1max=MAX2(y11, y12); y1min=MIN2(y11, y12); - yi= (MIN2(y2max,y1max)+MAX2(y2min,y1min))/2.0; + yi= (MIN2(y2max,y1max)+MAX2(y2min,y1min))/2.0f; } else if (m2==MAXSLOPE){ xi=x22; @@ -594,7 +594,7 @@ static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct } } } - if ((m2<=1.0)&&(m2>=-1.0)) perc = (xi-x21)/(x22-x21); + if ((m2 <= 1.0f) && (m2 >= -1.0f)) perc = (xi-x21)/(x22-x21); else perc=(yi-y21)/(y22-y21); /*lower slope more accurate*/ //isect=32768.0*(perc+0.0000153); /* Percentage in 1/32768ths */ diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index a59ca5ad954..0d210fa83eb 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1094,8 +1094,8 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in dm_deform_clear(dm, ob); dm = NULL; } } - } while(wasChange && (distToStart-distToBe)/fabs(distToStart-distToBe) == - (dists[bestIndex]-distToBe)/fabs(dists[bestIndex]-distToBe)); + } while(wasChange && (distToStart-distToBe)/fabsf(distToStart-distToBe) == + (dists[bestIndex]-distToBe)/fabsf(dists[bestIndex]-distToBe)); MEM_freeN(upDown); MEM_freeN(changes); MEM_freeN(dists); diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 98abbad13dd..d713303ca8b 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -555,8 +555,8 @@ static int view_zoom_inout_invoke(bContext *C, wmOperator *op, wmEvent *event, i ED_space_clip_size(sc, &width, &height); - sc->xof+= ((co[0]-0.5)*width-sc->xof)*(sc->zoom-oldzoom)/sc->zoom; - sc->yof+= ((co[1]-0.5)*height-sc->yof)*(sc->zoom-oldzoom)/sc->zoom; + sc->xof+= ((co[0]-0.5f)*width-sc->xof)*(sc->zoom-oldzoom)/sc->zoom; + sc->yof+= ((co[1]-0.5f)*height-sc->yof)*(sc->zoom-oldzoom)/sc->zoom; } return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 78bfb1498ac..e9006f5b1e9 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1317,8 +1317,8 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo break; exec_time= PIL_check_seconds_timer()-start_time; - if(tmj->delay>exec_time) - PIL_sleep_ms(tmj->delay-exec_time); + if(tmj->delay > (float)exec_time) + PIL_sleep_ms(tmj->delay-(float)exec_time); } else if(!BKE_tracking_next(tmj->context)) break; @@ -1820,13 +1820,13 @@ static void set_axis(Scene *scene, Object *ob, MovieTrackingTrack *track, char BKE_get_tracking_mat(scene, NULL, mat); mul_v3_m4v3(vec, mat, track->bundle_pos); - if(len_v2(vec)<1e-3) + if(len_v2(vec) < 1e-3f) return; unit_m4(mat); if(axis=='X') { - if(fabsf(vec[1])<1e-3) { + if(fabsf(vec[1])<1e-3f) { mat[0][0]= -1.0f; mat[0][1]= 0.0f; mat[0][2]= 0.0f; mat[1][0]= 0.0f; mat[1][1]= -1.0f; mat[1][2]= 0.0f; mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f; @@ -1837,7 +1837,7 @@ static void set_axis(Scene *scene, Object *ob, MovieTrackingTrack *track, char cross_v3_v3v3(mat[1], mat[2], mat[0]); } } else { - if(fabsf(vec[0])<1e-3) { + if(fabsf(vec[0])<1e-3f) { mat[0][0]= -1.0f; mat[0][1]= 0.0f; mat[0][2]= 0.0f; mat[1][0]= 0.0f; mat[1][1]= -1.0f; mat[1][2]= 0.0f; mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f; @@ -2062,7 +2062,7 @@ static int set_scale_exec(bContext *C, wmOperator *op) sub_v3_v3(vec[0], vec[1]); - if(len_v3(vec[0])>1e-5) { + if(len_v3(vec[0])>1e-5f) { scale= dist / len_v3(vec[0]); mul_v3_fl(parent->size, scale); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index d66197549d9..21fcc067764 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1479,7 +1479,7 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d, glPushMatrix(); glTranslatef(track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]); - glScalef(v3d->bundle_size/0.05, v3d->bundle_size/0.05, v3d->bundle_size/0.05); + glScalef(v3d->bundle_size/0.05f, v3d->bundle_size/0.05f, v3d->bundle_size/0.05f); if(v3d->drawtype==OB_WIRE) { glDisable(GL_LIGHTING); @@ -1720,8 +1720,8 @@ static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D glBegin(GL_LINE_LOOP); for(i = 0; i < 16; i++) { - vec[0] = cosf(M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); - vec[1] = sinf(M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); + vec[0] = cosf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); + vec[1] = sinf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); glVertex3fv(vec); } glEnd(); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index a5849864d86..cc0e93740ea 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1068,14 +1068,14 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy float dfac; if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) { - if(winx>winy) dfac= (sensor_x * 2.0) / (fac*winx*lens); - else dfac= (sensor_x * 2.0) / (fac*winy*lens); + if(winx>winy) dfac= (sensor_x * 2.0f) / (fac*winx*lens); + else dfac= (sensor_x * 2.0f) / (fac*winy*lens); } else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { - dfac= (sensor_x * 2.0) / (fac*winx*lens); + dfac= (sensor_x * 2.0f) / (fac*winx*lens); } else { - dfac= (sensor_y * 2.0) / (fac*winy*lens); + dfac= (sensor_y * 2.0f) / (fac*winy*lens); } x1= - *clipsta * winx*dfac; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 95daa11d97f..5060f55c533 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4691,7 +4691,7 @@ static int createSlideVerts(TransInfo *t) uv_new = tf->uv[k]; if (ev->tmp.l) { - if (fabsf(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) { + if (fabsf(suv->origuv[0]-uv_new[0]) > 0.0001f || fabsf(suv->origuv[1]-uv_new[1]) > 0.0001f) { ev->tmp.l = -1; /* Tag as invalid */ BLI_linklist_free(suv->fuv_list,NULL); suv->fuv_list = NULL; @@ -5462,7 +5462,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, else #endif { - val= (float)( floor(val+0.5f) ); + val= floorf(val+0.5f); } /* convert frame out of nla-action time */ @@ -5548,13 +5548,13 @@ static void headerTimeTranslate(TransInfo *t, char *str) /* apply snapping + frame->seconds conversions */ if (autosnap == SACTSNAP_STEP) { if (doTime) - val= floor(val/secf + 0.5f); + val= floor((double)val/secf + 0.5f); else val= floor(val + 0.5f); } else { if (doTime) - val= val / secf; + val= (float)((double)val / secf); } if (autosnap == SACTSNAP_FRAME) diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 0e053e68496..3a8c2e80351 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -197,8 +197,9 @@ static void clipMirrorModifier(TransInfo *t, Object *ob) clip = 0; if(axis & 1) { - if(fabs(iloc[0])<=tolerance[0] || - loc[0]*iloc[0]<0.0f) { + if(fabsf(iloc[0])<=tolerance[0] || + loc[0]*iloc[0]<0.0f) + { loc[0]= 0.0f; clip = 1; } @@ -206,14 +207,16 @@ static void clipMirrorModifier(TransInfo *t, Object *ob) if(axis & 2) { if(fabs(iloc[1])<=tolerance[1] || - loc[1]*iloc[1]<0.0f) { + loc[1]*iloc[1]<0.0f) + { loc[1]= 0.0f; clip = 1; } } if(axis & 4) { if(fabs(iloc[2])<=tolerance[2] || - loc[2]*iloc[2]<0.0f) { + loc[2]*iloc[2]<0.0f) + { loc[2]= 0.0f; clip = 1; } diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index d08d7cf2ead..3981e9fac02 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -775,7 +775,7 @@ int GPU_update_image_time(Image *ima, double time) if (ima->lastupdate<0) ima->lastupdate = 0; - if (ima->lastupdate>time) + if (ima->lastupdate > (float)time) ima->lastupdate=(float)time; if(ima->tpageflag & IMA_TWINANIM) { @@ -783,7 +783,7 @@ int GPU_update_image_time(Image *ima, double time) /* check: is the bindcode not in the array? Then free. (still to do) */ - diff = (float)(time-ima->lastupdate); + diff = (float)((float)time - ima->lastupdate); inc = (int)(diff*(float)ima->animspeed); ima->lastupdate+=((float)inc/(float)ima->animspeed); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 02ba2eba9e9..397c0e32c69 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1337,8 +1337,8 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) if(world) { /* exposure correction */ if(world->exp!=0.0f || world->range!=1.0f) { - linfac= 1.0 + pow((2.0*world->exp + 0.5), -10); - logfac= log((linfac-1.0f)/linfac)/world->range; + linfac= 1.0f + powf((2.0f*world->exp + 0.5f), -10); + logfac= logf((linfac-1.0f)/linfac)/world->range; GPU_link(mat, "set_value", GPU_uniform(&linfac), &ulinfac); GPU_link(mat, "set_value", GPU_uniform(&logfac), &ulogfac); @@ -1518,7 +1518,7 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l if(lamp->mode & LA_HALO) if(lamp->spotsi > 170.0f) lamp->spotsi = 170.0f; - lamp->spotsi= cos(M_PI*lamp->spotsi/360.0); + lamp->spotsi= cosf((float)M_PI*lamp->spotsi/360.0f); lamp->spotbl= (1.0f - lamp->spotsi)*la->spotblend; lamp->k= la->k; @@ -1539,7 +1539,7 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l /* makeshadowbuf */ angle= saacos(lamp->spotsi); - temp= 0.5f*lamp->size*cos(angle)/sin(angle); + temp= 0.5f*lamp->size*cosf(angle)/sinf(angle); pixsize= (lamp->d)/temp; wsize= pixsize*0.5f*lamp->size; diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 2a83052c827..7159c09d703 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -71,7 +71,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t if (data->flag & CONSTRAINT_IK_AUTO) break; if (data->tar==NULL) continue; if (data->tar->type==OB_ARMATURE && data->subtarget[0]==0) continue; - if ((con->flag & (CONSTRAINT_DISABLE|CONSTRAINT_OFF))==0 && (con->enforce!=0.0)) break; + if ((con->flag & (CONSTRAINT_DISABLE|CONSTRAINT_OFF))==0 && (con->enforce != 0.0f)) break; } } if(con==NULL) return; @@ -255,7 +255,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) if(!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP)) flag |= IK_ZDOF; - if(tree->stretch && (pchan->ikstretch > 0.0)) { + if(tree->stretch && (pchan->ikstretch > 0.0f)) { flag |= IK_TRANS_YDOF; hasstretch = 1; } @@ -320,9 +320,9 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) IK_SetStiffness(seg, IK_Y, pchan->stiffness[1]); IK_SetStiffness(seg, IK_Z, pchan->stiffness[2]); - if(tree->stretch && (pchan->ikstretch > 0.0)) { + if(tree->stretch && (pchan->ikstretch > 0.0f)) { float ikstretch = pchan->ikstretch*pchan->ikstretch; - IK_SetStiffness(seg, IK_TRANS_Y, MIN2(1.0-ikstretch, 0.99)); + IK_SetStiffness(seg, IK_TRANS_Y, MIN2(1.0f-ikstretch, 0.99f)); IK_SetLimit(seg, IK_TRANS_Y, 0.001, 1e10); } } @@ -389,10 +389,10 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) } /* do we need blending? */ - if (!resultblend && target->con->enforce!=1.0) { + if (!resultblend && target->con->enforce != 1.0f) { float q1[4], q2[4], q[4]; float fac= target->con->enforce; - float mfac= 1.0-fac; + float mfac= 1.0f-fac; pchan= tree->pchan[target->tip]; @@ -415,13 +415,13 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) iktarget= iktree[target->tip]; - if(data->weight != 0.0) { + if(data->weight != 0.0f) { if(poleconstrain) IK_SolverSetPoleVectorConstraint(solver, iktarget, goalpos, polepos, data->poleangle, (poleangledata == data)); IK_SolverAddGoal(solver, iktarget, goalpos, data->weight); } - if((data->flag & CONSTRAINT_IK_ROT) && (data->orientweight != 0.0)) + if((data->flag & CONSTRAINT_IK_ROT) && (data->orientweight != 0.0f)) if((data->flag & CONSTRAINT_IK_AUTO)==0) IK_SolverAddGoalOrientation(solver, iktarget, goalrot, data->orientweight); @@ -448,20 +448,20 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) float parentstretch, stretch; pchan= tree->pchan[a]; - parentstretch= (tree->parent[a] >= 0)? ikstretch[tree->parent[a]]: 1.0; + parentstretch= (tree->parent[a] >= 0)? ikstretch[tree->parent[a]]: 1.0f; - if(tree->stretch && (pchan->ikstretch > 0.0)) { + if(tree->stretch && (pchan->ikstretch > 0.0f)) { float trans[3], length; IK_GetTranslationChange(iktree[a], trans); length= pchan->bone->length*len_v3(pchan->pose_mat[1]); - ikstretch[a]= (length == 0.0)? 1.0: (trans[1]+length)/length; + ikstretch[a]= (length == 0.0f)? 1.0f: (trans[1]+length)/length; } else ikstretch[a] = 1.0; - stretch= (parentstretch == 0.0)? 1.0: ikstretch[a]/parentstretch; + stretch= (parentstretch == 0.0f)? 1.0f: ikstretch[a]/parentstretch; mul_v3_fl(tree->basis_change[a][0], stretch); mul_v3_fl(tree->basis_change[a][1], stretch); diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 10b062977b2..1a1d744fb1b 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -603,7 +603,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) if(nodeexec) { node = nodeexec->node; if(ntree->progress && totnode) - ntree->progress(ntree->prh, (1.0 - curnode/(float)totnode)); + ntree->progress(ntree->prh, (1.0f - curnode/(float)totnode)); if(ntree->stats_draw) { char str[64]; sprintf(str, "Compositing %d %s", curnode, node->name); diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index 0356ed394f1..ddd55790436 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -762,7 +762,7 @@ void premul_compbuf(CompBuf *img, int inversed) drect= img->rect; if(inversed) { for(x=img->x*img->y; x>0; x--, drect+=4) { - if(fabs(drect[3]) < 1e-5f) { + if(fabsf(drect[3]) < 1e-5f) { drect[0]= 0.0f; drect[1]= 0.0f; drect[2]= 0.0f; @@ -1314,7 +1314,7 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) int i, x, y, sz; // <0.5 not valid, though can have a possibly useful sort of sharpening effect - if (sigma < 0.5) return; + if (sigma < 0.5f) return; if ((xy < 1) || (xy > 3)) xy = 3; @@ -1326,10 +1326,10 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 - if (sigma >= 3.556) - q = 0.9804*(sigma - 3.556) + 2.5091; + if (sigma >= 3.556f) + q = 0.9804f*(sigma - 3.556f) + 2.5091f; else // sigma >= 0.5 - q = (0.0561*sigma + 0.5784)*sigma - 0.2568; + q = (0.0561f*sigma + 0.5784f)*sigma - 0.2568f; q2 = q*q; sc = (1.1668 + q)*(3.203729649 + (2.21566 + q)*q); // no gabor filtering here, so no complex multiplies, just the regular coefs. diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c index 17038fd6780..0f341335783 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c @@ -62,13 +62,14 @@ static bNodeSocketTemplate cmp_node_bilateralblur_out[]= { #define KERNEL_ELEMENT_C3(k) \ temp_color = src + deltas[k]; \ ref_color = ref + deltas[k]; \ - w = weight_tab[k] + COLOR_DISTANCE_C3(ref, ref_color )*i2sigma_color; \ + w = weight_tab[k] + \ + (double)COLOR_DISTANCE_C3(ref, ref_color ) * i2sigma_color; \ w = 1.0/(w*w + 1); \ mean0 += w; \ - mean1[0] += temp_color[0]*w; \ - mean1[1] += temp_color[1]*w; \ - mean1[2] += temp_color[2]*w; \ - mean1[3] += temp_color[3]*w; + mean1[0] += (double)temp_color[0]*w; \ + mean1[1] += (double)temp_color[1]*w; \ + mean1[2] += (double)temp_color[2]*w; \ + mean1[3] += (double)temp_color[3]*w; /* write blurred values to image */ #define UPDATE_OUTPUT_C3 \ @@ -137,8 +138,8 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN sigma_color= nbbd->sigma_color; sigma_space= nbbd->sigma_space; - i2sigma_color= 1. / (sigma_color * sigma_color); - i2sigma_space= 1. / (sigma_space * sigma_space); + i2sigma_color= 1.0f / (sigma_color * sigma_color); + i2sigma_space= 1.0f / (sigma_space * sigma_space); INIT_3X3_DELTAS(deltas, step, pix); diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index d0ddfb47f08..816aacbe61c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -77,7 +77,7 @@ static float *make_bloomtab(int rad) bloomtab = (float *) MEM_mallocN(n * sizeof(float), "bloom"); for (i = -rad; i <= rad; i++) { - val = pow(1.0 - fabs((float)i)/((float)rad), 4.0); + val = powf(1.0f - fabsf((float)i)/((float)rad), 4.0f); bloomtab[i+rad] = val; } diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c index 10f0afb6cf6..6597ceaeee2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c @@ -49,18 +49,18 @@ static void do_normalized_rgba_to_ycca2(bNode *UNUSED(node), float *out, float * { /*normalize to the range 0.0 to 1.0) */ rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); - out[0]=(out[0])/255.0; - out[1]=(out[1])/255.0; - out[2]=(out[2])/255.0; + out[0]=(out[0])/255.0f; + out[1]=(out[1])/255.0f; + out[2]=(out[2])/255.0f; out[3]=in[3]; } static void do_normalized_ycca_to_rgba2(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ - in[0]=in[0]*255.0; - in[1]=in[1]*255.0; - in[2]=in[2]*255.0; + in[0]=in[0]*255.0f; + in[1]=in[1]*255.0f; + in[2]=in[2]*255.0f; ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); out[3]=in[3]; } diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c index 25891aeaa68..9aadfdf363b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c @@ -50,14 +50,14 @@ static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *i rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); //normalize to 0..1.0 - out[0]=out[0]/255.0; - out[1]=out[1]/255.0; - out[2]=out[2]/255.0; + out[0]=out[0]/255.0f; + out[1]=out[1]/255.0f; + out[2]=out[2]/255.0f; //rescale to -1.0..1.0 - out[0]=(out[0]*2.0)-1.0; - out[1]=(out[1]*2.0)-1.0; - out[2]=(out[2]*2.0)-1.0; + out[0]=(out[0]*2.0f)-1.0f; + out[1]=(out[1]*2.0f)-1.0f; + out[2]=(out[2]*2.0f)-1.0f; // out[0]=((out[0])-16)/255.0; // out[1]=((out[1])-128)/255.0; @@ -68,13 +68,13 @@ static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *i static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ - in[0]=(in[0]+1.0)/2.0; - in[1]=(in[1]+1.0)/2.0; - in[2]=(in[2]+1.0)/2.0; + in[0]=(in[0]+1.0f)/2.0f; + in[1]=(in[1]+1.0f)/2.0f; + in[2]=(in[2]+1.0f)/2.0f; - in[0]=(in[0]*255.0); - in[1]=(in[1]*255.0); - in[2]=(in[2]*255.0); + in[0]=(in[0]*255.0f); + in[1]=(in[1]*255.0f); + in[2]=(in[2]*255.0f); // in[0]=(in[0]*255.0)+16; // in[1]=(in[1]*255.0)+128; @@ -98,27 +98,27 @@ static void do_chroma_key(bNode *node, float *out, float *in) theta=atan2(c->key[2], c->key[1]); /*rotate the cb and cr into x/z space */ - x=in[1]*cos(theta)+in[2]*sin(theta); - z=in[2]*cos(theta)-in[1]*sin(theta); + x=in[1]*cosf(theta)+in[2]*sinf(theta); + z=in[2]*cosf(theta)-in[1]*sinf(theta); /*if within the acceptance angle */ - angle=c->t1*M_PI/180.0; /* convert to radians */ + angle=c->t1*(float)M_PI/180.0f; /* convert to radians */ /* if kfg is <0 then the pixel is outside of the key color */ - kfg=x-(fabs(z)/tan(angle/2.0)); + kfg= x-(fabsf(z)/tanf(angle/2.0f)); out[0]=in[0]; out[1]=in[1]; out[2]=in[2]; - if(kfg>0.0) { /* found a pixel that is within key color */ - alpha=(1.0-kfg)*(c->fstrength); + if(kfg>0.0f) { /* found a pixel that is within key color */ + alpha=(1.0f-kfg)*(c->fstrength); beta=atan2(z,x); - angle2=c->t2*M_PI/180.0; + angle2=c->t2*(float)(M_PI/180.0); /* if beta is within the cutoff angle */ - if(fabs(beta)<(angle2/2.0)) { + if(fabsf(beta) < (angle2/2.0f)) { alpha=0.0; } diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c index b226e562799..66dc9ff0304 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c @@ -57,13 +57,13 @@ static void do_color_key(bNode *node, float *out, float *in) if( /* do hue last because it needs to wrap, and does some more checks */ - /* sat */ (fabs(in[1]-c->key[1]) < c->t2) && - /* val */ (fabs(in[2]-c->key[2]) < c->t3) && + /* sat */ (fabsf(in[1]-c->key[1]) < c->t2) && + /* val */ (fabsf(in[2]-c->key[2]) < c->t3) && /* multiply by 2 because it wraps on both sides of the hue, * otherwise 0.5 would key all hue's */ - /* hue */ ((h_wrap= 2.0f * fabs(in[0]-c->key[0])) < c->t1 || (2.0f - h_wrap) < c->t1) + /* hue */ ((h_wrap= 2.0f * fabsf(in[0]-c->key[0])) < c->t1 || (2.0f - h_wrap) < c->t1) ) { out[3]=0.0; /*make transparent*/ } diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c index eb75802c0a6..f7de5801a5e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c @@ -61,7 +61,7 @@ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slop float x = in * slope + offset; /* prevent NaN */ - CLAMP(x, 0.0, 1.0); + CLAMP(x, 0.0f, 1.0f); return powf(x, power); } diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c index 6f4d32f6573..2e54836e042 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.c +++ b/source/blender/nodes/composite/nodes/node_composite_curves.c @@ -141,9 +141,9 @@ static void do_curves(bNode *node, float *out, float *in) static void do_curves_fac(bNode *node, float *out, float *in, float *fac) { - if(*fac>=1.0) + if(*fac >= 1.0f) curvemapping_evaluate_premulRGBF(node->storage, out, in); - else if(*fac<=0.0) { + else if(*fac <= 0.0f) { copy_v3_v3(out, in); } else { @@ -175,7 +175,7 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS curvemapping_set_black_white(node->storage, in[2]->vec, in[3]->vec); - if(in[0]->data==NULL && in[0]->vec[0] == 1.0) + if(in[0]->data==NULL && in[0]->vec[0] == 1.0f) composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_curves, CB_RGBA); else composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_curves_fac, CB_RGBA, CB_VAL); diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 2232c4a489e..9b32e0f6f3f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -58,8 +58,8 @@ typedef struct BokehCoeffs { static void makeBokeh(char bktype, char ro, int* len_bkh, float* inradsq, BokehCoeffs BKH[8], float bkh_b[4]) { float x0, x1, y0, y1, dx, dy, iDxy; - float w = MAX2(1e-5f, ro)*M_PI/180.f; // never reported stangely enough, but a zero offset causes missing center line... - float wi = (360.f/bktype)*M_PI/180.f; + float w = MAX2(1e-5f, ro)*(float)(M_PI/180); // never reported stangely enough, but a zero offset causes missing center line... + float wi = (360.f/bktype)*(float)(M_PI/180); int i, ov, nv; // bktype must be at least 3 & <= 8 @@ -81,7 +81,7 @@ static void makeBokeh(char bktype, char ro, int* len_bkh, float* inradsq, BokehC BKH[i].x0 = x0; BKH[i].y0 = y0; dx = x1-x0, dy = y1-y0; - iDxy = 1.f / sqrt(dx*dx + dy*dy); + iDxy = 1.f / sqrtf(dx*dx + dy*dy); dx *= iDxy; dy *= iDxy; BKH[i].dx = dx; @@ -146,6 +146,7 @@ static float RI_vdC(unsigned int bits, unsigned int r) // single channel IIR gaussian filtering // much faster than anything else, constant time independent of width // should extend to multichannel and make this a node, could be useful +// note: this is an almost exact copy of 'IIR_gauss' static void IIR_gauss_single(CompBuf* buf, float sigma) { double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3]; @@ -156,14 +157,14 @@ static void IIR_gauss_single(CompBuf* buf, float sigma) if (buf->type != CB_VAL) return; // <0.5 not valid, though can have a possibly useful sort of sharpening effect - if (sigma < 0.5) return; + if (sigma < 0.5f) return; // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 - if (sigma >= 3.556) - q = 0.9804*(sigma - 3.556) + 2.5091; + if (sigma >= 3.556f) + q = 0.9804f*(sigma - 3.556f) + 2.5091f; else // sigma >= 0.5 - q = (0.0561*sigma + 0.5784)*sigma - 0.2568; + q = (0.0561f*sigma + 0.5784f)*sigma - 0.2568f; q2 = q*q; sc = (1.1668 + q)*(3.203729649 + (2.21566 + q)*q); // no gabor filtering here, so no complex multiplies, just the regular coefs. @@ -260,7 +261,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, Camera* cam = (Camera*)camob->data; cam_lens = cam->lens; cam_fdist = dof_camera(camob); - if (cam_fdist==0.0) cam_fdist = 1e10f; /* if the dof is 0.0 then set it be be far away */ + if (cam_fdist==0.0f) cam_fdist = 1e10f; /* if the dof is 0.0 then set it be be far away */ cam_invfdist = 1.f/cam_fdist; } @@ -362,7 +363,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // scale crad back to original maximum and blend crad->rect[px] = bcrad + wts->rect[px]*(scf*crad->rect[px] - bcrad); */ - crad->rect[px] = 0.5f*fabs(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f)); + crad->rect[px] = 0.5f*fabsf(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f)); // 'bug' #6615, limit minimum radius to 1 pixel, not really a solution, but somewhat mitigates the problem crad->rect[px] = MAX2(crad->rect[px], 0.5f); @@ -530,12 +531,13 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, }\ }\ } + i = ceil(ct_crad); j = 0; T = 0; while (i > j) { Dj = sqrt(cR2 - j*j); - Dj -= floor(Dj); + Dj -= floorf(Dj); di = 0; if (Dj > T) { i--; di = 1; } T = Dj; @@ -548,26 +550,26 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, lwt = wt*Dj; if (i!=j) { // outer pixels - AAPIX(x+j, y+i); - AAPIX(x+j, y-i); + AAPIX(x+j, y+i) + AAPIX(x+j, y-i) if (j) { - AAPIX(x-j, y+i); // BL - AAPIX(x-j, y-i); // TL + AAPIX(x-j, y+i) // BL + AAPIX(x-j, y-i) // TL } if (di) { // only when i changed, interior of outer section - CSCAN(j, i); // bottom - CSCAN(j, -i); // top + CSCAN(j, i) // bottom + CSCAN(j, -i) // top } } // lower mid section - AAPIX(x+i, y+j); - if (i) AAPIX(x-i, y+j); - CSCAN(i, j); + AAPIX(x+i, y+j) + if (i) AAPIX(x-i, y+j) + CSCAN(i, j) // upper mid section if (j) { - AAPIX(x+i, y-j); - if (i) AAPIX(x-i, y-j); - CSCAN(i, -j); + AAPIX(x+i, y-j) + if (i) AAPIX(x-i, y-j) + CSCAN(i, -j) } j++; } @@ -600,7 +602,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, fxe = fxe*ct_crad + x; xs = (int)floor(fxs), xe = (int)ceil(fxe); // AA hack for first and last x pixel, near vertical edges only - if (fabs(mind) <= 1.f) { + if (fabsf(mind) <= 1.f) { if ((xs >= 0) && (xs < new->x)) { lwt = 1.f-(fxs - xs); aacol[0] = wtcol[0]*lwt; @@ -619,7 +621,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, } } } - if (fabs(maxd) <= 1.f) { + if (fabsf(maxd) <= 1.f) { if ((xe >= 0) && (xe < new->x)) { lwt = 1.f-(xe - fxe); aacol[0] = wtcol[0]*lwt; @@ -676,7 +678,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, fys = fys*ct_crad + y; fye = fye*ct_crad + y; // near horizontal edges only, line slope <= 1 - if (fabs(mind) <= 1.f) { + if (fabsf(mind) <= 1.f) { int iys = (int)floor(fys); if ((iys >= 0) && (iys < new->y)) { lwt = 1.f - (fys - iys); @@ -696,7 +698,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, } } } - if (fabs(maxd) <= 1.f) { + if (fabsf(maxd) <= 1.f) { int iye = ceil(fye); if ((iye >= 0) && (iye < new->y)) { lwt = 1.f - (iye - fye); diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index 17156ab3492..5ca38b74420 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -58,7 +58,7 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float * fabs(inColor2[2]-inColor1[2]); /*average together the distances*/ - difference=difference/3.0; + difference=difference/3.0f; copy_v3_v3(outColor, inColor1); diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c index 591870d0911..802ef2d8e12 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c @@ -48,7 +48,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, if ((dist != 0.f) || (spin != 0.f) || (zoom != 0.f)) { void (*getpix)(CompBuf*, float, float, float*) = wrap ? qd_getPixelLerpWrap : qd_getPixelLerp; const float a= angle * (float)M_PI / 180.f; - const float itsc= 1.f / pow(2.f, (float)iterations); + const float itsc= 1.f / powf(2.f, (float)iterations); float D; float center_x_pix, center_y_pix; float tx, ty; @@ -62,14 +62,14 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, center_x_pix= center_x * img->x; center_y_pix= center_y * img->y; - tx= itsc * D * cos(a); - ty= -itsc * D * sin(a); + tx= itsc * D * cosf(a); + ty= -itsc * D * sinf(a); sc= itsc * zoom; rot= itsc * spin * (float)M_PI / 180.f; /* blur the image */ for(i= 0; i < iterations; ++i) { - const float cs= cos(rot), ss= sin(rot); + const float cs= cosf(rot), ss= sinf(rot); const float isc= 1.f / (1.f + sc); unsigned int x, y; float col[4]= {0,0,0,0}; diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c index 02a1d203bef..a55a6093f12 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.c +++ b/source/blender/nodes/composite/nodes/node_composite_displace.c @@ -49,7 +49,7 @@ static bNodeSocketTemplate cmp_node_displace_out[]= { /* minimum distance (in pixels) a pixel has to be displaced * in order to take effect */ -#define DISPLACE_EPSILON 0.01 +#define DISPLACE_EPSILON 0.01f static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *UNUSED(veccol), CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale) { diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c index 2bb600db99d..ad377799dea 100644 --- a/source/blender/nodes/composite/nodes/node_composite_gamma.c +++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c @@ -50,7 +50,7 @@ static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac) int i=0; for(i=0; i<3; i++) { /* check for negative to avoid nan's */ - out[i] = (in[i] > 0.0f)? pow(in[i],fac[0]): in[i]; + out[i] = (in[i] > 0.0f)? powf(in[i],fac[0]): in[i]; } out[3] = in[3]; } diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c index f4391a1af77..b7cc1d3c92d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.c +++ b/source/blender/nodes/composite/nodes/node_composite_glare.c @@ -253,7 +253,7 @@ static void streaks(NodeGlare* ndg, CompBuf* dst, CompBuf* src) const float p4 = pow(4.0, (double)n); const float vxp = vx*p4, vyp = vy*p4; const float wt = pow((double)ndg->fade, (double)p4); - const float cmo = 1.f - pow((double)ndg->colmod, (double)n+1); // colormodulation amount relative to current pass + const float cmo = 1.f - (float)pow((double)ndg->colmod, (double)n+1); // colormodulation amount relative to current pass float* tdstcol = tdst->rect; for (y=0; yy; ++y) { for (x=0; xx; ++x, tdstcol+=4) { diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c index 3c73d07d96c..711560a0a94 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c @@ -48,12 +48,12 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac) { NodeHueSat *nhs= node->storage; - if(*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0 || nhs->val!=1.0)) { + if(*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0f || nhs->val!=1.0f)) { float col[3], hsv[3], mfac= 1.0f - *fac; rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2); hsv[0]+= (nhs->hue - 0.5f); - if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0; + if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f; hsv[1]*= nhs->sat; hsv[2]*= nhs->val; hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c index f18eca3dfcc..acb70f13ec2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c @@ -61,7 +61,7 @@ static void do_huecorrect(bNode *node, float *out, float *in) f = curvemapping_evaluateF(node->storage, 2, hsv[0]); hsv[2] *= (f * 2.f); - hsv[0] = hsv[0] - floor(hsv[0]); /* mod 1.0 */ + hsv[0] = hsv[0] - floorf(hsv[0]); /* mod 1.0 */ CLAMP(hsv[1], 0.f, 1.f); /* convert back to rgb */ @@ -89,7 +89,7 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac) f = curvemapping_evaluateF(node->storage, 2, hsv[0]); hsv[2] *= (f * 2.f); - hsv[0] = hsv[0] - floor(hsv[0]); /* mod 1.0 */ + hsv[0] = hsv[0] - floorf(hsv[0]); /* mod 1.0 */ CLAMP(hsv[1], 0.f, 1.f); /* convert back to rgb */ diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c index daf2ee0cbe7..d98f5a1c64b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.c +++ b/source/blender/nodes/composite/nodes/node_composite_invert.c @@ -65,7 +65,7 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac) do_invert(node, col, in); /* blend inverted result against original input with fac */ - facm = 1.0 - fac[0]; + facm = 1.0f - fac[0]; if(node->custom1 & CMP_CHAN_RGB) { col[0] = fac[0]*col[0] + (facm*in[0]); diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c index 54e48bb749d..f3e4f0db8b6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.c +++ b/source/blender/nodes/composite/nodes/node_composite_levels.c @@ -63,7 +63,7 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins) /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0) { /* don't count transparent pixels */ + if(value[3] > 0.0f) { /* don't count transparent pixels */ switch(node->custom1) { case 1: { /* all colors */ rgb_tobw(value[0],value[1],value[2], &value[0]); @@ -120,7 +120,7 @@ static float brightness_mean(bNode* node, CompBuf* in) /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0) { /* don't count transparent pixels */ + if(value[3] > 0.0f) { /* don't count transparent pixels */ numPixels++; switch(node->custom1) { @@ -172,7 +172,7 @@ static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean) /* get the pixel */ qd_getPixel(in, x, y, value); - if(value[3] > 0.0) { /* don't count transparent pixels */ + if(value[3] > 0.0f) { /* don't count transparent pixels */ numPixels++; switch(node->custom1) { @@ -233,7 +233,7 @@ static void draw_histogram(bNode *node, CompBuf *out, int* bins) for(y=0;yy; y++) { /* get normalized value (0..255) */ - value=((float)bins[x]/(float)max)*255.0; + value=((float)bins[x]/(float)max)*255.0f; if(y < (int)value) { /*if the y value is below the height of the bar for this line then draw with the color */ switch (node->custom1) { diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c index 5dc6d1c3aaa..b596f67a886 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c @@ -73,40 +73,40 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr /* adaptive sampling, red (U) channel */ /* prevent alpha zero UVs to be used */ - uv_l= uv[-1]!=0.0f? fabs(uv[0]-uv[-3]) : 0.0f; - uv_r= uv[ 5]!=0.0f? fabs(uv[0]-uv[ 3]) : 0.0f; + uv_l= uv[-1]!=0.0f? fabsf(uv[0]-uv[-3]) : 0.0f; + uv_r= uv[ 5]!=0.0f? fabsf(uv[0]-uv[ 3]) : 0.0f; //dx= 0.5f*(fabs(uv[0]-uv[-3]) + fabs(uv[0]-uv[3])); dx= 0.5f*(uv_l + uv_r); - uv_l= uvprev[-1]!=0.0f? fabs(uv[0]-uvprev[-3]) : 0.0f; - uv_r= uvnext[-1]!=0.0f? fabs(uv[0]-uvnext[-3]) : 0.0f; + uv_l= uvprev[-1]!=0.0f? fabsf(uv[0]-uvprev[-3]) : 0.0f; + uv_r= uvnext[-1]!=0.0f? fabsf(uv[0]-uvnext[-3]) : 0.0f; //dx+= 0.25f*(fabs(uv[0]-uvprev[-3]) + fabs(uv[0]-uvnext[-3])); dx+= 0.25f*(uv_l + uv_r); - uv_l= uvprev[ 5]!=0.0f? fabs(uv[0]-uvprev[+3]) : 0.0f; - uv_r= uvnext[ 5]!=0.0f? fabs(uv[0]-uvnext[+3]) : 0.0f; + uv_l= uvprev[ 5]!=0.0f? fabsf(uv[0]-uvprev[+3]) : 0.0f; + uv_r= uvnext[ 5]!=0.0f? fabsf(uv[0]-uvnext[+3]) : 0.0f; //dx+= 0.25f*(fabs(uv[0]-uvprev[+3]) + fabs(uv[0]-uvnext[+3])); dx+= 0.25f*(uv_l + uv_r); /* adaptive sampling, green (V) channel */ - uv_l= uv[-row+2]!=0.0f? fabs(uv[1]-uv[-row+1]) : 0.0f; - uv_r= uv[ row+2]!=0.0f? fabs(uv[1]-uv[ row+1]) : 0.0f; + uv_l= uv[-row+2]!=0.0f? fabsf(uv[1]-uv[-row+1]) : 0.0f; + uv_r= uv[ row+2]!=0.0f? fabsf(uv[1]-uv[ row+1]) : 0.0f; //dy= 0.5f*(fabs(uv[1]-uv[-row+1]) + fabs(uv[1]-uv[row+1])); dy= 0.5f*(uv_l + uv_r); - uv_l= uvprev[-1]!=0.0f? fabs(uv[1]-uvprev[+1-3]) : 0.0f; - uv_r= uvnext[-1]!=0.0f? fabs(uv[1]-uvnext[+1-3]) : 0.0f; + uv_l= uvprev[-1]!=0.0f? fabsf(uv[1]-uvprev[+1-3]) : 0.0f; + uv_r= uvnext[-1]!=0.0f? fabsf(uv[1]-uvnext[+1-3]) : 0.0f; //dy+= 0.25f*(fabs(uv[1]-uvprev[+1-3]) + fabs(uv[1]-uvnext[+1-3])); dy+= 0.25f*(uv_l + uv_r); - uv_l= uvprev[ 5]!=0.0f? fabs(uv[1]-uvprev[+1+3]) : 0.0f; - uv_r= uvnext[ 5]!=0.0f? fabs(uv[1]-uvnext[+1+3]) : 0.0f; + uv_l= uvprev[ 5]!=0.0f? fabsf(uv[1]-uvprev[+1+3]) : 0.0f; + uv_r= uvnext[ 5]!=0.0f? fabsf(uv[1]-uvnext[+1+3]) : 0.0f; //dy+= 0.25f*(fabs(uv[1]-uvprev[+1+3]) + fabs(uv[1]-uvnext[+1+3])); dy+= 0.25f*(uv_l + uv_r); diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c index a0e7beff1ab..27fdcfc1d4e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.c +++ b/source/blender/nodes/composite/nodes/node_composite_math.c @@ -103,10 +103,10 @@ static void do_math(bNode *node, float *out, float *in, float *in2) } else { float y_mod_1 = fmod(in2[0], 1); /* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */ - if (y_mod_1 > 0.999 || y_mod_1 < 0.001) { - out[0]= pow(in[0], floor(in2[0] + 0.5)); + if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) { + out[0]= powf(in[0], floorf(in2[0] + 0.5f)); } else { - out[0] = 0.0; + out[0] = 0.0f; } } } diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c index 96712baf8b0..730c53a1a29 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c @@ -58,7 +58,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac int x, y, yo, xo; ImBuf *ibuf, *obuf; - rad= (M_PI*in[1]->vec[0])/180.0f; + rad= ((float)M_PI*in[1]->vec[0])/180.0f; s= sin(rad); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c index 3b3d57bf442..7944176c5d3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c @@ -53,9 +53,9 @@ static void do_sepycca_601(bNode *UNUSED(node), float *out, float *in) rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_ITU_BT601); /*divided by 255 to normalize for viewing in */ - out[0]= y/255.0; - out[1]= cb/255.0; - out[2]= cr/255.0; + out[0]= y/255.0f; + out[1]= cb/255.0f; + out[2]= cr/255.0f; out[3]= in[3]; } @@ -66,9 +66,9 @@ static void do_sepycca_709(bNode *UNUSED(node), float *out, float *in) rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_ITU_BT709); /*divided by 255 to normalize for viewing in */ - out[0]= y/255.0; - out[1]= cb/255.0; - out[2]= cr/255.0; + out[0]= y/255.0f; + out[1]= cb/255.0f; + out[2]= cr/255.0f; out[3]= in[3]; } @@ -79,9 +79,9 @@ static void do_sepycca_jfif(bNode *UNUSED(node), float *out, float *in) rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_JFIF_0_255); /*divided by 255 to normalize for viewing in */ - out[0]= y/255.0; - out[1]= cb/255.0; - out[2]= cr/255.0; + out[0]= y/255.0f; + out[1]= cb/255.0f; + out[2]= cr/255.0f; out[3]= in[3]; } @@ -106,9 +106,9 @@ static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeSta } /*divided by 255 to normalize for viewing in */ - out[0]->vec[0] = y/255.0; - out[1]->vec[0] = cb/255.0; - out[2]->vec[0] = cr/255.0; + out[0]->vec[0] = y/255.0f; + out[1]->vec[0] = cb/255.0f; + out[2]->vec[0] = cr/255.0f; out[3]->vec[0] = in[0]->vec[3]; } else if ((out[0]->hasoutput) || (out[1]->hasoutput) || (out[2]->hasoutput) || (out[3]->hasoutput)) { diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 3f0a5d55ec2..51ab5b50919 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -945,7 +945,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN angle= PyFloat_AsDouble(value); - if (angle==-1.0 && PyErr_Occurred()) { /* parsed item not a number */ + if (angle==-1.0f && PyErr_Occurred()) { /* parsed item not a number */ PyErr_SetString(PyExc_TypeError, "Quaternion.angle = value: float expected"); return -1; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 00805be2e42..440c7170341 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3621,7 +3621,7 @@ static void area_lamp_vectors(LampRen *lar) float xsize= 0.5f*lar->area_size, ysize= 0.5f*lar->area_sizey, multifac; /* make it smaller, so area light can be multisampled */ - multifac= 1.0f/sqrt((float)lar->ray_totsamp); + multifac= 1.0f/sqrtf((float)lar->ray_totsamp); xsize *= multifac; ysize *= multifac; @@ -3801,7 +3801,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) if(lar->mode & LA_HALO) { if(lar->spotsi>170.0f) lar->spotsi= 170.0f; } - lar->spotsi= cos( M_PI*lar->spotsi/360.0f ); + lar->spotsi= cosf( (float)M_PI*lar->spotsi/360.0f ); lar->spotbl= (1.0f-lar->spotsi)*la->spotblend; memcpy(lar->mtex, la->mtex, MAX_MTEX*sizeof(void *)); @@ -4028,8 +4028,8 @@ void init_render_world(Render *re) re->wrld.misi= 1.0f; } - re->wrld.linfac= 1.0 + pow((2.0*re->wrld.exp + 0.5), -10); - re->wrld.logfac= log( (re->wrld.linfac-1.0)/re->wrld.linfac )/re->wrld.range; + re->wrld.linfac= 1.0f + powf((2.0f*re->wrld.exp + 0.5f), -10); + re->wrld.logfac= logf((re->wrld.linfac-1.0f)/re->wrld.linfac) / re->wrld.range; } @@ -4082,7 +4082,7 @@ static void set_phong_threshold(ObjectRen *obr) if(tot) { thresh/= (float)tot; - obr->ob->smoothresh= cos(0.5*M_PI-saacos(thresh)); + obr->ob->smoothresh= cosf(0.5f*(float)M_PI-saacos(thresh)); } } @@ -5260,11 +5260,11 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con /* angle between (0,0,-1) and (co) */ copy_v3_v3(vec, co); - ang= saacos(-vec[2]/sqrt(vec[0]*vec[0] + vec[2]*vec[2])); + ang= saacos(-vec[2]/sqrtf(vec[0]*vec[0] + vec[2]*vec[2])); if(vec[0]<0.0f) ang= -ang; zco[0]= ang/pixelphix + zmulx; - ang= 0.5f*M_PI - saacos(vec[1]/sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2])); + ang= 0.5f*M_PI - saacos(vec[1]/sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2])); zco[1]= ang/pixelphiy + zmuly; } @@ -5292,7 +5292,7 @@ static void calculate_speedvector(const float vectors[2], int step, float winsq, /* maximize speed for image width, otherwise it never looks good */ len= zco[0]*zco[0] + zco[1]*zco[1]; if(len > winsq) { - len= winroot/sqrt(len); + len= winroot/sqrtf(len); zco[0]*= len; zco[1]*= len; } @@ -5502,7 +5502,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * // maximize speed as usual len= zco[0]*zco[0] + zco[1]*zco[1]; if(len > winsq) { - len= winroot/sqrt(len); + len= winroot/sqrtf(len); zco[0]*= len; zco[1]*= len; } diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 6ea62828601..62cb29c3d5f 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -601,31 +601,31 @@ static int envcube_isect(EnvMap *env, float *vec, float *answ) } else { /* which face */ - if( vec[2]<=-fabs(vec[0]) && vec[2]<=-fabs(vec[1]) ) { + if( vec[2] <= -fabsf(vec[0]) && vec[2] <= -fabsf(vec[1]) ) { face= 0; labda= -1.0f/vec[2]; answ[0]= labda*vec[0]; answ[1]= labda*vec[1]; } - else if( vec[2]>=fabs(vec[0]) && vec[2]>=fabs(vec[1]) ) { + else if (vec[2] >= fabsf(vec[0]) && vec[2] >= fabsf(vec[1])) { face= 1; labda= 1.0f/vec[2]; answ[0]= labda*vec[0]; answ[1]= -labda*vec[1]; } - else if( vec[1]>=fabs(vec[0]) ) { + else if (vec[1] >= fabsf(vec[0])) { face= 2; labda= 1.0f/vec[1]; answ[0]= labda*vec[0]; answ[1]= labda*vec[2]; } - else if( vec[0]<=-fabs(vec[1]) ) { + else if (vec[0] <= -fabsf(vec[1])) { face= 3; labda= -1.0f/vec[0]; answ[0]= labda*vec[1]; answ[1]= labda*vec[2]; } - else if( vec[1]<=-fabs(vec[0]) ) { + else if (vec[1] <= -fabsf(vec[0])) { face= 4; labda= -1.0f/vec[1]; answ[0]= -labda*vec[0]; diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index 36709408496..a78cc3e2288 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -331,7 +331,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, /* halo being intersected? */ if(har->zs> zz-har->zd) { t= ((float)(zz-har->zs))/(float)har->zd; - alpha*= sqrt(sqrt(t)); + alpha*= sqrtf(sqrtf(t)); } } @@ -351,7 +351,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, rc= hashvectf + (ofs % 768); - fac= fabs( rc[1]*(har->rad*fabs(rc[0]) - radist) ); + fac= fabsf( rc[1]*(har->rad*fabsf(rc[0]) - radist) ); if(fac< 1.0f) { ringf+= (1.0f-fac); @@ -360,7 +360,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, } if(har->type & HA_VECT) { - dist= fabs( har->cos*(yn) - har->sin*(xn) )/har->rad; + dist= fabsf( har->cos*(yn) - har->sin*(xn) )/har->rad; if(dist>1.0f) dist= 1.0f; if(har->tex) { zn= har->sin*xn - har->cos*yn; @@ -379,7 +379,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, if(har->hard>=30) { dist= sqrt(dist); if(har->hard>=40) { - dist= sin(dist*M_PI_2); + dist= sinf(dist*(float)M_PI_2); if(har->hard>=50) { dist= sqrt(dist); } @@ -418,8 +418,8 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, angle= atan2(yn, xn); angle*= (1.0f+0.25f*har->starpoints); - co= cos(angle); - si= sin(angle); + co= cosf(angle); + si= sinf(angle); angle= (co*xn+si*yn)*(co*yn-si*xn); @@ -427,7 +427,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, if(ster>1.0f) { ster= (har->rad)/(ster); - if(ster<1.0f) dist*= sqrt(ster); + if(ster<1.0f) dist*= sqrtf(ster); } } diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 2d3f6fa6005..85954d20a30 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -325,7 +325,7 @@ static float wood_int(Tex *tex, float x, float y, float z) wi = waveform[wf]((x + y + z)*10.0f); } else if (wt==TEX_RING) { - wi = waveform[wf](sqrt(x*x + y*y + z*z)*20.0f); + wi = waveform[wf](sqrtf(x*x + y*y + z*z)*20.0f); } else if (wt==TEX_BANDNOISE) { wi = tex->turbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); @@ -333,7 +333,7 @@ static float wood_int(Tex *tex, float x, float y, float z) } else if (wt==TEX_RINGNOISE) { wi = tex->turbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); - wi = waveform[wf](sqrt(x*x + y*y + z*z)*20.0f + wi); + wi = waveform[wf](sqrtf(x*x + y*y + z*z)*20.0f + wi); } return wi; @@ -659,7 +659,7 @@ static float voronoiTex(Tex *tex, float *texvec, TexResult *texres) if (sc!=0.f) sc = tex->ns_outscale/sc; voronoi(texvec[0], texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); - texres->tin = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + texres->tin = sc * fabsf(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); if (tex->vn_coltype) { float ca[3]; /* cell color */ @@ -699,11 +699,11 @@ static float voronoiTex(Tex *tex, float *texvec, TexResult *texres) /* calculate bumpnormal */ voronoi(texvec[0] + offs, texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); - texres->nor[0] = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + texres->nor[0] = sc * fabsf(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); voronoi(texvec[0], texvec[1] + offs, texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); - texres->nor[1] = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + texres->nor[1] = sc * fabsf(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); voronoi(texvec[0], texvec[1], texvec[2] + offs, da, pa, tex->vn_mexp, tex->vn_distm); - texres->nor[2] = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + texres->nor[2] = sc * fabsf(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); tex_normal_derivate(tex, texres); rv |= TEX_NOR; @@ -1450,9 +1450,9 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa case MTEX_DIFF: fact*= facg; facm= 1.0f-fact; - in[0]= facm*out[0] + fact*fabs(tex[0]-out[0]); - in[1]= facm*out[1] + fact*fabs(tex[1]-out[1]); - in[2]= facm*out[2] + fact*fabs(tex[2]-out[2]); + in[0]= facm*out[0] + fact*fabsf(tex[0]-out[0]); + in[1]= facm*out[1] + fact*fabsf(tex[1]-out[1]); + in[2]= facm*out[2] + fact*fabsf(tex[2]-out[2]); break; case MTEX_DARK: @@ -1557,7 +1557,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen break; case MTEX_DIFF: - in= facm*out + fact*fabs(tex-out); + in= facm*out + fact*fabsf(tex-out); break; case MTEX_DARK: @@ -2478,7 +2478,7 @@ void do_material_tex(ShadeInput *shi, Render *re) texres.nor[0] = -texres.nor[0]; texres.nor[1] = -texres.nor[1]; } - fact = Tnor*fabs(norfac); + fact = Tnor*fabsf(norfac); if (fact>1.f) fact = 1.f; facm = 1.f-fact; if(mtex->normapspace == MTEX_NSPACE_TANGENT) { @@ -3031,7 +3031,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h /* only works with texture being "real" */ /* use saacos(), fixes bug [#22398], float precision caused lo[2] to be slightly less then -1.0 */ if(lo[0] || lo[1]) { /* check for zero case [#24807] */ - fact= (1.0f/(float)M_PI)*saacos(lo[2])/(sqrt(lo[0]*lo[0] + lo[1]*lo[1])); + fact= (1.0f/(float)M_PI)*saacos(lo[2])/(sqrtf(lo[0]*lo[0] + lo[1]*lo[1])); tempvec[0]= lo[0]*fact; tempvec[1]= lo[1]*fact; tempvec[2]= 0.0; @@ -3721,15 +3721,12 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const obi.ob = ob; shi.obi = &obi; unit_m4(re.viewinv); - - color[0] = mat->vol.reflection_col[0]; - color[1] = mat->vol.reflection_col[1]; - color[2] = mat->vol.reflection_col[2]; + copy_v3_v3(color, mat->vol.reflection_col); *alpha = mat->vol.density; /* do texture */ do_volume_tex(&shi, volume_co, (MAP_TRANSMISSION_COL | MAP_REFLECTION_COL | MAP_DENSITY), - color, alpha, &re); + color, alpha, &re); } } diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index fde4eab37b0..e1f521db066 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -174,7 +174,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) VECCOPY(npos, p1); // npos is double! /* pre-scale */ - npos[2]*= lar->sh_zfac; + npos[2] *= (double)lar->sh_zfac; } else { VECCOPY(npos, lar->sh_invcampos); /* in initlamp calculated */ @@ -204,11 +204,11 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) maxz*= lar->sh_zfac; maxy= lar->imat[0][1]*p1[0]+lar->imat[1][1]*p1[1]+lar->imat[2][1]*p1[2]; - if( fabs(nray[2]) < FLT_EPSILON ) use_yco= 1; + if( fabsf(nray[2]) < FLT_EPSILON ) use_yco= 1; } /* scale z to make sure volume is normalized */ - nray[2]*= lar->sh_zfac; + nray[2] *= (double)lar->sh_zfac; /* nray does not need normalization */ ladist= lar->sh_zfac*lar->dist; @@ -260,7 +260,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) /* intersction point with -ladist, the bottom of the cone */ if(use_yco==0) { - t3= (-ladist-npos[2])/nray[2]; + t3= ((double)(-ladist)-npos[2])/nray[2]; /* de we have to replace one of the intersection points? */ if(ok1) { @@ -413,7 +413,7 @@ float fresnel_fac(float *view, float *vn, float grad, float fac) if(t1>0.0f) t2= 1.0f+t1; else t2= 1.0f-t1; - t2= grad + (1.0f-grad)*pow(t2, fac); + t2= grad + (1.0f-grad)*powf(t2, fac); if(t2<0.0f) return 0.0f; else if(t2>1.0f) return 1.0f; @@ -698,7 +698,7 @@ static float WardIso_Spec( float *n, float *l, float *v, float rms, int tangent) angle = tan(saacos(nh)); alpha = MAX2(rms, 0.001f); - i= nl * (1.0f/(4.0f*M_PI*alpha*alpha)) * (exp( -(angle*angle)/(alpha*alpha))/(sqrt(nv*nl))); + i= nl * (1.0f/(4.0f*(float)M_PI*alpha*alpha)) * (expf( -(angle*angle)/(alpha*alpha))/(sqrtf(nv*nl))); return i; } @@ -777,7 +777,7 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough b*= 0.95f; /* prevent tangens from shooting to inf, 'nl' can be not a dot product here. */ /* overflow only happens with extreme size area light, and higher roughness */ - i = nl * ( A + ( B * t * sin(a) * tan(b) ) ); + i = nl * ( A + ( B * t * sinf(a) * tanf(b) ) ); return i; } @@ -1636,9 +1636,9 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr) static void wrld_exposure_correct(float diff[3]) { - diff[0]= R.wrld.linfac*(1.0f-exp( diff[0]*R.wrld.logfac) ); - diff[1]= R.wrld.linfac*(1.0f-exp( diff[1]*R.wrld.logfac) ); - diff[2]= R.wrld.linfac*(1.0f-exp( diff[2]*R.wrld.logfac) ); + diff[0]= R.wrld.linfac*(1.0f-expf( diff[0]*R.wrld.logfac) ); + diff[1]= R.wrld.linfac*(1.0f-expf( diff[1]*R.wrld.logfac) ); + diff[2]= R.wrld.linfac*(1.0f-expf( diff[2]*R.wrld.logfac) ); } void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) -- 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/avi/intern/avi.c | 6 +- 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 +- source/blender/blenlib/BLI_fnmatch.h | 2 +- source/blender/blenlib/BLI_pbvh.h | 2 +- source/blender/blenlib/BLI_vfontdata.h | 6 +- source/blender/blenlib/intern/BLI_heap.c | 6 +- source/blender/blenlib/intern/edgehash.c | 2 +- source/blender/blenlib/intern/pbvh.c | 12 ++-- source/blender/blenlib/intern/scanfill.c | 2 +- source/blender/blenloader/intern/readfile.c | 26 ++++----- source/blender/collada/ArmatureExporter.cpp | 2 +- source/blender/collada/ArmatureImporter.cpp | 26 ++++----- source/blender/collada/ArmatureImporter.h | 2 +- source/blender/editors/armature/editarmature.c | 6 +- .../editors/armature/editarmature_retarget.c | 4 +- source/blender/editors/curve/curve_intern.h | 2 +- source/blender/editors/curve/editcurve.c | 4 +- source/blender/editors/include/ED_sculpt.h | 2 +- source/blender/editors/include/UI_interface.h | 4 +- source/blender/editors/interface/interface.c | 25 ++++---- source/blender/editors/interface/interface_draw.c | 6 +- source/blender/editors/mesh/editmesh_lib.c | 6 +- source/blender/editors/mesh/editmesh_mods.c | 2 +- source/blender/editors/mesh/editmesh_tools.c | 6 +- source/blender/editors/mesh/mesh_data.c | 4 +- source/blender/editors/object/object_edit.c | 8 +-- source/blender/editors/object/object_hook.c | 4 +- source/blender/editors/object/object_select.c | 4 +- source/blender/editors/sculpt_paint/paint_stroke.c | 26 ++++----- source/blender/editors/sculpt_paint/sculpt.c | 12 ++-- source/blender/editors/space_file/file_draw.c | 32 +++++------ source/blender/editors/space_logic/logic_window.c | 6 +- source/blender/editors/space_node/drawnode.c | 11 ++-- source/blender/editors/space_node/node_draw.c | 6 +- .../editors/space_sequencer/sequencer_edit.c | 16 +++--- .../editors/space_sequencer/sequencer_ops.c | 2 +- source/blender/editors/space_text/text_intern.h | 2 +- source/blender/editors/space_view3d/view3d_draw.c | 23 ++++++-- source/blender/editors/space_view3d/view3d_snap.c | 2 +- .../editors/transform/transform_conversions.c | 2 +- .../editors/transform/transform_orientations.c | 2 +- source/blender/gpu/intern/gpu_buffers.c | 28 ++++----- source/blender/gpu/intern/gpu_codegen.c | 2 +- source/blender/gpu/intern/gpu_draw.c | 6 +- source/blender/gpu/intern/gpu_extensions.c | 2 +- source/blender/imbuf/IMB_imbuf.h | 12 ++-- source/blender/imbuf/intern/IMB_indexer.h | 34 +++++------ source/blender/imbuf/intern/anim_movie.c | 48 ++++++++-------- source/blender/imbuf/intern/indexer.c | 54 +++++++++--------- source/blender/imbuf/intern/jpeg.c | 11 ++-- source/blender/imbuf/intern/png.c | 25 ++++---- source/blender/imbuf/intern/scaling.c | 18 +++--- source/blender/imbuf/intern/thumbs_blend.c | 2 +- source/blender/makesdna/DNA_ID.h | 4 +- source/blender/makesdna/DNA_object_force.h | 6 +- source/blender/makesdna/DNA_sensor_types.h | 2 +- source/blender/makesrna/intern/rna_curve.c | 11 ++-- source/blender/makesrna/intern/rna_lamp.c | 2 +- source/blender/makesrna/intern/rna_mesh.c | 11 ++-- source/blender/makesrna/intern/rna_meta.c | 11 ++-- source/blender/makesrna/intern/rna_scene.c | 2 +- source/blender/modifiers/intern/MOD_armature.c | 6 +- source/blender/modifiers/intern/MOD_array.c | 12 ++-- source/blender/modifiers/intern/MOD_boolean.c | 2 +- source/blender/modifiers/intern/MOD_curve.c | 4 +- source/blender/modifiers/intern/MOD_displace.c | 8 +-- source/blender/modifiers/intern/MOD_hook.c | 2 +- source/blender/modifiers/intern/MOD_lattice.c | 4 +- source/blender/modifiers/intern/MOD_mirror.c | 2 +- source/blender/modifiers/intern/MOD_smooth.c | 4 +- .../composite/nodes/node_composite_diffMatte.c | 6 +- .../nodes/composite/nodes/node_composite_image.c | 66 +++++++++++----------- source/blender/python/generic/noise_py_api.c | 12 ++-- source/blender/quicktime/apple/qtkit_import.m | 10 ++-- source/blender/quicktime/apple/quicktime_export.c | 9 ++- source/blender/quicktime/apple/quicktime_import.c | 49 ++++++++-------- source/blender/render/extern/include/RE_pipeline.h | 2 +- source/blender/render/intern/source/imagetexture.c | 2 +- source/blender/render/intern/source/occlusion.c | 4 +- source/blender/render/intern/source/pipeline.c | 4 +- .../blender/render/intern/source/render_texture.c | 6 +- source/blender/render/intern/source/shadbuf.c | 4 +- .../blender/windowmanager/intern/wm_event_system.c | 14 ++--- source/blender/windowmanager/intern/wm_operators.c | 4 +- 105 files changed, 501 insertions(+), 478 deletions(-) (limited to 'source/blender') diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index 6e8828ebce4..a021695b7c9 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -731,9 +731,9 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) { movie->header->fcc = FCC("avih"); movie->header->size = 56; movie->header->MicroSecPerFrame = 66667; - movie->header->MaxBytesPerSec = 0; - movie->header->PaddingGranularity = 0; - movie->header->Flags = AVIF_HASINDEX | AVIF_MUSTUSEINDEX; + movie->header->MaxBytesPerSec = 0; + movie->header->PaddingGranularity = 0; + movie->header->Flags = AVIF_HASINDEX | AVIF_MUSTUSEINDEX; movie->header->TotalFrames = 0; movie->header->InitialFrames = 0; movie->header->Streams = streams; 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; diff --git a/source/blender/blenlib/BLI_fnmatch.h b/source/blender/blenlib/BLI_fnmatch.h index 94ae741250f..c09a7c7c0d2 100644 --- a/source/blender/blenlib/BLI_fnmatch.h +++ b/source/blender/blenlib/BLI_fnmatch.h @@ -63,7 +63,7 @@ extern "C" { /* Match STRING against the filename pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ extern int fnmatch __P ((const char *__pattern, const char *__string, - int __flags)); + int __flags)); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_pbvh.h b/source/blender/blenlib/BLI_pbvh.h index c25243a9d36..e17a37c0a12 100644 --- a/source/blender/blenlib/BLI_pbvh.h +++ b/source/blender/blenlib/BLI_pbvh.h @@ -77,7 +77,7 @@ void BLI_pbvh_search_gather(PBVH *bvh, hit first */ void BLI_pbvh_raycast(PBVH *bvh, BLI_pbvh_HitOccludedCallback cb, void *data, - float ray_start[3], float ray_normal[3], int original); + float ray_start[3], float ray_normal[3], int original); int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], float ray_start[3], float ray_normal[3], float *dist); diff --git a/source/blender/blenlib/BLI_vfontdata.h b/source/blender/blenlib/BLI_vfontdata.h index ef6608e2c25..e858e784991 100644 --- a/source/blender/blenlib/BLI_vfontdata.h +++ b/source/blender/blenlib/BLI_vfontdata.h @@ -47,13 +47,13 @@ typedef struct VFontData { // float resol[MAX_VF_CHARS]; // float width[MAX_VF_CHARS]; // float *points[MAX_VF_CHARS]; - char name[128]; + char name[128]; } VFontData; typedef struct VChar { struct VChar *next, *prev; - ListBase nurbsbase; - intptr_t index; + ListBase nurbsbase; + intptr_t index; float resol; float width; float *points; diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index 52365371421..62a38e7933a 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -62,8 +62,10 @@ struct Heap { #define HEAP_COMPARE(a, b) (a->value < b->value) #define HEAP_EQUALS(a, b) (a->value == b->value) #define HEAP_SWAP(heap, i, j) \ - { SWAP(int, heap->tree[i]->index, heap->tree[j]->index); \ - SWAP(HeapNode*, heap->tree[i], heap->tree[j]); } +{ \ + SWAP(int, heap->tree[i]->index, heap->tree[j]->index); \ + SWAP(HeapNode*, heap->tree[i], heap->tree[j]); \ +} /***/ diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index 65c5dffa33c..0eda3e78824 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -85,7 +85,7 @@ void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) { v1 ^= v0; v0 ^= v1; } - hash = EDGEHASH(v0,v1)%eh->nbuckets; + hash = EDGEHASH(v0,v1)%eh->nbuckets; e->v0 = v0; e->v1 = v1; diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 5a8e378e8c4..0ac6e0ba4df 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -507,13 +507,13 @@ static void build_sub(PBVH *bvh, int node_index, BB *cb, BBC *prim_bbc, bvh->nodes[node_index].orig_vb= bvh->nodes[node_index].vb; end = partition_indices(bvh->prim_indices, offset, offset + count - 1, - axis, - (cb->bmax[axis] + cb->bmin[axis]) * 0.5f, - prim_bbc); + axis, + (cb->bmax[axis] + cb->bmin[axis]) * 0.5f, + prim_bbc); check_partitioning(bvh->prim_indices, offset, offset + count - 1, - axis, - (cb->bmax[axis] + cb->bmin[axis]) * 0.5f, - prim_bbc, end); + axis, + (cb->bmax[axis] + cb->bmin[axis]) * 0.5f, + prim_bbc, end); build_sub(bvh, bvh->nodes[node_index].children_offset, NULL, prim_bbc, offset, end - offset); diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 4bd17fcf0b9..41b1fea32a6 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -165,7 +165,7 @@ static void *new_mem_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/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 65e047ceb22..3fd661a52da 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1554,14 +1554,14 @@ static void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData IDP_DirectLinkIDPArray(prop, switch_endian, fd); break; case IDP_DOUBLE: - /*erg, stupid doubles. since I'm storing them - in the same field as int val; val2 in the - IDPropertyData struct, they have to deal with - endianness specifically - - in theory, val and val2 would've already been swapped - if switch_endian is true, so we have to first unswap - them then reswap them as a single 64-bit entity. + /* erg, stupid doubles. since I'm storing them + * in the same field as int val; val2 in the + * IDPropertyData struct, they have to deal with + * endianness specifically + + * in theory, val and val2 would've already been swapped + * if switch_endian is true, so we have to first unswap + * them then reswap them as a single 64-bit entity. */ if (switch_endian) { @@ -3567,8 +3567,8 @@ static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface) int i; /* Add pseudo-references (not fake users!) to images used by texface. A - little bogus; it would be better if each mesh consistently added one ref - to each image it used. - z0r */ + * little bogus; it would be better if each mesh consistently added one ref + * to each image it used. - z0r */ for (i=0; itpage= newlibadr(fd, me->id.lib, tf->tpage); if(tf->tpage && tf->tpage->id.us==0) @@ -3769,7 +3769,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) } /* if multires is present but has no valid vertex data, - there's no way to recover it; silently remove multires */ + * there's no way to recover it; silently remove multires */ if(mesh->mr && !mesh->mr->verts) { multires_free(mesh->mr); mesh->mr = NULL; @@ -8844,7 +8844,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* make sure old cameras have title safe on */ if (!(cam->flag & CAM_SHOWTITLESAFE)) - cam->flag |= CAM_SHOWTITLESAFE; + cam->flag |= CAM_SHOWTITLESAFE; /* set an appropriate camera passepartout alpha */ if (!(cam->passepartalpha)) cam->passepartalpha = 0.2f; @@ -9141,7 +9141,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for(group= main->group.first; group; group= group->id.next) if(group->layer==0) - group->layer= (1<<20)-1; + group->layer= (1<<20)-1; /* History fix (python?), shape key adrcode numbers have to be sorted */ sort_shape_fix(main); diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 077a06ce6ca..df786c38c71 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -267,7 +267,7 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm) std::string controller_id = get_controller_id(ob_arm, ob); openSkin(controller_id, controller_name, - COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob))); + COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob))); add_bind_shape_mat(ob); diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 7e9634da21d..bababf880a6 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -112,8 +112,7 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p bone->roll=angle; // set head copy_v3_v3(bone->head, mat[3]); - - + // set tail, don't set it to head because 0-length bones are not allowed float vec[3] = {0.0f, 0.5f, 0.0f}; add_v3_v3v3(bone->tail, bone->head, vec); @@ -427,7 +426,7 @@ void ArmatureImporter::create_armature_bones( ) TODO: check if bones have already been created for a given joint */ - leaf_bone_length = FLT_MAX; + leaf_bone_length = FLT_MAX; create_unskinned_bone(*ri, NULL, (*ri)->getChildNodes().getCount(), NULL, ob_arm); fix_leaf_bones(); @@ -593,17 +592,16 @@ void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node } else { copy_m4_m4(mat, obmat); - float invObmat[4][4]; - invert_m4_m4(invObmat, ob_arm->obmat); - mul_m4_m4m4(pchan->pose_mat, mat, invObmat); - + float invObmat[4][4]; + invert_m4_m4(invObmat, ob_arm->obmat); + mul_m4_m4m4(pchan->pose_mat, mat, invObmat); } - - mat4_to_axis_angle(ax,&angle,mat); - pchan->bone->roll = angle; - - COLLADAFW::NodePointerArray& children = root_node->getChildNodes(); + mat4_to_axis_angle(ax,&angle,mat); + pchan->bone->roll = angle; + + + COLLADAFW::NodePointerArray& children = root_node->getChildNodes(); for (unsigned int i = 0; i < children.getCount(); i++) { set_pose(ob_arm, children[i], bone_name, mat); } @@ -762,8 +760,8 @@ Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node) if (skin.uses_joint_or_descendant(node)) return skin.get_armature(); } - - std::map::iterator arm; + + std::map::iterator arm; for (arm = unskinned_armature_map.begin(); arm != unskinned_armature_map.end(); arm++) { if(arm->first == node->getUniqueId() ) return arm->second; diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index d2e3b8be4f5..343badaca28 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -107,7 +107,7 @@ private: float parent_mat[][4], bArmature *arm); void create_unskinned_bone(COLLADAFW::Node *node, EditBone *parent, int totchild, - float parent_mat[][4], Object * ob_arm); + float parent_mat[][4], Object * ob_arm); void add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW::Node * node); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 7376b2e804c..caffdc29118 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4108,7 +4108,7 @@ void ARMATURE_OT_select_hierarchy(wmOperatorType *ot) /* props */ RNA_def_enum(ot->srna, "direction", direction_items, - BONE_SELECT_PARENT, "Direction", ""); + BONE_SELECT_PARENT, "Direction", ""); RNA_def_boolean(ot->srna, "extend", 0, "Add to Selection", ""); } @@ -5207,9 +5207,9 @@ static int pose_hide_exec(bContext *C, wmOperator *op) bArmature *arm= ob->data; if(RNA_boolean_get(op->ptr, "unselected")) - bone_looper(ob, arm->bonebase.first, NULL, hide_unselected_pose_bone_cb); + bone_looper(ob, arm->bonebase.first, NULL, hide_unselected_pose_bone_cb); else - bone_looper(ob, arm->bonebase.first, NULL, hide_selected_pose_bone_cb); + bone_looper(ob, arm->bonebase.first, NULL, hide_selected_pose_bone_cb); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob); diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index ccc375a03f9..451e672da7c 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -2287,8 +2287,8 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc, /* set joints to best position */ for (edge = iarc->edges.first, i = 0; - edge; - edge = edge->next, i++) + edge; + edge = edge->next, i++) { float *no = NULL; if (i < nb_joints) diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index 2557c7f7c72..59b3f483b38 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -42,7 +42,7 @@ extern const char ED_lorem[]; enum { DEL_ALL, DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_SELECTION, DEL_NEXT_SEL, DEL_PREV_SEL }; enum { CASE_LOWER, CASE_UPPER }; enum { LINE_BEGIN, LINE_END, PREV_CHAR, NEXT_CHAR, PREV_WORD, NEXT_WORD, - PREV_LINE, NEXT_LINE, PREV_PAGE, NEXT_PAGE }; + PREV_LINE, NEXT_LINE, PREV_PAGE, NEXT_PAGE }; void FONT_OT_text_insert(struct wmOperatorType *ot); void FONT_OT_line_break(struct wmOperatorType *ot); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 0556291c197..1f6673137a1 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -688,8 +688,8 @@ static void key_to_bezt(float *key, BezTriple *basebezt, BezTriple *bezt) static void bezt_to_key(BezTriple *bezt, float *key) { - memcpy(key, bezt->vec, sizeof(float) * 9); - key[9] = bezt->alfa; + memcpy(key, bezt->vec, sizeof(float) * 9); + key[9] = bezt->alfa; } static void calc_keyHandles(ListBase *nurb, float *key) diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h index 7993e11ea55..bd746e36ef4 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_sculpt.h @@ -40,7 +40,7 @@ struct wmWindowManager; /* sculpt.c */ void ED_operatortypes_sculpt(void); void sculpt_get_redraw_planes(float planes[4][4], struct ARegion *ar, - struct RegionView3D *rv3d, struct Object *ob); + struct RegionView3D *rv3d, struct Object *ob); void ED_sculpt_force_update(struct bContext *C); /* paint_ops.c */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index cd5fee139ee..35fabb3b80e 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -727,7 +727,7 @@ void uiTemplateDopeSheetFilter(uiLayout *layout, struct bContext *C, struct Poin void uiTemplateID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop); void uiTemplateIDBrowse(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, - const char *newop, const char *openop, const char *unlinkop); + const char *newop, const char *openop, const char *unlinkop); void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols); void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, const char *propname, @@ -744,7 +744,7 @@ void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, int levels, int brush); void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname, - PointerRNA *used_ptr, const char *used_propname, int active_layer); + PointerRNA *used_ptr, const char *used_propname, int active_layer); void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact); void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser); void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index fab983cee43..81b42277055 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -274,7 +274,7 @@ void ui_bounds_block(uiBlock *block) if(bt->x1 < block->minx) block->minx= bt->x1; if(bt->y1 < block->miny) block->miny= bt->y1; - if(bt->x2 > block->maxx) block->maxx= bt->x2; + if(bt->x2 > block->maxx) block->maxx= bt->x2; if(bt->y2 > block->maxy) block->maxy= bt->y2; bt= bt->next; @@ -363,7 +363,7 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_ oldheight= oldheight > 0 ? oldheight : MAX2(1, height); /* offset block based on mouse position, user offset is scaled - along in case we resized the block in ui_text_bounds_block */ + * along in case we resized the block in ui_text_bounds_block */ startx= window->eventstate->x + block->minx + (block->mx*width)/oldwidth; starty= window->eventstate->y + block->miny + (block->my*height)/oldheight; @@ -633,7 +633,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut } /* copy hardmin for list rows to prevent 'sticking' highlight to mouse position - when scrolling without moving mouse (see [#28432]) */ + * when scrolling without moving mouse (see [#28432]) */ if(ELEM(oldbut->type, ROW, LISTROW)) oldbut->hardmax= but->hardmax; @@ -659,7 +659,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut } /* needed for temporarily rename buttons, such as in outliner or fileselect, - they should keep calling uiDefButs to keep them alive */ + * they should keep calling uiDefButs to keep them alive */ /* returns 0 when button removed */ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but) { @@ -1890,8 +1890,8 @@ static void ui_free_but(const bContext *C, uiBut *but) if(but->func_argN) MEM_freeN(but->func_argN); if(but->active) { /* XXX solve later, buttons should be free-able without context ideally, - however they may have open tooltips or popup windows, which need to - be closed using a context pointer */ + * however they may have open tooltips or popup windows, which need to + * be closed using a context pointer */ if(C) ui_button_active_free(C, but); else @@ -2424,14 +2424,13 @@ void ui_block_do_align(uiBlock *block) } /* -ui_def_but is the function that draws many button types + * ui_def_but is the function that draws many button types -for float buttons: - "a1" Click Step (how much to change the value each click) - "a2" Number of decimal point values to display. 0 defaults to 3 (0.000) 1,2,3, and a maximum of 4, - all greater values will be clamped to 4. - -*/ + * for float buttons: + * "a1" Click Step (how much to change the value each click) + * "a2" Number of decimal point values to display. 0 defaults to 3 (0.000) + * 1,2,3, and a maximum of 4, all greater values will be clamped to 4. + */ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip) { uiBut *but; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 67030f1aca7..1ed05bc54f0 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1326,9 +1326,9 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o static void glColor3ubvShade(unsigned char *col, int shade) { - glColor3ub(col[0]-shade>0?col[0]-shade:0, - col[1]-shade>0?col[1]-shade:0, - col[2]-shade>0?col[2]-shade:0); + glColor3ub(col[0]-shade>0?col[0]-shade:0, + col[1]-shade>0?col[1]-shade:0, + col[2]-shade>0?col[2]-shade:0); } void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect) diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index 0c0163d0f24..845cc29c91b 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -525,9 +525,9 @@ void EM_set_flag_all(EditMesh *em, int flag) void EM_set_flag_all_selectmode(EditMesh *em, int flag) { - EditVert *eve; - EditEdge *eed; - EditFace *efa; + EditVert *eve; + EditEdge *eed; + EditFace *efa; int selvert= 0, seledge= 0, selface= 0; diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index b4bee60e415..3e4051cc751 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -1312,7 +1312,7 @@ void MESH_OT_select_similar(wmOperatorType *ot) int mesh_layers_menu_charlen(CustomData *data, int type) { - int i, len = 0; + int i, len = 0; /* see if there is a duplicate */ for(i=0; itotlayer; i++) { if((&data->layers[i])->type == type) { diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 1852d90eed0..4ac418fdd9a 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1651,7 +1651,7 @@ static void fill_quad_single(EditMesh *em, EditFace *efa, struct GHash *gh, int facecopy(em, efa,hold); if(i+1 != (vertsize-1)/2) { if(seltype == SUBDIV_SELECT_INNER) { - hold->e3->f2 |= EDGEINNER; + hold->e3->f2 |= EDGEINNER; } } } @@ -1720,7 +1720,7 @@ static void fill_tri_single(EditMesh *em, EditFace *efa, struct GHash *gh, int n hold = addfacelist(em, verts[i],verts[i+1],v[op],NULL,NULL,NULL); if(i+1 != vertsize-1) { if(seltype == SUBDIV_SELECT_INNER) { - hold->e2->f2 |= EDGEINNER; + hold->e2->f2 |= EDGEINNER; } } facecopy(em, efa,hold); @@ -2369,7 +2369,7 @@ static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, i } // Clean up our dynamic multi-dim array for(i=0;ilayers[index]; if(!cdl) @@ -301,7 +301,7 @@ int ED_mesh_color_remove_named(bContext *C, Object *ob, Mesh *me, const char *na CustomDataLayer *cdl; int index; - index= CustomData_get_named_layer_index(data, CD_MCOL, name); + index= CustomData_get_named_layer_index(data, CD_MCOL, name); cdl= (index == -1)? NULL: &data->layers[index]; if(!cdl) diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 4fbb5e0d51c..88182a31056 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -475,7 +475,7 @@ void ED_object_enter_editmode(bContext *C, int flag) else if(ob->type==OB_FONT) { scene->obedit= ob; // XXX for context ok= 1; - make_editText(ob); + make_editText(ob); WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_TEXT, scene); } @@ -536,9 +536,9 @@ static int editmode_toggle_poll(bContext *C) return 0; return (ob->type == OB_MESH || ob->type == OB_ARMATURE || - ob->type == OB_FONT || ob->type == OB_MBALL || - ob->type == OB_LATTICE || ob->type == OB_SURF || - ob->type == OB_CURVE); + ob->type == OB_FONT || ob->type == OB_MBALL || + ob->type == OB_LATTICE || ob->type == OB_SURF || + ob->type == OB_CURVE); } void OBJECT_OT_editmode_toggle(wmOperatorType *ot) diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 5bb1b634fe0..2a827091fde 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -465,8 +465,8 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o invert_m4_m4(ob->imat, ob->obmat); /* apparently this call goes from right to left... */ - mul_serie_m4(hmd->parentinv, ob->imat, obedit->obmat, NULL, - NULL, NULL, NULL, NULL, NULL); + mul_serie_m4(hmd->parentinv, ob->imat, obedit->obmat, NULL, + NULL, NULL, NULL, NULL, NULL); DAG_scene_sort(bmain, scene); } diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index d10a6be1988..fce37b7a022 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -296,8 +296,8 @@ static int object_select_linked_exec(bContext *C, wmOperator *op) } else if(nr==5) { if(base->object->dup_group==ob->dup_group) { - base->flag |= SELECT; - changed = 1; + base->flag |= SELECT; + changed = 1; } } else if(nr==6) { diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 767001ff163..0e65383861b 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -423,15 +423,15 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush, /* save lots of GL state TODO: check on whether all of these are needed? */ glPushAttrib(GL_COLOR_BUFFER_BIT| - GL_CURRENT_BIT| - GL_DEPTH_BUFFER_BIT| - GL_ENABLE_BIT| - GL_LINE_BIT| - GL_POLYGON_BIT| - GL_STENCIL_BUFFER_BIT| - GL_TRANSFORM_BIT| - GL_VIEWPORT_BIT| - GL_TEXTURE_BIT); + GL_CURRENT_BIT| + GL_DEPTH_BUFFER_BIT| + GL_ENABLE_BIT| + GL_LINE_BIT| + GL_POLYGON_BIT| + GL_STENCIL_BUFFER_BIT| + GL_TRANSFORM_BIT| + GL_VIEWPORT_BIT| + GL_TEXTURE_BIT); if(load_tex(sd, brush, vc)) { glEnable(GL_BLEND); @@ -484,9 +484,9 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush, /* set quad color */ glColor4f(U.sculpt_paint_overlay_col[0], - U.sculpt_paint_overlay_col[1], - U.sculpt_paint_overlay_col[2], - brush->texture_overlay_alpha / 100.0f); + U.sculpt_paint_overlay_col[1], + U.sculpt_paint_overlay_col[2], + brush->texture_overlay_alpha / 100.0f); /* draw textured quad */ glBegin(GL_QUADS); @@ -619,7 +619,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) visual_strength = 1; outline_alpha = ((paint->flags & PAINT_SHOW_BRUSH_ON_SURFACE) ? - min_alpha + (visual_strength*(max_alpha-min_alpha)) : 0.50f); + min_alpha + (visual_strength*(max_alpha-min_alpha)) : 0.50f); if(sd->draw_anchored) { final_radius = sd->anchored_size; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index ac2efcb2ec2..a63a9256055 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2450,7 +2450,7 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob) if(!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) { /* these brushes start from original coordinates */ const int use_orco = (ELEM3(brush->sculpt_tool, SCULPT_TOOL_GRAB, - SCULPT_TOOL_ROTATE, SCULPT_TOOL_THUMB)); + SCULPT_TOOL_ROTATE, SCULPT_TOOL_THUMB)); #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP) for (n= 0; n < totnode; n++) { @@ -2972,7 +2972,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush) if(cache->first_time) { copy_v3_v3(cache->orig_grab_location, - cache->true_location); + cache->true_location); } else if(tool == SCULPT_TOOL_SNAKE_HOOK) add_v3_v3(cache->true_location, cache->grab_delta); @@ -3246,7 +3246,7 @@ int sculpt_stroke_get_location(bContext *C, struct PaintStroke *stroke, float ou srd.hit = 0; srd.original = (cache)? cache->original: 0; BLI_pbvh_raycast(ss->pbvh, sculpt_raycast_cb, &srd, - ray_start, ray_normal, srd.original); + ray_start, ray_normal, srd.original); copy_v3_v3(out, ray_normal); mul_v3_fl(out, srd.dist); @@ -3506,9 +3506,9 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even return OPERATOR_CANCELLED; stroke = paint_stroke_new(C, sculpt_stroke_get_location, - sculpt_stroke_test_start, - sculpt_stroke_update_step, - sculpt_stroke_done, event->type); + sculpt_stroke_test_start, + sculpt_stroke_update_step, + sculpt_stroke_done, event->type); op->customdata = stroke; diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index d91282e768f..41aae64445a 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -177,17 +177,17 @@ void file_draw_buttons(const bContext *C, ARegion *ar) uiBlockSetFunc(block, file_draw_check_cb, NULL, NULL); but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "", - min_x, line1_y, line1_w-chan_offs, btn_h, - params->dir, 0.0, (float)FILE_MAX, 0, 0, - TIP_("File path")); + min_x, line1_y, line1_w-chan_offs, btn_h, + params->dir, 0.0, (float)FILE_MAX, 0, 0, + TIP_("File path")); uiButSetCompleteFunc(but, autocomplete_directory, NULL); uiButSetFlag(but, UI_BUT_NO_UTF8); if((params->flag & FILE_DIRSEL_ONLY) == 0) { but = uiDefBut(block, TEX, B_FS_FILENAME, "", - min_x, line2_y, line2_w-chan_offs, btn_h, - params->file, 0.0, (float)FILE_MAXFILE, 0, 0, - TIP_(overwrite_alert ?N_("File name, overwrite existing") : N_("File name"))); + min_x, line2_y, line2_w-chan_offs, btn_h, + params->file, 0.0, (float)FILE_MAXFILE, 0, 0, + TIP_(overwrite_alert ?N_("File name, overwrite existing") : N_("File name"))); uiButSetCompleteFunc(but, autocomplete_file, NULL); uiButSetFlag(but, UI_BUT_NO_UTF8); @@ -205,16 +205,16 @@ void file_draw_buttons(const bContext *C, ARegion *ar) if (fnumbuttons && (params->flag & FILE_DIRSEL_ONLY) == 0) { uiBlockBeginAlign(block); but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMOUT, - min_x + line2_w + separator - chan_offs, line2_y, - btn_fn_w, btn_h, - TIP_("Decrement the filename number")); - RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", -1); - + min_x + line2_w + separator - chan_offs, line2_y, + btn_fn_w, btn_h, + TIP_("Decrement the filename number")); + RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", -1); + but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMIN, - min_x + line2_w + separator + btn_fn_w - chan_offs, line2_y, - btn_fn_w, btn_h, - TIP_("Increment the filename number")); - RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", 1); + min_x + line2_w + separator + btn_fn_w - chan_offs, line2_y, + btn_fn_w, btn_h, + TIP_("Increment the filename number")); + RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", 1); uiBlockEndAlign(block); } @@ -235,7 +235,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) static void draw_tile(int sx, int sy, int width, int height, int colorid, int shade) -{ +{ UI_ThemeColorShade(colorid, shade); uiSetRoundBox(UI_CNR_ALL); uiRoundBox((float)sx, (float)(sy - height), (float)(sx + width), (float)sy, 5.0f); diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index c36cb1bf00e..2f69fc5f99f 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -2335,7 +2335,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo str= "Edit Object %t|Add Object %x0|End Object %x1|Replace Mesh %x2|Track to %x3|Dynamics %x4"; uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &eoa->type, 0.0, 0.0, 0, 0, ""); - yco-= ysize; + yco-= ysize; break; @@ -2472,9 +2472,9 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo } str= "Constraint Type %t|Location %x0|Distance %x1|Orientation %x2|Force field %x3"; but = uiDefButS(block, MENU, B_REDR, str, xco+40, yco-23, (width-80), 19, &coa->type, 0.0, 0.0, 0, 0, ""); - yco-= ysize; + yco-= ysize; break; - + case ACT_SCENE: sca= act->data; diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 4394b4b1920..e2e47338eee 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -340,8 +340,9 @@ static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA * uiBut *bt; bt= uiDefButF(block, BUT_NORMAL, B_NODE_EXEC, "", - (short)butr->xmin, (short)butr->xmin, butr->xmax-butr->xmin, butr->xmax-butr->xmin, - nor, 0.0f, 1.0f, 0, 0, ""); + (short)butr->xmin, (short)butr->xmin, + butr->xmax-butr->xmin, butr->xmax-butr->xmin, + nor, 0.0f, 1.0f, 0, 0, ""); uiButSetFunc(bt, node_normal_cb, ntree, node); } #if 0 // not used in 2.5x yet @@ -627,9 +628,9 @@ static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket * uiButSetFunc(bt, update_group_output_cb, snode, ngroup); } else { - uiDefBut(gnode->block, LABEL, 0, sock->name, - sock->locx+xoffset, sock->locy+1+yoffset, 72, NODE_DY, - NULL, 0, 31, 0, 0, ""); + uiDefBut(gnode->block, LABEL, 0, sock->name, + sock->locx+xoffset, sock->locy+1+yoffset, 72, NODE_DY, + NULL, 0, 31, 0, 0, ""); } } diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index a932f1b10d9..36cba15e5f2 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -585,8 +585,8 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN UI_ThemeColor(color_id); if(node->flag & NODE_MUTED) - UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); - + UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD); @@ -758,7 +758,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b /* body */ UI_ThemeColor(color_id); if(node->flag & NODE_MUTED) - UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); + UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad); /* outline active and selected emphasis */ diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 8575d0348ab..5fd3d3b45d6 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -170,7 +170,7 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog BLI_mutex_unlock(&pj->queue_lock); seq_proxy_rebuild(pj->main, pj->scene, seq, - stop, do_update, progress); + stop, do_update, progress); seq_free_sequence_recurse(pj->scene, seq); } @@ -195,7 +195,7 @@ static void seq_proxy_build_job(const bContext *C, Sequence * seq) seq = seq_dupli_recursive(scene, scene, seq, 0); steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), - sa, "Building Proxies", WM_JOB_PROGRESS); + sa, "Building Proxies", WM_JOB_PROGRESS); pj = WM_jobs_get_customdata(steve); @@ -209,9 +209,9 @@ static void seq_proxy_build_job(const bContext *C, Sequence * seq) WM_jobs_customdata(steve, pj, proxy_freejob); WM_jobs_timer(steve, 0.1, NC_SCENE|ND_SEQUENCER, - NC_SCENE|ND_SEQUENCER); - WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, - proxy_endjob); + NC_SCENE|ND_SEQUENCER); + WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, + proxy_endjob); } BLI_mutex_lock(&pj->queue_lock); @@ -250,9 +250,9 @@ static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* calle sh.free(last_seq); sh.init_plugin(last_seq, str); - last_seq->machine = MAX3(last_seq->seq1->machine, - last_seq->seq2->machine, - last_seq->seq3->machine); + last_seq->machine = MAX3(last_seq->seq1->machine, + last_seq->seq2->machine, + last_seq->seq3->machine); if( seq_test_overlap(ed->seqbasep, last_seq) ) shuffle_seq(ed->seqbasep, last_seq, scene); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 720081d946b..07ca56cde8b 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -184,7 +184,7 @@ void sequencer_keymap(wmKeyConfig *keyconf) regular number keys */ { int keys[] = { ONEKEY, TWOKEY, THREEKEY, FOURKEY, FIVEKEY, - SIXKEY, SEVENKEY, EIGHTKEY, NINEKEY, ZEROKEY }; + SIXKEY, SEVENKEY, EIGHTKEY, NINEKEY, ZEROKEY }; int i; for (i = 1; i <= 10; i++) { diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index 565d531975b..62cd4fedf0e 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -105,7 +105,7 @@ int text_get_total_lines(struct SpaceText *st, struct ARegion *ar); /* text_ops.c */ enum { LINE_BEGIN, LINE_END, FILE_TOP, FILE_BOTTOM, PREV_CHAR, NEXT_CHAR, - PREV_WORD, NEXT_WORD, PREV_LINE, NEXT_LINE, PREV_PAGE, NEXT_PAGE }; + PREV_WORD, NEXT_WORD, PREV_LINE, NEXT_LINE, PREV_PAGE, NEXT_PAGE }; enum { DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_NEXT_WORD, DEL_PREV_WORD }; void TEXT_OT_new(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 8e20f331698..edcaed43de6 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -448,7 +448,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) if(usys) { int i= bUnit_GetBaseUnit(usys); *grid_unit= bUnit_GetNameDisplay(usys, i); - grid_scale = (grid_scale * (float)bUnit_GetScaler(usys, i)) / scene->unit.scale_length; + grid_scale = (grid_scale * (float)bUnit_GetScaler(usys, i)) / scene->unit.scale_length; } } @@ -1267,11 +1267,24 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) BLI_assert(ar->regiontype == RGN_TYPE_WINDOW); if(base && (base->object->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT) || - paint_facesel_test(base->object))); + paint_facesel_test(base->object))) + { + /* do nothing */ + } else if((base && (base->object->mode & OB_MODE_TEXTURE_PAINT)) && - scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)); - else if((base && (base->object->mode & OB_MODE_PARTICLE_EDIT)) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)); - else if(scene->obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)); + scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)) + { + /* do nothing */ + } + else if((base && (base->object->mode & OB_MODE_PARTICLE_EDIT)) && + v3d->drawtype > OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)) + { + /* do nothing */ + } + else if(scene->obedit && v3d->drawtype>OB_WIRE && + (v3d->flag & V3D_ZBUF_SELECT)) { + /* do nothing */ + } else { v3d->flag &= ~V3D_INVALID_BACKBUF; return; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 7cd9c07c00c..b2707db806f 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -977,7 +977,7 @@ void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot) ot->poll= ED_operator_view3d_active; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } /* **************************************************** */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 7ab1b24e9b3..e19c115b194 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1256,7 +1256,7 @@ static void createTransArmatureVerts(TransInfo *t) static void createTransMBallVerts(TransInfo *t) { MetaBall *mb = (MetaBall*)t->obedit->data; - MetaElem *ml; + MetaElem *ml; TransData *td; TransDataExtension *tx; float mtx[3][3], smtx[3][3]; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 5d61d2a1ebb..442ad662813 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -792,7 +792,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], float mat[4][4]; /* Rotation of MetaElem is stored in quat */ - quat_to_mat4( mat,ml_sel->quat); + quat_to_mat4( mat,ml_sel->quat); copy_v3_v3(normal, mat[2]); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 22cae058b2a..8d72bd64e29 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -468,11 +468,11 @@ void GPU_drawobject_free(DerivedMesh *dm) } typedef void (*GPUBufferCopyFunc)(DerivedMesh *dm, float *varray, int *index, - int *mat_orig_to_new, void *user_data); + int *mat_orig_to_new, void *user_data); static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object, - int vector_size, int size, GLenum target, - void *user, GPUBufferCopyFunc copy_f) + int vector_size, int size, GLenum target, + void *user, GPUBufferCopyFunc copy_f) { GPUBufferPool *pool; GPUBuffer *buffer; @@ -546,8 +546,8 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object, while(uploaded == GL_FALSE) { (*copy_f)(dm, varray, cur_index_per_mat, mat_orig_to_new, user); /* glUnmapBuffer returns GL_FALSE if - the data store is corrupted; retry - in that case */ + * the data store is corrupted; retry + * in that case */ uploaded = glUnmapBufferARB(target); } } @@ -924,8 +924,8 @@ static GPUBuffer *gpu_buffer_setup_type(DerivedMesh *dm, GPUBufferType type) } buf = gpu_buffer_setup(dm, dm->drawObject, ts->vector_size, - gpu_buffer_size_from_type(dm, type), - ts->gl_buffer_type, user_data, ts->copy); + gpu_buffer_size_from_type(dm, type), + ts->gl_buffer_type, user_data, ts->copy); return buf; } @@ -1144,8 +1144,8 @@ void GPU_buffer_unbind(void) } } GLStates &= !(GPU_BUFFER_VERTEX_STATE | GPU_BUFFER_NORMAL_STATE | - GPU_BUFFER_TEXCOORD_STATE | GPU_BUFFER_COLOR_STATE | - GPU_BUFFER_ELEMENT_STATE); + GPU_BUFFER_TEXCOORD_STATE | GPU_BUFFER_COLOR_STATE | + GPU_BUFFER_ELEMENT_STATE); for(i = 0; i < MAX_GPU_ATTRIB_DATA; i++) { if(attribData[i].index != -1) { @@ -1310,8 +1310,8 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers_v, MVert *mvert, /* Build VBO */ glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf); glBufferDataARB(GL_ARRAY_BUFFER_ARB, - sizeof(VertexBufferFormat) * totvert, - NULL, GL_STATIC_DRAW_ARB); + sizeof(VertexBufferFormat) * totvert, + NULL, GL_STATIC_DRAW_ARB); vert_data = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); if(vert_data) { @@ -1359,7 +1359,7 @@ GPU_Buffers *GPU_build_mesh_buffers(GHash *map, MVert *mvert, MFace *mface, /* Generate index buffer object */ glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffers->index_buf); glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, - sizeof(unsigned short) * tottri * 3, NULL, GL_STATIC_DRAW_ARB); + sizeof(unsigned short) * tottri * 3, NULL, GL_STATIC_DRAW_ARB); /* Fill the triangle buffer */ tri_data = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); @@ -1429,8 +1429,8 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers_v, DMGridData **grids, if(buffers->vert_buf) { glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf); glBufferDataARB(GL_ARRAY_BUFFER_ARB, - sizeof(DMGridData) * totvert, - NULL, GL_STATIC_DRAW_ARB); + sizeof(DMGridData) * totvert, + NULL, GL_STATIC_DRAW_ARB); vert_data = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); if(vert_data) { for(i = 0; i < totgrid; ++i) { diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 78f5eb52d52..35ef48250cc 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -909,7 +909,7 @@ static void gpu_node_input_socket(GPUNode *node, GPUNodeStack *sock) gpu_node_input_link(node, sock->link, sock->type); } else { - link = GPU_node_link_create(0); + link = GPU_node_link_create(0); link->ptr1 = sock->vec; gpu_node_input_link(node, link, sock->type); } diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 3981e9fac02..05b980cd88c 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -596,7 +596,7 @@ static void gpu_verify_repeat(Image *ima) { /* set either clamp or repeat in X/Y */ if (ima->tpageflag & IMA_CLAMP_U) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); else glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); @@ -809,11 +809,11 @@ void GPU_free_smoke(SmokeModifierData *smd) if(smd->type & MOD_SMOKE_TYPE_DOMAIN && smd->domain) { if(smd->domain->tex) - GPU_texture_free(smd->domain->tex); + GPU_texture_free(smd->domain->tex); smd->domain->tex = NULL; if(smd->domain->tex_shadow) - GPU_texture_free(smd->domain->tex_shadow); + GPU_texture_free(smd->domain->tex_shadow); smd->domain->tex_shadow = NULL; } } diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index e1a89daf7e2..184eac9519e 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -1208,7 +1208,7 @@ GPUPixelBuffer *gpu_pixelbuffer_create(int x, int y, int halffloat, int numbuffe pb->numbuffers = numbuffers; pb->halffloat = halffloat; - glGenBuffersARB(pb->numbuffers, pb->bindcode); + glGenBuffersARB(pb->numbuffers, pb->bindcode); if (!pb->bindcode[0]) { fprintf(stderr, "GPUPixelBuffer allocation failed\n"); diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 3ab199625a4..3586e8f1b5e 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -214,14 +214,14 @@ typedef enum IMB_Proxy_Size { void IMB_anim_set_index_dir(struct anim * anim, const char * dir); int IMB_anim_index_get_frame_index(struct anim * anim, IMB_Timecode_Type tc, - int position); + int position); /* will rebuild all used indices and proxies at once */ void IMB_anim_index_rebuild(struct anim * anim, - IMB_Timecode_Type build_tcs, - IMB_Proxy_Size build_preview_sizes, - int build_quality, - short *stop, short *do_update, float *progress); + IMB_Timecode_Type build_tcs, + IMB_Proxy_Size build_preview_sizes, + int build_quality, + short *stop, short *do_update, float *progress); /** * Return the length (in frames) of the given @a anim. @@ -234,7 +234,7 @@ int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc); * and frs_sec and frs_sec_base untouched if none available!) */ int IMB_anim_get_fps(struct anim * anim, - short * frs_sec, float * frs_sec_base); + short * frs_sec, float * frs_sec_base); /** * diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h index 5c76f33a319..9ce587aa983 100644 --- a/source/blender/imbuf/intern/IMB_indexer.h +++ b/source/blender/imbuf/intern/IMB_indexer.h @@ -78,24 +78,26 @@ typedef struct anim_index_builder { void * private_data; void (*delete_priv_data)(struct anim_index_builder * idx); - void (*proc_frame)(struct anim_index_builder * idx, - unsigned char * buffer, - int data_size, - struct anim_index_entry * entry); + void (*proc_frame)(struct anim_index_builder * idx, + unsigned char * buffer, + int data_size, + struct anim_index_entry * entry); } anim_index_builder; anim_index_builder * IMB_index_builder_create(const char * name); -void IMB_index_builder_add_entry(anim_index_builder * fp, - int frameno, unsigned long long seek_pos, - unsigned long long seek_pos_dts, - unsigned long long pts); - -void IMB_index_builder_proc_frame(anim_index_builder * fp, - unsigned char * buffer, - int data_size, - int frameno, unsigned long long seek_pos, - unsigned long long seek_pos_dts, - unsigned long long pts); +void IMB_index_builder_add_entry( + anim_index_builder * fp, + int frameno, unsigned long long seek_pos, + unsigned long long seek_pos_dts, + unsigned long long pts); + +void IMB_index_builder_proc_frame( + anim_index_builder * fp, + unsigned char * buffer, + int data_size, + int frameno, unsigned long long seek_pos, + unsigned long long seek_pos_dts, + unsigned long long pts); void IMB_index_builder_finish(anim_index_builder * fp, int rollback); @@ -111,7 +113,7 @@ unsigned long long IMB_indexer_get_pts(struct anim_index * idx, int IMB_indexer_get_duration(struct anim_index * idx); int IMB_indexer_can_scan(struct anim_index * idx, - int old_frame_index, int new_frame_index); + int old_frame_index, int new_frame_index); void IMB_indexer_close(struct anim_index * idx); diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 09b79e51648..fb6c85c2408 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -530,12 +530,12 @@ static int startffmpeg(struct anim * anim) { } if (anim->ib_flags & IB_animdeinterlace) { - avpicture_fill((AVPicture*) anim->pFrameDeinterlaced, - MEM_callocN(avpicture_get_size( - anim->pCodecCtx->pix_fmt, - anim->x, anim->y), - "ffmpeg deinterlace"), - anim->pCodecCtx->pix_fmt, anim->x, anim->y); + avpicture_fill((AVPicture*) anim->pFrameDeinterlaced, + MEM_callocN(avpicture_get_size( + anim->pCodecCtx->pix_fmt, + anim->x, anim->y), + "ffmpeg deinterlace"), + anim->pCodecCtx->pix_fmt, anim->x, anim->y); } if (pCodecCtx->has_b_frames) { @@ -627,9 +627,9 @@ static void ffmpeg_postprocess(struct anim * anim) } } - avpicture_fill((AVPicture*) anim->pFrameRGB, - (unsigned char*) ibuf->rect, - PIX_FMT_RGBA, anim->x, anim->y); + avpicture_fill((AVPicture*) anim->pFrameRGB, + (unsigned char*) ibuf->rect, + PIX_FMT_RGBA, anim->x, anim->y); if (ENDIAN_ORDER == B_ENDIAN) { int * dstStride = anim->pFrameRGB->linesize; @@ -641,12 +641,12 @@ static void ffmpeg_postprocess(struct anim * anim) unsigned char* top; sws_scale(anim->img_convert_ctx, - (const uint8_t * const *)input->data, - input->linesize, - 0, - anim->pCodecCtx->height, - dst2, - dstStride2); + (const uint8_t * const *)input->data, + input->linesize, + 0, + anim->pCodecCtx->height, + dst2, + dstStride2); /* workaround: sws_scale bug sets alpha = 0 and compensate @@ -691,12 +691,12 @@ static void ffmpeg_postprocess(struct anim * anim) unsigned char* r; sws_scale(anim->img_convert_ctx, - (const uint8_t * const *)input->data, - input->linesize, - 0, - anim->pCodecCtx->height, - dst2, - dstStride2); + (const uint8_t * const *)input->data, + input->linesize, + 0, + anim->pCodecCtx->height, + dst2, + dstStride2); r = (unsigned char*) ibuf->rect; @@ -1024,10 +1024,10 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, } if (ret < 0) { - av_log(anim->pFormatCtx, AV_LOG_ERROR, + av_log(anim->pFormatCtx, AV_LOG_ERROR, "FETCH: " "error while seeking to DTS = %lld " - "(frameno = %d, PTS = %lld): errcode = %d\n", + "(frameno = %d, PTS = %lld): errcode = %d\n", pos, position, (long long int)pts_to_search, ret); } @@ -1125,7 +1125,7 @@ static ImBuf * redcode_fetchibuf(struct anim * anim, int position) { } ibuf = IMB_allocImBuf(raw_frame->width * 2, - raw_frame->height * 2, 32, IB_rectfloat); + raw_frame->height * 2, 32, IB_rectfloat); redcode_decode_video_float(raw_frame, ibuf->rect_float, 1); diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 3a94c79f48d..9993df61089 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -48,12 +48,12 @@ static char magic[] = "BlenMIdx"; static char temp_ext [] = "_part"; static int proxy_sizes[] = { IMB_PROXY_25, IMB_PROXY_50, IMB_PROXY_75, - IMB_PROXY_100 }; + IMB_PROXY_100 }; static float proxy_fac[] = { 0.25, 0.50, 0.75, 1.00 }; #ifdef WITH_FFMPEG static int tc_types[] = { IMB_TC_RECORD_RUN, IMB_TC_FREE_RUN, - IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN }; + IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN }; #endif #define INDEX_FILE_VERSION 1 @@ -73,9 +73,9 @@ extern void IMB_indexer_dv_new(anim_index_builder * idx); anim_index_builder * IMB_index_builder_create(const char * name) { - anim_index_builder * rv - = MEM_callocN( sizeof(struct anim_index_builder), - "index builder"); + anim_index_builder * rv + = MEM_callocN( sizeof(struct anim_index_builder), + "index builder"); fprintf(stderr, "Starting work on index: %s\n", name); @@ -197,13 +197,13 @@ struct anim_index * IMB_indexer_open(const char * name) * idx->num_entries, "anim_index_entries"); for (i = 0; i < idx->num_entries; i++) { - fread(&idx->entries[i].frameno, + fread(&idx->entries[i].frameno, sizeof(int), 1, fp); - fread(&idx->entries[i].seek_pos, + fread(&idx->entries[i].seek_pos, sizeof(unsigned long long), 1, fp); - fread(&idx->entries[i].seek_pos_dts, + fread(&idx->entries[i].seek_pos_dts, sizeof(unsigned long long), 1, fp); - fread(&idx->entries[i].pts, + fread(&idx->entries[i].pts, sizeof(unsigned long long), 1, fp); } @@ -392,7 +392,7 @@ static void get_proxy_filename(struct anim * anim, IMB_Proxy_Size preview_size, get_index_dir(anim, index_dir); BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, - temp ? proxy_temp_name : proxy_name); + temp ? proxy_temp_name : proxy_name); } static void get_tc_filename(struct anim * anim, IMB_Timecode_Type tc, @@ -418,7 +418,7 @@ static void get_tc_filename(struct anim * anim, IMB_Timecode_Type tc, get_index_dir(anim, index_dir); BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, - index_dir, index_name); + index_dir, index_name); } /* ---------------------------------------------------------------------- @@ -533,15 +533,16 @@ static struct proxy_output_ctx * alloc_proxy_output_ffmpeg( rv->orig_height = st->codec->height; - if (st->codec->width != width || st->codec->height != height - || st->codec->pix_fmt != rv->c->pix_fmt) { + if (st->codec->width != width || st->codec->height != height || + st->codec->pix_fmt != rv->c->pix_fmt) + { rv->frame = avcodec_alloc_frame(); - avpicture_fill((AVPicture*) rv->frame, - MEM_mallocN(avpicture_get_size( - rv->c->pix_fmt, - round_up(width, 16), height), - "alloc proxy output frame"), - rv->c->pix_fmt, round_up(width, 16), height); + avpicture_fill((AVPicture*) rv->frame, + MEM_mallocN(avpicture_get_size( + rv->c->pix_fmt, + round_up(width, 16), height), + "alloc proxy output frame"), + rv->c->pix_fmt, round_up(width, 16), height); rv->sws_ctx = sws_getContext( st->codec->width, @@ -567,12 +568,13 @@ static int add_to_proxy_output_ffmpeg( return 0; } - if (ctx->sws_ctx && frame && - (frame->data[0] || frame->data[1] || - frame->data[2] || frame->data[3])) { + if ( ctx->sws_ctx && frame && + (frame->data[0] || frame->data[1] || + frame->data[2] || frame->data[3])) + { sws_scale(ctx->sws_ctx, (const uint8_t * const*) frame->data, - frame->linesize, 0, ctx->orig_height, - ctx->frame->data, ctx->frame->linesize); + frame->linesize, 0, ctx->orig_height, + ctx->frame->data, ctx->frame->linesize); } frame = ctx->sws_ctx ? (frame ? ctx->frame : 0) : frame; @@ -664,13 +666,13 @@ static void free_proxy_output_ffmpeg(struct proxy_output_ctx * ctx, } get_proxy_filename(ctx->anim, ctx->proxy_size, - fname_tmp, TRUE); + fname_tmp, TRUE); if (rollback) { unlink(fname_tmp); } else { get_proxy_filename(ctx->anim, ctx->proxy_size, - fname, FALSE); + fname, FALSE); rename(fname_tmp, fname); } diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index d9bd0b9cda4..89038d7d1d2 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -219,14 +219,13 @@ static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t * Note we do *not* do INPUT_SYNC before calling fill_input_buffer, * but we must reload the local copies after a successful fill. */ -#define MAKE_BYTE_AVAIL(cinfo,action) \ - if (bytes_in_buffer == 0) { \ - if (! (*datasrc->fill_input_buffer) (cinfo)) \ - { action; } \ - INPUT_RELOAD(cinfo); \ +#define MAKE_BYTE_AVAIL(cinfo, action) \ + if (bytes_in_buffer == 0) { \ + if (! (*datasrc->fill_input_buffer) (cinfo)) \ + { action; } \ + INPUT_RELOAD(cinfo); \ } - /* Read a byte into variable V. * If must suspend, take the specified action (typically "return FALSE"). diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 13c381ae9c4..be245baef21 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -190,10 +190,11 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) ibuf->encodedsize = 0; png_set_write_fn(png_ptr, - (png_voidp) ibuf, - WriteData, - Flush); - } else { + (png_voidp) ibuf, + WriteData, + Flush); + } + else { fp = fopen(name, "wb"); if (!fp) { png_destroy_write_struct(&png_ptr, &info_ptr); @@ -218,14 +219,14 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) // png image settings png_set_IHDR(png_ptr, - info_ptr, - ibuf->x, - ibuf->y, - 8, - color_type, - PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT); + info_ptr, + ibuf->x, + ibuf->y, + 8, + color_type, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); /* image text info */ if (ibuf->metadata) { diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index fe53a883f82..6519e389a21 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -539,7 +539,7 @@ static void shrink_picture_byte( *dst++ = (val= (dst_line1[x].a * f) >> 15) > 255 ? 255: val; } memset(dst_line1, 0, dst_width * - sizeof(struct scale_outpix_byte)); + sizeof(struct scale_outpix_byte)); temp = dst_line1; dst_line1 = dst_line2; dst_line2 = temp; @@ -740,7 +740,7 @@ static void shrink_picture_float( *dst++ = dst_line1[x].a * f; } memset(dst_line1, 0, dst_width * - sizeof(struct scale_outpix_float)); + sizeof(struct scale_outpix_float)); temp = dst_line1; dst_line1 = dst_line2; dst_line2 = temp; @@ -803,21 +803,21 @@ static int q_scale_linear_interpolation( } if (ibuf->rect) { - unsigned char * newrect = - MEM_mallocN(newx * newy * sizeof(int), "q_scale rect"); + unsigned char * newrect = + MEM_mallocN(newx * newy * sizeof(int), "q_scale rect"); q_scale_byte((unsigned char *)ibuf->rect, newrect, ibuf->x, ibuf->y, - newx, newy); + newx, newy); imb_freerectImBuf(ibuf); ibuf->mall |= IB_rect; ibuf->rect = (unsigned int *) newrect; } if (ibuf->rect_float) { - float * newrect = - MEM_mallocN(newx * newy * 4 *sizeof(float), - "q_scale rectfloat"); + float * newrect = + MEM_mallocN(newx * newy * 4 *sizeof(float), + "q_scale rectfloat"); q_scale_float(ibuf->rect_float, newrect, ibuf->x, ibuf->y, - newx, newy); + newx, newy); imb_freerectfloatImBuf(ibuf); ibuf->mall |= IB_rectfloat; ibuf->rect_float = newrect; diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c index 0eaa87542d5..149b5fb9096 100644 --- a/source/blender/imbuf/intern/thumbs_blend.c +++ b/source/blender/imbuf/intern/thumbs_blend.c @@ -64,7 +64,7 @@ static ImBuf *loadblend_thumb(gzFile gzfile) else return NULL; - sizeof_bhead = 16 + pointer_size; + sizeof_bhead = 16 + pointer_size; if(buf[8]=='V') endian= B_ENDIAN; /* big: PPC */ diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 7fa26478ae2..c135254b11b 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -58,8 +58,8 @@ typedef struct IDProperty { IDPropertyData data; /* note, alignment for 64 bits */ int len; /* array length, also (this is important!) string length + 1. the idea is to be able to reuse array realloc functions on strings.*/ - /*totallen is total length of allocated array/string, including a buffer. - Note that the buffering is mild; the code comes from python's list implementation.*/ + /* totallen is total length of allocated array/string, including a buffer. + * Note that the buffering is mild; the code comes from python's list implementation.*/ int totallen; /*strings and arrays are both buffered, though the buffer isn't saved.*/ } IDProperty; diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 48185eefdbc..d45a8f83f76 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -296,9 +296,9 @@ typedef struct SoftBody { /* springs */ float inspring; /* softbody inner springs */ float infrict; /* softbody inner springs friction */ - char namedVG_Spring_K[32]; /* along with it introduce Spring_K painting - starting to fix old bug .. nastyness that VG are indexes - rather find them by name tag to find it -> jow20090613 */ + char namedVG_Spring_K[32]; /* along with it introduce Spring_K painting + starting to fix old bug .. nastyness that VG are indexes + rather find them by name tag to find it -> jow20090613 */ /* baking */ int sfra, efra; diff --git a/source/blender/makesdna/DNA_sensor_types.h b/source/blender/makesdna/DNA_sensor_types.h index b3593c5e08c..451774b1abb 100644 --- a/source/blender/makesdna/DNA_sensor_types.h +++ b/source/blender/makesdna/DNA_sensor_types.h @@ -103,7 +103,7 @@ typedef struct bCollisionSensor { // struct Material *ma; // XXX remove materialName short damptimer, damp; short mode; /* flag to choose material or property */ - short pad2; + short pad2; } bCollisionSensor; typedef struct bRadarSensor { diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 93fdc2b2136..95f44d86058 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -1394,11 +1394,12 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Curve_update_data"); /* not supported yet - prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER); - RNA_def_property_float(prop, NULL, "rot"); - RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation"); - RNA_def_property_editable_func(prop, texspace_editable); - RNA_def_property_update(prop, 0, "rna_Curve_update_data");*/ + prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER); + RNA_def_property_float(prop, NULL, "rot"); + RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation"); + RNA_def_property_editable_func(prop, texspace_editable); + RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + */ prop= RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO); diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 629711fcf96..5b71df86f30 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -265,7 +265,7 @@ static void rna_def_lamp_sky_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sun Size", "Sun size"); RNA_def_property_update(prop, 0, "rna_Lamp_sky_update"); - prop= RNA_def_property(srna, "backscattered_light", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "backscattered_light", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -1.0f, 1.0f); RNA_def_property_ui_text(prop, "Backscattered Light", "Backscattered light"); RNA_def_property_update(prop, 0, "rna_Lamp_sky_update"); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 93cdfb6069b..48a4d055520 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1945,11 +1945,12 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); /* not supported yet - prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER); - RNA_def_property_float(prop, NULL, "rot"); - RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation"); - RNA_def_property_editable_func(prop, texspace_editable); - RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");*/ + prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER); + RNA_def_property_float(prop, NULL, "rot"); + RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation"); + RNA_def_property_editable_func(prop, texspace_editable); + RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); + */ /* materials */ prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index 2b847084e10..323fb6780fb 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -317,11 +317,12 @@ static void rna_def_metaball(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); /* not supported yet - prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER); - RNA_def_property_float(prop, NULL, "rot"); - RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation"); - RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable"); - RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");*/ + prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER); + RNA_def_property_float(prop, NULL, "rot"); + RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation"); + RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable"); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); + */ /* materials */ prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index c22ded39a74..2d3944a5b07 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3025,7 +3025,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_full_sample", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FULL_SAMPLE); - RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_full_sample_get", NULL); + RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_full_sample_get", NULL); RNA_def_property_ui_text(prop, "Full Sample", "Save for every anti-aliasing sample the entire RenderLayer results " "(this solves anti-aliasing issues with compositing)"); diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 95e16f3bea4..d2d875150e8 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -110,7 +110,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, DagNode *curNode = dag_get_node(forest, amd->object); dag_add_relation(forest, curNode, obNode, - DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Armature Modifier"); + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Armature Modifier"); } } @@ -169,7 +169,7 @@ static void deformMatricesEM( if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data); armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts, - amd->deformflag, NULL, amd->defgrp_name); + amd->deformflag, NULL, amd->defgrp_name); if(!derivedData) dm->release(dm); } @@ -183,7 +183,7 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat if(!derivedData) dm = CDDM_from_mesh((Mesh*)ob->data, ob); armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts, - amd->deformflag, NULL, amd->defgrp_name); + amd->deformflag, NULL, amd->defgrp_name); if(!derivedData) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index f56eda674c5..ce052b2c1bd 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -116,25 +116,25 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, DagNode *curNode = dag_get_node(forest, amd->start_cap); dag_add_relation(forest, curNode, obNode, - DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier"); + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier"); } if (amd->end_cap) { DagNode *curNode = dag_get_node(forest, amd->end_cap); dag_add_relation(forest, curNode, obNode, - DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier"); + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier"); } if (amd->curve_ob) { DagNode *curNode = dag_get_node(forest, amd->curve_ob); dag_add_relation(forest, curNode, obNode, - DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier"); + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier"); } if (amd->offset_ob) { DagNode *curNode = dag_get_node(forest, amd->offset_ob); dag_add_relation(forest, curNode, obNode, - DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier"); + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array Modifier"); } } @@ -275,8 +275,8 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, unit_m4(obinv); mul_serie_m4(result_mat, offset, - obinv, amd->offset_ob->obmat, - NULL, NULL, NULL, NULL, NULL); + obinv, amd->offset_ob->obmat, + NULL, NULL, NULL, NULL, NULL); copy_m4_m4(offset, result_mat); } diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 1828781690b..e502878fca5 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -85,7 +85,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, DagNode *curNode = dag_get_node(forest, bmd->object); dag_add_relation(forest, curNode, obNode, - DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Boolean Modifier"); + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Boolean Modifier"); } } diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index bdf67c25e74..261d0c6c0d3 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -106,7 +106,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, DagNode *curNode = dag_get_node(forest, cmd->object); dag_add_relation(forest, curNode, obNode, - DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Curve Modifier"); + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Curve Modifier"); } } @@ -120,7 +120,7 @@ static void deformVerts(ModifierData *md, Object *ob, CurveModifierData *cmd = (CurveModifierData*) md; curve_deform_verts(md->scene, cmd->object, ob, derivedData, vertexCos, numVerts, - cmd->name, cmd->defaxis); + cmd->name, cmd->defaxis); } static void deformVertsEM( diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index a7a25fbb00e..da90879ed6d 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -157,13 +157,13 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, DagNode *curNode = dag_get_node(forest, dmd->map_object); dag_add_relation(forest, curNode, obNode, - DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Displace Modifier"); + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Displace Modifier"); } if(dmd->texmapping == MOD_DISP_MAP_GLOBAL) dag_add_relation(forest, obNode, obNode, - DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Displace Modifier"); + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Displace Modifier"); } @@ -244,7 +244,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *dm= get_cddm(ob, NULL, derivedData, vertexCos); displaceModifier_do((DisplaceModifierData *)md, ob, dm, - vertexCos, numVerts); + vertexCos, numVerts); if(dm != derivedData) dm->release(dm); @@ -257,7 +257,7 @@ static void deformVertsEM( DerivedMesh *dm= get_cddm(ob, editData, derivedData, vertexCos); displaceModifier_do((DisplaceModifierData *)md, ob, dm, - vertexCos, numVerts); + vertexCos, numVerts); if(dm != derivedData) dm->release(dm); diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index ad1a636589f..30e801c9b42 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -170,7 +170,7 @@ static void deformVerts(ModifierData *md, Object *ob, } invert_m4_m4(ob->imat, ob->obmat); mul_serie_m4(mat, ob->imat, dmat, hmd->parentinv, - NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); modifier_get_vgroup(ob, dm, hmd->name, &dvert, &defgrp_index); max_dvert = (dvert)? numVerts: 0; diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 9ef5e501aca..4d5c63986a5 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -98,7 +98,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, DagNode *latNode = dag_get_node(forest, lmd->object); dag_add_relation(forest, latNode, obNode, - DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Lattice Modifier"); + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Lattice Modifier"); } } @@ -115,7 +115,7 @@ static void deformVerts(ModifierData *md, Object *ob, modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */ lattice_deform_verts(lmd->object, ob, derivedData, - vertexCos, numVerts, lmd->name); + vertexCos, numVerts, lmd->name); } static void deformVertsEM( diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index b36850da786..2e744337b97 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -91,7 +91,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, DagNode *latNode = dag_get_node(forest, mmd->mirror_ob); dag_add_relation(forest, latNode, obNode, - DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Mirror Modifier"); + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Mirror Modifier"); } } diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index edd16c045f6..2eaa142db47 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -225,7 +225,7 @@ static void deformVerts( DerivedMesh *dm= get_dm(ob, NULL, derivedData, NULL, 0); smoothModifier_do((SmoothModifierData *)md, ob, dm, - vertexCos, numVerts); + vertexCos, numVerts); if(dm != derivedData) dm->release(dm); @@ -238,7 +238,7 @@ static void deformVertsEM( DerivedMesh *dm= get_dm(ob, editData, derivedData, NULL, 0); smoothModifier_do((SmoothModifierData *)md, ob, dm, - vertexCos, numVerts); + vertexCos, numVerts); if(dm != derivedData) dm->release(dm); diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index 5ca38b74420..3b2a2342167 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -53,9 +53,9 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float * float difference; float alpha; - difference= fabs(inColor2[0]-inColor1[0])+ - fabs(inColor2[1]-inColor1[1])+ - fabs(inColor2[2]-inColor1[2]); + difference= fabs(inColor2[0]-inColor1[0]) + + fabs(inColor2[1]-inColor1[1]) + + fabs(inColor2[2]-inColor1[2]); /*average together the distances*/ difference=difference/3.0f; diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 41427c42286..672d2af0646 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -358,41 +358,41 @@ static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, in static void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out, int rectx, int recty) { - if(out[RRES_OUT_Z]->hasoutput) - out[RRES_OUT_Z]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_Z); - if(out[RRES_OUT_VEC]->hasoutput) - out[RRES_OUT_VEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_VECTOR); - if(out[RRES_OUT_NORMAL]->hasoutput) - out[RRES_OUT_NORMAL]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_NORMAL); - if(out[RRES_OUT_UV]->hasoutput) - out[RRES_OUT_UV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_UV); - - if(out[RRES_OUT_RGBA]->hasoutput) - out[RRES_OUT_RGBA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_RGBA); - if(out[RRES_OUT_DIFF]->hasoutput) - out[RRES_OUT_DIFF]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE); - if(out[RRES_OUT_SPEC]->hasoutput) - out[RRES_OUT_SPEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SPEC); - if(out[RRES_OUT_SHADOW]->hasoutput) - out[RRES_OUT_SHADOW]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SHADOW); - if(out[RRES_OUT_AO]->hasoutput) - out[RRES_OUT_AO]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_AO); - if(out[RRES_OUT_REFLECT]->hasoutput) - out[RRES_OUT_REFLECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFLECT); - if(out[RRES_OUT_REFRACT]->hasoutput) - out[RRES_OUT_REFRACT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFRACT); - if(out[RRES_OUT_INDIRECT]->hasoutput) - out[RRES_OUT_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDIRECT); - if(out[RRES_OUT_INDEXOB]->hasoutput) - out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB); + if(out[RRES_OUT_Z]->hasoutput) + out[RRES_OUT_Z]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_Z); + if(out[RRES_OUT_VEC]->hasoutput) + out[RRES_OUT_VEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_VECTOR); + if(out[RRES_OUT_NORMAL]->hasoutput) + out[RRES_OUT_NORMAL]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_NORMAL); + if(out[RRES_OUT_UV]->hasoutput) + out[RRES_OUT_UV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_UV); + + if(out[RRES_OUT_RGBA]->hasoutput) + out[RRES_OUT_RGBA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_RGBA); + if(out[RRES_OUT_DIFF]->hasoutput) + out[RRES_OUT_DIFF]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE); + if(out[RRES_OUT_SPEC]->hasoutput) + out[RRES_OUT_SPEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SPEC); + if(out[RRES_OUT_SHADOW]->hasoutput) + out[RRES_OUT_SHADOW]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SHADOW); + if(out[RRES_OUT_AO]->hasoutput) + out[RRES_OUT_AO]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_AO); + if(out[RRES_OUT_REFLECT]->hasoutput) + out[RRES_OUT_REFLECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFLECT); + if(out[RRES_OUT_REFRACT]->hasoutput) + out[RRES_OUT_REFRACT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFRACT); + if(out[RRES_OUT_INDIRECT]->hasoutput) + out[RRES_OUT_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDIRECT); + if(out[RRES_OUT_INDEXOB]->hasoutput) + out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB); if(out[RRES_OUT_INDEXMA]->hasoutput) out[RRES_OUT_INDEXMA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXMA); - if(out[RRES_OUT_MIST]->hasoutput) - out[RRES_OUT_MIST]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_MIST); - if(out[RRES_OUT_EMIT]->hasoutput) - out[RRES_OUT_EMIT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_EMIT); - if(out[RRES_OUT_ENV]->hasoutput) - out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT); + if(out[RRES_OUT_MIST]->hasoutput) + out[RRES_OUT_MIST]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_MIST); + if(out[RRES_OUT_EMIT]->hasoutput) + out[RRES_OUT_EMIT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_EMIT); + if(out[RRES_OUT_ENV]->hasoutput) + out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT); } static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) diff --git a/source/blender/python/generic/noise_py_api.c b/source/blender/python/generic/noise_py_api.c index c12cc1ccdd2..c84aab83b7e 100644 --- a/source/blender/python/generic/noise_py_api.c +++ b/source/blender/python/generic/noise_py_api.c @@ -263,10 +263,10 @@ static void noise_vector(float x, float y, float z, int nb, float v[3]) { /* Simply evaluate noise at 3 different positions */ v[0]= (float)(2.0f * BLI_gNoise(1.f, x + 9.321f, y - 1.531f, z - 7.951f, 0, - nb) - 1.0f); + nb) - 1.0f); v[1]= (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f); v[2]= (float)(2.0f * BLI_gNoise(1.f, x + 6.327f, y + 0.1671f, z - 2.672f, 0, - nb) - 1.0f); + nb) - 1.0f); } static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args) @@ -442,10 +442,10 @@ static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args) return NULL; voronoi(x, y, z, da, pa, me, dtype); return Py_BuildValue("[[ffff][[fff][fff][fff][fff]]]", - da[0], da[1], da[2], da[3], - pa[0], pa[1], pa[2], - pa[3], pa[4], pa[5], - pa[6], pa[7], pa[8], pa[9], pa[10], pa[11]); + da[0], da[1], da[2], da[3], + pa[0], pa[1], pa[2], + pa[3], pa[4], pa[5], + pa[6], pa[7], pa[8], pa[9], pa[10], pa[11]); } /*-------------------------------------------------------------------------*/ diff --git a/source/blender/quicktime/apple/qtkit_import.m b/source/blender/quicktime/apple/qtkit_import.m index 279192e9692..4307529002c 100644 --- a/source/blender/quicktime/apple/qtkit_import.m +++ b/source/blender/quicktime/apple/qtkit_import.m @@ -311,11 +311,11 @@ int startquicktime (struct anim *anim) [QTMovie enterQTKitOnThread]; attributes = [NSDictionary dictionaryWithObjectsAndKeys: - [NSString stringWithCString:anim->name - encoding:[NSString defaultCStringEncoding]], QTMovieFileNameAttribute, - [NSNumber numberWithBool:NO], QTMovieEditableAttribute, - nil]; - + [NSString stringWithCString:anim->name + encoding:[NSString defaultCStringEncoding]], QTMovieFileNameAttribute, + [NSNumber numberWithBool:NO], QTMovieEditableAttribute, + nil]; + anim->qtime->movie = [QTMovie movieWithAttributes:attributes error:NULL]; if (!anim->qtime->movie) { diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index 77cc45664a4..5c0460d4e74 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -657,9 +657,12 @@ static void check_renderbutton_framerate(RenderData *rd, ReportList *reports) CheckError(err, "SCGetInfo fr error", reports); if( (rd->frs_sec == 24 || rd->frs_sec == 30 || rd->frs_sec == 60) && - (qtdata->gTemporalSettings.frameRate == 1571553 || - qtdata->gTemporalSettings.frameRate == 1964113 || - qtdata->gTemporalSettings.frameRate == 3928227)) {;} + (qtdata->gTemporalSettings.frameRate == 1571553 || + qtdata->gTemporalSettings.frameRate == 1964113 || + qtdata->gTemporalSettings.frameRate == 3928227)) + { + /* do nothing */ + } else { if (rd->frs_sec_base > 0) qtdata->gTemporalSettings.frameRate = diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c index f88cba51ac3..d7ef371873a 100644 --- a/source/blender/quicktime/apple/quicktime_import.c +++ b/source/blender/quicktime/apple/quicktime_import.c @@ -381,8 +381,9 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position) //add alpha to ibuf boxsize = anim->x * anim->y * 4; crect = (unsigned char *) rect; - for( index = 0; index < boxsize; index+=4, crect+=4 ) - crect[3] = 0xFF; + for( index = 0; index < boxsize; index+=4, crect+=4 ) { + crect[3] = 0xFF; + } } #endif @@ -522,8 +523,8 @@ int startquicktime (struct anim *anim) anim->qtime->have_gw = TRUE; SetMovieGWorld(anim->qtime->movie, - anim->qtime->offscreenGWorld, - GetGWorldDevice(anim->qtime->offscreenGWorld)); + anim->qtime->offscreenGWorld, + GetGWorldDevice(anim->qtime->offscreenGWorld)); SetMoviePlayHints(anim->qtime->movie, hintsHighQuality, hintsHighQuality); // sets Media and Track! @@ -780,7 +781,7 @@ bail: if( depth < 32 && (**desc).cType != kGIFCodecType) { for(i = 0; i < box; i++, arect+=4) - arect[3] = 0xFF; + arect[3] = 0xFF; } #endif @@ -799,25 +800,25 @@ bail: #if 0 struct ImageDescription { - long idSize; - CodecType cType; - long resvd1; - short resvd2; - short dataRefIndex; - short version; - short revisionLevel; - long vendor; - CodecQ temporalQuality; - CodecQ spatialQuality; - short width; - short height; - Fixed hRes; - Fixed vRes; - long dataSize; - short frameCount; - Str31 name; - short depth; - short clutID; + long idSize; + CodecType cType; + long resvd1; + short resvd2; + short dataRefIndex; + short version; + short revisionLevel; + long vendor; + CodecQ temporalQuality; + CodecQ spatialQuality; + short width; + short height; + Fixed hRes; + Fixed vRes; + long dataSize; + short frameCount; + Str31 name; + short depth; + short clutID; }; #endif // 0 diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index fac3329bae0..c00df7db87e 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -233,7 +233,7 @@ void RE_MergeFullSample(struct Render *re, struct Main *bmain, struct Scene *sce /* ancient stars function... go away! */ void RE_make_stars(struct Render *re, struct Scene *scenev3d, void (*initfunc)(void), - void (*vertexfunc)(float*), void (*termfunc)(void)); + void (*vertexfunc)(float*), void (*termfunc)(void)); /* display and event callbacks */ void RE_display_init_cb (struct Render *re, void *handle, void (*f)(void *handle, RenderResult *rr)); diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index d1f7059416d..785d9ac69d8 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -1092,7 +1092,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex if (tex->imaflag & TEX_FILTER_MIN) { // make sure the filtersize is minimal in pixels (normal, ref map can have miniature pixel dx/dy) - const float addval = (0.5f * tex->filtersize) / (float)MIN2(ibuf->x, ibuf->y); + const float addval = (0.5f * tex->filtersize) / (float)MIN2(ibuf->x, ibuf->y); if (addval > minx) minx = addval; if (addval > miny) miny = addval; } diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index 0984c9e784f..e20fd85d0f0 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -1034,8 +1034,8 @@ static float occ_quad_form_factor(float *p, float *n, float *q0, float *q1, floa /* dot */ vresult.v = (vec_splat_float(n[0])*gx + - vec_splat_float(n[1])*gy + - vec_splat_float(n[2])*gz)*vangle; + vec_splat_float(n[1])*gy + + vec_splat_float(n[2])*gz)*vangle; result= (vresult.f[0] + vresult.f[1] + vresult.f[2] + vresult.f[3])*(0.5f/(float)M_PI); result= MAX2(result, 0.0f); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index d4bd8f8a693..d7045c0b322 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -159,7 +159,7 @@ static void stats_background(void *UNUSED(arg), RenderStats *rs) megs_peak_memory = (peak_memory)/(1024.0*1024.0); fprintf(stdout, "Fra:%d Mem:%.2fM (%.2fM, peak %.2fM) ", rs->cfra, - megs_used_memory, mmap_used_memory, megs_peak_memory); + megs_used_memory, mmap_used_memory, megs_peak_memory); if(rs->curfield) fprintf(stdout, "Field %d ", rs->curfield); @@ -1831,7 +1831,7 @@ static void do_render_3d(Render *re) if(render_scene_needs_vector(re)) RE_Database_FromScene_Vectors(re, re->main, re->scene, re->lay); else - RE_Database_FromScene(re, re->main, re->scene, re->lay, 1); + RE_Database_FromScene(re, re->main, re->scene, re->lay, 1); /* clear UI drawing locks */ if(re->draw_lock) diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 85954d20a30..afc52f7c92a 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -2721,9 +2721,9 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col mul_m4_v3(ob->imat_ren, co); } } - else if(mtex->texco==TEXCO_GLOB) { - copy_v3_v3(co, xyz); - mul_m4_v3(re->viewinv, co); + else if(mtex->texco==TEXCO_GLOB) { + copy_v3_v3(co, xyz); + mul_m4_v3(re->viewinv, co); } else continue; // can happen when texco defines disappear and it renders old files diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index f3eb2234778..8cb7009f756 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -1083,7 +1083,7 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int else { /* got warning on this for 64 bits.... */ /* but it's working code! in this case rz is not a pointer but zvalue (ton) */ - zsamp= GET_INT_FROM_POINTER(rz); + zsamp= GET_INT_FROM_POINTER(rz); } /* tricky stuff here; we use ints which can overflow easily with bias values */ @@ -1267,7 +1267,7 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i else { /* same as before */ /* still working code! (ton) */ - zsamp= GET_INT_FROM_POINTER(rz); + zsamp= GET_INT_FROM_POINTER(rz); } /* NO schadow when sampled at 'eternal' distance */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 03b0d637de1..4342c9f4bff 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -457,14 +457,14 @@ void WM_event_print(wmEvent *event) RNA_enum_identifier(event_value_items, event->val, &val_id); printf("wmEvent - type:%d/%s, val:%d/%s, " - "shift:%d, ctrl:%d, alt:%d, oskey:%d, keymodifier:%d, " - "mouse:(%d,%d), ascii:'%c', utf8:'%.*s', " - "keymap_idname:%s, pointer:%p\n", - event->type, type_id, event->val, val_id, - event->shift, event->ctrl, event->alt, event->oskey, event->keymodifier, - event->x, event->y, event->ascii, + "shift:%d, ctrl:%d, alt:%d, oskey:%d, keymodifier:%d, " + "mouse:(%d,%d), ascii:'%c', utf8:'%.*s', " + "keymap_idname:%s, pointer:%p\n", + event->type, type_id, event->val, val_id, + event->shift, event->ctrl, event->alt, event->oskey, event->keymodifier, + event->x, event->y, event->ascii, BLI_str_utf8_size(event->utf8_buf), event->utf8_buf, - event->keymap_idname, (void *)event); + event->keymap_idname, (void *)event); } else { printf("wmEvent - NULL\n"); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f12dec6459a..4367a8b03ef 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3062,8 +3062,8 @@ static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op, if(*r_prop && (len = RNA_property_array_length(r_ptr, *r_prop)) != req_length) { MEM_freeN(str); BKE_reportf(op->reports, RPT_ERROR, - "Property from path %s has length %d instead of %d", - name, len, req_length); + "Property from path %s has length %d instead of %d", + name, len, req_length); return 0; } -- cgit v1.2.3 From e070823378dfb7e35a73a9fb5e76d9073ec82e25 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 11 Nov 2011 16:01:13 +0000 Subject: Fix #29207: cancelling volume precache at high resolution was too slow, added more test_break calls. --- .../blender/render/intern/source/volume_precache.c | 35 ++++++++++++++++------ 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'source/blender') diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index 29eea081672..8b3c3ec5c3d 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -285,7 +285,7 @@ static inline int lc_to_ms_I(int x, int y, int z, int *n) /* *** multiple scattering approximation *** */ /* get the total amount of light energy in the light cache. used to normalise after multiple scattering */ -static float total_ss_energy(VolumePrecache *vp) +static float total_ss_energy(Render *re, int do_test_break, VolumePrecache *vp) { int x, y, z; int *res = vp->res; @@ -301,12 +301,14 @@ static float total_ss_energy(VolumePrecache *vp) if (vp->data_b[i] > 0.f) energy += vp->data_b[i]; } } + + if (do_test_break && re->test_break(re->tbh)) break; } return energy; } -static float total_ms_energy(float *sr, float *sg, float *sb, int *res) +static float total_ms_energy(Render *re, int do_test_break, float *sr, float *sg, float *sb, int *res) { int x, y, z; float energy=0.f; @@ -321,16 +323,19 @@ static float total_ms_energy(float *sr, float *sg, float *sb, int *res) if (sb[i] > 0.f) energy += sb[i]; } } + + if (do_test_break && re->test_break(re->tbh)) break; } return energy; } -static void ms_diffuse(float *x0, float *x, float diff, int *n) //n is the unpadded resolution +static void ms_diffuse(Render *re, int do_test_break, float *x0, float *x, float diff, int *n) //n is the unpadded resolution { int i, j, k, l; const float dt = VOL_MS_TIMESTEP; - const float a = dt*diff*n[0]*n[1]*n[2]; + size_t size = n[0]*n[1]*n[2]; + const float a = dt*diff*size; for (l=0; l<20; l++) { @@ -345,7 +350,11 @@ static void ms_diffuse(float *x0, float *x, float diff, int *n) //n is the unpad ) / (1+6*a); } } + + if (do_test_break && re->test_break(re->tbh)) break; } + + if (re->test_break(re->tbh)) break; } } @@ -359,6 +368,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi int x, y, z, m; int *n = vp->res; const int size = (n[0]+2)*(n[1]+2)*(n[2]+2); + const int do_test_break = (size > 100000); double time, lasttime= PIL_check_seconds_timer(); float total; float c=1.0f; @@ -374,7 +384,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi total = (float)(n[0]*n[1]*n[2]*simframes); - energy_ss = total_ss_energy(vp); + energy_ss = total_ss_energy(re, do_test_break, vp); /* Scattering as diffusion pass */ for (m=0; mtest_break(re->tbh)) break; } + + if (re->test_break(re->tbh)) break; + SWAP(float *,sr,sr0); SWAP(float *,sg,sg0); SWAP(float *,sb,sb0); /* main diffusion simulation */ - ms_diffuse(sr0, sr, diff, n); - ms_diffuse(sg0, sg, diff, n); - ms_diffuse(sb0, sb, diff, n); + ms_diffuse(re, do_test_break, sr0, sr, diff, n); + ms_diffuse(re, do_test_break, sg0, sg, diff, n); + ms_diffuse(re, do_test_break, sb0, sb, diff, n); if (re->test_break(re->tbh)) break; } /* normalisation factor to conserve energy */ - energy_ms = total_ms_energy(sr, sg, sb, n); + energy_ms = total_ms_energy(re, do_test_break, sr, sg, sb, n); fac *= (energy_ss / energy_ms); /* blend multiple scattering back in the light cache */ @@ -449,6 +464,8 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi vp->data_b[i] = origf * vp->data_b[i] + fac * sb[j]; } } + + if (do_test_break && re->test_break(re->tbh)) break; } MEM_freeN(sr0); -- 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 +++++++- source/blender/editors/armature/poseobject.c | 4 ++-- source/blender/editors/object/object_edit.c | 4 ++-- source/blender/makesrna/intern/rna_animviz.c | 5 +++-- 5 files changed, 16 insertions(+), 8 deletions(-) (limited to 'source/blender') 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; } diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index e89674e8a37..993c8420576 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -199,7 +199,7 @@ void ED_pose_recalculate_paths(Scene *scene, Object *ob) /* For the object with pose/action: create path curves for selected bones * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range */ -static int pose_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op)) +static int pose_calculate_paths_exec (bContext *C, wmOperator *op) { ScrArea *sa= CTX_wm_area(C); Scene *scene= CTX_data_scene(C); @@ -218,7 +218,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op)) CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) { /* verify makes sure that the selected bone has a bone with the appropriate settings */ - animviz_verify_motionpaths(scene, ob, pchan); + animviz_verify_motionpaths(op->reports, scene, ob, pchan); } CTX_DATA_END; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 88182a31056..c39477cbf6c 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1461,7 +1461,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) /* For the object with pose/action: create path curves for selected bones * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range */ -static int object_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op)) +static int object_calculate_paths_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); @@ -1469,7 +1469,7 @@ static int object_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op)) CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { /* verify makes sure that the selected bone has a bone with the appropriate settings */ - animviz_verify_motionpaths(scene, ob, NULL); + animviz_verify_motionpaths(op->reports, scene, ob, NULL); } CTX_DATA_END; diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c index e65b137e846..29133db8101 100644 --- a/source/blender/makesrna/intern/rna_animviz.c +++ b/source/blender/makesrna/intern/rna_animviz.c @@ -71,7 +71,7 @@ static void rna_AnimViz_path_start_frame_set(PointerRNA *ptr, int value) { bAnimVizSettings *data= (bAnimVizSettings*)ptr->data; - CLAMP(value, 1, data->path_ef); + CLAMP(value, 1, data->path_ef-1); data->path_sf= value; } @@ -79,7 +79,8 @@ static void rna_AnimViz_path_end_frame_set(PointerRNA *ptr, int value) { bAnimVizSettings *data= (bAnimVizSettings*)ptr->data; - CLAMP(value, data->path_sf, (int)(MAXFRAMEF/2)); + // XXX: watchit! Path Start > MAXFRAME/2 could be a problem... + CLAMP(value, data->path_sf+1, (int)(MAXFRAMEF/2)); data->path_ef= value; } -- cgit v1.2.3 From e2c06d5fc91f4f1125cf79280cb585400f6e056c Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 12 Nov 2011 05:00:24 +0000 Subject: Bugfix [#29212] Select before/after current frame deselects all channels in graph editor No need to deselect all channels when doing the select left/right operator, since we don't replace the selection afterwards with anything useful. This would be a problem when the "Only Show Selected" option is enabled (as it is by default), as this results in the curves being worked on disappearing from view. F-Curves though will still get deselected as a result of the code to deselect keyframes. Will need to review whether this is still a good idea (original intention was so that only curves with keyframes selected would remain selected). --- source/blender/editors/space_action/action_select.c | 7 +++---- source/blender/editors/space_graph/graph_select.c | 5 +++-- source/blender/editors/space_nla/nla_select.c | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index dc81fb1e8bc..f717b827a7e 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -728,8 +728,9 @@ static void actkeys_select_leftright (bAnimContext *ac, short leftright, short s if (select_mode==SELECT_REPLACE) { select_mode= SELECT_ADD; - /* deselect all other channels and keyframes */ - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + /* - deselect all other keyframes, so that just the newly selected remain + * - channels aren't deselected, since we don't re-select any as a consequence + */ deselect_action_keys(ac, 0, SELECT_SUBTRACT); } @@ -918,8 +919,6 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se KeyframeEditFunc select_cb, ok_cb; KeyframeEditData ked= {{NULL}}; - /* initialise keyframe editing data */ - /* set up BezTriple edit callbacks */ select_cb= ANIM_editkeyframes_select(select_mode); ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAME); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index e74c7d50adc..6506933df54 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -732,8 +732,9 @@ static void graphkeys_select_leftright (bAnimContext *ac, short leftright, short if (select_mode==SELECT_REPLACE) { select_mode= SELECT_ADD; - /* deselect all other channels and keyframes */ - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + /* - deselect all other keyframes, so that just the newly selected remain + * - channels aren't deselected, since we don't re-select any as a consequence + */ deselect_graph_keys(ac, 0, SELECT_SUBTRACT); } diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 05d38a63109..49340b31b47 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -376,8 +376,9 @@ static void nlaedit_select_leftright (bContext *C, bAnimContext *ac, short leftr if (select_mode==SELECT_REPLACE) { select_mode= SELECT_ADD; - /* deselect all other channels and keyframes */ - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + /* - deselect all other keyframes, so that just the newly selected remain + * - channels aren't deselected, since we don't re-select any as a consequence + */ deselect_nla_strips(ac, 0, SELECT_SUBTRACT); } -- cgit v1.2.3 From 817b6cb9a8990483a2bfce7a11e690c829e75ddc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 12 Nov 2011 10:06:56 +0000 Subject: mathutils.geometry.distance_point_to_plane(pt, plane_co, plane_no) - utility function, BLI math version too. --- source/blender/blenlib/BLI_math_geom.h | 1 + source/blender/blenlib/intern/math_geom.c | 12 ++++++ .../blender/python/mathutils/mathutils_geometry.c | 43 ++++++++++++++++++++-- 3 files changed, 53 insertions(+), 3 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 8a42414ea9f..99687ae8bb4 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -60,6 +60,7 @@ float dist_to_line_v2(const float p[2], const float l1[2], const float l2[2]); float dist_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]); void closest_to_line_segment_v2(float closest[2], const float p[2], const float l1[2], const float l2[2]); +float dist_to_plane_v3(const float p[2], const float plane_co[3], const float plane_no[2]); float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v2(float r[2], const float p[2], const float l1[2], const float l2[2]); diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 99ead8e9d6a..a135cb43882 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -237,6 +237,18 @@ void closest_to_line_segment_v3(float closest[3], const float v1[3], const float copy_v3_v3(closest, cp); } +/* signed distance from the point to the plane in 3D */ +float dist_to_plane_v3(const float p[2], const float plane_co[3], const float plane_no[2]) +{ + float plane_no_unit[3]; + float plane_co_other[3]; + + normalize_v3_v3(plane_no_unit, plane_no); + add_v3_v3v3(plane_co_other, plane_co, plane_no_unit); + + return -line_point_factor_v3(p, plane_co, plane_co_other); +} + /* distance v1 to line-piece v2-v3 in 3D */ float dist_to_line_segment_v3(const float v1[3], const float v2[3], const float v3[3]) { diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 3518c8008c6..a0a6ba277cf 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -420,7 +420,7 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec return NULL; } - if ( BaseMath_ReadCallback(line_a) == -1 || + if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || BaseMath_ReadCallback(plane_co) == -1 || BaseMath_ReadCallback(plane_no) == -1 @@ -559,7 +559,7 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO return NULL; } - if ( BaseMath_ReadCallback(line_a) == -1 || + if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || BaseMath_ReadCallback(sphere_co) == -1 ) { @@ -686,7 +686,7 @@ PyDoc_STRVAR(M_Geometry_intersect_point_quad_2d_doc, " Takes 5 vectors (using only the x and y coordinates): one is the point and the next 4 define the quad, only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n" "\n" " :arg pt: Point\n" -" :type v1: :class:`mathutils.Vector`\n" +" :type pt: :class:`mathutils.Vector`\n" " :arg quad_p1: First point of the quad\n" " :type quad_p1: :class:`mathutils.Vector`\n" " :arg quad_p2: Second point of the quad\n" @@ -717,6 +717,42 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb return PyLong_FromLong(isect_point_quad_v2(pt_vec->vec, quad_p1->vec, quad_p2->vec, quad_p3->vec, quad_p4->vec)); } +PyDoc_STRVAR(M_Geometry_distance_point_to_plane_doc, +".. function:: distance_point_to_plane(pt, plane_co, plane_no)\n" +"\n" +" Returns the signed distance between a point and a plane " +" (negative when below the normal).\n" +"\n" +" :arg pt: Point\n" +" :type pt: :class:`mathutils.Vector`\n" +" :arg plane_co: First point of the quad\n" +" :type plane_co: :class:`mathutils.Vector`\n" +" :arg plane_no: Second point of the quad\n" +" :type plane_no: :class:`mathutils.Vector`\n" +" :rtype: float\n" +); +static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyObject* args) +{ + VectorObject *pt, *plene_co, *plane_no; + + if (!PyArg_ParseTuple(args, "O!O!O!:distance_point_to_plane", + &vector_Type, &pt, + &vector_Type, &plene_co, + &vector_Type, &plane_no) + ) { + return NULL; + } + + if ( BaseMath_ReadCallback(pt) == -1 || + BaseMath_ReadCallback(plene_co) == -1 || + BaseMath_ReadCallback(plane_no) == -1) + { + return NULL; + } + + return PyFloat_FromDouble(dist_to_plane_v3(pt->vec, plene_co->vec, plane_no->vec)); +} + PyDoc_STRVAR(M_Geometry_barycentric_transform_doc, ".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n" "\n" @@ -1103,6 +1139,7 @@ static PyMethodDef M_Geometry_methods[]= { {"intersect_line_plane", (PyCFunction) M_Geometry_intersect_line_plane, METH_VARARGS, M_Geometry_intersect_line_plane_doc}, {"intersect_line_sphere", (PyCFunction) M_Geometry_intersect_line_sphere, METH_VARARGS, M_Geometry_intersect_line_sphere_doc}, {"intersect_line_sphere_2d", (PyCFunction) M_Geometry_intersect_line_sphere_2d, METH_VARARGS, M_Geometry_intersect_line_sphere_2d_doc}, + {"distance_point_to_plane", (PyCFunction) M_Geometry_distance_point_to_plane, METH_VARARGS, M_Geometry_distance_point_to_plane_doc}, {"area_tri", (PyCFunction) M_Geometry_area_tri, METH_VARARGS, M_Geometry_area_tri_doc}, {"normal", (PyCFunction) M_Geometry_normal, METH_VARARGS, M_Geometry_normal_doc}, {"barycentric_transform", (PyCFunction) M_Geometry_barycentric_transform, METH_VARARGS, M_Geometry_barycentric_transform_doc}, -- cgit v1.2.3 From 72a7101576dc54f6608fda8a0def19db20d10f44 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 09:20:04 +0000 Subject: include invalid type name in mathutils error messages. --- source/blender/python/mathutils/mathutils_Color.c | 42 ++++++++++++---------- source/blender/python/mathutils/mathutils_Matrix.c | 15 ++++---- .../python/mathutils/mathutils_Quaternion.c | 14 ++++---- source/blender/python/mathutils/mathutils_Vector.c | 35 ++++++++++-------- 4 files changed, 61 insertions(+), 45 deletions(-) (limited to 'source/blender') diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index c374d0eb73d..3e7aeef3044 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -370,9 +370,10 @@ static PyObject *Color_add(PyObject *v1, PyObject *v2) float col[COLOR_SIZE]; if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { - PyErr_SetString(PyExc_TypeError, - "Color addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Color addition: (%s + %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } color1 = (ColorObject*)v1; @@ -392,9 +393,10 @@ static PyObject *Color_iadd(PyObject *v1, PyObject *v2) ColorObject *color1 = NULL, *color2 = NULL; if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { - PyErr_SetString(PyExc_TypeError, - "Color addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Color addition: (%s += %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } color1 = (ColorObject*)v1; @@ -417,9 +419,10 @@ static PyObject *Color_sub(PyObject *v1, PyObject *v2) float col[COLOR_SIZE]; if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { - PyErr_SetString(PyExc_TypeError, - "Color subtraction: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Color subtraction: (%s - %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } color1 = (ColorObject*)v1; @@ -439,9 +442,10 @@ static PyObject *Color_isub(PyObject *v1, PyObject *v2) ColorObject *color1= NULL, *color2= NULL; if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { - PyErr_SetString(PyExc_TypeError, - "Color subtraction: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Color subtraction: (%s -= %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } color1 = (ColorObject*)v1; @@ -554,9 +558,10 @@ static PyObject *Color_imul(PyObject *v1, PyObject *v2) mul_vn_fl(color->col, COLOR_SIZE, scalar); } else { - PyErr_SetString(PyExc_TypeError, - "Color multiplication: " - "arguments not acceptable for this operation"); + PyErr_Format(PyExc_TypeError, + "Color multiplication: (%s *= %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } @@ -585,9 +590,10 @@ static PyObject *Color_idiv(PyObject *v1, PyObject *v2) mul_vn_fl(color->col, COLOR_SIZE, 1.0f / scalar); } else { - PyErr_SetString(PyExc_TypeError, - "Color multiplication: " - "arguments not acceptable for this operation"); + PyErr_Format(PyExc_TypeError, + "Color division: (%s /= %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 980dbd17a96..293a960e0a6 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1489,9 +1489,10 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2) mat2 = (MatrixObject*)m2; if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) { - PyErr_SetString(PyExc_TypeError, - "Matrix addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Matrix addition: (%s + %s) " + "invalid type for this operation", + Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name); return NULL; } @@ -1520,9 +1521,11 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2) mat2 = (MatrixObject*)m2; if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) { - PyErr_SetString(PyExc_TypeError, - "Matrix addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Matrix subtraction: (%s - %s) " + "invalid type for this operation", + Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name + ); return NULL; } diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 51ab5b50919..a8585f386d5 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -707,9 +707,10 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2) QuaternionObject *quat1 = NULL, *quat2 = NULL; if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) { - PyErr_SetString(PyExc_TypeError, - "Quaternion addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Quaternion addition: (%s + %s) " + "invalid type for this operation", + Py_TYPE(q1)->tp_name, Py_TYPE(q2)->tp_name); return NULL; } quat1 = (QuaternionObject*)q1; @@ -730,9 +731,10 @@ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2) QuaternionObject *quat1 = NULL, *quat2 = NULL; if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) { - PyErr_SetString(PyExc_TypeError, - "Quaternion addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Quaternion subtraction: (%s - %s) " + "invalid type for this operation", + Py_TYPE(q1)->tp_name, Py_TYPE(q2)->tp_name); return NULL; } diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index ba7cf604c42..66dda6a9623 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -953,9 +953,10 @@ static PyObject *Vector_add(PyObject *v1, PyObject *v2) float vec[MAX_DIMENSIONS]; if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) { - PyErr_SetString(PyExc_AttributeError, - "Vector addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_AttributeError, + "Vector addition: (%s + %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } vec1 = (VectorObject*)v1; @@ -983,9 +984,10 @@ static PyObject *Vector_iadd(PyObject *v1, PyObject *v2) VectorObject *vec1 = NULL, *vec2 = NULL; if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) { - PyErr_SetString(PyExc_AttributeError, - "Vector addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_AttributeError, + "Vector addition: (%s += %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } vec1 = (VectorObject*)v1; @@ -1015,9 +1017,10 @@ static PyObject *Vector_sub(PyObject *v1, PyObject *v2) float vec[MAX_DIMENSIONS]; if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) { - PyErr_SetString(PyExc_AttributeError, - "Vector subtraction: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_AttributeError, + "Vector subtraction: (%s - %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } vec1 = (VectorObject*)v1; @@ -1044,9 +1047,10 @@ static PyObject *Vector_isub(PyObject *v1, PyObject *v2) VectorObject *vec1= NULL, *vec2= NULL; if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) { - PyErr_SetString(PyExc_AttributeError, - "Vector subtraction: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_AttributeError, + "Vector subtraction: (%s -= %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } vec1 = (VectorObject*)v1; @@ -1281,9 +1285,10 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) mul_vn_fl(vec->vec, vec->size, scalar); } else { - PyErr_SetString(PyExc_TypeError, - "Vector multiplication: " - "arguments not acceptable for this operation"); + PyErr_Format(PyExc_TypeError, + "Vector multiplication: (%s *= %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } -- cgit v1.2.3 From 963e39e417c654602bde7c0e8e8ff522478a1ac3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 09:38:53 +0000 Subject: formatting edits only - no functional changes --- .../blender/python/mathutils/mathutils_geometry.c | 232 ++++++++++++++------- 1 file changed, 154 insertions(+), 78 deletions(-) (limited to 'source/blender') diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index a0a6ba277cf..c2487db707c 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -85,7 +85,14 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject* float det, inv_det, u, v, t; int clip= 1; - if (!PyArg_ParseTuple(args, "O!O!O!O!O!|i:intersect_ray_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &ray, &vector_Type, &ray_off , &clip)) { + if (!PyArg_ParseTuple(args, + "O!O!O!O!O!|i:intersect_ray_tri", + &vector_Type, &vec1, + &vector_Type, &vec2, + &vector_Type, &vec3, + &vector_Type, &ray, + &vector_Type, &ray_off, &clip)) + { return NULL; } if (vec1->size != 3 || vec2->size != 3 || vec3->size != 3 || ray->size != 3 || ray_off->size != 3) { @@ -94,8 +101,14 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject* return NULL; } - if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(ray) == -1 || BaseMath_ReadCallback(ray_off) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1 || + BaseMath_ReadCallback(ray) == -1 || + BaseMath_ReadCallback(ray_off) == -1) + { return NULL; + } copy_v3_v3(v1, vec1->vec); copy_v3_v3(v2, vec2->vec); @@ -173,17 +186,28 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject VectorObject *vec1, *vec2, *vec3, *vec4; float v1[3], v2[3], v3[3], v4[3], i1[3], i2[3]; - if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) { + if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line", + &vector_Type, &vec1, + &vector_Type, &vec2, + &vector_Type, &vec3, + &vector_Type, &vec4)) + { return NULL; } + if (vec1->size != vec2->size || vec1->size != vec3->size || vec3->size != vec2->size) { PyErr_SetString(PyExc_ValueError, "vectors must be of the same size"); return NULL; } - if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(vec4) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1 || + BaseMath_ReadCallback(vec4) == -1) + { return NULL; + } if (vec1->size == 3 || vec1->size == 2) { int result; @@ -257,9 +281,14 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args) float n[3]; if (PyTuple_GET_SIZE(args) == 3) { - if (!PyArg_ParseTuple(args, "O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) { + if (!PyArg_ParseTuple(args, "O!O!O!:normal", + &vector_Type, &vec1, + &vector_Type, &vec2, + &vector_Type, &vec3)) + { return NULL; } + if (vec1->size != vec2->size || vec1->size != vec3->size) { PyErr_SetString(PyExc_ValueError, "vectors must be of the same size"); @@ -271,13 +300,22 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args) return NULL; } - if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1) + { return NULL; + } normal_tri_v3(n, vec1->vec, vec2->vec, vec3->vec); } else { - if (!PyArg_ParseTuple(args, "O!O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) { + if (!PyArg_ParseTuple(args, "O!O!O!O!:normal", + &vector_Type, &vec1, + &vector_Type, &vec2, + &vector_Type, &vec3, + &vector_Type, &vec4)) + { return NULL; } if (vec1->size != vec2->size || vec1->size != vec3->size || vec1->size != vec4->size) { @@ -291,8 +329,13 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args) return NULL; } - if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(vec4) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1 || + BaseMath_ReadCallback(vec4) == -1) + { return NULL; + } normal_quad_v3(n, vec1->vec, vec2->vec, vec3->vec, vec4->vec); } @@ -319,7 +362,11 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1, *vec2, *vec3; - if (!PyArg_ParseTuple(args, "O!O!O!:area_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) { + if (!PyArg_ParseTuple(args, "O!O!O!:area_tri", + &vector_Type, &vec1, + &vector_Type, &vec2, + &vector_Type, &vec3)) + { return NULL; } @@ -329,8 +376,12 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args) return NULL; } - if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1) + { return NULL; + } if (vec1->size == 3) { return PyFloat_FromDouble(area_tri_v3(vec1->vec, vec2->vec, vec3->vec)); @@ -367,16 +418,21 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj VectorObject *line_a1, *line_a2, *line_b1, *line_b2; float vi[2]; if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line_2d", - &vector_Type, &line_a1, - &vector_Type, &line_a2, - &vector_Type, &line_b1, - &vector_Type, &line_b2) - ) { + &vector_Type, &line_a1, + &vector_Type, &line_a2, + &vector_Type, &line_b1, + &vector_Type, &line_b2)) + { return NULL; } - if (BaseMath_ReadCallback(line_a1) == -1 || BaseMath_ReadCallback(line_a2) == -1 || BaseMath_ReadCallback(line_b1) == -1 || BaseMath_ReadCallback(line_b2) == -1) + if ( BaseMath_ReadCallback(line_a1) == -1 || + BaseMath_ReadCallback(line_a2) == -1 || + BaseMath_ReadCallback(line_b1) == -1 || + BaseMath_ReadCallback(line_b2) == -1) + { return NULL; + } if (isect_seg_seg_v2_point(line_a1->vec, line_a2->vec, line_b1->vec, line_b2->vec, vi) == 1) { return newVectorObject(vi, 2, Py_NEW, NULL); @@ -411,20 +467,20 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec int no_flip= 0; float isect[3]; if (!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_line_plane", - &vector_Type, &line_a, - &vector_Type, &line_b, - &vector_Type, &plane_co, - &vector_Type, &plane_no, - &no_flip) - ) { + &vector_Type, &line_a, + &vector_Type, &line_b, + &vector_Type, &plane_co, + &vector_Type, &plane_no, + &no_flip)) + { return NULL; } if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || BaseMath_ReadCallback(plane_co) == -1 || - BaseMath_ReadCallback(plane_no) == -1 - ) { + BaseMath_ReadCallback(plane_no) == -1) + { return NULL; } @@ -471,18 +527,18 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje float isect_b[3]; if (!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere", - &vector_Type, &line_a, - &vector_Type, &line_b, - &vector_Type, &sphere_co, - &sphere_radius, &clip) - ) { + &vector_Type, &line_a, + &vector_Type, &line_b, + &vector_Type, &sphere_co, + &sphere_radius, &clip)) + { return NULL; } - if ( BaseMath_ReadCallback(line_a) == -1 || + if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || - BaseMath_ReadCallback(sphere_co) == -1 - ) { + BaseMath_ReadCallback(sphere_co) == -1) + { return NULL; } @@ -551,18 +607,18 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO float isect_b[3]; if (!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere_2d", - &vector_Type, &line_a, - &vector_Type, &line_b, - &vector_Type, &sphere_co, - &sphere_radius, &clip) - ) { + &vector_Type, &line_a, + &vector_Type, &line_b, + &vector_Type, &sphere_co, + &sphere_radius, &clip)) + { return NULL; } if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || - BaseMath_ReadCallback(sphere_co) == -1 - ) { + BaseMath_ReadCallback(sphere_co) == -1) + { return NULL; } else { @@ -617,16 +673,20 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec PyObject *ret; if (!PyArg_ParseTuple(args, "O!O!O!:intersect_point_line", - &vector_Type, &pt, - &vector_Type, &line_1, - &vector_Type, &line_2) - ) { + &vector_Type, &pt, + &vector_Type, &line_1, + &vector_Type, &line_2)) + { return NULL; } - - if (BaseMath_ReadCallback(pt) == -1 || BaseMath_ReadCallback(line_1) == -1 || BaseMath_ReadCallback(line_2) == -1) + + if ( BaseMath_ReadCallback(pt) == -1 || + BaseMath_ReadCallback(line_1) == -1 || + BaseMath_ReadCallback(line_2) == -1) + { return NULL; - + } + /* accept 2d verts */ if (pt->size==3) { copy_v3_v3(pt_in, pt->vec);} else { pt_in[2]=0.0; copy_v2_v2(pt_in, pt->vec); } @@ -666,17 +726,22 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3; if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_point_tri_2d", - &vector_Type, &pt_vec, - &vector_Type, &tri_p1, - &vector_Type, &tri_p2, - &vector_Type, &tri_p3) - ) { + &vector_Type, &pt_vec, + &vector_Type, &tri_p1, + &vector_Type, &tri_p2, + &vector_Type, &tri_p3)) + { return NULL; } - if (BaseMath_ReadCallback(pt_vec) == -1 || BaseMath_ReadCallback(tri_p1) == -1 || BaseMath_ReadCallback(tri_p2) == -1 || BaseMath_ReadCallback(tri_p3) == -1) + if ( BaseMath_ReadCallback(pt_vec) == -1 || + BaseMath_ReadCallback(tri_p1) == -1 || + BaseMath_ReadCallback(tri_p2) == -1 || + BaseMath_ReadCallback(tri_p3) == -1) + { return NULL; - + } + return PyLong_FromLong(isect_point_tri_v2(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec)); } @@ -702,18 +767,24 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4; if (!PyArg_ParseTuple(args, "O!O!O!O!O!:intersect_point_quad_2d", - &vector_Type, &pt_vec, - &vector_Type, &quad_p1, - &vector_Type, &quad_p2, - &vector_Type, &quad_p3, - &vector_Type, &quad_p4) - ) { + &vector_Type, &pt_vec, + &vector_Type, &quad_p1, + &vector_Type, &quad_p2, + &vector_Type, &quad_p3, + &vector_Type, &quad_p4)) + { return NULL; } - - if (BaseMath_ReadCallback(pt_vec) == -1 || BaseMath_ReadCallback(quad_p1) == -1 || BaseMath_ReadCallback(quad_p2) == -1 || BaseMath_ReadCallback(quad_p3) == -1 || BaseMath_ReadCallback(quad_p4) == -1) + + if ( BaseMath_ReadCallback(pt_vec) == -1 || + BaseMath_ReadCallback(quad_p1) == -1 || + BaseMath_ReadCallback(quad_p2) == -1 || + BaseMath_ReadCallback(quad_p3) == -1 || + BaseMath_ReadCallback(quad_p4) == -1) + { return NULL; - + } + return PyLong_FromLong(isect_point_quad_v2(pt_vec->vec, quad_p1->vec, quad_p2->vec, quad_p3->vec, quad_p4->vec)); } @@ -738,8 +809,8 @@ static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyOb if (!PyArg_ParseTuple(args, "O!O!O!:distance_point_to_plane", &vector_Type, &pt, &vector_Type, &plene_co, - &vector_Type, &plane_no) - ) { + &vector_Type, &plane_no)) + { return NULL; } @@ -783,14 +854,14 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje float vec[3]; if (!PyArg_ParseTuple(args, "O!O!O!O!O!O!O!:barycentric_transform", - &vector_Type, &vec_pt, - &vector_Type, &vec_t1_src, - &vector_Type, &vec_t2_src, - &vector_Type, &vec_t3_src, - &vector_Type, &vec_t1_tar, - &vector_Type, &vec_t2_tar, - &vector_Type, &vec_t3_tar) - ) { + &vector_Type, &vec_pt, + &vector_Type, &vec_t1_src, + &vector_Type, &vec_t2_src, + &vector_Type, &vec_t3_src, + &vector_Type, &vec_t1_tar, + &vector_Type, &vec_t2_tar, + &vector_Type, &vec_t3_tar)) + { return NULL; } @@ -850,11 +921,11 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* if (!PyArg_ParseTuple(args, "O!O!O!O!i:interpolate_bezier", - &vector_Type, &vec_k1, - &vector_Type, &vec_h1, - &vector_Type, &vec_h2, - &vector_Type, &vec_k2, &resolu) - ) { + &vector_Type, &vec_k1, + &vector_Type, &vec_h1, + &vector_Type, &vec_h2, + &vector_Type, &vec_k2, &resolu)) + { return NULL; } @@ -864,8 +935,13 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* return NULL; } - if (BaseMath_ReadCallback(vec_k1) == -1 || BaseMath_ReadCallback(vec_h1) == -1 || BaseMath_ReadCallback(vec_k2) == -1 || BaseMath_ReadCallback(vec_h2) == -1) + if ( BaseMath_ReadCallback(vec_k1) == -1 || + BaseMath_ReadCallback(vec_h1) == -1 || + BaseMath_ReadCallback(vec_k2) == -1 || + BaseMath_ReadCallback(vec_h2) == -1) + { return NULL; + } dims= MAX4(vec_k1->size, vec_h1->size, vec_h2->size, vec_k2->size); -- cgit v1.2.3 From 11a1c1ec19f50f2b53e65f43b634c6dd7ea73093 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 13 Nov 2011 10:09:34 +0000 Subject: Fix crash when multires-baking in sculpt mode when sculpt mode is active and sculpt level is set to 0. --- source/blender/editors/object/object_bake.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender') diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 5487cbdadb2..03e169e7007 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -1001,6 +1001,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l *simple= mmd->simple; tmp_mmd.lvl= mmd->totlvl; + tmp_mmd.sculptlvl= mmd->totlvl; dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0, 0); cddm->release(cddm); -- cgit v1.2.3 From 05d09feeee3cfc70957c079610c8fcbb12a5b711 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 13 Nov 2011 10:48:46 +0000 Subject: Speedup of multires baker Issue was caused by how CCGDM handles ORIGINDEX cystom layer: It runs cycle through all faces to fill origindex array on each call of dm->getFaceDataArray(dm, CD_ORIGINDEX) Solved issue by obtaining origindex array once on baker data initialization and using this stored array when interpolating multires grid data. --- source/blender/editors/object/object_bake.c | 41 ++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 03e169e7007..2d5f0b5ff2b 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -153,8 +153,13 @@ typedef struct { float height_min, height_max; Image *ima; DerivedMesh *ssdm; + const int *origindex; } MHeightBakeData; +typedef struct { + const int *origindex; +} MNormalBakeData; + static void multiresbake_get_normal(const MResolvePixelData *data, float norm[], const int face_num, const int vert_index) { unsigned int indices[]= {data->mface[face_num].v1, data->mface[face_num].v2, @@ -501,7 +506,7 @@ static void interp_bilinear_grid(DMGridData *grid, int grid_size, float crn_x, f interp_bilinear_quad_data(data, u, v, res); } -static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int lvl, const int face_index, const float u, const float v, float co[3], float n[3]) +static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *origindex, const int lvl, const int face_index, const float u, const float v, float co[3], float n[3]) { MFace mface; DMGridData **grid_data; @@ -521,9 +526,8 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int lvl, g_index= grid_offset[face_index]; S= mdisp_rot_face_to_crn(mface.v4 ? 4 : 3, face_side, u*(face_side-1), v*(face_side-1), &crn_x, &crn_y); } else { - const int *index= lodm->getFaceDataArray(lodm, CD_ORIGINDEX); int side= (1 << (lvl-1)) + 1; - int grid_index= index[face_index]; + int grid_index= origindex[face_index]; int loc_offs= face_index % (1<<(2*lvl)); int cell_index= loc_offs % ((side-1)*(side-1)); int cell_side= grid_size / (side-1); @@ -587,10 +591,11 @@ static void interp_barycentric_mface(DerivedMesh *dm, MFace *mface, const float interp_barycentric_tri_data(data, u, v, res); } -static void *init_heights_data(MultiresBakeRender *bkr, Image* ima) +static void *init_heights_data(MultiresBakeRender *bkr, Image *ima) { MHeightBakeData *height_data; ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + DerivedMesh *lodm= bkr->lores_dm; height_data= MEM_callocN(sizeof(MHeightBakeData), "MultiresBake heightData"); @@ -614,9 +619,23 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image* ima) height_data->ssdm= subsurf_make_derived_from_derived(bkr->lores_dm, &smd, 0, NULL, 0, 0, 0); } + height_data->origindex= lodm->getFaceDataArray(lodm, CD_ORIGINDEX); + return (void*)height_data; } +static void *init_normal_data(MultiresBakeRender *bkr, Image *UNUSED(ima)) +{ + MNormalBakeData *normal_data; + DerivedMesh *lodm= bkr->lores_dm; + + normal_data= MEM_callocN(sizeof(MNormalBakeData), "MultiresBake normalData"); + + normal_data->origindex= lodm->getFaceDataArray(lodm, CD_ORIGINDEX); + + return (void*)normal_data; +} + static void apply_heights_data(void *bake_data) { MHeightBakeData *height_data= (MHeightBakeData*)bake_data; @@ -698,13 +717,11 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, CLAMP(uv[0], 0.0f, 1.0f); CLAMP(uv[1], 0.0f, 1.0f); - get_ccgdm_data(lores_dm, hires_dm, lvl, face_index, uv[0], uv[1], p1, 0); + get_ccgdm_data(lores_dm, hires_dm, height_data->origindex, lvl, face_index, uv[0], uv[1], p1, 0); if(height_data->ssdm) { - //get_ccgdm_data_ss(lores_dm, height_data->ssdm, lvl, face_index, uv[0], uv[1], p0, n); - get_ccgdm_data(lores_dm, height_data->ssdm, 0, face_index, uv[0], uv[1], p0, n); + get_ccgdm_data(lores_dm, height_data->ssdm, height_data->origindex, 0, face_index, uv[0], uv[1], p0, n); } else { - MFace mface; lores_dm->getFace(lores_dm, face_index, &mface); if(mface.v4) { @@ -717,7 +734,6 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, } sub_v3_v3v3(vec, p1, p0); - //len= len_v3(vec); len= dot_v3v3(n, vec); height_data->heights[pixel]= len; @@ -740,7 +756,7 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, - find coord and normal of point with specified UV in hi-res mesh - multiply it by tangmat - vector in color space would be norm(vec) /2 + (0.5, 0.5, 0.5) */ -static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *UNUSED(bake_data), +static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *bake_data, const int face_index, const int lvl, const float st[2], float tangmat[3][3], const int x, const int y) { @@ -748,6 +764,7 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, MFace mface; Image *ima= mtface[face_index].tpage; ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + MNormalBakeData *normal_data= (MNormalBakeData*)bake_data; float uv[2], *st0, *st1, *st2, *st3; int pixel= ibuf->x*y + x; float n[3], vec[3], tmp[3]= {0.5, 0.5, 0.5}; @@ -767,7 +784,7 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, CLAMP(uv[0], 0.0f, 1.0f); CLAMP(uv[1], 0.0f, 1.0f); - get_ccgdm_data(lores_dm, hires_dm, lvl, face_index, uv[0], uv[1], NULL, n); + get_ccgdm_data(lores_dm, hires_dm, normal_data->origindex, lvl, face_index, uv[0], uv[1], NULL, n); mul_v3_m3v3(vec, tangmat, n); normalize_v3(vec); @@ -832,7 +849,7 @@ static void bake_images(MultiresBakeRender *bkr) switch(bkr->mode) { case RE_BAKE_NORMALS: - do_multires_bake(bkr, ima, apply_tangmat_callback, NULL, NULL, NULL); + do_multires_bake(bkr, ima, apply_tangmat_callback, init_normal_data, NULL, NULL); break; case RE_BAKE_DISPLACEMENT: do_multires_bake(bkr, ima, apply_heights_callback, init_heights_data, -- cgit v1.2.3