use c90 compatible static initializers.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 3 Nov 2010 06:31:53 +0000 (06:31 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 3 Nov 2010 06:31:53 +0000 (06:31 +0000)
17 files changed:
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/shrinkwrap.c
source/blender/blenkernel/intern/unit.c
source/blender/blenlib/intern/uvproject.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/pointdensity.c
source/blender/render/intern/source/volume_precache.c
source/blender/windowmanager/intern/wm_gesture.c
source/blender/windowmanager/intern/wm_operators.c

index d95b7010993d39dc28557b58a0c211c51bd7ffc6..21ef1c03e3a08b8b0243438ee15117400d2c0b54 100644 (file)
@@ -2350,8 +2350,10 @@ void DAG_id_flush_update(ID *id, short flag)
                /* set flags based on textures - can influence depgraph via modifiers */
                if(idtype == ID_TE) {
                        for(obt=bmain->object.first; obt; obt= obt->id.next) {
-                               struct { ID *id; int is_dependent; } data = {id, 0};
-                               
+                               struct { ID *id; int is_dependent; } data;
+                               data.id= id;
+                               data.is_dependent= 0;
+
                                modifiers_foreachIDLink(obt, dag_id_flush_update__isDependentTexture, &data);
                                if (data.is_dependent)
                                        obt->recalc |= OB_RECALC_DATA;
index 70e814ef9560ca0ea9703367825ee91ee47ac357..24a95c58e36d9fa3e9c63d1d301939772418e4b9 100644 (file)
@@ -628,7 +628,6 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
                }
        }
        else if(eff->psys) {
-               ParticleSimulationData sim = {eff->scene, eff->ob, eff->psys, NULL, NULL};
                ParticleData *pa = eff->psys->particles + *efd->index;
                ParticleKey state;
 
@@ -636,6 +635,11 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
                if(eff->psys == point->psys && *efd->index == point->index)
                        ;
                else {
+                       ParticleSimulationData sim= {0};
+                       sim.scene= eff->scene;
+                       sim.ob= eff->ob;
+                       sim.psys= eff->psys;
+
                        /* TODO: time from actual previous calculated frame (step might not be 1) */
                        state.time = cfra - 1.0;
                        ret = psys_get_particle_state(&sim, *efd->index, &state, 0);
index 58917e75a43188785311d843938a2f28df8cf920..0b27aaeb0ba843e39cb821e061392457a8f74cf6 100644 (file)
@@ -1193,8 +1193,12 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
                                ascii = mem[i];
                                info = &(custrinfo[i]);
                                if (cu->sepchar == (i+1)) {
-                                       float vecyo[3]= {ct->xof, ct->yof, 0.0f};
-                                       
+                                       float vecyo[3];
+
+                                       vecyo[0]= ct->xof;
+                                       vecyo[1]= ct->yof;
+                                       vecyo[2]= 0.0f;
+
                                        mem[0] = ascii;
                                        mem[1] = 0;
                                        custrinfo[0]= *info;
index 624587338c9934c3e7140267f313933dd930282c..65b898a2807ba169abc5cb4bea8ffd538d72f3e8 100644 (file)
@@ -3221,7 +3221,12 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
        edit->totcached = totpart;
 
        if(psys) {
-               ParticleSimulationData sim = {scene, ob, psys, psys_get_modifier(ob, psys), NULL};
+               ParticleSimulationData sim= {0};
+               sim.scene= scene;
+               sim.ob= ob;
+               sim.psys= psys;
+               sim.psmd= psys_get_modifier(ob, psys);
+
                psys_cache_child_paths(&sim, cfra, 1);
        }
 
index bd37abc266bcd1e666fac567daa26b4beb3b5c47..002e8c9de0fbb619378fb9f08ca964b2c6db0875 100644 (file)
@@ -199,13 +199,17 @@ static int ptcache_write_particle(int index, void *psys_v, void **data, int cfra
        ParticleSystem *psys= psys_v;
        ParticleData *pa = psys->particles + index;
        BoidParticle *boid = (psys->part->phystype == PART_PHYS_BOIDS) ? pa->boid : NULL;
-       float times[3] = {pa->time, pa->dietime, pa->lifetime};
+       float times[3];
        int step = psys->pointcache->step;
 
        /* No need to store unborn or died particles outside cache step bounds */
        if(data[BPHYS_DATA_INDEX] && (cfra < pa->time - step || cfra > pa->dietime + step))
                return 0;
-       
+
+       times[0]= pa->time;
+       times[1]= pa->dietime;
+       times[2]= pa->lifetime;
+
        PTCACHE_DATA_FROM(data, BPHYS_DATA_INDEX, &index);
        PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, pa->state.co);
        PTCACHE_DATA_FROM(data, BPHYS_DATA_VELOCITY, pa->state.vel);
index 4746341876fb2fba643be245ecf799c3ad6bce88..a6daaf36ff69151356c790a3be4487921ee18d4e 100644 (file)
@@ -391,8 +391,8 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, struct S
                        //Project over negative direction of axis
                        if(use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR)
                        {
-                               float inv_no[3] = { -tmp_no[0], -tmp_no[1], -tmp_no[2] };
-
+                               float inv_no[3];
+                               negate_v3_v3(inv_no, tmp_no);
 
                                if(auxData.tree)
                                        normal_projection_project_vertex(0, tmp_co, inv_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData);
index 83ace49eb67652bd2a6172209da4371a306e931a..1240b85393b6521d6997fb7c2d913429d38160df 100644 (file)
@@ -334,7 +334,8 @@ static int unit_as_string(char *str, int len_max, double value, int prec, bUnitC
 
        /* Convert to a string */
        {
-               char conv_str[6] = {'%', '.', '0'+prec, 'l', 'f', '\0'}; /* "%.2lf" when prec is 2, must be under 10 */
+               char conv_str[6] = {'%', '.', '0', 'l', 'f', '\0'}; /* "%.2lf" when prec is 2, must be under 10 */
+               conv_str[2] += prec;
                len= snprintf(str, len_max, conv_str, (float)value_conv);
 
                if(len >= len_max)
index cc115d52928281085dc675a58ac624083f76e84e..b08f05b4fc8dd496bf6c20674d5b7352a2540bd9 100644 (file)
@@ -60,7 +60,9 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci)
                        target[1]= pv4[1] / uci->camsize;
                }
                else {
-                       float vec2d[2]= {pv4[0], pv4[2]}; /* 2D position from the camera */
+                       float vec2d[2]; /* 2D position from the camera */
+                       vec2d[0]= pv4[0];
+                       vec2d[1]= pv4[2];
                        target[0]= angle * (M_PI / uci->camangle);
                        target[1]= pv4[1] / (len_v2(vec2d) * uci->camsize);
                }
index 8b9e960cdb335bed085458644d020a10002d60f6..d59f40666801cefec6ae6dea0dbd62f030d793e0 100644 (file)
@@ -320,8 +320,12 @@ static void draw_xyz_wire(float *c, float size, int axis)
 {
        float v1[3]= {0.f, 0.f, 0.f}, v2[3] = {0.f, 0.f, 0.f};
        float dim = size * 0.1;
-       float dx[3]={dim, 0.0, 0.0}, dy[3]={0.0, dim, 0.0}, dz[3]={0.0, 0.0, dim};
-       
+       float dx[3], dy[3], dz[3];
+
+       dx[0]=dim; dx[1]=0.f; dx[2]=0.f;
+       dy[0]=0.f; dy[1]=dim; dy[2]=0.f;
+       dz[0]=0.f; dz[1]=0.f; dz[2]=dim;
+
        switch(axis) {
                case 0:         /* x axis */
                        glBegin(GL_LINES);
@@ -524,8 +528,13 @@ void drawcircball(int mode, float *cent, float rad, float tmat[][4])
 /* circle for object centers, special_color is for library or ob users */
 static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, float *co, int selstate, int special_color)
 {
-       float vec[3]= {rv3d->persmat[0][3], rv3d->persmat[1][3], rv3d->persmat[2][3]};
        float size= rv3d->pixsize*((float)U.obcenter_dia*0.5f);
+       float vec[3];
+       
+       vec[0]= rv3d->persmat[0][3];
+       vec[1]= rv3d->persmat[1][3];
+       vec[2]= rv3d->persmat[2][3];
+
        size *= dot_v3v3(vec, co) + rv3d->persmat[3][3];
 
        /* using gldepthfunc guarantees that it does write z values, but not checks for it, so centers remain visible independt order of drawing */
@@ -3430,7 +3439,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
        ParticleData *pars, *pa;
        ParticleKey state, *states=0;
        ParticleBillboardData bb;
-       ParticleSimulationData sim = {scene, ob, psys, NULL};
+       ParticleSimulationData sim= {0};
        ParticleDrawData *pdd = psys->pdd;
        Material *ma;
        float vel[3], imat[4][4];
@@ -3468,6 +3477,9 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
                return;
 
 /* 2. */
+       sim.scene= scene;
+       sim.ob= ob;
+       sim.psys= psys;
        sim.psmd = psmd = psys_get_modifier(ob,psys);
 
        if(part->phystype==PART_PHYS_KEYED){
@@ -4757,9 +4769,17 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
                        
                        while (nr-->0) { /* accounts for empty bevel lists */
                                float fac= bevp->radius * ts->normalsize;
-                               float vec_a[3] = { fac,0, 0}; // Offset perpendicular to the curve
-                               float vec_b[3] = {-fac,0, 0}; // Delta along the curve
+                               float vec_a[3]; // Offset perpendicular to the curve
+                               float vec_b[3]; // Delta along the curve
+
+                               vec_a[0]= fac;
+                               vec_a[1]= 0.0f;
+                               vec_a[2]= 0.0f;
 
+                               vec_b[0]= -fac;
+                               vec_b[1]= 0.0f;
+                               vec_b[2]= 0.0f;
+                               
                                mul_qt_v3(bevp->quat, vec_a);
                                mul_qt_v3(bevp->quat, vec_b);
                                add_v3_v3(vec_a, bevp->vec);
@@ -5510,22 +5530,22 @@ static void draw_hooks(Object *ob)
 void drawRBpivot(bRigidBodyJointConstraint *data)
 {
        int axis;
-       float v1[3]= {data->pivX, data->pivY, data->pivZ};
-       float eu[3]= {data->axX, data->axY, data->axZ};
        float mat[4][4];
 
-       eul_to_mat4(mat,eu);
+       eul_to_mat4(mat,&data->axX);
        glLineWidth (4.0f);
        setlinestyle(2);
        for (axis=0; axis<3; axis++) {
                float dir[3] = {0,0,0};
-               float v[3]= {data->pivX, data->pivY, data->pivZ};
+               float v[3];
+
+               copy_v3_v3(v, &data->pivX);
 
                dir[axis] = 1.f;
                glBegin(GL_LINES);
                mul_m4_v3(mat,dir);
                add_v3_v3(v, dir);
-               glVertex3fv(v1);
+               glVertex3fv(&data->pivX);
                glVertex3fv(v);                 
                glEnd();
                if (axis==0)
index b8fff23434757d6cd771518f582494995e531e49..27afe07c4b25abc1afe10da46ec9702712d1f819 100644 (file)
@@ -1583,9 +1583,14 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas
 void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
 {
        int x, y, w, h; 
-       rcti r= {0, ar->winx-1, 0, ar->winy-1};
+       rcti r;
        /* clamp rect by area */
 
+       r.xmin= 0;
+       r.xmax= ar->winx-1;
+       r.ymin= 0;
+       r.ymax= ar->winy-1;
+
        /* Constrain rect to depth bounds */
        BLI_isect_rcti(&r, rect, rect);
 
@@ -1997,10 +2002,19 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar,
        {
                /* note:  '1.0f / len_v3(v1)'  replaced  'len_v3(rv3d->viewmat[0])'
                 * because of float point precission problems at large values [#23908] */
-               float v1[3]= {rv3d->persmat[0][0], rv3d->persmat[1][0], rv3d->persmat[2][0]};
-               float v2[3]= {rv3d->persmat[0][1], rv3d->persmat[1][1], rv3d->persmat[2][1]};
-               float len1= 1.0f / len_v3(v1);
-               float len2= 1.0f / len_v3(v2);
+               float v1[3], v2[3];
+               float len1, len2;
+
+               v1[0]= rv3d->persmat[0][0];
+               v1[1]= rv3d->persmat[1][0];
+               v1[2]= rv3d->persmat[2][0];
+
+               v2[0]= rv3d->persmat[0][1];
+               v2[1]= rv3d->persmat[1][1];
+               v2[2]= rv3d->persmat[2][1];
+               
+               len1= 1.0f / len_v3(v1);
+               len2= 1.0f / len_v3(v2);
 
                rv3d->pixsize = (2.0f * MAX2(len1, len2)) / (float)MAX2(ar->winx, ar->winy);
        }
index d706dc27404e5286bbb43f1a118ed00b3d41159c..18091942973cc9d68c5afc4e0d6a28d6e17b65b5 100644 (file)
@@ -2423,7 +2423,9 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
                short depth_used = 0;
 
                if (U.uiflag & USER_ORBIT_ZBUF) { /* maybe this should be accessed some other way */
-                       short mval_depth[2] = {mx, my};
+                       short mval_depth[2];
+                       mval_depth[0]= mx;
+                       mval_depth[1]= my;
                        view3d_operator_needs_opengl(C);
                        if (view_autodist(scene, ar, v3d, mval_depth, fp))
                                depth_used= 1;
index 8d6eec3285c5a265d319d8c24b3955a3479b96f4..2e75b5163f9848ff7a746534bec50b057f458d4e 100644 (file)
@@ -139,8 +139,12 @@ void view3d_settings_from_ob(Object *ob, float *ofs, float *quat, float *dist, f
        }
 
        if (dist) {
-               float vec[3] = {0.0f, 0.0f, -(*dist)};
                float tquat[4];
+               float vec[3];
+
+               vec[0]= 0.0f;
+               vec[1]= 0.0f;
+               vec[2]= -(*dist);
 
                mat4_to_quat(tquat, ob->obmat);
 
index 50e52bfe2f7b2dd576374c6a05ea033e8b3e89eb..89176944652850d429c12d7ca3be777ef166fe48 100644 (file)
@@ -1485,7 +1485,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
        ParticleKey state;
        ParticleCacheKey *cache=0;
        ParticleBillboardData bb;
-       ParticleSimulationData sim = {re->scene, ob, psys, NULL};
+       ParticleSimulationData sim = {0};
        ParticleStrandData sd;
        StrandBuffer *strandbuf=0;
        StrandVert *svert=0;
@@ -1519,10 +1519,15 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 /* 2. start initialising things */
 
        /* last possibility to bail out! */
-       sim.psmd = psmd = psys_get_modifier(ob,psys);
+       psmd = psys_get_modifier(ob,psys);
        if(!(psmd->modifier.mode & eModifierMode_Render))
                return 0;
 
+       sim.scene= re->scene;
+       sim.ob= ob;
+       sim.psys= psys;
+       sim.psmd= psmd;
+
        if(part->phystype==PART_PHYS_KEYED)
                psys_count_keyed_targets(&sim);
 
index d8156594085d8303ced527edc9069bad754cf2a1..a5609390ef4a581890b5ee649a75e9c1be316b6b 100644 (file)
@@ -94,7 +94,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
 {
        DerivedMesh* dm;
        ParticleKey state;
-       ParticleSimulationData sim = {re->scene, ob, psys, NULL};
+       ParticleSimulationData sim= {0};
        ParticleData *pa=NULL;
        float cfra = BKE_curframe(re->scene);
        int i, childexists;
@@ -103,10 +103,9 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
        float partco[3];
        float obview[4][4];
        
-       
        /* init everything */
        if (!psys || !ob || !pd) return;
-       
+
        mul_m4_m4m4(obview, re->viewinv, ob->obmat);
        
        /* Just to create a valid rendering context for particles */
@@ -119,6 +118,10 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
                return;
        }
        
+       sim.scene= re->scene;
+       sim.ob= ob;
+       sim.psys= psys;
+
        /* in case ob->imat isn't up-to-date */
        invert_m4_m4(ob->imat, ob->obmat);
        
index a76a3e978f52ed62148c4e4205834561035a0fc5..ccdef6006d4a46b55da85b3facc19d75a27333bf 100644 (file)
@@ -485,7 +485,11 @@ static void *vol_precache_part(void *data)
        float scatter_col[3] = {0.f, 0.f, 0.f};
        float co[3], cco[3];
        int x, y, z, i;
-       const int res[3]= {pa->res[0], pa->res[1], pa->res[2]};
+       int res[3];
+
+       res[0]= pa->res[0];
+       res[1]= pa->res[1];
+       res[2]= pa->res[2];
 
        for (z= pa->minz; z < pa->maxz; z++) {
                co[2] = pa->bbmin[2] + (pa->voxel[2] * (z + 0.5f));
index 8dcf65886e48d6c8f56b36e1405490becd07e918..c1e28654f73aa2d4b4eb5545bd1df80379fecd76 100644 (file)
@@ -232,8 +232,12 @@ static void draw_filled_lasso(wmGesture *gt)
        int i;
        
        for (i=0; i<gt->points; i++, lasso+=2) {
-               float co[3] = {(float)lasso[0], (float)lasso[1], 0.f};
-               
+               float co[3];
+
+               co[0]= (float)lasso[0];
+               co[1]= (float)lasso[1];
+               co[2]= 0.0f;
+
                v = BLI_addfillvert(co);
                if (lastv)
                        e = BLI_addfilledge(lastv, v);
index 2a9ef1e752e59f18fe900c14065342ad9fd5615f..c6baf0e53be71c5365354db2bb4684ece7e8ecd9 100644 (file)
@@ -2866,7 +2866,10 @@ int WM_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
        int mode = RNA_int_get(op->ptr, "mode");
        float initial_value = RNA_float_get(op->ptr, "initial_value");
        //float initial_size = RNA_float_get(op->ptr, "initial_size");
-       int mouse[2] = {event->x, event->y};
+       int mouse[2];
+
+       mouse[0]= event->x;
+       mouse[1]= event->y;
 
        //if (initial_size == 0)
        //      initial_size = WM_RADIAL_CONTROL_DISPLAY_SIZE;