style cleanup: follow style guide for formatting of if/for/while loops, and else...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 24 Mar 2012 06:24:53 +0000 (06:24 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 24 Mar 2012 06:24:53 +0000 (06:24 +0000)
90 files changed:
source/blender/avi/intern/avi.c
source/blender/avi/intern/avirgb.c
source/blender/avi/intern/mjpeg.c
source/blender/avi/intern/rgb32.c
source/blender/blenfont/intern/blf_glyph.c
source/blender/blenfont/intern/blf_translation.c
source/blender/ikplugin/intern/iksolver_plugin.c
source/blender/ikplugin/intern/itasc_plugin.cpp
source/blender/makesdna/intern/dna_genfile.c
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_actuator.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_image_api.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_api.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_property.c
source/blender/makesrna/intern/rna_sensor.c
source/blender/makesrna/intern/rna_sequencer.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm_api.c
source/blender/modifiers/intern/MOD_armature.c
source/blender/modifiers/intern/MOD_array.c
source/blender/modifiers/intern/MOD_bevel.c
source/blender/modifiers/intern/MOD_boolean.c
source/blender/modifiers/intern/MOD_boolean_util.c
source/blender/modifiers/intern/MOD_build.c
source/blender/modifiers/intern/MOD_cast.c
source/blender/modifiers/intern/MOD_cloth.c
source/blender/modifiers/intern/MOD_collision.c
source/blender/modifiers/intern/MOD_curve.c
source/blender/modifiers/intern/MOD_decimate.c
source/blender/modifiers/intern/MOD_displace.c
source/blender/modifiers/intern/MOD_dynamicpaint.c
source/blender/modifiers/intern/MOD_edgesplit.c
source/blender/modifiers/intern/MOD_explode.c
source/blender/modifiers/intern/MOD_fluidsim.c
source/blender/modifiers/intern/MOD_fluidsim_util.c
source/blender/modifiers/intern/MOD_hook.c
source/blender/modifiers/intern/MOD_lattice.c
source/blender/modifiers/intern/MOD_mask.c
source/blender/modifiers/intern/MOD_meshdeform.c
source/blender/modifiers/intern/MOD_mirror.c
source/blender/modifiers/intern/MOD_multires.c
source/blender/modifiers/intern/MOD_ocean.c
source/blender/modifiers/intern/MOD_particleinstance.c
source/blender/modifiers/intern/MOD_particlesystem.c
source/blender/modifiers/intern/MOD_remesh.c
source/blender/modifiers/intern/MOD_screw.c
source/blender/modifiers/intern/MOD_shapekey.c
source/blender/modifiers/intern/MOD_shrinkwrap.c
source/blender/modifiers/intern/MOD_simpledeform.c
source/blender/modifiers/intern/MOD_smoke.c
source/blender/modifiers/intern/MOD_smooth.c
source/blender/modifiers/intern/MOD_solidify.c
source/blender/modifiers/intern/MOD_subsurf.c
source/blender/modifiers/intern/MOD_surface.c
source/blender/modifiers/intern/MOD_util.c
source/blender/modifiers/intern/MOD_uvproject.c
source/blender/modifiers/intern/MOD_warp.c
source/blender/modifiers/intern/MOD_wave.c
source/blender/modifiers/intern/MOD_weightvg_util.c
source/blender/modifiers/intern/MOD_weightvgedit.c
source/blender/modifiers/intern/MOD_weightvgmix.c
source/blender/modifiers/intern/MOD_weightvgproximity.c
source/blender/python/generic/py_capi_utils.c
source/blender/python/intern/bpy_rna.c
source/blender/quicktime/apple/qtkit_export.m
source/blender/quicktime/apple/quicktime_export.c
source/blender/quicktime/apple/quicktime_import.c
source/blender/windowmanager/intern/wm.c
source/blender/windowmanager/intern/wm_apple.c
source/blender/windowmanager/intern/wm_cursors.c
source/blender/windowmanager/intern/wm_dragdrop.c
source/blender/windowmanager/intern/wm_draw.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_gesture.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_jobs.c
source/blender/windowmanager/intern/wm_keymap.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/intern/wm_subwindow.c
source/blender/windowmanager/intern/wm_window.c

index cc4d6b41f9807653d9ba28c5d630ec27cecdf26d..a58189c6018ef778ffdb53beb6518fd801c55bca 100644 (file)
@@ -216,7 +216,8 @@ int AVI_is_avi (char *name)
                !GET_FCC (fp) ||
                GET_FCC (fp) != FCC("AVI ")) {
                ret = 0;
-       } else {
+       }
+       else {
                ret = 1;
        }
 
@@ -312,9 +313,11 @@ int AVI_is_avi (const char *name)
                                fcca == FCC ("RAW ") ||
                                fcca == 0) {
                                movie.streams[temp].format = AVI_FORMAT_AVI_RGB;
-                       } else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
+                       }
+                       else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
                                movie.streams[temp].format = AVI_FORMAT_MJPEG;
-                       } else {
+                       }
+                       else {
                                MEM_freeN(movie.streams);
                                fclose(movie.fp);
                                return 0;
@@ -379,10 +382,12 @@ int AVI_is_avi (const char *name)
                                                fcca == FCC ("rgb ") ||
                                                fcca == FCC ("RAW ") ||
                                                fcca == 0 ) {
-                                       } else if ( fcca == FCC ("mjpg") || 
+                                       }
+                                       else if ( fcca == FCC ("mjpg") ||
                                                fcca == FCC ("MJPG")) {
                                                        movie.streams[temp].format = AVI_FORMAT_MJPEG;
-                                       } else {
+                                       }
+                                       else {
                                                MEM_freeN(movie.streams);
                                                fclose(movie.fp);
                                                return 0;
@@ -391,7 +396,8 @@ int AVI_is_avi (const char *name)
 
                        } 
                        if (j > 0) fseek (movie.fp, j, SEEK_CUR);
-               } else fseek (movie.fp, movie.streams[temp].sf_size, SEEK_CUR);
+               }
+               else fseek (movie.fp, movie.streams[temp].sf_size, SEEK_CUR);
 
                /* Walk to the next LIST */             
                while (GET_FCC (movie.fp) != FCC("LIST")) {
@@ -495,9 +501,11 @@ AviError AVI_open_movie (const char *name, AviMovie *movie)
                                fcca == FCC ("RAW ") ||
                                fcca == 0) {
                                movie->streams[temp].format = AVI_FORMAT_AVI_RGB;
-                       } else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
+                       }
+                       else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
                                movie->streams[temp].format = AVI_FORMAT_MJPEG;
-                       } else {
+                       }
+                       else {
                                return AVI_ERROR_COMPRESSION;
                        }
                }
@@ -558,17 +566,20 @@ AviError AVI_open_movie (const char *name, AviMovie *movie)
                                                fcca == FCC ("rgb ") ||
                                                fcca == FCC ("RAW ") ||
                                                fcca == 0 ) {
-                                       } else if ( fcca == FCC ("mjpg") || 
+                                       }
+                                       else if ( fcca == FCC ("mjpg") ||
                                                fcca == FCC ("MJPG")) {
                                                        movie->streams[temp].format = AVI_FORMAT_MJPEG;
-                                       } else {
+                                       }
+                                       else {
                                                return AVI_ERROR_COMPRESSION;
                                        }
                                }
 
                        } 
                        if (j > 0) fseek (movie->fp, j, SEEK_CUR);
-               } else fseek (movie->fp, movie->streams[temp].sf_size, SEEK_CUR);
+               }
+               else fseek (movie->fp, movie->streams[temp].sf_size, SEEK_CUR);
                
                /* Walk to the next LIST */             
                while (GET_FCC (movie->fp) != FCC("LIST")) {
@@ -595,7 +606,8 @@ AviError AVI_open_movie (const char *name, AviMovie *movie)
                                break;
                        else
                                fseek (movie->fp, size-4, SEEK_CUR);
-               } else {
+               }
+               else {
                        fseek (movie->fp, size, SEEK_CUR);
                }
                if (ftell(movie->fp) > movie->size) {
@@ -659,7 +671,7 @@ void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
 
        /* Retrieve the record number of the desired frame in the index 
         * If a chunk has Size 0 we need to rewind to previous frame */
-       while(rewind && frame > -1) {
+       while (rewind && frame > -1) {
                i=0;
                cur_frame=-1;
                rewind = 0;
@@ -670,7 +682,8 @@ void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
                                if ((cur_frame == frame -1) && (movie->entries[i].Size == 0)) {
                                        rewind = 1;
                                        frame = frame -1;
-                               } else {
+                               }
+                               else {
                                        cur_frame++;
                                }
                        }
@@ -802,7 +815,8 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
                                movie->streams[i].sf = MEM_mallocN (sizeof(AviBitmapInfoHeader) 
                                                                                + sizeof(AviMJPEGUnknown),"moviestreamformatL");
                                movie->streams[i].sf_size = sizeof(AviBitmapInfoHeader) + sizeof(AviMJPEGUnknown);
-                       } else {
+                       }
+                       else {
 #endif
                        movie->streams[i].sf = MEM_mallocN (sizeof(AviBitmapInfoHeader),  "moviestreamformatS");
                        movie->streams[i].sf_size = sizeof(AviBitmapInfoHeader);
index 42a094b1e1cdb767a14ee6e5c1880996f6506de2..8e5806c09cf1b804cbc5a971ea28125d3794f3a4 100644 (file)
@@ -94,7 +94,8 @@ void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *bu
                MEM_freeN (buffer);
                
                return buf;
-       } else {
+       }
+       else {
                buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
        
                rowstride = movie->header->Width*3;
index dab0b213d9545922cb6b8ff86dcbddaa45bd908c..f6ebcab2aebfa0c648a693ccb6c0e5a9d9f67e25 100644 (file)
@@ -159,7 +159,7 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
        jpeg_create_decompress(&dinfo);
        jpegmemsrcmgr_build(&dinfo, inBuffer, bufsize);
        jpeg_read_header(&dinfo, TRUE);
-       if (dinfo.dc_huff_tbl_ptrs[0] == NULL){
+       if (dinfo.dc_huff_tbl_ptrs[0] == NULL) {
                std_huff_tables(&dinfo);
        }
        dinfo.out_color_space = JCS_RGB;
@@ -181,13 +181,13 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
 
        numbytes= 0;
        jpeg_read_header(&dinfo, TRUE);
-       if (dinfo.dc_huff_tbl_ptrs[0] == NULL){
+       if (dinfo.dc_huff_tbl_ptrs[0] == NULL) {
                std_huff_tables(&dinfo);
        }
 
        jpeg_start_decompress(&dinfo);
        rowstride= dinfo.output_width*dinfo.output_components;
-       for (y= 0; y<dinfo.output_height; y++){
+       for (y= 0; y<dinfo.output_height; y++) {
                jpeg_read_scanlines(&dinfo, (JSAMPARRAY) &outBuffer, 1);
                outBuffer += rowstride;
        }
@@ -251,7 +251,7 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *
        jpeg_write_marker (&cinfo, JPEG_COM, marker, 60);
 
        rowstride= cinfo.image_width*cinfo.input_components;
-       for (y = 0; y < cinfo.image_height; y++){
+       for (y = 0; y < cinfo.image_height; y++) {
                jpeg_write_scanlines(&cinfo, (JSAMPARRAY) &inBuffer, 1);
                inBuffer += rowstride;
        }
@@ -301,7 +301,8 @@ static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, in
                MEM_freeN(tmpbuf);
                
                return ret;
-       } else {
+       }
+       else {
                return Decode_JPEG(inbuf, outbuf, width, height, bufsize);
        }
 }
@@ -329,7 +330,8 @@ static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned
                Compress_JPEG(quality, outbuf, tmpbuf, jwidth, jheight, bufsize);
 
                MEM_freeN(tmpbuf);
-       } else {
+       }
+       else {
                Compress_JPEG(quality, outbuf, inbuf, width, height, bufsize);
        }
 }
@@ -369,7 +371,8 @@ void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer
        buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "avi.avi_converter_to_mjpeg 1");   
        if (!movie->interlace) {
                check_and_compress_jpeg(movie->streams[stream].sh.Quality/100, buf, buffer,  movie->header->Width, movie->header->Height, bufsize);
-       } else {
+       }
+       else {
                deinterlace (movie->odd_fields, buf, buffer, movie->header->Width, movie->header->Height);
                MEM_freeN (buffer);
        
index e3be082cca67f71bbee605c0d7919c2f1c0528a2..c6830d9666a34c09b9480c7ee0f6b966a5b41750 100644 (file)
@@ -82,7 +82,7 @@ void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer
        to= buf; from= buffer;
        i=movie->header->Height*movie->header->Width;
        
-       while(i--) {
+       while (i--) {
                memcpy(to, from, 3);
                to+=4; from+=3;
        }
index e542e24775591178dcde04bc8178acdda2e347f7..033efbfc1fca2a60b652314bc777546d9b7b3186 100644 (file)
@@ -239,7 +239,8 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
                err += FT_Bitmap_Convert(font->ft_lib, &slot->bitmap, &tempbitmap, 1); /* Does Blender use Pitch 1 always? It works so far */
                err += FT_Bitmap_Copy(font->ft_lib, &tempbitmap, &slot->bitmap);
                err += FT_Bitmap_Done(font->ft_lib, &tempbitmap);
-       } else {
+       }
+       else {
                err = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL);
        }
 
index f3d4242192b0931087ee54fcd6ed5e4464c3e98c..5d74a844425fc627c883512d0b92b1c898c4b8fb 100644 (file)
@@ -157,7 +157,7 @@ int BLF_translate_tooltips(void)
 const char *BLF_translate_do_iface(const char *context, const char *msgid)
 {
 #ifdef WITH_INTERNATIONAL
-       if(BLF_translate_iface()) {
+       if (BLF_translate_iface()) {
                if (context)
                        return BLF_pgettext(context, msgid);
                else
@@ -174,7 +174,7 @@ const char *BLF_translate_do_iface(const char *context, const char *msgid)
 const char *BLF_translate_do_tooltip(const char *context, const char *msgid)
 {
 #ifdef WITH_INTERNATIONAL
-       if(BLF_translate_tooltips()) {
+       if (BLF_translate_tooltips()) {
                if (context)
                        return BLF_pgettext(context, msgid);
                else
index 7a96edeaf5f0b6d9609c4ce0c0e242a1cddc1bdf..41700b96acc00dbb04b4cdd4b402bb8838a8711b 100644 (file)
@@ -65,8 +65,8 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
        int a, t, segcount= 0, size, newsize, *oldparent, parent;
 
        /* find IK constraint, and validate it */
-       for(con= pchan_tip->constraints.first; con; con= con->next) {
-               if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+       for (con= pchan_tip->constraints.first; con; con= con->next) {
+               if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
                        data=(bKinematicConstraint*)con->data;
                        if (data->flag & CONSTRAINT_IK_AUTO) break;
                        if (data->tar==NULL) continue;
@@ -74,36 +74,36 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
                        if ((con->flag & (CONSTRAINT_DISABLE|CONSTRAINT_OFF))==0 && (con->enforce != 0.0f)) break;
                }
        }
-       if(con==NULL) return;
+       if (con==NULL) return;
        
        /* exclude tip from chain? */
-       if(!(data->flag & CONSTRAINT_IK_TIP))
+       if (!(data->flag & CONSTRAINT_IK_TIP))
                pchan_tip= pchan_tip->parent;
        
        /* Find the chain's root & count the segments needed */
-       for (curchan = pchan_tip; curchan; curchan=curchan->parent){
+       for (curchan = pchan_tip; curchan; curchan=curchan->parent) {
                pchan_root = curchan;
                
                curchan->flag |= POSE_CHAIN;    // don't forget to clear this
                chanlist[segcount]=curchan;
                segcount++;
                
-               if(segcount==data->rootbone || segcount>255) break; // 255 is weak
+               if (segcount==data->rootbone || segcount>255) break; // 255 is weak
        }
        if (!segcount) return;
 
        /* setup the chain data */
        
        /* we make tree-IK, unless all existing targets are in this chain */
-       for(tree= pchan_root->iktree.first; tree; tree= tree->next) {
-               for(target= tree->targets.first; target; target= target->next) {
+       for (tree= pchan_root->iktree.first; tree; tree= tree->next) {
+               for (target= tree->targets.first; target; target= target->next) {
                        curchan= tree->pchan[target->tip];
-                       if(curchan->flag & POSE_CHAIN)
+                       if (curchan->flag & POSE_CHAIN)
                                curchan->flag &= ~POSE_CHAIN;
                        else
                                break;
                }
-               if(target) break;
+               if (target) break;
        }
 
        /* create a target */
@@ -111,7 +111,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
        target->con= con;
        pchan_tip->flag &= ~POSE_CHAIN;
 
-       if(tree==NULL) {
+       if (tree==NULL) {
                /* make new tree */
                tree= MEM_callocN(sizeof(PoseTree), "posetree");
 
@@ -123,7 +123,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
                
                tree->pchan= MEM_callocN(segcount*sizeof(void*), "ik tree pchan");
                tree->parent= MEM_callocN(segcount*sizeof(int), "ik tree parent");
-               for(a=0; a<segcount; a++) {
+               for (a=0; a<segcount; a++) {
                        tree->pchan[a]= chanlist[segcount-a-1];
                        tree->parent[a]= a-1;
                }
@@ -144,19 +144,19 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
                        for (;t<tree->totchannel && tree->pchan[t]!=chanlist[segcount-a-1];t++);
                        if (t>=tree->totchannel)
                                break;
-                       for(; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++);
+                       for (; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++);
                }
 
                segcount= segcount-a;
                target->tip= tree->totchannel + segcount - 1;
 
                if (segcount > 0) {
-                       for(parent = a - 1; parent < tree->totchannel; parent++)
-                               if(tree->pchan[parent] == chanlist[segcount-1]->parent)
+                       for (parent = a - 1; parent < tree->totchannel; parent++)
+                               if (tree->pchan[parent] == chanlist[segcount-1]->parent)
                                        break;
                        
                        /* shouldn't happen, but could with dependency cycles */
-                       if(parent == tree->totchannel)
+                       if (parent == tree->totchannel)
                                parent = a - 1;
 
                        /* resize array */
@@ -172,7 +172,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
                        MEM_freeN(oldparent);
 
                        /* add new pose channels at the end, in reverse order */
-                       for(a=0; a<segcount; a++) {
+                       for (a=0; a<segcount; a++) {
                                tree->pchan[tree->totchannel+a]= chanlist[segcount-a-1];
                                tree->parent[tree->totchannel+a]= tree->totchannel+a-1;
                        }
@@ -256,20 +256,20 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
        
        iktree= MEM_mallocN(sizeof(void*)*tree->totchannel, "ik tree");
 
-       for(a=0; a<tree->totchannel; a++) {
+       for (a=0; a<tree->totchannel; a++) {
                pchan= tree->pchan[a];
                bone= pchan->bone;
                
                /* set DoF flag */
                flag= 0;
-               if(!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP))
+               if (!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP))
                        flag |= IK_XDOF;
-               if(!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP))
+               if (!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP))
                        flag |= IK_YDOF;
-               if(!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP))
+               if (!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP))
                        flag |= IK_ZDOF;
                
-               if(tree->stretch && (pchan->ikstretch > 0.0f)) {
+               if (tree->stretch && (pchan->ikstretch > 0.0f)) {
                        flag |= IK_TRANS_YDOF;
                        hasstretch = 1;
                }
@@ -277,7 +277,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
                seg= iktree[a]= IK_CreateSegment(flag);
                
                /* find parent */
-               if(a == 0)
+               if (a == 0)
                        parent= NULL;
                else
                        parent= iktree[tree->parent[a]];
@@ -334,7 +334,7 @@ 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.0f)) {
+               if (tree->stretch && (pchan->ikstretch > 0.0f)) {
                        float ikstretch = pchan->ikstretch*pchan->ikstretch;
                        IK_SetStiffness(seg, IK_TRANS_Y, MIN2(1.0f-ikstretch, 0.99f));
                        IK_SetLimit(seg, IK_TRANS_Y, 0.001, 1e10);
@@ -377,10 +377,10 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
                copy_m3_m4(goalrot, goal);
                
                /* same for pole vector target */
-               if(data->poletar) {
+               if (data->poletar) {
                        get_constraint_target_matrix(scene, target->con, 1, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0);
                        
-                       if(data->flag & CONSTRAINT_IK_SETANGLE) {
+                       if (data->flag & CONSTRAINT_IK_SETANGLE) {
                                /* don't solve IK when we are setting the pole angle */
                                break;
                        }
@@ -395,7 +395,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
                                resultblend= 1;
                                resultinf= target->con->enforce;
                                
-                               if(data->flag & CONSTRAINT_IK_GETANGLE) {
+                               if (data->flag & CONSTRAINT_IK_GETANGLE) {
                                        poleangledata= data;
                                        data->flag &= ~CONSTRAINT_IK_GETANGLE;
                                }
@@ -429,14 +429,14 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
                
                iktarget= iktree[target->tip];
                
-               if(data->weight != 0.0f) {
-                       if(poleconstrain)
+               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.0f))
-                       if((data->flag & CONSTRAINT_IK_AUTO)==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);
        }
@@ -444,27 +444,27 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
        /* solve */
        IK_Solve(solver, 0.0f, tree->iterations);
 
-       if(poleangledata)
+       if (poleangledata)
                poleangledata->poleangle= IK_SolverGetPoleAngle(solver);
 
        IK_FreeSolver(solver);
 
        /* gather basis changes */
        tree->basis_change= MEM_mallocN(sizeof(float[3][3])*tree->totchannel, "ik basis change");
-       if(hasstretch)
+       if (hasstretch)
                ikstretch= MEM_mallocN(sizeof(float)*tree->totchannel, "ik stretch");
        
-       for(a=0; a<tree->totchannel; a++) {
+       for (a=0; a<tree->totchannel; a++) {
                IK_GetBasisChange(iktree[a], tree->basis_change[a]);
                
-               if(hasstretch) {
+               if (hasstretch) {
                        /* have to compensate for scaling received from parent */
                        float parentstretch, stretch;
                        
                        pchan= tree->pchan[a];
                        parentstretch= (tree->parent[a] >= 0)? ikstretch[tree->parent[a]]: 1.0f;
                        
-                       if(tree->stretch && (pchan->ikstretch > 0.0f)) {
+                       if (tree->stretch && (pchan->ikstretch > 0.0f)) {
                                float trans[3], length;
                                
                                IK_GetTranslationChange(iktree[a], trans);
@@ -482,7 +482,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
                        mul_v3_fl(tree->basis_change[a][2], stretch);
                }
 
-               if(resultblend && resultinf!=1.0f) {
+               if (resultblend && resultinf!=1.0f) {
                        unit_m3(identity);
                        blend_m3_m3m3(tree->basis_change[a], identity,
                                tree->basis_change[a], resultinf);
@@ -492,15 +492,15 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
        }
        
        MEM_freeN(iktree);
-       if(ikstretch) MEM_freeN(ikstretch);
+       if (ikstretch) MEM_freeN(ikstretch);
 }
 
 static void free_posetree(PoseTree *tree)
 {
        BLI_freelistN(&tree->targets);
-       if(tree->pchan) MEM_freeN(tree->pchan);
-       if(tree->parent) MEM_freeN(tree->parent);
-       if(tree->basis_change) MEM_freeN(tree->basis_change);
+       if (tree->pchan) MEM_freeN(tree->pchan);
+       if (tree->parent) MEM_freeN(tree->parent);
+       if (tree->basis_change) MEM_freeN(tree->basis_change);
        MEM_freeN(tree);
 }
 
@@ -511,8 +511,8 @@ void iksolver_initialize_tree(struct Scene *UNUSED(scene), struct Object *ob, fl
 {
        bPoseChannel *pchan;
        
-       for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-               if(pchan->constflag & PCHAN_HAS_IK) // flag is set on editing constraints
+       for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+               if (pchan->constflag & PCHAN_HAS_IK) // flag is set on editing constraints
                        initialize_posetree(ob, pchan); // will attach it to root!
        }
        ob->pose->flag &= ~POSE_WAS_REBUILT;
@@ -520,7 +520,7 @@ void iksolver_initialize_tree(struct Scene *UNUSED(scene), struct Object *ob, fl
 
 void iksolver_execute_tree(struct Scene *scene, struct Object *ob,  struct bPoseChannel *pchan, float ctime)
 {
-       while(pchan->iktree.first) {
+       while (pchan->iktree.first) {
                PoseTree *tree= pchan->iktree.first;
                int a;
                
@@ -529,8 +529,8 @@ void iksolver_execute_tree(struct Scene *scene, struct Object *ob,  struct bPose
                        return;
                
                /* 4. walk over the tree for regular solving */
-               for(a=0; a<tree->totchannel; a++) {
-                       if(!(tree->pchan[a]->flag & POSE_DONE)) // successive trees can set the flag
+               for (a=0; a<tree->totchannel; a++) {
+                       if (!(tree->pchan[a]->flag & POSE_DONE))        // successive trees can set the flag
                                where_is_pose_bone(scene, ob, tree->pchan[a], ctime, 1);
                        // tell blender that this channel was controlled by IK, it's cleared on each where_is_pose()
                        tree->pchan[a]->flag |= POSE_CHAIN;
@@ -540,11 +540,11 @@ void iksolver_execute_tree(struct Scene *scene, struct Object *ob,  struct bPose
                
                /* 6. apply the differences to the channels, 
                 *    we need to calculate the original differences first */
-               for(a=0; a<tree->totchannel; a++) {
+               for (a=0; a<tree->totchannel; a++) {
                        make_dmats(tree->pchan[a]);
                }
                
-               for(a=0; a<tree->totchannel; a++) {
+               for (a=0; a<tree->totchannel; a++) {
                        /* sets POSE_DONE */
                        where_is_ik_bone(tree->pchan[a], tree->basis_change[a]);
                }
index 5385366f0755b9eb051d2d0e69c25cb3ddd13a4b..7237015872345ae574eaf71ccf2e05551dd079fc 100644 (file)
@@ -430,7 +430,8 @@ static double EulerAngleFromMatrix(const KDL::Rotation& R, int axis)
                if (axis == 0) return -KDL::atan2(R(1,2), R(2,2));
         else if(axis == 1) return KDL::atan2(-R(0,2), t);
         else return -KDL::atan2(R(0,1), R(0,0));
-    } else {
+       }
+       else {
                if (axis == 0) return -KDL::atan2(-R(2,1), R(1,1));
         else if(axis == 1) return KDL::atan2(-R(0,2), t);
         else return 0.0f;
@@ -476,7 +477,8 @@ static void GetEulerXZY(const KDL::Rotation& R, double& X,double& Z,double& Y)
         X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0));
         Z = -KDL::sign(R(0,1)) * KDL::PI / 2;
         Y = 0.0;
-    } else {
+       }
+       else {
         X = KDL::atan2(R(2,1), R(1,1));
         Z = KDL::atan2(-R(0,1), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,2))));
         Y = KDL::atan2(R(0,2), R(0,0));
@@ -489,7 +491,8 @@ static void GetEulerXYZ(const KDL::Rotation& R, double& X,double& Y,double& Z)
         X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1));
         Y = KDL::sign(R(0,2)) * KDL::PI / 2;
         Z = 0.0;
-    } else {
+       }
+       else {
         X = KDL::atan2(-R(1,2), R(2,2));
         Y = KDL::atan2(R(0,2), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,1))));
         Z = KDL::atan2(-R(0,1), R(0,0));
@@ -691,7 +694,8 @@ static bool copypose_callback(const iTaSC::Timestamp& timestamp, iTaSC::Constrai
                        values->action = iTaSC::ACT_ALPHA;
                        values++;
                }
-       } else {
+       }
+       else {
                if (iktarget->controlType & iTaSC::CopyPose::CTL_POSITION) {
                        // update error
                        values->alpha = condata->weight;
@@ -745,7 +749,8 @@ static bool distance_callback(const iTaSC::Timestamp& timestamp, iTaSC::Constrai
        // update weight according to mode
        if (iktarget->blenderConstraint->flag & CONSTRAINT_OFF) {
                values->alpha = 0.0;
-       } else {
+       }
+       else {
                switch (condata->mode) {
                case LIMITDIST_INSIDE:
                        values->alpha = (values->values[0].y > condata->dist) ? condata->weight : 0.0;
@@ -996,7 +1001,8 @@ static void convert_pose(IK_Scene *ikscene)
                if (pchan->parent) {
                        unit_m4(bmat);
                        mul_m4_m4m3(bmat, pchan->parent->pose_mat, bone->bone_mat);
-               } else {
+               }
+               else {
                        copy_m4_m4(bmat, bone->arm_mat);
                }
                invert_m4_m4(rmat, bmat);
@@ -1076,7 +1082,8 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
        if (!ikparam) {
                // you must have our own copy
                ikparam = &DefIKParam;
-       } else if (ingame) {
+       }
+       else if (ingame) {
                // tweak the param when in game to have efficient stepping
                // using fixed substep is not effecient since frames in the GE are often
                // shorter than in animation => move to auto step automatically and set
@@ -1120,7 +1127,8 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
                // in the GE, set the initial joint angle to match the current pose
                // this will update the jointArray in ikscene
                convert_pose(ikscene);
-       } else {
+       }
+       else {
                // in Blender, the rest pose is always 0 for joints
                rest_pose(ikscene);
        }
@@ -1393,7 +1401,8 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
                // move to the tail and scale to get rest pose of armature base
                copy_v3_v3(baseFrame[3], pchan->bone->arm_tail);
                invert_m4_m4(invBaseFrame, baseFrame);
-       } else {
+       }
+       else {
                unit_m4(invBaseFrame);
        }
        // finally add the constraint
@@ -1538,7 +1547,8 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl
                        ikchan->pchan->flag |= (POSE_DONE|POSE_CHAIN);
                        ikchan->jointValid = 0;
                }
-       } else {
+       }
+       else {
                // in animation mode, we must get the bone position from action and constraints
                for(i=0, ikchan=ikscene->channels; i<ikscene->numchan; i++, ++ikchan) {
                        if (!(ikchan->pchan->flag & POSE_DONE))
@@ -1589,7 +1599,8 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl
                        // the cache is empty before this time, reiterate
                        if (ikparam->flag & ITASC_INITIAL_REITERATION)
                                reiterate = true;
-               } else {
+               }
+               else {
                        // can take the cache as a start point.
                        sts -= cts;
                        timestep = sts/1000.0;
@@ -1780,7 +1791,8 @@ void itasc_update_param(struct bPose *pose)
                                ikscene->scene->setParam(iTaSC::Scene::MAX_TIMESTEP, ikparam->maxstep);
                                ikscene->solver->setParam(iTaSC::Solver::DLS_QMAX, ikparam->maxvel);
                                ikscene->armature->setControlParameter(CONSTRAINT_ID_ALL, iTaSC::Armature::ID_JOINT, iTaSC::ACT_FEEDBACK, ikparam->feedback);
-                       } else {
+                       }
+                       else {
                                // in animation mode timestep is 1s by convention => 
                                // qmax becomes radiant and feedback becomes fraction of error gap corrected in one iteration
                                ikscene->scene->setParam(iTaSC::Scene::MIN_TIMESTEP, 1.0);
index 2148bc96c04d6402c3d4160859f0350e2af54c6b..5e4c244dbc2be43d95c637df3091b0771f3f242c 100644 (file)
@@ -178,11 +178,11 @@ int DNA_elem_array_size(const char *astr, int len)
 
        memcpy(str, astr, len+1);
 
-       for(a=0; a<len; a++) {
-               if( str[a]== '[' ) {
+       for (a=0; a<len; a++) {
+               if ( str[a]== '[' ) {
                        cp= &(str[a+1]);
                }
-               else if( str[a]==']' && cp) {
+               else if ( str[a]==']' && cp) {
                        str[a]= 0;
                        mul*= atoi(cp);
                }
@@ -226,17 +226,17 @@ static int elementsize(SDNA *sdna, short type, short name)
        
        namelen= strlen(cp);
        /* is it a pointer or function pointer? */
-       if(ispointer(cp)) {
+       if (ispointer(cp)) {
                /* has the naam an extra length? (array) */
                mul= 1;
-               if( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
+               if ( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
                
                len= sdna->pointerlen*mul;
        }
-       else if( sdna->typelens[type] ) {
+       else if ( sdna->typelens[type] ) {
                /* has the naam an extra length? (array) */
                mul= 1;
-               if( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
+               if ( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
                
                len= mul*sdna->typelens[type];
                
@@ -258,7 +258,7 @@ static void printstruct(SDNA *sdna, short strnr)
        nr= sp[1];
        sp+= 2;
        
-       for(b=0; b< nr; b++, sp+= 2) {
+       for (b=0; b< nr; b++, sp+= 2) {
                printf("   %s %s\n", sdna->types[sp[0]], sdna->names[sp[1]]);
        }
 }
@@ -270,11 +270,11 @@ static short *findstruct_name(SDNA *sdna, const char *str)
        short *sp= NULL;
 
 
-       for(a=0; a<sdna->nr_structs; a++) {
+       for (a=0; a<sdna->nr_structs; a++) {
 
                sp= sdna->structs[a];
                
-               if(strcmp( sdna->types[ sp[0] ], str )==0) return sp;
+               if (strcmp( sdna->types[ sp[0] ], str )==0) return sp;
        }
        
        return NULL;
@@ -284,9 +284,9 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str)
 {
        short *sp= NULL;
 
-       if(sdna->lastfind<sdna->nr_structs) {
+       if (sdna->lastfind<sdna->nr_structs) {
                sp= sdna->structs[sdna->lastfind];
-               if(strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind;
+               if (strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind;
        }
 
 #ifdef WITH_DNA_GHASH
@@ -295,11 +295,11 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str)
        {
                int a;
 
-               for(a=0; a<sdna->nr_structs; a++) {
+               for (a=0; a<sdna->nr_structs; a++) {
 
                        sp= sdna->structs[a];
 
-                       if(strcmp( sdna->types[ sp[0] ], str )==0) {
+                       if (strcmp( sdna->types[ sp[0] ], str )==0) {
                                sdna->lastfind= a;
                                return a;
                        }
@@ -325,16 +325,16 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
        data= (int *)sdna->data;
 
        strcpy(str, "SDNA");
-       if( *data == *verg ) {
+       if ( *data == *verg ) {
        
                data++;
                
                /* load names array */
                strcpy(str, "NAME");
-               if( *data == *verg ) {
+               if ( *data == *verg ) {
                        data++;
                        
-                       if(do_endian_swap) sdna->nr_names= le_int(*data);
+                       if (do_endian_swap) sdna->nr_names= le_int(*data);
                        else sdna->nr_names= *data;
                        
                        data++;
@@ -347,20 +347,20 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
                
                nr= 0;
                cp= (char *)data;
-               while(nr<sdna->nr_names) {
+               while (nr<sdna->nr_names) {
                        sdna->names[nr]= cp;
 
                        /* "float gravity [3]" was parsed wrong giving both "gravity" and
                         * "[3]"  members. we rename "[3]", and later set the type of
                         * "gravity" to "void" so the offsets work out correct */
-                       if(*cp == '[' && strcmp(cp, "[3]")==0) {
-                               if(nr && strcmp(sdna->names[nr-1], "Cvi") == 0) {
+                       if (*cp == '[' && strcmp(cp, "[3]")==0) {
+                               if (nr && strcmp(sdna->names[nr-1], "Cvi") == 0) {
                                        sdna->names[nr]= "gravity[3]";
                                        gravity_fix= nr;
                                }
                        }
 
-                       while( *cp) cp++;
+                       while ( *cp) cp++;
                        cp++;
                        nr++;
                }
@@ -371,10 +371,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
                /* load type names array */
                data= (int *)cp;
                strcpy(str, "TYPE");
-               if( *data == *verg ) {
+               if ( *data == *verg ) {
                        data++;
                        
-                       if(do_endian_swap) sdna->nr_types= le_int(*data);
+                       if (do_endian_swap) sdna->nr_types= le_int(*data);
                        else sdna->nr_types= *data;
                        
                        data++;
@@ -387,18 +387,18 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
                
                nr= 0;
                cp= (char *)data;
-               while(nr<sdna->nr_types) {
+               while (nr<sdna->nr_types) {
                        sdna->types[nr]= cp;
                        
                        /* this is a patch, to change struct names without a conflict with SDNA */
                        /* be careful to use it, in this case for a system-struct (opengl/X) */
                        
-                       if( *cp == 'b') {
+                       if ( *cp == 'b') {
                                /* struct Screen was already used by X, 'bScreen' replaces the old IrisGL 'Screen' struct */
-                               if( strcmp("bScreen", cp)==0 ) sdna->types[nr]= cp+1;
+                               if ( strcmp("bScreen", cp)==0 ) sdna->types[nr]= cp+1;
                        }
                        
-                       while( *cp) cp++;
+                       while ( *cp) cp++;
                        cp++;
                        nr++;
                }
@@ -409,16 +409,16 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
                /* load typelen array */
                data= (int *)cp;
                strcpy(str, "TLEN");
-               if( *data == *verg ) {
+               if ( *data == *verg ) {
                        data++;
                        sp= (short *)data;
                        sdna->typelens= sp;
                        
-                       if(do_endian_swap) {
+                       if (do_endian_swap) {
                                short a, *spo= sp;
                                
                                a= sdna->nr_types;
-                               while(a--) {
+                               while (a--) {
                                        spo[0]= le_short(spo[0]);
                                        spo++;
                                }
@@ -430,15 +430,15 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
                        printf("TLEN error in SDNA file\n");
                        return;
                }
-               if(sdna->nr_types & 1) sp++;    /* prevent BUS error */
+               if (sdna->nr_types & 1) sp++;   /* prevent BUS error */
 
                /* load struct array */
                data= (int *)sp;
                strcpy(str, "STRC");
-               if( *data == *verg ) {
+               if ( *data == *verg ) {
                        data++;
                        
-                       if(do_endian_swap) sdna->nr_structs= le_int(*data);
+                       if (do_endian_swap) sdna->nr_structs= le_int(*data);
                        else sdna->nr_structs= *data;
                        
                        data++;
@@ -451,10 +451,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
                
                nr= 0;
                sp= (short *)data;
-               while(nr<sdna->nr_structs) {
+               while (nr<sdna->nr_structs) {
                        sdna->structs[nr]= sp;
                        
-                       if(do_endian_swap) {
+                       if (do_endian_swap) {
                                short a;
                                
                                sp[0]= le_short(sp[0]);
@@ -462,7 +462,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
                                
                                a= sp[1];
                                sp+= 2;
-                               while(a--) {
+                               while (a--) {
                                        sp[0]= le_short(sp[0]);
                                        sp[1]= le_short(sp[1]);
                                        sp+= 2;
@@ -481,17 +481,17 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
                
                sdna->pointerlen= sdna->typelens[ sp[0] ]/2;
 
-               if(sp[1]!=2 || (sdna->pointerlen!=4 && sdna->pointerlen!=8)) {
+               if (sp[1]!=2 || (sdna->pointerlen!=4 && sdna->pointerlen!=8)) {
                        printf("ListBase struct error! Needs it to calculate pointerize.\n");
                        exit(0);
                        /* well, at least sizeof(ListBase) is error proof! (ton) */
                }
                
                /* second part of gravity problem, setting "gravity" type to void */
-               if(gravity_fix > -1) {
-                       for(nr=0; nr<sdna->nr_structs; nr++) {
+               if (gravity_fix > -1) {
+                       for (nr=0; nr<sdna->nr_structs; nr++) {
                                sp= sdna->structs[nr];
-                               if(strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0)
+                               if (strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0)
                                        sp[10]= SDNA_TYPE_VOID;
                        }
                }
@@ -500,7 +500,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
                /* create a ghash lookup to speed up */
                sdna->structs_map= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "init_structDNA gh");
 
-               for(nr = 0; nr < sdna->nr_structs; nr++) {
+               for (nr = 0; nr < sdna->nr_structs; nr++) {
                        sp= sdna->structs[nr];
                        BLI_ghash_insert(sdna->structs_map, (void *)sdna->types[sp[0]], (void *)(nr + 1));
                }
@@ -537,15 +537,15 @@ static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr)
        sp= sdna->structs[structnr];
        typenr= sp[0];
        
-       for(a=0; a<sdna->nr_structs; a++) {
-               if(a!=structnr && compflags[a]==1) {
+       for (a=0; a<sdna->nr_structs; a++) {
+               if (a!=structnr && compflags[a]==1) {
                        sp= sdna->structs[a];
                        elems= sp[1];
                        sp+= 2;
-                       for(b=0; b<elems; b++, sp+=2) {
-                               if(sp[0]==typenr) {
+                       for (b=0; b<elems; b++, sp+=2) {
+                               if (sp[0]==typenr) {
                                        cp= sdna->names[ sp[1] ];
-                                       if(!ispointer(cp)) {
+                                       if (!ispointer(cp)) {
                                                compflags[a]= 2;
                                                recurs_test_compflags(sdna, compflags, a);
                                        }
@@ -578,7 +578,7 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
        const char *str1, *str2;
        char *compflags;
        
-       if(sdna->nr_structs==0) {
+       if (sdna->nr_structs==0) {
                printf("error: file without SDNA\n");
                return NULL;
        }
@@ -589,42 +589,42 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
         * the structs in 'newsdna'
         */
        
-       for(a=0; a<sdna->nr_structs; a++) {
+       for (a=0; a<sdna->nr_structs; a++) {
                spold= sdna->structs[a];
                
                /* search for type in cur */
                spcur= findstruct_name(newsdna, sdna->types[spold[0]]);
                
-               if(spcur) {
+               if (spcur) {
                        compflags[a]= 2;
                        
                        /* compare length and amount of elems */
-                       if( spcur[1] == spold[1]) {
-                               if( newsdna->typelens[spcur[0]] == sdna->typelens[spold[0]] ) {
+                       if ( spcur[1] == spold[1]) {
+                               if ( newsdna->typelens[spcur[0]] == sdna->typelens[spold[0]] ) {
 
                                        /* same length, same amount of elems, now per type and name */
                                        b= spold[1];
                                        spold+= 2;
                                        spcur+= 2;
-                                       while(b > 0) {
+                                       while (b > 0) {
                                                str1= newsdna->types[spcur[0]];
                                                str2= sdna->types[spold[0]];
-                                               if(strcmp(str1, str2)!=0) break;
+                                               if (strcmp(str1, str2)!=0) break;
 
                                                str1= newsdna->names[spcur[1]];
                                                str2= sdna->names[spold[1]];
-                                               if(strcmp(str1, str2)!=0) break;
+                                               if (strcmp(str1, str2)!=0) break;
 
                                                /* same type and same name, now pointersize */
-                                               if(ispointer(str1)) {
-                                                       if(sdna->pointerlen!=newsdna->pointerlen) break;
+                                               if (ispointer(str1)) {
+                                                       if (sdna->pointerlen!=newsdna->pointerlen) break;
                                                }
 
                                                b--;
                                                spold+= 2;
                                                spcur+= 2;
                                        }
-                                       if(b==0) compflags[a]= 1;
+                                       if (b==0) compflags[a]= 1;
 
                                }
                        }
@@ -640,13 +640,13 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
        /* Because structs can be inside structs, we recursively
         * set flags when a struct is altered
         */
-       for(a=0; a<sdna->nr_structs; a++) {
-               if(compflags[a]==2) recurs_test_compflags(sdna, compflags, a);
+       for (a=0; a<sdna->nr_structs; a++) {
+               if (compflags[a]==2) recurs_test_compflags(sdna, compflags, a);
        }
        
 #if 0
-       for(a=0; a<sdna->nr_structs; a++) {
-               if(compflags[a]==2) {
+       for (a=0; a<sdna->nr_structs; a++) {
+               if (compflags[a]==2) {
                        spold= sdna->structs[a];
                        printf("changed: %s\n", sdna->types[ spold[0] ]);
                }
@@ -659,16 +659,16 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
 static eSDNA_Type sdna_type_nr(const char *dna_type)
 {
        if     ((strcmp(dna_type, "char")==0) || (strcmp(dna_type, "const char")==0))         return SDNA_TYPE_CHAR;
-       else if((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0))     return SDNA_TYPE_UCHAR;
-       else if( strcmp(dna_type, "short")==0)                                                return SDNA_TYPE_SHORT;
-       else if((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0))     return SDNA_TYPE_USHORT;
-       else if( strcmp(dna_type, "int")==0)                                                  return SDNA_TYPE_INT;
-       else if( strcmp(dna_type, "long")==0)                                                 return SDNA_TYPE_LONG;
-       else if((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0))       return SDNA_TYPE_ULONG;
-       else if( strcmp(dna_type, "float")==0)                                                return SDNA_TYPE_FLOAT;
-       else if( strcmp(dna_type, "double")==0)                                               return SDNA_TYPE_DOUBLE;
-       else if( strcmp(dna_type, "int64_t")==0)                                              return SDNA_TYPE_INT64;
-       else if( strcmp(dna_type, "uint64_t")==0)                                             return SDNA_TYPE_UINT64;
+       else if ((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0))     return SDNA_TYPE_UCHAR;
+       else if ( strcmp(dna_type, "short")==0)                                                return SDNA_TYPE_SHORT;
+       else if ((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0))     return SDNA_TYPE_USHORT;
+       else if ( strcmp(dna_type, "int")==0)                                                  return SDNA_TYPE_INT;
+       else if ( strcmp(dna_type, "long")==0)                                                 return SDNA_TYPE_LONG;
+       else if ((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0))       return SDNA_TYPE_ULONG;
+       else if ( strcmp(dna_type, "float")==0)                                                return SDNA_TYPE_FLOAT;
+       else if ( strcmp(dna_type, "double")==0)                                               return SDNA_TYPE_DOUBLE;
+       else if ( strcmp(dna_type, "int64_t")==0)                                              return SDNA_TYPE_INT64;
+       else if ( strcmp(dna_type, "uint64_t")==0)                                             return SDNA_TYPE_UINT64;
        else                                                                                  return -1; /* invalid! */
 }
 
@@ -691,7 +691,7 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch
        oldlen= DNA_elem_type_size(otypenr);
        curlen= DNA_elem_type_size(ctypenr);
 
-       while(arrlen>0) {
+       while (arrlen>0) {
                switch(otypenr) {
                case SDNA_TYPE_CHAR:
                        val= *olddata; break;
@@ -733,10 +733,10 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch
                case SDNA_TYPE_ULONG:
                        *( (unsigned int *)curdata)= val; break;
                case SDNA_TYPE_FLOAT:
-                       if(otypenr<2) val/= 255;
+                       if (otypenr<2) val/= 255;
                        *( (float *)curdata)= val; break;
                case SDNA_TYPE_DOUBLE:
-                       if(otypenr<2) val/= 255;
+                       if (otypenr<2) val/= 255;
                        *( (double *)curdata)= val; break;
                case SDNA_TYPE_INT64:
                        *( (int64_t *)curdata)= val; break;
@@ -761,12 +761,12 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
        
        arrlen= DNA_elem_array_size(name, strlen(name));
        
-       while(arrlen>0) {
+       while (arrlen>0) {
        
-               if(curlen==oldlen) {
+               if (curlen==oldlen) {
                        memcpy(curdata, olddata, curlen);
                }
-               else if(curlen==4 && oldlen==8) {
+               else if (curlen==4 && oldlen==8) {
 #ifdef WIN32                   
                        lval= *( (__int64 *)olddata );
 #else
@@ -774,7 +774,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
 #endif
                        *((int *)curdata) = lval>>3;            /* is of course gambling! */
                }
-               else if(curlen==8 && oldlen==4) {
+               else if (curlen==8 && oldlen==4) {
 #ifdef WIN32
                         *( (__int64 *)curdata ) = *((int *)olddata);
 #else
@@ -799,10 +799,10 @@ static int elem_strcmp(const char *name, const char *oname)
        
        /* strcmp without array part */
        
-       while(1) {
-               if(name[a] != oname[a]) return 1;
-               if(name[a]=='[') break;
-               if(name[a]==0) break;
+       while (1) {
+               if (name[a] != oname[a]) return 1;
+               if (name[a]=='[') break;
+               if (name[a]==0) break;
                a++;
        }
        return 0;
@@ -818,16 +818,16 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol
        /* in old is the old struct */
        elemcount= old[1];
        old+= 2;
-       for(a=0; a<elemcount; a++, old+=2) {
+       for (a=0; a<elemcount; a++, old+=2) {
        
                otype= sdna->types[old[0]];
                oname= sdna->names[old[1]];
                
                len= elementsize(sdna, old[0], old[1]);
                
-               if( elem_strcmp(name, oname)==0 ) {     /* naam equal */
-                       if( strcmp(type, otype)==0 ) {  /* type equal */
-                               if(sppo) *sppo= old;
+               if ( elem_strcmp(name, oname)==0 ) {    /* naam equal */
+                       if ( strcmp(type, otype)==0 ) { /* type equal */
+                               if (sppo) *sppo= old;
                                return olddata;
                        }
                        
@@ -858,53 +858,53 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna,
        /* is 'name' an array? */
        cp= name;
        array= 0;
-       while( *cp && *cp!='[') {
+       while ( *cp && *cp!='[') {
                cp++; array++;
        }
-       if( *cp!= '[' ) array= 0;
+       if ( *cp!= '[' ) array= 0;
        
        /* in old is the old struct */
        elemcount= old[1];
        old+= 2;
-       for(a=0; a<elemcount; a++, old+=2) {
+       for (a=0; a<elemcount; a++, old+=2) {
                otype= oldsdna->types[old[0]];
                oname= oldsdna->names[old[1]];
                len= elementsize(oldsdna, old[0], old[1]);
                
-               if( strcmp(name, oname)==0 ) {  /* name equal */
+               if ( strcmp(name, oname)==0 ) { /* name equal */
                        
-                       if(ispointer(name)) {   /* pointer of functionpointer afhandelen */
+                       if (ispointer(name)) {  /* pointer of functionpointer afhandelen */
                                cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata);
                        }
-                       else if( strcmp(type, otype)==0 ) {     /* type equal */
+                       else if ( strcmp(type, otype)==0 ) {    /* type equal */
                                memcpy(curdata, olddata, len);
                        }
                        else cast_elem(type, otype, name, curdata, olddata);
 
                        return;
                }
-               else if(array) {                /* name is an array */
+               else if (array) {               /* name is an array */
 
-                       if(oname[array]=='[' && strncmp(name, oname, array)==0 ) {                      /* basis equal */
+                       if (oname[array]=='[' && strncmp(name, oname, array)==0 ) {                     /* basis equal */
                                
                                cursize= DNA_elem_array_size(name, strlen(name));
                                oldsize= DNA_elem_array_size(oname, strlen(oname));
 
-                               if(ispointer(name)) {           /* handle pointer or functionpointer */
-                                       if(cursize>oldsize) cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, oname, curdata, olddata);
+                               if (ispointer(name)) {          /* handle pointer or functionpointer */
+                                       if (cursize>oldsize) cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, oname, curdata, olddata);
                                        else cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata);
                                }
-                               else if(name[0]=='*' || strcmp(type, otype)==0 ) {      /* type equal */
+                               else if (name[0]=='*' || strcmp(type, otype)==0 ) {     /* type equal */
                                        mul= len/oldsize;
                                        mul*= (cursize < oldsize)? cursize: oldsize;
                                        memcpy(curdata, olddata, mul);
                                        
                                        /* terminate strings */
-                                       if(oldsize > cursize && strcmp(type, "char")==0)
+                                       if (oldsize > cursize && strcmp(type, "char")==0)
                                                curdata[mul-1]= 0;
                                }
                                else {
-                                       if(cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata);
+                                       if (cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata);
                                        else cast_elem(type, otype, name, curdata, olddata);
                                }
                                return;
@@ -926,10 +926,10 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
        char *type, *cpo, *cpc;
        const char *name, *nameo;
 
-       if(oldSDNAnr== -1) return;
-       if(curSDNAnr== -1) return;
+       if (oldSDNAnr== -1) return;
+       if (curSDNAnr== -1) return;
 
-       if( compflags[oldSDNAnr]==1 ) {         /* if recursive: test for equal */
+       if ( compflags[oldSDNAnr]==1 ) {                /* if recursive: test for equal */
        
                spo= oldsdna->structs[oldSDNAnr];
                elen= oldsdna->typelens[ spo[0] ];
@@ -947,19 +947,19 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
 
        spc+= 2;
        cpc= cur;
-       for(a=0; a<elemcount; a++, spc+=2) {
+       for (a=0; a<elemcount; a++, spc+=2) {
                type= newsdna->types[spc[0]];
                name= newsdna->names[spc[1]];
                
                elen= elementsize(newsdna, spc[0], spc[1]);
 
                /* test: is type a struct? */
-               if(spc[0]>=firststructtypenr  &&  !ispointer(name)) {
+               if (spc[0]>=firststructtypenr  &&  !ispointer(name)) {
                
                        /* where does the old struct data start (and is there an old one?) */
                        cpo= find_elem(oldsdna, type, name, spo, data, &sppo);
                        
-                       if(cpo) {
+                       if (cpo) {
                                oldSDNAnr= DNA_struct_find_nr(oldsdna, type);
                                curSDNAnr= DNA_struct_find_nr(newsdna, type);
                                
@@ -973,14 +973,14 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
                                elen/= mul;
                                eleno/= mulo;
                                
-                               while(mul--) {
+                               while (mul--) {
                                        reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc);
                                        cpo+= eleno;
                                        cpc+= elen;
                                        
                                        /* new struct array larger than old */
                                        mulo--;
-                                       if(mulo<=0) break;
+                                       if (mulo<=0) break;
                                }
                        }
                        else cpc+= elen;
@@ -1004,7 +1004,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
        char *type, *cpo, *cur, cval;
        const char *name;
 
-       if(oldSDNAnr== -1) return;
+       if (oldSDNAnr== -1) return;
        firststructtypenr= *(oldsdna->structs[0]);
        
        spo= spc= oldsdna->structs[oldSDNAnr];
@@ -1014,7 +1014,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
        spc+= 2;
        cur= data;
        
-       for(a=0; a<elemcount; a++, spc+=2) {
+       for (a=0; a<elemcount; a++, spc+=2) {
                type= oldsdna->types[spc[0]];
                name= oldsdna->names[spc[1]];
                
@@ -1022,16 +1022,16 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
                elen= elementsize(oldsdna, spc[0], spc[1]);
 
                /* test: is type a struct? */
-               if(spc[0]>=firststructtypenr  &&  !ispointer(name)) {
+               if (spc[0]>=firststructtypenr  &&  !ispointer(name)) {
                        /* where does the old data start (is there one?) */
                        cpo= find_elem(oldsdna, type, name, spo, data, NULL);
-                       if(cpo) {
+                       if (cpo) {
                                oldSDNAnr= DNA_struct_find_nr(oldsdna, type);
                                
                                mul= DNA_elem_array_size(name, strlen(name));
                                elena= elen/mul;
 
-                               while(mul--) {
+                               while (mul--) {
                                        DNA_struct_switch_endian(oldsdna, oldSDNAnr, cpo);
                                        cpo += elena;
                                }
@@ -1039,12 +1039,12 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
                }
                else {
                        
-                       if(ispointer(name)) {
-                               if(oldsdna->pointerlen==8) {
+                       if (ispointer(name)) {
+                               if (oldsdna->pointerlen==8) {
                                        
                                        mul= DNA_elem_array_size(name, strlen(name));
                                        cpo= cur;
-                                       while(mul--) {
+                                       while (mul--) {
                                                cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval;
                                                cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval;
                                                cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval;
@@ -1063,17 +1063,17 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
                                        
                                        /* exception: variable called blocktype/ipowin: derived from ID_  */
                                        skip= 0;
-                                       if(name[0]=='b' && name[1]=='l') {
-                                               if(strcmp(name, "blocktype")==0) skip= 1;
+                                       if (name[0]=='b' && name[1]=='l') {
+                                               if (strcmp(name, "blocktype")==0) skip= 1;
                                        }
-                                       else if(name[0]=='i' && name[1]=='p') {
-                                               if(strcmp(name, "ipowin")==0) skip= 1;
+                                       else if (name[0]=='i' && name[1]=='p') {
+                                               if (strcmp(name, "ipowin")==0) skip= 1;
                                        }
                                        
-                                       if(skip==0) {
+                                       if (skip==0) {
                                                mul= DNA_elem_array_size(name, strlen(name));
                                                cpo= cur;
-                                               while(mul--) {
+                                               while (mul--) {
                                                        cval= cpo[0];
                                                        cpo[0]= cpo[1];
                                                        cpo[1]= cval;
@@ -1089,7 +1089,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 
                                        mul= DNA_elem_array_size(name, strlen(name));
                                        cpo= cur;
-                                       while(mul--) {
+                                       while (mul--) {
                                                cval= cpo[0];
                                                cpo[0]= cpo[3];
                                                cpo[3]= cval;
@@ -1104,7 +1104,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
                                {
                                        mul= DNA_elem_array_size(name, strlen(name));
                                        cpo= cur;
-                                       while(mul--) {
+                                       while (mul--) {
                                                cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval;
                                                cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval;
                                                cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval;
@@ -1132,18 +1132,18 @@ void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int
        curSDNAnr= DNA_struct_find_nr(newsdna, type);
 
        /* init data and alloc */
-       if(curSDNAnr >= 0) {
+       if (curSDNAnr >= 0) {
                spc= newsdna->structs[curSDNAnr];
                curlen= newsdna->typelens[ spc[0] ];
        }
-       if(curlen==0) {
+       if (curlen==0) {
                return NULL;
        }
 
        cur= MEM_callocN( blocks*curlen, "reconstruct");
        cpc= cur;
        cpo= data;
-       for(a=0; a<blocks; a++) {
+       for (a=0; a<blocks; a++) {
                reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc);
                cpc+= curlen;
                cpo+= oldlen;
index 42fe26d87a9d08da985e27174856783dba997401..bd04698107cd8713b3809b924dca483386ffaa09 100644 (file)
@@ -228,7 +228,7 @@ static int add_type(const char *str, int len)
        char *cp;
        
        /* first do validity check */
-       if(str[0]==0) {
+       if (str[0]==0) {
                return -1;
        }
        else if (strchr(str, '*')) {
@@ -238,8 +238,8 @@ static int add_type(const char *str, int len)
        }
        
        /* search through type array */
-       for(nr=0; nr<nr_types; nr++) {
-               if(strcmp(str, types[nr])==0) {
+       for (nr=0; nr<nr_types; nr++) {
+               if (strcmp(str, types[nr])==0) {
                        if (len) {
                                typelens[nr]= len;
                                alphalens[nr] = len;
@@ -249,7 +249,7 @@ static int add_type(const char *str, int len)
        }
        
        /* append new type */
-       if(nr_types==0) cp= typedata;
+       if (nr_types==0) cp= typedata;
        else {
                cp= types[nr_types-1]+strlen(types[nr_types-1])+1;
        }
@@ -258,7 +258,7 @@ static int add_type(const char *str, int len)
        typelens[nr_types]= len;
        alphalens[nr_types]= len;
        
-       if(nr_types>=maxnr) {
+       if (nr_types>=maxnr) {
                printf("too many types\n");
                return nr_types-1;
        }
@@ -285,7 +285,7 @@ static int add_name(const char *str)
 
        additional_slen_offset = 0;
        
-       if(str[0]==0 /*  || (str[1]==0) */) return -1;
+       if (str[0]==0 /*  || (str[1]==0) */) return -1;
 
        if (str[0] == '(' && str[1] == '*') {
                /* we handle function pointer and special array cases here, e.g.
@@ -321,7 +321,7 @@ static int add_name(const char *str)
                                
                if (!isfuncptr) {
                        /* multidimensional array pointer case */
-                       if(str[j] == 0) {
+                       if (str[j] == 0) {
                                if (debugSDNA > 3) printf("offsetting for multidim array pointer\n");
                        }
                        else
@@ -337,10 +337,12 @@ static int add_name(const char *str)
                        }
                        if (debugSDNA > 3) printf("extra offset %d\n", k);
                        additional_slen_offset = k;
-               } else if (str[j] == ')' ) {
+               }
+               else if (str[j] == ')' ) {
                        if (debugSDNA > 3) printf("offsetting for brace\n");
                        ; /* don't get extra offset */
-               } else {
+               }
+               else {
                        printf("Error during tokening function pointer argument list\n");
                }
                                
@@ -368,7 +370,8 @@ static int add_name(const char *str)
                        buf[i+5] = 'd';
                        buf[i+6] = ')';
                        buf[i+7] = 0;
-               } else {
+               }
+               else {
                        buf[i] = ')';
                        buf[i+1] = '(';
                        buf[i+2] = ')';
@@ -377,27 +380,28 @@ static int add_name(const char *str)
                /* now precede with buf*/
                if (debugSDNA > 3)  printf("\t\t\t\t\tProposing fp name %s\n", buf);
                name = buf;
-       } else {
+       }
+       else {
                /* normal field: old code */
                name = str;
        }
        
        /* search name array */
-       for(nr=0; nr<nr_names; nr++) {
-               if(strcmp(name, names[nr])==0) {
+       for (nr=0; nr<nr_names; nr++) {
+               if (strcmp(name, names[nr])==0) {
                        return nr;
                }
        }
        
        /* append new type */
-       if(nr_names==0) cp= namedata;
+       if (nr_names==0) cp= namedata;
        else {
                cp= names[nr_names-1]+strlen(names[nr_names-1])+1;
        }
        strcpy(cp, name);
        names[nr_names]= cp;
        
-       if(nr_names>=maxnr) {
+       if (nr_names>=maxnr) {
                printf("too many names\n");
                return nr_names-1;
        }
@@ -411,7 +415,7 @@ static short *add_struct(int namecode)
        int len;
        short *sp;
 
-       if(nr_structs==0) {
+       if (nr_structs==0) {
                structs[0]= structdata;
        }
        else {
@@ -423,7 +427,7 @@ static short *add_struct(int namecode)
        sp= structs[nr_structs];
        sp[0]= namecode;
        
-       if(nr_structs>=maxnr) {
+       if (nr_structs>=maxnr) {
                printf("too many structs\n");
                return sp;
        }
@@ -449,10 +453,11 @@ static int preprocess_include(char *maindata, int len)
        cp= temp;
        a= len;
        comment = 0;
-       while(a--) {
-               if(cp[0]=='/' && cp[1]=='/') {
+       while (a--) {
+               if (cp[0]=='/' && cp[1]=='/') {
                        comment = 1;
-               } else if (*cp<32) {
+               }
+               else if (*cp<32) {
                        comment = 0;
                }
                if (comment || *cp<32 || *cp>128 ) *cp= 32;
@@ -466,21 +471,21 @@ static int preprocess_include(char *maindata, int len)
        newlen= 0;
        comment= 0;
        a= len;
-       while(a--) {
+       while (a--) {
                
-               if(cp[0]=='/' && cp[1]=='*') {
+               if (cp[0]=='/' && cp[1]=='*') {
                        comment= 1;
                        cp[0]=cp[1]= 32;
                }
-               if(cp[0]=='*' && cp[1]=='/') {
+               if (cp[0]=='*' && cp[1]=='/') {
                        comment= 0;
                        cp[0]=cp[1]= 32;
                }
 
                /* do not copy when: */
-               if(comment);
-               else if( cp[0]==' ' && cp[1]==' ' );
-               else if( cp[-1]=='*' && cp[0]==' ' );   /* pointers with a space */
+               if (comment);
+               else if ( cp[0]==' ' && cp[1]==' ' );
+               else if ( cp[-1]=='*' && cp[0]==' ' );  /* pointers with a space */
 
                /* skip special keywords */
                else if (strncmp("DNA_DEPRECATED", cp, 14)==0) {
@@ -557,26 +562,26 @@ static int convert_include(char *filename)
        /* we look for '{' and then back to 'struct' */
        count= 0;
        overslaan= 0;
-       while(count<filelen) {
+       while (count<filelen) {
                
                /* code for skipping a struct: two hashes on 2 lines. (preprocess added a space) */
-               if(md[0]=='#' && md[1]==' ' && md[2]=='#') {
+               if (md[0]=='#' && md[1]==' ' && md[2]=='#') {
                        overslaan= 1;
                }
                
-               if(md[0]=='{') {
+               if (md[0]=='{') {
                        md[0]= 0;
-                       if(overslaan) {
+                       if (overslaan) {
                                overslaan= 0;
                        }
                        else {
-                               if(md[-1]==' ') md[-1]= 0;
+                               if (md[-1]==' ') md[-1]= 0;
                                md1= md-2;
-                               while( *md1!=32) md1--;         /* to beginning of word */
+                               while ( *md1!=32) md1--;                /* to beginning of word */
                                md1++;
                                
                                /* we've got a struct name when... */
-                               if( strncmp(md1-7, "struct", 6)==0 ) {
+                               if ( strncmp(md1-7, "struct", 6)==0 ) {
 
                                        strct = add_type(md1, 0);
                                        if (strct == -1) {
@@ -591,23 +596,23 @@ static int convert_include(char *filename)
 
                                        /* first lets make it all nice strings */
                                        md1= md+1;
-                                       while(*md1 != '}') {
-                                               if(md1>mainend) break;
+                                       while (*md1 != '}') {
+                                               if (md1>mainend) break;
                                                
-                                               if(*md1==',' || *md1==' ') *md1= 0;
+                                               if (*md1==',' || *md1==' ') *md1= 0;
                                                md1++;
                                        }
                                        
                                        /* read types and names until first character that is not '}' */
                                        md1= md+1;
-                                       while( *md1 != '}' ) {
-                                               if(md1>mainend) break;
+                                       while ( *md1 != '}' ) {
+                                               if (md1>mainend) break;
                                                
                                                /* skip when it says 'struct' or 'unsigned' or 'const' */
-                                               if(*md1) {
-                                                       if( strncmp(md1, "struct", 6)==0 ) md1+= 7;
-                                                       if( strncmp(md1, "unsigned", 8)==0 ) md1+= 9;
-                                                       if( strncmp(md1, "const", 5)==0 ) md1+= 6;
+                                               if (*md1) {
+                                                       if ( strncmp(md1, "struct", 6)==0 ) md1+= 7;
+                                                       if ( strncmp(md1, "unsigned", 8)==0 ) md1+= 9;
+                                                       if ( strncmp(md1, "const", 5)==0 ) md1+= 6;
                                                        
                                                        /* we've got a type! */
                                                        type= add_type(md1, 0);
@@ -622,15 +627,15 @@ static int convert_include(char *filename)
 
                                                        
                                                        /* read until ';' */
-                                                       while( *md1 != ';' ) {
-                                                               if(md1>mainend) break;
+                                                       while ( *md1 != ';' ) {
+                                                               if (md1>mainend) break;
                                                                
-                                                               if(*md1) {
+                                                               if (*md1) {
                                                                        /* We've got a name. slen needs
                                                                         * correction for function
                                                                         * pointers! */
                                                                        slen= (int) strlen(md1);
-                                                                       if( md1[slen-1]==';' ) {
+                                                                       if ( md1[slen-1]==';' ) {
                                                                                md1[slen-1]= 0;
 
 
@@ -688,11 +693,11 @@ static int arraysize(char *astr, int len)
 
        memcpy(str, astr, len+1);
        
-       for(a=0; a<len; a++) {
-               if( str[a]== '[' ) {
+       for (a=0; a<len; a++) {
+               if ( str[a]== '[' ) {
                        cp= &(str[a+1]);
                }
-               else if( str[a]==']' && cp) {
+               else if ( str[a]==']' && cp) {
                        str[a]= 0;
                        /* if 'cp' is a preprocessor definition, it will evaluate to 0,
                         * the caller needs to check for this case and throw an error */
@@ -710,17 +715,17 @@ static int calculate_structlens(int firststruct)
        char *cp;
        int has_pointer, dna_error = 0;
                
-       while(unknown) {
+       while (unknown) {
                lastunknown= unknown;
                unknown= 0;
                
                /* check all structs... */
-               for(a=0; a<nr_structs; a++) {
+               for (a=0; a<nr_structs; a++) {
                        structpoin= structs[a];
                        structtype= structpoin[0];
 
                        /* when length is not known... */
-                       if(typelens[structtype]==0) {
+                       if (typelens[structtype]==0) {
                                
                                sp= structpoin+2;
                                len= 0;
@@ -728,17 +733,17 @@ static int calculate_structlens(int firststruct)
                                has_pointer = 0;
                                
                                /* check all elements in struct */
-                               for(b=0; b<structpoin[1]; b++, sp+=2) {
+                               for (b=0; b<structpoin[1]; b++, sp+=2) {
                                        type= sp[0];
                                        cp= names[sp[1]];
 
                                        namelen= (int) strlen(cp);
                                        /* is it a pointer or function pointer? */
-                                       if(cp[0]=='*' || cp[1]=='*') {
+                                       if (cp[0]=='*' || cp[1]=='*') {
                                                has_pointer = 1;
                                                /* has the name an extra length? (array) */
                                                mul= 1;
-                                               if( cp[namelen-1]==']') mul= arraysize(cp, namelen);
+                                               if ( cp[namelen-1]==']') mul= arraysize(cp, namelen);
 
                                                if (mul == 0) {
                                                        printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp);
@@ -746,12 +751,13 @@ static int calculate_structlens(int firststruct)
                                                }
 
                                                /* 4-8 aligned/ */
-                                               if(sizeof(void *) == 4) {
+                                               if (sizeof(void *) == 4) {
                                                        if (len % 4) {
                                                                printf("Align pointer error in struct (len4): %s %s\n", types[structtype], cp);
                                                                dna_error = 1;
                                                        }
-                                               } else {
+                                               }
+                                               else {
                                                        if (len % 8) {
                                                                printf("Align pointer error in struct (len8): %s %s\n", types[structtype], cp);
                                                                dna_error = 1;
@@ -766,14 +772,16 @@ static int calculate_structlens(int firststruct)
                                                len += sizeof(void *) * mul;
                                                alphalen += 8 * mul;
 
-                                       } else if(cp[0]=='[') {
+                                       }
+                                       else if (cp[0]=='[') {
                                                /* parsing can cause names "var" and "[3]" to be found for "float var [3]" ... */
                                                printf("Parse error in struct, invalid member name: %s %s\n", types[structtype], cp);
                                                dna_error = 1;
-                                       } else if( typelens[type] ) {
+                                       }
+                                       else if ( typelens[type] ) {
                                                /* has the name an extra length? (array) */
                                                mul= 1;
-                                               if( cp[namelen-1]==']') mul= arraysize(cp, namelen);
+                                               if ( cp[namelen-1]==']') mul= arraysize(cp, namelen);
 
                                                if (mul == 0) {
                                                        printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp);
@@ -781,19 +789,19 @@ static int calculate_structlens(int firststruct)
                                                }
 
                                                /* struct alignment */
-                                               if(type >= firststruct) {
-                                                       if(sizeof(void *)==8 && (len % 8) ) {
+                                               if (type >= firststruct) {
+                                                       if (sizeof(void *)==8 && (len % 8) ) {
                                                                printf("Align struct error: %s %s\n", types[structtype],cp);
                                                                dna_error = 1;
                                                        }
                                                }
                                                
                                                /* 2-4 aligned/ */
-                                               if(typelens[type]>3 && (len % 4) ) {
+                                               if (typelens[type]>3 && (len % 4) ) {
                                                        printf("Align 4 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len%4);
                                                        dna_error = 1;
                                                }
-                                               else if(typelens[type]==2 && (len % 2) ) {
+                                               else if (typelens[type]==2 && (len % 2) ) {
                                                        printf("Align 2 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len%2);
                                                        dna_error = 1;
                                                }
@@ -801,7 +809,8 @@ static int calculate_structlens(int firststruct)
                                                len += mul*typelens[type];
                                                alphalen += mul * alphalens[type];
                                                
-                                       } else {
+                                       }
+                                       else {
                                                len= 0;
                                                alphalen = 0;
                                                break;
@@ -810,7 +819,8 @@ static int calculate_structlens(int firststruct)
                                
                                if (len==0) {
                                        unknown++;
-                               } else {
+                               }
+                               else {
                                        typelens[structtype]= len;
                                        alphalens[structtype]= alphalen;
                                        // two ways to detect if a struct contains a pointer:
@@ -822,7 +832,7 @@ static int calculate_structlens(int firststruct)
                                                }
                                        }
                                        
-                                       if(len % 4) {
+                                       if (len % 4) {
                                                printf("Sizeerror 4 in struct: %s (add %d bytes)\n", types[structtype], len%4);
                                                dna_error = 1;
                                        }
@@ -831,21 +841,21 @@ static int calculate_structlens(int firststruct)
                        }
                }
                
-               if(unknown==lastunknown) break;
+               if (unknown==lastunknown) break;
        }
        
-       if(unknown) {
+       if (unknown) {
                printf("ERROR: still %d structs unknown\n", unknown);
 
                if (debugSDNA) {
                        printf("*** Known structs : \n");
                        
-                       for(a=0; a<nr_structs; a++) {
+                       for (a=0; a<nr_structs; a++) {
                                structpoin= structs[a];
                                structtype= structpoin[0];
                                
                                /* length unknown */
-                               if(typelens[structtype]!=0) {
+                               if (typelens[structtype]!=0) {
                                        printf("  %s\n", types[structtype]);
                                }
                        }
@@ -854,12 +864,12 @@ static int calculate_structlens(int firststruct)
                        
                printf("*** Unknown structs : \n");
                        
-               for(a=0; a<nr_structs; a++) {
+               for (a=0; a<nr_structs; a++) {
                        structpoin= structs[a];
                        structtype= structpoin[0];
 
                        /* length unknown yet */
-                       if(typelens[structtype]==0) {
+                       if (typelens[structtype]==0) {
                                printf("  %s\n", types[structtype]);
                        }
                }
@@ -896,12 +906,12 @@ void printStructLenghts(void)
        short *structpoin;
        printf("\n\n*** All detected structs:\n");
 
-       while(unknown) {
+       while (unknown) {
                /*lastunknown= unknown;*/ /*UNUSED*/
                unknown= 0;
                
                /* check all structs... */
-               for(a=0; a<nr_structs; a++) {
+               for (a=0; a<nr_structs; a++) {
                        structpoin= structs[a];
                        structtype= structpoin[0];
                        printf("\t%s\t:%d\n", types[structtype], typelens[structtype]);
@@ -984,24 +994,24 @@ static int make_structDNA(char *baseDirectory, FILE *file)
                short num_types;
 
                printf("nr_names %d nr_types %d nr_structs %d\n", nr_names, nr_types, nr_structs);
-               for(a=0; a<nr_names; a++) { 
+               for (a=0; a<nr_names; a++) { 
                        printf(" %s \n", names[a]);
                }
                printf("\n");
                
                sp= typelens;
-               for(a=0; a<nr_types; a++, sp++) { 
+               for (a=0; a<nr_types; a++, sp++) { 
                        printf(" %s %d\n", types[a], *sp);
                }
                printf("\n");
                
-               for(a=0; a<nr_structs; a++) {
+               for (a=0; a<nr_structs; a++) {
                        sp= structs[a];
                        printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1],typelens[sp[0]]);
                        num_types  = sp[1];
                        sp+= 2;
                        /* ? num_types was elem? */
-                       for(b=0; b< num_types; b++, sp+= 2) {
+                       for (b=0; b< num_types; b++, sp+= 2) {
                                printf("   %s %s\n", types[sp[0]], names[sp[1]]);
                        }
                }
@@ -1011,7 +1021,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
 
        if (debugSDNA > -1) printf("Writing file ... ");
                
-       if(nr_names==0 || nr_structs==0);
+       if (nr_names==0 || nr_structs==0);
        else {
                strcpy(str, "SDNA");
                dna_write(file, str, 4);
@@ -1048,7 +1058,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
                dna_write(file, str, 4);
                
                len= 2*nr_types;
-               if(nr_types & 1) len+= 2;
+               if (nr_types & 1) len+= 2;
                dna_write(file, typelens, len);
                
                /* WRITE STRUCTS */
@@ -1071,7 +1081,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
                        int a;
                        
                        fp= fopen("padding.c", "w");
-                       if(fp==NULL);
+                       if (fp==NULL);
                        else {
 
                                // add all include files defined in the global array
@@ -1079,11 +1089,11 @@ static int make_structDNA(char *baseDirectory, FILE *file)
                                        fprintf(fp, "#include \"%s%s\"\n", baseDirectory, includefiles[i]);
                                }
 
-                               fprintf(fp, "main(){\n");
+                               fprintf(fp, "main() {\n");
                                sp = typelens;
                                sp += firststruct;
-                               for(a=firststruct; a<nr_types; a++, sp++) { 
-                                       if(*sp) {
+                               for (a=firststruct; a<nr_types; a++, sp++) { 
+                                       if (*sp) {
                                                fprintf(fp, "\tif(sizeof(struct %s) - %d) printf(\"ALIGN ERROR:", types[a], *sp);
                                                fprintf(fp, "%%d %s %d ", types[a], *sp);
                                                fprintf(fp, "\\n\",  sizeof(struct %s) - %d);\n", types[a], *sp);
@@ -1132,17 +1142,20 @@ int main(int argc, char ** argv)
        if (argc!=2 && argc!=3) {
                printf("Usage: %s outfile.c [base directory]\n", argv[0]);
                return_status = 1;
-       } else {
+       }
+       else {
                file = fopen(argv[1], "w");
                if (!file) {
                        printf ("Unable to open file: %s\n", argv[1]);
                        return_status = 1;
-               } else {
+               }
+               else {
                        char baseDirectory[256];
 
                        if (argc==3) {
                                strcpy(baseDirectory, argv[2]);
-                       } else {
+                       }
+                       else {
                                strcpy(baseDirectory, BASE_HEADER);
                        }
 
@@ -1152,7 +1165,8 @@ int main(int argc, char ** argv)
                                fclose(file);
                                make_bad_file(argv[1], __LINE__);
                                return_status = 1;
-                       } else {
+                       }
+                       else {
                                fprintf(file, "};\n");
                                fprintf(file, "int DNAlen= sizeof(DNAstr);\n");
        
index 4c5fc709d7edfd575557c10f0ed7ed83d117d684..473934c3b443b2e4cae60df5e149cab8a13b50e6 100644 (file)
@@ -607,12 +607,12 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                                                                                        "get_length");
                                                fprintf(f, "    int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
                                                fprintf(f, "    int len= %s(ptr, arraylen);\n\n", lenfunc);
-                                               fprintf(f, "    for(i=0; i<len; i++) {\n");
+                                               fprintf(f, "    for (i=0; i<len; i++) {\n");
                                                MEM_freeN(lenfunc);
                                        }
                                        else {
                                                fprintf(f, "    int i;\n\n");
-                                               fprintf(f, "    for(i=0; i<%u; i++) {\n", prop->totarraylength);
+                                               fprintf(f, "    for (i=0; i<%u; i++) {\n", prop->totarraylength);
                                        }
 
                                        if (dp->dnaarraylength == 1) {
@@ -801,20 +801,20 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 
                                if (prop->flag & PROP_ID_SELF_CHECK) {
                                        rna_print_id_get(f, dp);
-                                       fprintf(f, "    if(id==value.data) return;\n\n");
+                                       fprintf(f, "    if (id==value.data) return;\n\n");
                                }
 
                                if (prop->flag & PROP_ID_REFCOUNT) {
-                                       fprintf(f, "\n  if(data->%s)\n", dp->dnaname);
+                                       fprintf(f, "\n  if (data->%s)\n", dp->dnaname);
                                        fprintf(f, "            id_us_min((ID*)data->%s);\n", dp->dnaname);
-                                       fprintf(f, "    if(value.data)\n");
+                                       fprintf(f, "    if (value.data)\n");
                                        fprintf(f, "            id_us_plus((ID*)value.data);\n\n");
                                }
                                else {
                                        PointerPropertyRNA *pprop = (PointerPropertyRNA*)dp->prop;
                                        StructRNA *type = rna_find_struct((const char*)pprop->type);
                                        if (type && (type->flag & STRUCT_ID)) {
-                                               fprintf(f, "    if(value.data)\n");
+                                               fprintf(f, "    if (value.data)\n");
                                                fprintf(f, "            id_lib_extern((ID*)value.data);\n\n");
                                        }
                                }
@@ -846,18 +846,18 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                                                fprintf(f, "    int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
                                                fprintf(f, "    int len= %s(ptr, arraylen);\n\n", lenfunc);
                                                rna_clamp_value_range(f, prop);
-                                               fprintf(f, "    for(i=0; i<len; i++) {\n");
+                                               fprintf(f, "    for (i=0; i<len; i++) {\n");
                                                MEM_freeN(lenfunc);
                                        }
                                        else {
                                                fprintf(f, "    int i;\n\n");
                                                rna_clamp_value_range(f, prop);
-                                               fprintf(f, "    for(i=0; i<%u; i++) {\n", prop->totarraylength);
+                                               fprintf(f, "    for (i=0; i<%u; i++) {\n", prop->totarraylength);
                                        }
 
                                        if (dp->dnaarraylength == 1) {
                                                if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
-                                                       fprintf(f, "            if(%svalues[i]) data->%s |= (%d<<i);\n",
+                                                       fprintf(f, "            if (%svalues[i]) data->%s |= (%d<<i);\n",
                                                                (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
                                                        fprintf(f, "            else data->%s &= ~(%d<<i);\n", dp->dnaname, dp->booleanbit);
                                                }
@@ -868,7 +868,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                                        }
                                        else {
                                                if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
-                                                       fprintf(f, "            if(%svalues[i]) data->%s[i] |= ", (dp->booleannegative) ? "!" : "",
+                                                       fprintf(f, "            if (%svalues[i]) data->%s[i] |= ", (dp->booleannegative) ? "!" : "",
                                                                dp->dnaname);
                                                        rna_int_print(f, dp->booleanbit);
                                                        fprintf(f, ";\n");
@@ -902,7 +902,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                                else {
                                        rna_print_data_get(f, dp);
                                        if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
-                                               fprintf(f, "    if(%svalue) data->%s |= ", (dp->booleannegative) ? "!" : "", dp->dnaname);
+                                               fprintf(f, "    if (%svalue) data->%s |= ", (dp->booleannegative) ? "!" : "", dp->dnaname);
                                                rna_int_print(f, dp->booleanbit);
                                                fprintf(f, ";\n");
                                                fprintf(f, "    else data->%s &= ~", dp->dnaname);
@@ -1043,7 +1043,7 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *
 
        getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
 
-       fprintf(f, "\n  if(iter->valid)\n");
+       fprintf(f, "\n  if (iter->valid)\n");
        fprintf(f, "            iter->ptr= %s(iter);\n", getfunc);
 
        fprintf(f, "}\n\n");
@@ -1087,19 +1087,19 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
        fprintf(f, "    CollectionPropertyIterator iter;\n\n");
 
        fprintf(f, "    %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
-       fprintf(f, "    if(iter.valid){\n");
+       fprintf(f, "    if (iter.valid) {\n");
 
        if (strcmp(nextfunc, "rna_iterator_array_next") == 0) {
                fprintf(f, "            ArrayIterator *internal= iter.internal;\n");
-               fprintf(f, "            if(index < 0 || index >= internal->length) {\n");
+               fprintf(f, "            if (index < 0 || index >= internal->length) {\n");
                fprintf(f, "#ifdef __GNUC__\n");
                fprintf(f, "                    printf(\"Array iterator out of range: %%s (index %%d)\\n\", __func__, index);\n");
                fprintf(f, "#else\n");
                fprintf(f, "                    printf(\"Array iterator out of range: (index %%d)\\n\", index);\n");
                fprintf(f, "#endif\n");
                fprintf(f, "            }\n");
-               fprintf(f, "            else if(internal->skip) {\n");
-               fprintf(f, "                    while(index-- > 0 && iter.valid) {\n");
+               fprintf(f, "            else if (internal->skip) {\n");
+               fprintf(f, "                    while (index-- > 0 && iter.valid) {\n");
                fprintf(f, "                            rna_iterator_array_next(&iter);\n");
                fprintf(f, "                    }\n");
                fprintf(f, "                    found= (index == -1 && iter.valid);\n");
@@ -1111,20 +1111,20 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
        }
        else if (strcmp(nextfunc, "rna_iterator_listbase_next") == 0) {
                fprintf(f, "            ListBaseIterator *internal= iter.internal;\n");
-               fprintf(f, "            if(internal->skip) {\n");
-               fprintf(f, "                    while(index-- > 0 && iter.valid) {\n");
+               fprintf(f, "            if (internal->skip) {\n");
+               fprintf(f, "                    while (index-- > 0 && iter.valid) {\n");
                fprintf(f, "                            rna_iterator_listbase_next(&iter);\n");
                fprintf(f, "                    }\n");
                fprintf(f, "                    found= (index == -1 && iter.valid);\n");
                fprintf(f, "            }\n");
                fprintf(f, "            else {\n");
-               fprintf(f, "                    while(index-- > 0 && internal->link)\n");
+               fprintf(f, "                    while (index-- > 0 && internal->link)\n");
                fprintf(f, "                            internal->link= internal->link->next;\n");
                fprintf(f, "                    found= (index == -1 && internal->link);\n");
                fprintf(f, "            }\n");
        }
 
-       fprintf(f, "            if(found) *r_ptr = %s_%s_get(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
+       fprintf(f, "            if (found) *r_ptr = %s_%s_get(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
        fprintf(f, "    }\n\n");
        fprintf(f, "    %s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier));
 
@@ -1175,7 +1175,7 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p
 
        getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
 
-       fprintf(f, "\n  if(iter->valid)\n");
+       fprintf(f, "\n  if (iter->valid)\n");
        fprintf(f, "            iter->ptr= %s(iter);\n", getfunc);
 
        fprintf(f, "}\n\n");
@@ -2754,7 +2754,7 @@ static void rna_generate_header(BlenderRNA *brna, FILE *f)
        fprintf(f, "#define FOREACH_BEGIN(property, sptr, itemptr) \\\n");
        fprintf(f, "    { \\\n");
        fprintf(f, "            CollectionPropertyIterator rna_macro_iter; \\\n");
-       fprintf(f, "            for(property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; "
+       fprintf(f, "            for (property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; "
                   "property##_next(&rna_macro_iter)) { \\\n");
        fprintf(f, "                    itemptr= rna_macro_iter.ptr;\n\n");
 
index f2a37dec5d503dcd5826a5b25d9944304dae6f4d..d2537f9fabd1fce16412c194249e6a6796048320 100644 (file)
@@ -1179,7 +1179,8 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA
 
                if (*free) {
                        nitem = *item;
-               } else {
+               }
+               else {
                        int totitem = 0;
 
                        /* count */
@@ -2721,7 +2722,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
 
        /* py api calls directly */
 #if 0
-       else if (cprop->add){
+       else if (cprop->add) {
                if (!(cprop->add->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
                        ParameterList params;
                        RNA_parameter_list_create(&params, ptr, cprop->add);
@@ -2778,7 +2779,7 @@ int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
 
        /* py api calls directly */
 #if 0
-       else if (cprop->remove){
+       else if (cprop->remove) {
                if (!(cprop->remove->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
                        ParameterList params;
                        RNA_parameter_list_create(&params, ptr, cprop->remove);
index 708d3ad06990ded5f50f2bd346fb5e87b3f9e926..c24b78a155c850cbb07774a6b70ff1917fbf7c12 100644 (file)
@@ -341,11 +341,13 @@ static void rna_ActionActuator_add_set(struct PointerRNA *ptr, int value)
        bActuator *act = (bActuator *)ptr->data;
        bActionActuator *aa = act->data;
 
-       if (value == 1){
+       if (value == 1) {
                aa->flag &= ~ACT_IPOFORCE;
                aa->flag |= ACT_IPOADD;
-       }else
+       }
+       else {
                aa->flag &= ~ACT_IPOADD;
+       }
 }
 
 static void rna_ActionActuator_force_set(struct PointerRNA *ptr, int value)
@@ -353,11 +355,13 @@ static void rna_ActionActuator_force_set(struct PointerRNA *ptr, int value)
        bActuator *act = (bActuator *)ptr->data;
        bActionActuator *aa = act->data;
 
-       if (value == 1){
+       if (value == 1) {
                aa->flag &= ~ACT_IPOADD;
                aa->flag |= ACT_IPOFORCE;
-       }else
+       }
+       else {
                aa->flag &= ~ACT_IPOFORCE;
+       }
 }
 
 static void rna_ObjectActuator_type_set(struct PointerRNA *ptr, int value)
@@ -422,9 +426,10 @@ EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, Property
        Object *ob = NULL;
        int totitem = 0;
        
-       if (ptr->type == &RNA_Actuator || RNA_struct_is_a(ptr->type, &RNA_Actuator)){
+       if (ptr->type == &RNA_Actuator || RNA_struct_is_a(ptr->type, &RNA_Actuator)) {
                ob = (Object *)ptr->id.data;
-       } else {
+       }
+       else {
                /* can't use ob from ptr->id.data because that enum is also used by operators */
                ob = CTX_data_active_object(C);
        }
index 6c067bba4e7df9244115e5a21ee1b49762a348d2..8c219e9440773f9d0f8371be20dca6fcba81a6a1 100644 (file)
@@ -316,7 +316,8 @@ static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float
        if (ELEM3(acon->type, 0, 1, 2)) {
                *min = -180.0f;
                *max = 180.0f;
-       } else {
+       }
+       else {
                *min = -1000.f;
                *max = 1000.f;
        }
@@ -374,7 +375,8 @@ static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr, PointerRNA va
                if (ob->type == OB_CAMERA && ob != (Object*)ptr->id.data) {
                        data->camera = ob;
                }
-       } else {
+       }
+       else {
                data->camera = NULL;
        }
 }
@@ -389,7 +391,8 @@ static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr, PointerR
                if (ob->type == OB_MESH && ob != (Object*)ptr->id.data) {
                        data->depth_ob = ob;
                }
-       } else {
+       }
+       else {
                data->depth_ob = NULL;
        }
 }
@@ -417,7 +420,8 @@ static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr, PointerRNA v
                if (ob->type == OB_CAMERA && ob != (Object*)ptr->id.data) {
                        data->camera = ob;
                }
-       } else {
+       }
+       else {
                data->camera = NULL;
        }
 }
index bb6d5ba93abe4ea925593e9c241e756e6e90ab14..94ef3018812cf9bbee2d8d58cda214d4c90d1a64 100644 (file)
@@ -353,7 +353,8 @@ static void rna_Curve_bevelObject_set(PointerRNA *ptr, PointerRNA value)
                if (ob->type == OB_CURVE && ob->data != cu) {
                        cu->bevobj = ob;
                }
-       } else {
+       }
+       else {
                cu->bevobj = NULL;
        }
 }
@@ -394,7 +395,8 @@ static void rna_Curve_taperObject_set(PointerRNA *ptr, PointerRNA value)
                if (ob->type == OB_CURVE && ob->data != cu) {
                        cu->taperobj = ob;
                }
-       } else {
+       }
+       else {
                cu->taperobj = NULL;
        }
 }
@@ -480,7 +482,8 @@ static void rna_Nurb_update_cyclic_u(Main *bmain, Scene *scene, PointerRNA *ptr)
 
        if (nu->type == CU_BEZIER) {
                calchandlesNurb(nu);
-       } else {
+       }
+       else {
                nurbs_knot_calc_u(nu);
        }
 
@@ -523,7 +526,8 @@ static void rna_Curve_spline_points_add(ID *id, Nurb *nu, ReportList *reports, i
        }
        else if (number == 0) {
                /* do nothing */
-       } else {
+       }
+       else {
 
                addNurbPoints(nu, number);
 
@@ -541,7 +545,8 @@ static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, ReportList *reports
        }
        else if (number == 0) {
                /* do nothing */
-       } else {
+       }
+       else {
                addNurbPointsBezier(nu, number);
 
                /* update */
index 5d68bcbd4d79088649b218a6b98f8a96df17c871..651b6fd9c160f1b76e7149ccdddc15f5ad5f744b 100644 (file)
@@ -508,8 +508,8 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
        PropertyRNA *parm, *nextparm;
 
        /*
-       if(srna->flag & STRUCT_RUNTIME) {
-               if(RNA_struct_py_type_get(srna)) {
+       if (srna->flag & STRUCT_RUNTIME) {
+               if (RNA_struct_py_type_get(srna)) {
                        fprintf(stderr, "%s '%s' freed while holding a python reference\n", __func__, srna->identifier);
                }
        } */
@@ -2717,7 +2717,8 @@ int rna_parameter_size(PropertyRNA *parm)
                                if (parm->flag & PROP_THICK_WRAP) {
                                        StringPropertyRNA *sparm = (StringPropertyRNA*)parm;
                                        return sizeof(char) * sparm->maxlength;
-                               } else
+                               }
+                               else
                                        return sizeof(char *);
                        case PROP_POINTER: {
 #ifdef RNA_RUNTIME
@@ -2762,7 +2763,7 @@ void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropert
        if (tot == 0) {
                *items = MEM_callocN(sizeof(EnumPropertyItem)*8, "RNA_enum_items_add");
        }
-       else if (tot >= 8 && (tot&(tot-1)) == 0){
+       else if (tot >= 8 && (tot&(tot-1)) == 0) {
                /* power of two > 8 */
                newitems = MEM_callocN(sizeof(EnumPropertyItem)*tot*2, "RNA_enum_items_add");
                memcpy(newitems, *items, sizeof(EnumPropertyItem)*tot);
index f8b2b07aa180fc2c5eced2caf390f7ba2651c123..e5a0f43baf37ff0d43fbfb963d4e8a36cc1ad7a1 100644 (file)
@@ -191,7 +191,7 @@ static void rna_Image_file_format_set(PointerRNA *ptr, int value)
 
                /*
                ibuf= BKE_image_get_ibuf(image, NULL);
-               if(ibuf)
+               if (ibuf)
                        ibuf->ftype= ftype;
                */
 
index f950729a0f09762f02774e74bc51aa7b704de208..1b50db36a3d93af60160a3fabe08f724bef43d56 100644 (file)
@@ -94,7 +94,8 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
                }
 
                BKE_image_release_ibuf(image, lock);
-       } else {
+       }
+       else {
                BKE_reportf(reports, RPT_ERROR, "Scene not in context, couldn't get save parameters");
        }
 }
index 0e7df0df8ad66c758a3a2c06f925e1581612d281..e3cf9af6c39a13be118c38392b1e5f44c5db14b3 100644 (file)
@@ -869,20 +869,27 @@ static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr)
        if (!(ob->gameflag & OB_COLLISION)) {
                if (ob->gameflag & OB_OCCLUDER) {
                        ob->body_type = OB_BODY_TYPE_OCCLUDER;
-               } else if (ob->gameflag & OB_NAVMESH){
+               }
+               else if (ob->gameflag & OB_NAVMESH) {
                        ob->body_type = OB_BODY_TYPE_NAVMESH;
-               } else {
+               }
+               else {
                        ob->body_type = OB_BODY_TYPE_NO_COLLISION;
                }
-       } else if (ob->gameflag & OB_SENSOR) {
+       }
+       else if (ob->gameflag & OB_SENSOR) {
                ob->body_type = OB_BODY_TYPE_SENSOR;
-       } else if (!(ob->gameflag & OB_DYNAMIC)) {
+       }
+       else if (!(ob->gameflag & OB_DYNAMIC)) {
                ob->body_type = OB_BODY_TYPE_STATIC;
-       } else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) {
+       }
+       else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) {
                ob->body_type = OB_BODY_TYPE_DYNAMIC;
-       } else if (ob->gameflag & OB_RIGID_BODY) {
+       }
+       else if (ob->gameflag & OB_RIGID_BODY) {
                ob->body_type = OB_BODY_TYPE_RIGID;
-       } else {
+       }
+       else {
                ob->body_type = OB_BODY_TYPE_SOFT;
                /* create the structure here because we display soft body buttons in the main panel */
                if (!ob->bsoft)
index 69b948e17a1e5fd6881a72a59e6851366fa07f92..0e97729c52c9babceee4d9f9d5a6250e2e39f449 100644 (file)
@@ -155,7 +155,8 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
                        /* copies the data */
                        tmpmesh = copy_mesh( ob->data );
                /* if not getting the original caged mesh, get final derived mesh */
-               } else {
+               }
+               else {
                        /* Make a dummy mesh, saves copying */
                        DerivedMesh *dm;
                        /* CustomDataMask mask = CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL; */
index a2fb8dd9850e18bf61f992a88bad027c2ab3583b..be28300eb018c1fb7c56c43075a48585f8cf78c2 100644 (file)
@@ -570,7 +570,8 @@ static char *rna_FieldSettings_path(PointerRNA *ptr)
                        return BLI_sprintfN("force_field_1");
                else if (part->pd2 == pd)
                        return BLI_sprintfN("force_field_2");
-       } else {
+       }
+       else {
                /* object force field */
                Object *ob = (Object*)ptr->id.data;
                
@@ -607,7 +608,8 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr)
                
                if (part->effector_weights == ew)
                        return BLI_sprintfN("effector_weights");
-       } else {
+       }
+       else {
                Object *ob = (Object*)ptr->id.data;
                ModifierData *md;
                
index fd6c45c28281e9e323d6e3fcb8eebac1f18ab8fa..3eac129a195880e675596e61638587bc62194d53 100644 (file)
@@ -52,7 +52,7 @@ static StructRNA* rna_GameProperty_refine(struct PointerRNA *ptr)
 {
        bProperty *property = (bProperty*)ptr->data;
 
-       switch (property->type){
+       switch (property->type) {
                case GPROP_BOOL:
                        return &RNA_GameBooleanProperty;
                case GPROP_INT:
index 80c654b9c102d5c7c538aadc7870a92e9a1c1edf..ff336ba669328aa8ff4c2ebabad429ba3489242b 100644 (file)
@@ -146,7 +146,8 @@ EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRN
 
        if (ptr->type == &RNA_Sensor || RNA_struct_is_a(ptr->type, &RNA_Sensor)) {
                ob = (Object *)ptr->id.data;
-       } else {
+       }
+       else {
                /* can't use ob from ptr->id.data because that enum is also used by operators */
                ob = CTX_data_active_object(C);
        }
index 5365c16cc3d211a17398684d02ff41ded1f0ab5e..3491371ac06b2039905d359ae71a8f3b32939fd9 100644 (file)
@@ -231,7 +231,8 @@ static void rna_Sequence_use_color_balance_set(PointerRNA *ptr, int value)
                                seq->strip->color_balance->gain[c] = 1.0f;
                        }
                }
-       } else {
+       }
+       else {
                seq->flag ^= SEQ_USE_COLOR_BALANCE;
        }
 }
@@ -248,7 +249,8 @@ static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value)
                        seq->strip->proxy->build_size_flags
                                = SEQ_PROXY_IMAGE_SIZE_25;
                }
-       } else {
+       }
+       else {
                seq->flag ^= SEQ_USE_PROXY;
        }
 }
@@ -261,7 +263,8 @@ static void rna_Sequence_use_translation_set(PointerRNA *ptr, int value)
                if (seq->strip->transform == NULL) {
                        seq->strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform");
                }
-       } else {
+       }
+       else {
                seq->flag ^= SEQ_USE_TRANSFORM;
        }
 }
@@ -274,7 +277,8 @@ static void rna_Sequence_use_crop_set(PointerRNA *ptr, int value)
                if (seq->strip->crop == NULL) {
                        seq->strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop");
                }
-       } else {
+       }
+       else {
                seq->flag ^= SEQ_USE_CROP;
        }
 }
index 65350ba42a72448617a8d4615c951cf5e12d6f06..7cf2475f9de54328397ebc19acada2f28b99a97f 100644 (file)
@@ -602,7 +602,8 @@ static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *val
        
        if (sima->flag & SI_COORDFLOATS) {
                copy_v2_v2(values, sima->cursor);
-       } else {
+       }
+       else {
                int w, h;
                ED_space_image_size(sima, &w, &h);
                
@@ -617,7 +618,8 @@ static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const floa
        
        if (sima->flag & SI_COORDFLOATS) {
                copy_v2_v2(sima->cursor, values);
-       } else {
+       }
+       else {
                int w, h;
                ED_space_image_size(sima, &w, &h);
                
index 360f82226190543a4b95f3a1f3eb42db1a7d9977..4fad3aaf81509976ab64df29b8bc279ae4994c6b 100644 (file)
@@ -790,7 +790,7 @@ static void rna_def_userdef_theme_space_generic(BlenderRNA *brna)
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
        /* buttons */
-/*     if(! ELEM(spacetype, SPACE_BUTS, SPACE_OUTLINER)) { */
+/*     if (! ELEM(spacetype, SPACE_BUTS, SPACE_OUTLINER)) { */
        prop = RNA_def_property(srna, "button", PROP_FLOAT, PROP_COLOR_GAMMA);
        RNA_def_property_array(prop, 3);
        RNA_def_property_ui_text(prop, "Region Background", "");
index 28174bb56c64aa7c3cd5be4ddfdcd5c9c5ad4b8d..bad122ab76180d3eb16bc4132869844ca7cb9fa5 100644 (file)
@@ -144,7 +144,8 @@ static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int sp
 {
        if (modal == 0) {
                return WM_keymap_find(keyconf, idname, spaceid, regionid);
-       } else {
+       }
+       else {
                return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
        }
 }
index 7260e39e9829a2a1963a941cac489aa4bd1aab2f..fd9730238f570cbeb46fc4f260960d453fe672a9 100644 (file)
@@ -129,7 +129,7 @@ static void deformVerts(ModifierData *md, Object *ob,
                numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
 
        /* free cache */
-       if(amd->prevCos) {
+       if (amd->prevCos) {
                MEM_freeN(amd->prevCos);
                amd->prevCos= NULL;
        }
@@ -142,7 +142,7 @@ static void deformVertsEM(
        ArmatureModifierData *amd = (ArmatureModifierData*) md;
        DerivedMesh *dm = derivedData;
 
-       if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+       if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
 
        modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
 
@@ -150,12 +150,12 @@ static void deformVertsEM(
                numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
 
        /* free cache */
-       if(amd->prevCos) {
+       if (amd->prevCos) {
                MEM_freeN(amd->prevCos);
                amd->prevCos= NULL;
        }
 
-       if(!derivedData) dm->release(dm);
+       if (!derivedData) dm->release(dm);
 }
 
 static void deformMatricesEM(
@@ -166,12 +166,12 @@ static void deformMatricesEM(
        ArmatureModifierData *amd = (ArmatureModifierData*) md;
        DerivedMesh *dm = derivedData;
 
-       if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+       if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
 
        armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts,
                              amd->deformflag, NULL, amd->defgrp_name);
 
-       if(!derivedData) dm->release(dm);
+       if (!derivedData) dm->release(dm);
 }
 
 static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedData,
@@ -180,12 +180,12 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat
        ArmatureModifierData *amd = (ArmatureModifierData*) md;
        DerivedMesh *dm = derivedData;
 
-       if(!derivedData) dm = CDDM_from_mesh((Mesh*)ob->data, ob);
+       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);
 
-       if(!derivedData) dm->release(dm);
+       if (!derivedData) dm->release(dm);
 }
 
 ModifierTypeInfo modifierType_Armature = {
index 13c1739bd3f21dd71dafb25a35bbf117e20cb413..621be8023a298b86b4b89f6fe8f326aa8f3ca4e6 100644 (file)
@@ -149,14 +149,14 @@ static float vertarray_size(MVert *mvert, int numVerts, int axis)
        float min_co, max_co;
 
        /* if there are no vertices, width is 0 */
-       if(numVerts == 0) return 0;
+       if (numVerts == 0) return 0;
 
        /* find the minimum and maximum coordinates on the desired axis */
        min_co = max_co = mvert->co[axis];
        ++mvert;
-       for(i = 1; i < numVerts; ++i, ++mvert) {
-               if(mvert->co[axis] < min_co) min_co = mvert->co[axis];
-               if(mvert->co[axis] > max_co) max_co = mvert->co[axis];
+       for (i = 1; i < numVerts; ++i, ++mvert) {
+               if (mvert->co[axis] < min_co) min_co = mvert->co[axis];
+               if (mvert->co[axis] > max_co) max_co = mvert->co[axis];
        }
 
        return max_co - min_co;
@@ -204,9 +204,9 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
        MVert *src_mvert;
 
        /* need to avoid infinite recursion here */
-       if(amd->start_cap && amd->start_cap != ob)
+       if (amd->start_cap && amd->start_cap != ob)
                start_cap = mesh_get_derived_final(scene, amd->start_cap, CD_MASK_MESH);
-       if(amd->end_cap && amd->end_cap != ob)
+       if (amd->end_cap && amd->end_cap != ob)
                end_cap = mesh_get_derived_final(scene, amd->end_cap, CD_MASK_MESH);
 
        unit_m4(offset);
@@ -214,19 +214,19 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
        src_mvert = dm->getVertArray(dm);
        maxVerts = dm->getNumVerts(dm);
 
-       if(amd->offset_type & MOD_ARR_OFF_CONST)
+       if (amd->offset_type & MOD_ARR_OFF_CONST)
                add_v3_v3v3(offset[3], offset[3], amd->offset);
-       if(amd->offset_type & MOD_ARR_OFF_RELATIVE) {
-               for(j = 0; j < 3; j++)
+       if (amd->offset_type & MOD_ARR_OFF_RELATIVE) {
+               for (j = 0; j < 3; j++)
                        offset[3][j] += amd->scale[j] * vertarray_size(src_mvert,
                                        maxVerts, j);
        }
 
-       if((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) {
+       if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) {
                float obinv[4][4];
                float result_mat[4][4];
 
-               if(ob)
+               if (ob)
                        invert_m4_m4(obinv, ob->obmat);
                else
                        unit_m4(obinv);
@@ -240,36 +240,36 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
        /* calculate the offset matrix of the final copy (for merging) */
        unit_m4(final_offset);
 
-       for(j=0; j < count - 1; j++) {
+       for (j=0; j < count - 1; j++) {
                mult_m4_m4m4(tmp_mat, offset, final_offset);
                copy_m4_m4(final_offset, tmp_mat);
        }
 
-       if(amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob) {
+       if (amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob) {
                Curve *cu = amd->curve_ob->data;
-               if(cu) {
+               if (cu) {
                        float tmp_mat[3][3];
                        float scale;
                        
                        object_to_mat3(amd->curve_ob, tmp_mat);
                        scale = mat3_to_scale(tmp_mat);
                                
-                       if(!cu->path) {
+                       if (!cu->path) {
                                cu->flag |= CU_PATH; // needed for path & bevlist
                                makeDispListCurveTypes(scene, amd->curve_ob, 0);
                        }
-                       if(cu->path)
+                       if (cu->path)
                                length = scale*cu->path->totdist;
                }
        }
 
        /* calculate the maximum number of copies which will fit within the
         * prescribed length */
-       if(amd->fit_type == MOD_ARR_FITLENGTH
+       if (amd->fit_type == MOD_ARR_FITLENGTH
                  || amd->fit_type == MOD_ARR_FITCURVE) {
                float dist = sqrt(dot_v3v3(offset[3], offset[3]));
 
-               if(dist > 1e-6f)
+               if (dist > 1e-6f)
                        /* this gives length = first copy start to last copy end
                         * add a tiny offset for floating point rounding errors */
                        count = (length + 1e-6f) / dist;
@@ -278,7 +278,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
                        count = 1;
        }
 
-       if(count < 1)
+       if (count < 1)
                count = 1;
 
        /* BMESH_TODO: bumping up the stack level avoids computing the normals
index 8b29ef952af9bdb09187a062fba9b2501f1f2338..4bfcd86733c53fb258935047f89d9b504d81796a 100644 (file)
@@ -83,7 +83,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
        CustomDataMask dataMask = 0;
 
        /* ask for vertexgroups if we need them */
-       if(bmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+       if (bmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
        return dataMask;
 }
index 2b3c1f00541799be9afb51cd1d5bc912baa5a7d2..e4e89db403d7f196e6e51b8da73ea321c138c9fe 100644 (file)
@@ -83,7 +83,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 {
        BooleanModifierData *bmd = (BooleanModifierData*) md;
 
-       if(bmd->object) {
+       if (bmd->object) {
                DagNode *curNode = dag_get_node(forest, bmd->object);
 
                dag_add_relation(forest, curNode, obNode,
@@ -96,14 +96,14 @@ static DerivedMesh *get_quick_derivedMesh(DerivedMesh *derivedData, DerivedMesh
 {
        DerivedMesh *result = NULL;
 
-       if(derivedData->getNumPolys(derivedData) == 0 || dm->getNumPolys(dm) == 0) {
+       if (derivedData->getNumPolys(derivedData) == 0 || dm->getNumPolys(dm) == 0) {
                switch(operation) {
                        case eBooleanModifierOp_Intersect:
                                result = CDDM_new(0, 0, 0, 0, 0);
                                break;
 
                        case eBooleanModifierOp_Union:
-                               if(derivedData->getNumPolys(derivedData)) result = derivedData;
+                               if (derivedData->getNumPolys(derivedData)) result = derivedData;
                                else result = CDDM_copy(dm);
 
                                break;
@@ -125,12 +125,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
        BooleanModifierData *bmd = (BooleanModifierData*) md;
        DerivedMesh *dm;
 
-       if(!bmd->object)
+       if (!bmd->object)
                return derivedData;
 
        dm = bmd->object->derivedFinal;
 
-       if(dm) {
+       if (dm) {
                DerivedMesh *result;
 
                /* when one of objects is empty (has got no faces) we could speed up
@@ -138,7 +138,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
                 * Returning mesh is depended on modifiers operation (sergey) */
                result = get_quick_derivedMesh(derivedData, dm, bmd->operation);
 
-               if(result == NULL) {
+               if (result == NULL) {
 
                        DM_ensure_tessface(dm);          /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
                        DM_ensure_tessface(derivedData); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
@@ -153,7 +153,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
                /* if new mesh returned, return it; otherwise there was
                 * an error, so delete the modifier object */
-               if(result)
+               if (result)
                        return result;
                else
                        modifier_setError(md, "%s", TIP_("Can't execute boolean operation."));
index 65ab6666220972f2c02d62a5b57939e8813b8ccf..7d4ec3c3d814c052e2168142f653651bf8ce7a89 100644 (file)
@@ -185,17 +185,19 @@ static void FaceIt_Fill(CSG_IteratorPtr it, CSG_IFace *face)
 
        /* reverse face vertices if necessary */
        face->vertex_index[1] = mface->v2;
-       if( face_it->flip == 0 ) {
+       if ( face_it->flip == 0 ) {
        face->vertex_index[0] = mface->v1;
        face->vertex_index[2] = mface->v3;
-       } else {
+       }
+       else {
                face->vertex_index[2] = mface->v1;
                face->vertex_index[0] = mface->v3;
        }
        if (mface->v4) {
                face->vertex_index[3] = mface->v4;
                face->vertex_number = 4;
-       } else {
+       }
+       else {
                face->vertex_number = 3;
        }
 
@@ -234,17 +236,22 @@ static void FaceIt_Construct(
        if (ob->size[0] < 0.0f) {
                if (ob->size[1] < 0.0f && ob->size[2] < 0.0f) {
                        it->flip = 1;
-               } else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
+               }
+               else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
                        it->flip = 1;
-               } else {
+               }
+               else {
                        it->flip = 0;
                }
-       } else {
+       }
+       else {
                if (ob->size[1] < 0.0f && ob->size[2] < 0.0f) {
                        it->flip = 0;
-               } else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
+               }
+               else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
                        it->flip = 0;
-               } else {
+               }
+               else {
                        it->flip = 1;
                }
        }
@@ -382,7 +389,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
        origindex_layer = result->getTessFaceDataArray(result, CD_ORIGINDEX);
 
        // step through the face iterators
-       for(i = 0; !face_it->Done(face_it->it); i++) {
+       for (i = 0; !face_it->Done(face_it->it); i++) {
                Mesh *orig_me;
                Object *orig_ob;
                Material *orig_mat;
@@ -422,8 +429,8 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
                        else
                                mface->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat));
                }
-               else if(orig_mat) {
-                       if(orig_ob == ob1) {
+               else if (orig_mat) {
+                       if (orig_ob == ob1) {
                                // No need to change materian index for faces from left operand
                        }
                        else {
@@ -433,8 +440,8 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
                                        int a;
 
                                        mat_nr = 0;
-                                       for(a = 0; a < ob1->totcol; a++) {
-                                               if(give_current_material(ob1, a+1) == orig_mat) {
+                                       for (a = 0; a < ob1->totcol; a++) {
+                                               if (give_current_material(ob1, a+1) == orig_mat) {
                                                        mat_nr = a;
                                                        break;
                                                }
@@ -456,7 +463,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
 
                test_index_face(mface, &result->faceData, i, csgface.vertex_number);
 
-               if(origindex_layer && orig_ob == ob2)
+               if (origindex_layer && orig_ob == ob2)
                        origindex_layer[i] = ORIGINDEX_NONE;
        }
 
index a268f475bc80dbe099486dcc8555e0ada9ba62f8..ddfb793bd5d1b7ccf428c0f3003c21f029d5f4a8 100644 (file)
@@ -172,7 +172,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
        else if (numEdges_dst) {
                MEdge *medge, *me;
 
-               if(bmd->randomize)
+               if (bmd->randomize)
                        BLI_array_randomize(edgeMap, sizeof(*edgeMap),
                                            numEdge_src, bmd->seed);
 
@@ -183,11 +183,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
                for (i = 0; i < numEdges_dst; i++) {
                        me = medge + edgeMap[i];
 
-                       if(!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1))) {
+                       if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1))) {
                                BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(me->v1),
                                                 SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
                        }
-                       if(!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2))) {
+                       if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2))) {
                                BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(me->v2), SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
                        }
                }
index 6ca3a82dd0ecb9dd01416cbab3c476bc8f715992..15940112527b17f752eecb958e959eb9b2a25500 100644 (file)
@@ -86,7 +86,7 @@ static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
        
        flag = cmd->flag & (MOD_CAST_X|MOD_CAST_Y|MOD_CAST_Z);
 
-       if((cmd->fac == 0.0f) || flag == 0) return 1;
+       if ((cmd->fac == 0.0f) || flag == 0) return 1;
 
        return 0;
 }
@@ -97,7 +97,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
        CustomDataMask dataMask = 0;
 
        /* ask for vertexgroups if we need them */
-       if(cmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+       if (cmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
        return dataMask;
 }
@@ -157,7 +157,7 @@ static void sphere_do(
         * space), by default, but if the user defined a control object,
         * we use its location, transformed to ob's local space */
        if (ctrl_ob) {
-               if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+               if (flag & MOD_CAST_USE_OB_TRANSFORM) {
                        invert_m4_m4(ctrl_ob->imat, ctrl_ob->obmat);
                        mult_m4_m4m4(mat, ctrl_ob->imat, ob->obmat);
                        invert_m4_m4(imat, mat);
@@ -178,14 +178,14 @@ static void sphere_do(
         * only those vertices should be affected */
        modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index);
 
-       if(flag & MOD_CAST_SIZE_FROM_RADIUS) {
+       if (flag & MOD_CAST_SIZE_FROM_RADIUS) {
                len = cmd->radius;
        }
        else {
                len = cmd->size;
        }
 
-       if(len <= 0) {
+       if (len <= 0) {
                for (i = 0; i < numVerts; i++) {
                        len += len_v3v3(center, vertexCos[i]);
                }
@@ -207,10 +207,11 @@ static void sphere_do(
                        float weight;
 
                        copy_v3_v3(tmp_co, vertexCos[i]);
-                       if(ctrl_ob) {
-                               if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+                       if (ctrl_ob) {
+                               if (flag & MOD_CAST_USE_OB_TRANSFORM) {
                                        mul_m4_v3(mat, tmp_co);
-                               } else {
+                               }
+                               else {
                                        sub_v3_v3(tmp_co, center);
                                }
                        }
@@ -239,10 +240,11 @@ static void sphere_do(
                        if (flag & MOD_CAST_Z)
                                tmp_co[2] = fac*vec[2]*len + facm*tmp_co[2];
 
-                       if(ctrl_ob) {
-                               if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+                       if (ctrl_ob) {
+                               if (flag & MOD_CAST_USE_OB_TRANSFORM) {
                                        mul_m4_v3(imat, tmp_co);
-                               } else {
+                               }
+                               else {
                                        add_v3_v3(tmp_co, center);
                                }
                        }
@@ -257,10 +259,11 @@ static void sphere_do(
                float tmp_co[3];
 
                copy_v3_v3(tmp_co, vertexCos[i]);
-               if(ctrl_ob) {
-                       if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+               if (ctrl_ob) {
+                       if (flag & MOD_CAST_USE_OB_TRANSFORM) {
                                mul_m4_v3(mat, tmp_co);
-                       } else {
+                       }
+                       else {
                                sub_v3_v3(tmp_co, center);
                        }
                }
@@ -283,10 +286,11 @@ static void sphere_do(
                if (flag & MOD_CAST_Z)
                        tmp_co[2] = fac*vec[2]*len + facm*tmp_co[2];
 
-               if(ctrl_ob) {
-                       if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+               if (ctrl_ob) {
+                       if (flag & MOD_CAST_USE_OB_TRANSFORM) {
                                mul_m4_v3(imat, tmp_co);
-                       } else {
+                       }
+                       else {
                                add_v3_v3(tmp_co, center);
                        }
                }
@@ -329,7 +333,7 @@ static void cuboid_do(
        modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index);
 
        if (ctrl_ob) {
-               if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+               if (flag & MOD_CAST_USE_OB_TRANSFORM) {
                        invert_m4_m4(ctrl_ob->imat, ctrl_ob->obmat);
                        mult_m4_m4m4(mat, ctrl_ob->imat, ob->obmat);
                        invert_m4_m4(imat, mat);
@@ -339,17 +343,19 @@ static void cuboid_do(
                mul_v3_m4v3(center, ob->imat, ctrl_ob->obmat[3]);
        }
 
-       if((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) {
-               for(i = 0; i < 3; i++) {
+       if ((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) {
+               for (i = 0; i < 3; i++) {
                        min[i] = -cmd->radius;
                        max[i] = cmd->radius;
                }
-       } else if(!(flag & MOD_CAST_SIZE_FROM_RADIUS) && cmd->size > 0) {
-               for(i = 0; i < 3; i++) {
+       }
+       else if (!(flag & MOD_CAST_SIZE_FROM_RADIUS) && cmd->size > 0) {
+               for (i = 0; i < 3; i++) {
                        min[i] = -cmd->size;
                        max[i] = cmd->size;
                }
-       } else {
+       }
+       else {
                /* get bound box */
                /* We can't use the object's bound box because other modifiers
                 * may have changed the vertex data. */
@@ -406,10 +412,11 @@ static void cuboid_do(
                        float tmp_co[3];
 
                        copy_v3_v3(tmp_co, vertexCos[i]);
-                       if(ctrl_ob) {
-                               if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+                       if (ctrl_ob) {
+                               if (flag & MOD_CAST_USE_OB_TRANSFORM) {
                                        mul_m4_v3(mat, tmp_co);
-                               } else {
+                               }
+                               else {
                                        sub_v3_v3(tmp_co, center);
                                }
                        }
@@ -421,7 +428,7 @@ static void cuboid_do(
                        }
 
                        for (j = 0; j < dvert[i].totweight; ++j) {
-                               if(dvert[i].dw[j].def_nr == defgrp_index) {
+                               if (dvert[i].dw[j].def_nr == defgrp_index) {
                                        dw = &dvert[i].dw[j];
                                        break;
                                }
@@ -482,10 +489,11 @@ static void cuboid_do(
                        if (flag & MOD_CAST_Z)
                                tmp_co[2] = facm * tmp_co[2] + fac * tmp_co[2] * fbb;
 
-                       if(ctrl_ob) {
-                               if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+                       if (ctrl_ob) {
+                               if (flag & MOD_CAST_USE_OB_TRANSFORM) {
                                        mul_m4_v3(imat, tmp_co);
-                               } else {
+                               }
+                               else {
                                        add_v3_v3(tmp_co, center);
                                }
                        }
@@ -502,10 +510,11 @@ static void cuboid_do(
                float tmp_co[3];
 
                copy_v3_v3(tmp_co, vertexCos[i]);
-               if(ctrl_ob) {
-                       if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+               if (ctrl_ob) {
+                       if (flag & MOD_CAST_USE_OB_TRANSFORM) {
                                mul_m4_v3(mat, tmp_co);
-                       } else {
+                       }
+                       else {
                                sub_v3_v3(tmp_co, center);
                        }
                }
@@ -550,10 +559,11 @@ static void cuboid_do(
                if (flag & MOD_CAST_Z)
                        tmp_co[2] = facm * tmp_co[2] + fac * tmp_co[2] * fbb;
 
-               if(ctrl_ob) {
-                       if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+               if (ctrl_ob) {
+                       if (flag & MOD_CAST_USE_OB_TRANSFORM) {
                                mul_m4_v3(imat, tmp_co);
-                       } else {
+                       }
+                       else {
                                add_v3_v3(tmp_co, center);
                        }
                }
@@ -576,11 +586,12 @@ static void deformVerts(ModifierData *md, Object *ob,
 
        if (cmd->type == MOD_CAST_TYPE_CUBOID) {
                cuboid_do(cmd, ob, dm, vertexCos, numVerts);
-       } else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
+       }
+       else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
                sphere_do(cmd, ob, dm, vertexCos, numVerts);
        }
 
-       if(dm != derivedData)
+       if (dm != derivedData)
                dm->release(dm);
 }
 
@@ -593,11 +604,12 @@ static void deformVertsEM(
 
        if (cmd->type == MOD_CAST_TYPE_CUBOID) {
                cuboid_do(cmd, ob, dm, vertexCos, numVerts);
-       } else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
+       }
+       else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
                sphere_do(cmd, ob, dm, vertexCos, numVerts);
        }
 
-       if(dm != derivedData)
+       if (dm != derivedData)
                dm->release(dm);
 }
 
index f23690454c0f21808c4e8c4a403e00636c81fc96..d5d8439c7496b0980b3970331886d1e325103c87 100644 (file)
@@ -61,7 +61,7 @@ static void initData(ModifierData *md)
        clmd->point_cache = BKE_ptcache_add(&clmd->ptcaches);
        
        /* check for alloc failing */
-       if(!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache)
+       if (!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache)
                return;
        
        cloth_init (clmd);
@@ -78,12 +78,12 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
        if (!clmd->sim_parms || !clmd->coll_parms) {
                initData(md);
 
-               if(!clmd->sim_parms || !clmd->coll_parms)
+               if (!clmd->sim_parms || !clmd->coll_parms)
                        return;
        }
 
        dm = get_dm(ob, NULL, derivedData, NULL, 0);
-       if(dm == derivedData)
+       if (dm == derivedData)
                dm = CDDM_copy(dm);
 
        CDDM_apply_vert_coords(dm, vertexCos);
@@ -92,7 +92,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
 
        clothModifier_do(clmd, md->scene, ob, dm, vertexCos);
 
-       if(result) {
+       if (result) {
                result->getVertCos(result, vertexCos);
                result->release(result);
        }
@@ -106,8 +106,8 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, Scene *scene, Ob
        
        Base *base;
        
-       if(clmd) {
-               for(base = scene->base.first; base; base= base->next) {
+       if (clmd) {
+               for (base = scene->base.first; base; base= base->next) {
                        Object *ob1= base->object;
                        if (ob1 != ob) {
                                CollisionModifierData *coll_clmd = (CollisionModifierData *)modifiers_findByType(ob1, eModifierType_Collision);
@@ -125,10 +125,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
        CustomDataMask dataMask = 0;
        ClothModifierData *clmd = (ClothModifierData*)md;
 
-       if(cloth_uses_vgroup(clmd))
+       if (cloth_uses_vgroup(clmd))
                dataMask |= CD_MASK_MDEFORMVERT;
 
-       if(clmd->sim_parms->shapekey_rest != 0)
+       if (clmd->sim_parms->shapekey_rest != 0)
                dataMask |= CD_MASK_CLOTH_ORCO;
 
        return dataMask;
@@ -139,20 +139,20 @@ static void copyData(ModifierData *md, ModifierData *target)
        ClothModifierData *clmd = (ClothModifierData*) md;
        ClothModifierData *tclmd = (ClothModifierData*) target;
 
-       if(tclmd->sim_parms) {
-               if(tclmd->sim_parms->effector_weights)
+       if (tclmd->sim_parms) {
+               if (tclmd->sim_parms->effector_weights)
                        MEM_freeN(tclmd->sim_parms->effector_weights);
                MEM_freeN(tclmd->sim_parms);
        }
 
-       if(tclmd->coll_parms)
+       if (tclmd->coll_parms)
                MEM_freeN(tclmd->coll_parms);
        
        BKE_ptcache_free_list(&tclmd->ptcaches);
        tclmd->point_cache = NULL;
 
        tclmd->sim_parms = MEM_dupallocN(clmd->sim_parms);
-       if(clmd->sim_parms->effector_weights)
+       if (clmd->sim_parms->effector_weights)
                tclmd->sim_parms->effector_weights = MEM_dupallocN(clmd->sim_parms->effector_weights);
        tclmd->coll_parms = MEM_dupallocN(clmd->coll_parms);
        tclmd->point_cache = BKE_ptcache_copy_list(&tclmd->ptcaches, &clmd->ptcaches);
@@ -169,17 +169,17 @@ static void freeData(ModifierData *md)
        ClothModifierData *clmd = (ClothModifierData*) md;
        
        if (clmd) {
-               if(G.rt > 0)
+               if (G.rt > 0)
                        printf("clothModifier_freeData\n");
                
                cloth_free_modifier_extern (clmd);
                
-               if(clmd->sim_parms) {
-                       if(clmd->sim_parms->effector_weights)
+               if (clmd->sim_parms) {
+                       if (clmd->sim_parms->effector_weights)
                                MEM_freeN(clmd->sim_parms->effector_weights);
                        MEM_freeN(clmd->sim_parms);
                }
-               if(clmd->coll_parms)
+               if (clmd->coll_parms)
                        MEM_freeN(clmd->coll_parms);    
                
                BKE_ptcache_free_list(&clmd->ptcaches);
@@ -192,11 +192,11 @@ static void foreachIDLink(ModifierData *md, Object *ob,
 {
        ClothModifierData *clmd = (ClothModifierData*) md;
 
-       if(clmd->coll_parms) {
+       if (clmd->coll_parms) {
                walk(userData, ob, (ID **)&clmd->coll_parms->group);
        }
 
-       if(clmd->sim_parms && clmd->sim_parms->effector_weights) {
+       if (clmd->sim_parms && clmd->sim_parms->effector_weights) {
                walk(userData, ob, (ID **)&clmd->sim_parms->effector_weights->group);
        }
 }
index a1467c55ecfe01f7b880ddaaa2d4076b75b18ba5..b3faf6c140a2a448d80c56604af7a6e3d85d66b6 100644 (file)
@@ -73,19 +73,19 @@ static void freeData(ModifierData *md)
        
        if (collmd) 
        {
-               if(collmd->bvhtree)
+               if (collmd->bvhtree)
                        BLI_bvhtree_free(collmd->bvhtree);
-               if(collmd->x)
+               if (collmd->x)
                        MEM_freeN(collmd->x);
-               if(collmd->xnew)
+               if (collmd->xnew)
                        MEM_freeN(collmd->xnew);
-               if(collmd->current_x)
+               if (collmd->current_x)
                        MEM_freeN(collmd->current_x);
-               if(collmd->current_xnew)
+               if (collmd->current_xnew)
                        MEM_freeN(collmd->current_xnew);
-               if(collmd->current_v)
+               if (collmd->current_v)
                        MEM_freeN(collmd->current_v);
-               if(collmd->mfaces)
+               if (collmd->mfaces)
                        MEM_freeN(collmd->mfaces);
                
                collmd->x = NULL;
@@ -117,16 +117,16 @@ static void deformVerts(ModifierData *md, Object *ob,
        MVert *tempVert = NULL;
        
        /* if possible use/create DerivedMesh */
-       if(derivedData) dm = CDDM_copy(derivedData);
-       else if(ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
+       if (derivedData) dm = CDDM_copy(derivedData);
+       else if (ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
        
-       if(!ob->pd)
+       if (!ob->pd)
        {
                printf("CollisionModifier deformVerts: Should not happen!\n");
                return;
        }
        
-       if(dm)
+       if (dm)
        {
                float current_time = 0;
                unsigned int numverts = 0;
@@ -136,20 +136,20 @@ static void deformVerts(ModifierData *md, Object *ob,
                
                current_time = BKE_curframe(md->scene);
                
-               if(G.rt > 0)
+               if (G.rt > 0)
                        printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew);
                
                numverts = dm->getNumVerts ( dm );
                
-               if((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics()))
+               if ((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics()))
                {
                        unsigned int i;
 
                        // check if mesh has changed
-                       if(collmd->x && (numverts != collmd->numverts))
+                       if (collmd->x && (numverts != collmd->numverts))
                                freeData((ModifierData *)collmd);
                        
-                       if(collmd->time_xnew == -1000) // first time
+                       if (collmd->time_xnew == -1000) // first time
                        {
                                collmd->x = dm->dupVertArray(dm); // frame start position
                                
@@ -176,7 +176,7 @@ static void deformVerts(ModifierData *md, Object *ob,
                                
                                collmd->time_x = collmd->time_xnew = current_time;
                        }
-                       else if(numverts == collmd->numverts) {
+                       else if (numverts == collmd->numverts) {
                                // put positions to old positions
                                tempVert = collmd->x;
                                collmd->x = collmd->xnew;
@@ -194,8 +194,8 @@ static void deformVerts(ModifierData *md, Object *ob,
                                memcpy(collmd->current_x, collmd->x, numverts*sizeof(MVert));
                                
                                /* check if GUI setting has changed for bvh */
-                               if(collmd->bvhtree) {
-                                       if(ob->pd->pdef_sboft != BLI_bvhtree_getepsilon(collmd->bvhtree)) {
+                               if (collmd->bvhtree) {
+                                       if (ob->pd->pdef_sboft != BLI_bvhtree_getepsilon(collmd->bvhtree)) {
                                                BLI_bvhtree_free(collmd->bvhtree);
                                                collmd->bvhtree = bvhtree_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->current_x, numverts, ob->pd->pdef_sboft);
                                        }
@@ -213,12 +213,12 @@ static void deformVerts(ModifierData *md, Object *ob,
                                
                                collmd->time_xnew = current_time;
                        }
-                       else if(numverts != collmd->numverts) {
+                       else if (numverts != collmd->numverts) {
                                freeData((ModifierData *)collmd);
                        }
                        
                }
-               else if(current_time < collmd->time_xnew) {
+               else if (current_time < collmd->time_xnew) {
                        freeData((ModifierData *)collmd);
                }
                else {
@@ -228,7 +228,7 @@ static void deformVerts(ModifierData *md, Object *ob,
                }
        }
        
-       if(dm)
+       if (dm)
                dm->release(dm);
 }
 
index 0ff37c6fa76e8d6f88bb12ba6951a9de1922db6b..f516f971dc0c771f1b90acbc2e0ab19e6520b347 100644 (file)
@@ -73,7 +73,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
        CustomDataMask dataMask = 0;
 
        /* ask for vertexgroups if we need them */
-       if(cmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+       if (cmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
        return dataMask;
 }
@@ -131,11 +131,11 @@ static void deformVertsEM(
 {
        DerivedMesh *dm = derivedData;
 
-       if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+       if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
 
        deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0);
 
-       if(!derivedData) dm->release(dm);
+       if (!derivedData) dm->release(dm);
 }
 
 
index 3c3381dc36b5cb5d1dfdffe0985506663a0c72d4..f55faf9c18342b15db341f063596fda1e9c9ee78 100644 (file)
@@ -97,7 +97,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
                if (mf->v4) numTris++;
        }
 
-       if(numTris<3) {
+       if (numTris<3) {
                modifier_setError(md, "%s", TIP_("Modifier requires more than 3 input faces (triangles)."));
                dm = CDDM_copy(dm);
                return dm;
@@ -109,7 +109,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
        lod.vertex_num= totvert;
        lod.face_num= numTris;
 
-       for(a=0; a<totvert; a++) {
+       for (a=0; a<totvert; a++) {
                MVert *mv = &mvert[a];
                float *vbCo = &lod.vertex_buffer[a*3];
                float *vbNo = &lod.vertex_normal_buffer[a*3];
@@ -119,14 +119,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
        }
 
        numTris = 0;
-       for(a=0; a<totface; a++) {
+       for (a=0; a<totface; a++) {
                MFace *mf = &mface[a];
                int *tri = &lod.triangle_index_buffer[3*numTris++];
                tri[0]= mf->v1;
                tri[1]= mf->v2;
                tri[2]= mf->v3;
 
-               if(mf->v4) {
+               if (mf->v4) {
                        tri = &lod.triangle_index_buffer[3*numTris++];
                        tri[0]= mf->v1;
                        tri[1]= mf->v3;
@@ -135,15 +135,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
        }
 
        dmd->faceCount = 0;
-       if(LOD_LoadMesh(&lod) ) {
-               if( LOD_PreprocessMesh(&lod) ) {
+       if (LOD_LoadMesh(&lod) ) {
+               if ( LOD_PreprocessMesh(&lod) ) {
                        /* we assume the decim_faces tells how much to reduce */
 
-                       while(lod.face_num > numTris*dmd->percent) {
-                               if( LOD_CollapseEdge(&lod)==0) break;
+                       while (lod.face_num > numTris*dmd->percent) {
+                               if ( LOD_CollapseEdge(&lod)==0) break;
                        }
 
-                       if(lod.vertex_num>2) {
+                       if (lod.vertex_num>2) {
                                result = CDDM_new(lod.vertex_num, 0, lod.face_num, 0, 0);
                                dmd->faceCount = lod.face_num;
                        }
@@ -151,16 +151,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
                                result = CDDM_new(lod.vertex_num, 0, 0, 0, 0);
 
                        mvert = CDDM_get_verts(result);
-                       for(a=0; a<lod.vertex_num; a++) {
+                       for (a=0; a<lod.vertex_num; a++) {
                                MVert *mv = &mvert[a];
                                float *vbCo = &lod.vertex_buffer[a*3];
                                
                                copy_v3_v3(mv->co, vbCo);
                        }
 
-                       if(lod.vertex_num>2) {
+                       if (lod.vertex_num>2) {
                                mface = CDDM_get_tessfaces(result);
-                               for(a=0; a<lod.face_num; a++) {
+                               for (a=0; a<lod.face_num; a++) {
                                        MFace *mf = &mface[a];
                                        int *tri = &lod.triangle_index_buffer[a*3];
                                        mf->v1 = tri[0];
index 55971e358a97f2e77e48b19484b6f0ff649e35b1..f3d7a24e51758a5630ee1a8dfd2653fd0b91952c 100644 (file)
@@ -87,10 +87,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
        CustomDataMask dataMask = 0;
 
        /* ask for vertexgroups if we need them */
-       if(dmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+       if (dmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
        /* ask for UV coordinates if we need them */
-       if(dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE;
+       if (dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE;
 
        return dataMask;
 }
@@ -99,7 +99,7 @@ static int dependsOnTime(ModifierData *md)
 {
        DisplaceModifierData *dmd = (DisplaceModifierData *)md;
 
-       if(dmd->texture) {
+       if (dmd->texture) {
                return BKE_texture_dependsOnTime(dmd->texture);
        }
        else {
@@ -151,7 +151,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 {
        DisplaceModifierData *dmd = (DisplaceModifierData*) md;
 
-       if(dmd->map_object && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
+       if (dmd->map_object && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
                DagNode *curNode = dag_get_node(forest, dmd->map_object);
 
                dag_add_relation(forest, curNode, obNode,
@@ -159,7 +159,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
        }
        
 
-       if(dmd->texmapping == MOD_DISP_MAP_GLOBAL)
+       if (dmd->texmapping == MOD_DISP_MAP_GLOBAL)
                dag_add_relation(forest, obNode, obNode,
                                 DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Displace Modifier");
        
@@ -177,8 +177,8 @@ static void displaceModifier_do(
        float (*tex_co)[3];
        float weight= 1.0f; /* init value unused but some compilers may complain */
 
-       if(!dmd->texture) return;
-       if(dmd->strength == 0.0f) return;
+       if (!dmd->texture) return;
+       if (dmd->strength == 0.0f) return;
 
        mvert = CDDM_get_verts(dm);
        modifier_get_vgroup(ob, dm, dmd->defgrp_name, &dvert, &defgrp_index);
@@ -187,13 +187,13 @@ static void displaceModifier_do(
                                 "displaceModifier_do tex_co");
        get_texture_coords((MappingInfoModifierData *)dmd, ob, dm, vertexCos, tex_co, numVerts);
 
-       for(i = 0; i < numVerts; ++i) {
+       for (i = 0; i < numVerts; ++i) {
                TexResult texres;
                float delta = 0, strength = dmd->strength;
 
-               if(dvert) {
+               if (dvert) {
                        weight= defvert_find_weight(dvert + i, defgrp_index);
-                       if(weight == 0.0f) continue;
+                       if (weight == 0.0f) continue;
                }
 
                texres.nor = NULL;
@@ -201,7 +201,7 @@ static void displaceModifier_do(
 
                delta = texres.tin - dmd->midlevel;
 
-               if(dvert) strength *= weight;
+               if (dvert) strength *= weight;
 
                delta *= strength;
                CLAMP(delta, -10000, 10000);
@@ -244,7 +244,7 @@ static void deformVerts(ModifierData *md, Object *ob,
        displaceModifier_do((DisplaceModifierData *)md, ob, dm,
                            vertexCos, numVerts);
 
-       if(dm != derivedData)
+       if (dm != derivedData)
                dm->release(dm);
 }
 
@@ -257,7 +257,7 @@ static void deformVertsEM(
        displaceModifier_do((DisplaceModifierData *)md, ob, dm,
                            vertexCos, numVerts);
 
-       if(dm != derivedData)
+       if (dm != derivedData)
                dm->release(dm);
 }
 
index e567765d61b67165adaccb3720e23eef7b4d6437..5005e2c010daa7052f9871958f21098b58306255 100644 (file)
@@ -75,7 +75,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 
        if (pmd->canvas) {
                DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
-               for(; surface; surface=surface->next) {
+               for (; surface; surface=surface->next) {
                        /* tface */
                        if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ || 
                                surface->init_color_type == MOD_DPAINT_INITIAL_TEXTURE) {
@@ -143,10 +143,10 @@ static void foreachIDLink(ModifierData *md, Object *ob,
 {
        DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
 
-       if(pmd->canvas) {
+       if (pmd->canvas) {
                DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
 
-               for(; surface; surface=surface->next) {
+               for (; surface; surface=surface->next) {
                        walk(userData, ob, (ID **)&surface->brush_group);
                        walk(userData, ob, (ID **)&surface->init_texture);
                }
index e50c0d5521b946ee173766635e3b802b7374eae6..6ffacba3b682098344211f3a95eda404b60ebdaa 100644 (file)
@@ -134,7 +134,7 @@ static void copyData(ModifierData *md, ModifierData *target)
 static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd,
                                         Object *ob, DerivedMesh *dm)
 {
-       if(!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG)))
+       if (!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG)))
                return dm;
 
        return doEdgeSplit(dm, emd, ob);
@@ -149,7 +149,7 @@ static DerivedMesh *applyModifier(
 
        result = edgesplitModifier_do(emd, ob, derivedData);
 
-       if(result != derivedData)
+       if (result != derivedData)
                CDDM_calc_normals(result);
 
        return result;
index 39beecab22f3b5d39737c7a83a59e0b311198a3b..ddc79c4e4f85badd8b4f135e0f2902b183fb9d06 100644 (file)
@@ -67,7 +67,7 @@ static void freeData(ModifierData *md)
 {
        ExplodeModifierData *emd= (ExplodeModifierData*) md;
        
-       if(emd->facepa) MEM_freeN(emd->facepa);
+       if (emd->facepa) MEM_freeN(emd->facepa);
 }
 static void copyData(ModifierData *md, ModifierData *target)
 {
@@ -88,7 +88,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
        ExplodeModifierData *emd= (ExplodeModifierData*) md;
        CustomDataMask dataMask = 0;
 
-       if(emd->vgroup)
+       if (emd->vgroup)
                dataMask |= CD_MASK_MDEFORMVERT;
 
        return dataMask;
@@ -115,7 +115,7 @@ static void createFacepa(ExplodeModifierData *emd,
 
        BLI_srandom(psys->seed);
 
-       if(emd->facepa)
+       if (emd->facepa)
                MEM_freeN(emd->facepa);
 
        facepa = emd->facepa = MEM_callocN(sizeof(int)*totface, "explode_facepa");
@@ -123,21 +123,21 @@ static void createFacepa(ExplodeModifierData *emd,
        vertpa = MEM_callocN(sizeof(int)*totvert, "explode_vertpa");
 
        /* initialize all faces & verts to no particle */
-       for(i=0; i<totface; i++)
+       for (i=0; i<totface; i++)
                facepa[i]=totpart;
 
        for (i=0; i<totvert; i++)
                vertpa[i]=totpart;
 
        /* set protected verts */
-       if(emd->vgroup){
+       if (emd->vgroup) {
                MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
-               if(dvert){
+               if (dvert) {
                        const int defgrp_index= emd->vgroup-1;
-                       for(i=0; i<totvert; i++, dvert++){
+                       for (i=0; i<totvert; i++, dvert++) {
                                float val = BLI_frand();
                                val = (1.0f-emd->protect)*val + emd->protect*0.5f;
-                               if(val < defvert_find_weight(dvert, defgrp_index))
+                               if (val < defvert_find_weight(dvert, defgrp_index))
                                        vertpa[i] = -1;
                        }
                }
@@ -145,17 +145,17 @@ static void createFacepa(ExplodeModifierData *emd,
 
        /* make tree of emitter locations */
        tree=BLI_kdtree_new(totpart);
-       for(p=0,pa=psys->particles; p<totpart; p++,pa++){
+       for (p=0,pa=psys->particles; p<totpart; p++,pa++) {
                psys_particle_on_emitter(psmd,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,NULL,NULL,NULL,NULL,NULL);
                BLI_kdtree_insert(tree, p, co, NULL);
        }
        BLI_kdtree_balance(tree);
 
        /* set face-particle-indexes to nearest particle to face center */
-       for(i=0,fa=mface; i<totface; i++,fa++){
+       for (i=0,fa=mface; i<totface; i++,fa++) {
                add_v3_v3v3(center,mvert[fa->v1].co,mvert[fa->v2].co);
                add_v3_v3(center, mvert[fa->v3].co);
-               if(fa->v4){
+               if (fa->v4) {
                        add_v3_v3(center, mvert[fa->v4].co);
                        mul_v3_fl(center,0.25);
                }
@@ -167,19 +167,19 @@ static void createFacepa(ExplodeModifierData *emd,
                v1=vertpa[fa->v1];
                v2=vertpa[fa->v2];
                v3=vertpa[fa->v3];
-               if(fa->v4)
+               if (fa->v4)
                        v4=vertpa[fa->v4];
 
-               if(v1>=0 && v2>=0 && v3>=0 && (fa->v4==0 || v4>=0))
+               if (v1>=0 && v2>=0 && v3>=0 && (fa->v4==0 || v4>=0))
                        facepa[i]=p;
 
-               if(v1>=0) vertpa[fa->v1]=p;
-               if(v2>=0) vertpa[fa->v2]=p;
-               if(v3>=0) vertpa[fa->v3]=p;
-               if(fa->v4 && v4>=0) vertpa[fa->v4]=p;
+               if (v1>=0) vertpa[fa->v1]=p;
+               if (v2>=0) vertpa[fa->v2]=p;
+               if (v3>=0) vertpa[fa->v3]=p;
+               if (fa->v4 && v4>=0) vertpa[fa->v4]=p;
        }
 
-       if(vertpa) MEM_freeN(vertpa);
+       if (vertpa) MEM_freeN(vertpa);
        BLI_kdtree_free(tree);
 }
 
@@ -246,7 +246,7 @@ static void remap_uvs_3_6_9_12(DerivedMesh *dm, DerivedMesh *split, int numlayer
        MTFace *mf, *df1, *df2, *df3;
        int l;
 
-       for(l=0; l<numlayer; l++) {
+       for (l=0; l<numlayer; l++) {
                mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
                df1 = mf+cur;
                df2 = df1 + 1;
@@ -294,7 +294,7 @@ static void remap_uvs_5_10(DerivedMesh *dm, DerivedMesh *split, int numlayer, in
        MTFace *mf, *df1, *df2;
        int l;
 
-       for(l=0; l<numlayer; l++) {
+       for (l=0; l<numlayer; l++) {
                mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
                df1 = mf+cur;
                df2 = df1 + 1;
@@ -355,7 +355,7 @@ static void remap_uvs_15(DerivedMesh *dm, DerivedMesh *split, int numlayer, int
        MTFace *mf, *df1, *df2, *df3, *df4;
        int l;
 
-       for(l=0; l<numlayer; l++) {
+       for (l=0; l<numlayer; l++) {
                mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
                df1 = mf+cur;
                df2 = df1 + 1;
@@ -419,7 +419,7 @@ static void remap_uvs_7_11_13_14(DerivedMesh *dm, DerivedMesh *split, int numlay
        MTFace *mf, *df1, *df2, *df3;
        int l;
 
-       for(l=0; l<numlayer; l++) {
+       for (l=0; l<numlayer; l++) {
                mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
                df1 = mf+cur;
                df2 = df1 + 1;
@@ -468,7 +468,7 @@ static void remap_uvs_19_21_22(DerivedMesh *dm, DerivedMesh *split, int numlayer
        MTFace *mf, *df1, *df2;
        int l;
 
-       for(l=0; l<numlayer; l++) {
+       for (l=0; l<numlayer; l++) {
                mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
                df1 = mf+cur;
                df2 = df1 + 1;
@@ -519,7 +519,7 @@ static void remap_uvs_23(DerivedMesh *dm, DerivedMesh *split, int numlayer, int
        MTFace *mf, *df1, *df2;
        int l;
 
-       for(l=0; l<numlayer; l++) {
+       for (l=0; l<numlayer; l++) {
                mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
                df1 = mf+cur;
                df2 = df1 + 1;
@@ -569,7 +569,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
                vertpa[mf->v1]=facepa[i];
                vertpa[mf->v2]=facepa[i];
                vertpa[mf->v3]=facepa[i];
-               if(mf->v4)
+               if (mf->v4)
                        vertpa[mf->v4]=facepa[i];
        }
 
@@ -579,37 +579,37 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
                v2=vertpa[mf->v2];
                v3=vertpa[mf->v3];
 
-               if(v1!=v2){
+               if (v1!=v2) {
                        BLI_edgehash_insert(edgehash, mf->v1, mf->v2, NULL);
                        (*fs) |= 1;
                }
 
-               if(v2!=v3){
+               if (v2!=v3) {
                        BLI_edgehash_insert(edgehash, mf->v2, mf->v3, NULL);
                        (*fs) |= 2;
                }
 
-               if(mf->v4){
+               if (mf->v4) {
                        v4=vertpa[mf->v4];
 
-                       if(v3!=v4){
+                       if (v3!=v4) {
                                BLI_edgehash_insert(edgehash, mf->v3, mf->v4, NULL);
                                (*fs) |= 4;
                        }
 
-                       if(v1!=v4){
+                       if (v1!=v4) {
                                BLI_edgehash_insert(edgehash, mf->v1, mf->v4, NULL);
                                (*fs) |= 8;
                        }
 
                        /* mark center vertex as a fake edge split */
-                       if(*fs == 15)
+                       if (*fs == 15)
                                BLI_edgehash_insert(edgehash, mf->v1, mf->v3, NULL);
                }
                else {
                        (*fs) |= 16; /* mark face as tri */
 
-                       if(v1!=v3){
+                       if (v1!=v3) {
                                BLI_edgehash_insert(edgehash, mf->v1, mf->v3, NULL);
                                (*fs) |= 4;
                        }
@@ -619,21 +619,21 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
        /* count splits & create indexes for new verts */
        ehi= BLI_edgehashIterator_new(edgehash);
        totesplit=totvert;
-       for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+       for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
                BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totesplit));
                totesplit++;
        }
        BLI_edgehashIterator_free(ehi);
 
        /* count new faces due to splitting */
-       for(i=0,fs=facesplit; i<totface; i++,fs++)
+       for (i=0,fs=facesplit; i<totface; i++,fs++)
                totfsplit += add_faces[*fs];
        
        splitdm= CDDM_from_template(dm, totesplit, 0, totface+totfsplit, 0, 0);
        numlayer = CustomData_number_of_layers(&splitdm->faceData, CD_MTFACE);
 
        /* copy new faces & verts (is it really this painful with custom data??) */
-       for(i=0; i<totvert; i++){
+       for (i=0; i<totvert; i++) {
                MVert source;
                MVert *dest;
                dm->getVert(dm, i, &source);
@@ -655,7 +655,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 
        /* create new verts */
        ehi= BLI_edgehashIterator_new(edgehash);
-       for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+       for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
                BLI_edgehashIterator_getKey(ehi, &ed_v1, &ed_v2);
                esplit= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
                mv=CDDM_get_vert(splitdm, ed_v2);
@@ -675,7 +675,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
        /* create new faces */
        curdupface=0;//=totface;
        //curdupin=totesplit;
-       for(i=0,fs=facesplit; i<totface; i++,fs++){
+       for (i=0,fs=facesplit; i<totface; i++,fs++) {
                mf = dm->getTessFaceData(dm, i, CD_MFACE);
 
                switch(*fs) {
@@ -716,18 +716,18 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
                case 9:
                case 12:
                        remap_faces_3_6_9_12(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
-                       if(numlayer)
+                       if (numlayer)
                                remap_uvs_3_6_9_12(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
                        break;
                case 5:
                case 10:
                        remap_faces_5_10(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
-                       if(numlayer)
+                       if (numlayer)
                                remap_uvs_5_10(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
                        break;
                case 15:
                        remap_faces_15(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
-                       if(numlayer)
+                       if (numlayer)
                                remap_uvs_15(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
                        break;
                case 7:
@@ -735,19 +735,19 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
                case 13:
                case 14:
                        remap_faces_7_11_13_14(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
-                       if(numlayer)
+                       if (numlayer)
                                remap_uvs_7_11_13_14(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
                        break;
                case 19:
                case 21:
                case 22:
                        remap_faces_19_21_22(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2]);
-                       if(numlayer)
+                       if (numlayer)
                                remap_uvs_19_21_22(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2]);
                        break;
                case 23:
                        remap_faces_23(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2]);
-                       if(numlayer)
+                       if (numlayer)
                                remap_uvs_23(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2]);
                        break;
                case 0:
@@ -755,7 +755,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
                        df1 = get_dface(dm, splitdm, curdupface, i, mf);
                        facepa[curdupface] = vertpa[mf->v1];
 
-                       if(df1->v4)
+                       if (df1->v4)
                                df1->flag |= ME_FACE_SEL;
                        else
                                df1->flag &= ~ME_FACE_SEL;
@@ -765,7 +765,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
                curdupface += add_faces[*fs]+1;
        }
 
-       for(i=0; i<curdupface; i++) {
+       for (i=0; i<curdupface; i++) {
                mf = CDDM_get_tessface(splitdm, i);
                test_index_face(mf, &splitdm->faceData, i, (mf->flag & ME_FACE_SEL ? 4 : 3));
        }
@@ -833,7 +833,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 
                /* do mindex + totvert to ensure the vertex index to be the first
                 * with BLI_edgehashIterator_getKey */
-               if(facepa[i]==totpart || cfra < (pars+facepa[i])->time)
+               if (facepa[i]==totpart || cfra < (pars+facepa[i])->time)
                        mindex = totvert+totpart;
                else 
                        mindex = totvert+facepa[i];
@@ -844,13 +844,13 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
                BLI_edgehash_insert(vertpahash, mf->v1, mindex, NULL);
                BLI_edgehash_insert(vertpahash, mf->v2, mindex, NULL);
                BLI_edgehash_insert(vertpahash, mf->v3, mindex, NULL);
-               if(mf->v4)
+               if (mf->v4)
                        BLI_edgehash_insert(vertpahash, mf->v4, mindex, NULL);
        }
 
        /* make new vertice indexes & count total vertices after duplication */
        ehi= BLI_edgehashIterator_new(vertpahash);
-       for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+       for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
                BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totdup));
                totdup++;
        }
@@ -868,7 +868,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 
        /* duplicate & displace vertices */
        ehi= BLI_edgehashIterator_new(vertpahash);
-       for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+       for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
                MVert source;
                MVert *dest;
 
@@ -883,7 +883,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
                DM_copy_vert_data(dm, explode, ed_v1, v, 1);
                *dest = source;
 
-               if(ed_v2 != totpart) {
+               if (ed_v2 != totpart) {
                        /* get particle */
                        pa= pars + ed_v2;
 
@@ -901,7 +901,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
                        sub_qt_qtqt(rot, state.rot, birth.rot);
                        mul_qt_v3(rot, vertco);
 
-                       if(emd->flag & eExplodeFlag_PaSize)
+                       if (emd->flag & eExplodeFlag_PaSize)
                                mul_v3_fl(vertco,pa->size);
 
                        add_v3_v3(vertco, state.co);
@@ -919,9 +919,9 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
                if (facepa[i]!=totpart) {
                        pa=pars+facepa[i];
 
-                       if(pa->alive==PARS_UNBORN && (emd->flag&eExplodeFlag_Unborn)==0) continue;
-                       if(pa->alive==PARS_ALIVE && (emd->flag&eExplodeFlag_Alive)==0) continue;
-                       if(pa->alive==PARS_DEAD && (emd->flag&eExplodeFlag_Dead)==0) continue;
+                       if (pa->alive==PARS_UNBORN && (emd->flag&eExplodeFlag_Unborn)==0) continue;
+                       if (pa->alive==PARS_ALIVE && (emd->flag&eExplodeFlag_Alive)==0) continue;
+                       if (pa->alive==PARS_DEAD && (emd->flag&eExplodeFlag_Dead)==0) continue;
                }
 
                dm->getTessFace(dm,i,&source);
@@ -929,7 +929,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
                
                orig_v4 = source.v4;
 
-               if(facepa[i]!=totpart && cfra < pa->time)
+               if (facepa[i]!=totpart && cfra < pa->time)
                        mindex = totvert+totpart;
                else 
                        mindex = totvert+facepa[i];
@@ -937,7 +937,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
                source.v1 = edgecut_get(vertpahash, source.v1, mindex);
                source.v2 = edgecut_get(vertpahash, source.v2, mindex);
                source.v3 = edgecut_get(vertpahash, source.v3, mindex);
-               if(source.v4)
+               if (source.v4)
                        source.v4 = edgecut_get(vertpahash, source.v4, mindex);
 
                DM_copy_tessface_data(dm,explode,i,u,1);
@@ -945,7 +945,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
                *mf = source;
 
                /* override uv channel for particle age */
-               if(mtface) {
+               if (mtface) {
                        float age = (cfra - pa->time)/pa->lifetime;
                        /* Clamp to this range to avoid flipping to the other side of the coordinates. */
                        CLAMP(age, 0.001f, 0.999f);
@@ -968,7 +968,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
        CDDM_tessfaces_to_faces(explode);
        CDDM_calc_normals(explode);
 
-       if(psmd->psys->lattice){
+       if (psmd->psys->lattice) {
                end_latt_deform(psmd->psys->lattice);
                psmd->psys->lattice= NULL;
        }
@@ -981,8 +981,8 @@ static ParticleSystemModifierData * findPrecedingParticlesystem(Object *ob, Modi
        ModifierData *md;
        ParticleSystemModifierData *psmd= NULL;
 
-       for (md=ob->modifiers.first; emd!=md; md=md->next){
-               if(md->type==eModifierType_ParticleSystem)
+       for (md=ob->modifiers.first; emd!=md; md=md->next) {
+               if (md->type==eModifierType_ParticleSystem)
                        psmd= (ParticleSystemModifierData*) md;
        }
        return psmd;
@@ -998,29 +998,29 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
 
        DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
 
-       if(psmd){
+       if (psmd) {
                ParticleSystem * psys=psmd->psys;
 
-               if(psys==NULL || psys->totpart==0) return derivedData;
-               if(psys->part==NULL || psys->particles==NULL) return derivedData;
-               if(psmd->dm==NULL) return derivedData;
+               if (psys==NULL || psys->totpart==0) return derivedData;
+               if (psys->part==NULL || psys->particles==NULL) return derivedData;
+               if (psmd->dm==NULL) return derivedData;
 
                /* 1. find faces to be exploded if needed */
-               if(emd->facepa == NULL
+               if (emd->facepa == NULL
                                 || psmd->flag&eParticleSystemFlag_Pars
                                 || emd->flag&eExplodeFlag_CalcFaces
                                 || MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumTessFaces(dm))
                {
-                       if(psmd->flag & eParticleSystemFlag_Pars)
+                       if (psmd->flag & eParticleSystemFlag_Pars)
                                psmd->flag &= ~eParticleSystemFlag_Pars;
                        
-                       if(emd->flag & eExplodeFlag_CalcFaces)
+                       if (emd->flag & eExplodeFlag_CalcFaces)
                                emd->flag &= ~eExplodeFlag_CalcFaces;
 
                        createFacepa(emd,psmd,derivedData);
                }
                /* 2. create new mesh */
-               if(emd->flag & eExplodeFlag_EdgeCut){
+               if (emd->flag & eExplodeFlag_EdgeCut) {
                        int *facepa = emd->facepa;
                        DerivedMesh *splitdm=cutEdges(emd,dm);
                        DerivedMesh *explode=explodeMesh(emd, psmd, md->scene, ob, splitdm);
index 3df8718a7c1940809bcd88c2c985de781fb9dc57..9a80f241a003a77a34b3e7dd0510fdfbdabfd3d3 100644 (file)
@@ -68,7 +68,7 @@ static void copyData(ModifierData *md, ModifierData *target)
        FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
        FluidsimModifierData *tfluidmd= (FluidsimModifierData*) target;
        
-       if(tfluidmd->fss)
+       if (tfluidmd->fss)
                MEM_freeN(tfluidmd->fss);
        
        tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
@@ -85,7 +85,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
        DerivedMesh *result = NULL;
        
        /* check for alloc failing */
-       if(!fluidmd->fss) {
+       if (!fluidmd->fss) {
                initData(md);
                
                if (!fluidmd->fss) {
@@ -105,15 +105,15 @@ static void updateDepgraph(
        FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
        Base *base;
 
-       if(fluidmd && fluidmd->fss) {
-               if(fluidmd->fss->type == OB_FLUIDSIM_DOMAIN) {
-                       for(base = scene->base.first; base; base= base->next) {
+       if (fluidmd && fluidmd->fss) {
+               if (fluidmd->fss->type == OB_FLUIDSIM_DOMAIN) {
+                       for (base = scene->base.first; base; base= base->next) {
                                Object *ob1= base->object;
-                               if(ob1 != ob) {
+                               if (ob1 != ob) {
                                        FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob1, eModifierType_Fluidsim);
                                        
                                        // only put dependancies from NON-DOMAIN fluids in here
-                                       if(fluidmdtmp && fluidmdtmp->fss && (fluidmdtmp->fss->type!=OB_FLUIDSIM_DOMAIN)) {
+                                       if (fluidmdtmp && fluidmdtmp->fss && (fluidmdtmp->fss->type!=OB_FLUIDSIM_DOMAIN)) {
                                                DagNode *curNode = dag_get_node(forest, ob1);
                                                dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Fluidsim Object");
                                        }
index 2ccae9671b3e3c1c0ba54fca05319d3b8b5d5c38..9cd656c3621591bd53c83f7dc495885176eaaf34 100644 (file)
 void fluidsim_init(FluidsimModifierData *fluidmd)
 {
 #ifdef WITH_MOD_FLUID
-       if(fluidmd)
+       if (fluidmd)
        {
                FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings");
 
                fluidmd->fss = fss;
                
-               if(!fss)
+               if (!fss)
                        return;
                
                fss->fmd = fluidmd;
@@ -199,21 +199,21 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
 
 
        // read number of normals
-       if(gotBytes)
+       if (gotBytes)
                gotBytes = gzread(gzf, &wri, sizeof(wri));
 
        // skip normals
        gotBytes = gzseek(gzf, numverts * 3 * sizeof(float), SEEK_CUR) != -1;
 
        /* get no. of triangles */
-       if(gotBytes)
+       if (gotBytes)
                gotBytes = gzread(gzf, &wri, sizeof(wri));
        numfaces = wri;
 
        gzclose(gzf);
        // ------------------------------------------------
 
-       if(!numfaces || !numverts || !gotBytes)
+       if (!numfaces || !numverts || !gotBytes)
                return NULL;
 
        gzf = BLI_gzopen(filename, "rb");
@@ -224,7 +224,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
 
        dm = CDDM_new(numverts, 0, 0, numfaces * 3, numfaces);
 
-       if(!dm)
+       if (!dm)
        {
                gzclose(gzf);
                return NULL;
@@ -236,30 +236,30 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
        // read vertex position from file
        mv = CDDM_get_verts(dm);
 
-       for(i=0; i<numverts; i++, mv++)
+       for (i=0; i<numverts; i++, mv++)
                gotBytes = gzread(gzf, mv->co, sizeof(float) * 3);
 
        // should be the same as numverts
        gotBytes = gzread(gzf, &wri, sizeof(wri));
-       if(wri != numverts)
+       if (wri != numverts)
        {
-               if(dm)
+               if (dm)
                        dm->release(dm);
                gzclose(gzf);
                return NULL;
        }
 
        normals = MEM_callocN(sizeof(short) * numverts * 3, "fluid_tmp_normals" );
-       if(!normals)
+       if (!normals)
        {
-               if(dm)
+               if (dm)
                        dm->release(dm);
                gzclose(gzf);
                return NULL;
        }
 
        // read normals from file (but don't save them yet)
-       for(i=numverts, no_s= normals; i>0; i--, no_s += 3)
+       for (i=numverts, no_s= normals; i>0; i--, no_s += 3)
        {
                gotBytes = gzread(gzf, no, sizeof(float) * 3);
                normal_float_to_short_v3(no_s, no);
@@ -268,9 +268,9 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
        /* read no. of triangles */
        gotBytes = gzread(gzf, &wri, sizeof(wri));
 
-       if(wri!=numfaces) {
+       if (wri!=numfaces) {
                printf("Fluidsim: error in reading data from file.\n");
-               if(dm)
+               if (dm)
                        dm->release(dm);
                gzclose(gzf);
                MEM_freeN(normals);
@@ -280,7 +280,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
        // read triangles from file
        mp = CDDM_get_polys(dm);
        ml = CDDM_get_loops(dm);
-       for(i=0; i < numfaces; i++, mp++, ml += 3)
+       for (i=0; i < numfaces; i++, mp++, ml += 3)
        {
                int face[3];
 
@@ -319,7 +319,7 @@ void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4],
        int i;
        float vec[3];
 
-       if(totvert == 0) {
+       if (totvert == 0) {
                zero_v3(start);
                zero_v3(size);
                return;
@@ -330,25 +330,25 @@ void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4],
        bbsx = vec[0]; bbsy = vec[1]; bbsz = vec[2];
        bbex = vec[0]; bbey = vec[1]; bbez = vec[2];
 
-       for(i = 1; i < totvert; i++) {
+       for (i = 1; i < totvert; i++) {
                copy_v3_v3(vec, mvert[i].co);
                mul_m4_v3(obmat, vec);
 
-               if(vec[0] < bbsx){ bbsx= vec[0]; }
-               if(vec[1] < bbsy){ bbsy= vec[1]; }
-               if(vec[2] < bbsz){ bbsz= vec[2]; }
-               if(vec[0] > bbex){ bbex= vec[0]; }
-               if(vec[1] > bbey){ bbey= vec[1]; }
-               if(vec[2] > bbez){ bbez= vec[2]; }
+               if (vec[0] < bbsx) { bbsx= vec[0]; }
+               if (vec[1] < bbsy) { bbsy= vec[1]; }
+               if (vec[2] < bbsz) { bbsz= vec[2]; }
+               if (vec[0] > bbex) { bbex= vec[0]; }
+               if (vec[1] > bbey) { bbey= vec[1]; }
+               if (vec[2] > bbez) { bbez= vec[2]; }
        }
 
        // return values...
-       if(start) {
+       if (start) {
                start[0] = bbsx;
                start[1] = bbsy;
                start[2] = bbsz;
        }
-       if(size) {
+       if (size) {
                size[0] = bbex-bbsx;
                size[1] = bbey-bbsy;
                size[2] = bbez-bbsz;
@@ -365,7 +365,7 @@ void fluid_estimate_memory(Object *ob, FluidsimSettings *fss, char *value)
 
        value[0]= '\0';
 
-       if(ob->type == OB_MESH) {
+       if (ob->type == OB_MESH) {
                /* use mesh bounding box and object scaling */
                mesh= ob->data;
 
@@ -388,15 +388,15 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
 
        // mesh and vverts have to be valid from loading...
 
-       if(fss->meshVelocities)
+       if (fss->meshVelocities)
                MEM_freeN(fss->meshVelocities);
 
-       if(len<7)
+       if (len<7)
        {
                return;
        }
 
-       if(fss->domainNovecgen>0) return;
+       if (fss->domainNovecgen>0) return;
 
        fss->meshVelocities = MEM_callocN(sizeof(FluidVertexVelocity)*dm->getNumVerts(dm), "Fluidsim_velocities");
        fss->totvert = totvert;
@@ -418,16 +418,16 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
        }
 
        gzread(gzf, &wri, sizeof( wri ));
-       if(wri != totvert)
+       if (wri != totvert)
        {
                MEM_freeN(fss->meshVelocities);
                fss->meshVelocities = NULL;
                return;
        }
 
-       for(i=0; i<totvert;i++)
+       for (i=0; i<totvert;i++)
        {
-               for(j=0; j<3; j++)
+               for (j=0; j<3; j++)
                {
                        gzread(gzf, &wrf, sizeof( wrf ));
                        velarray[i].vel[j] = wrf;
@@ -447,9 +447,10 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim
        MPoly *mpoly;
        MPoly mp_example = {0};
 
-       if(!useRenderParams) {
+       if (!useRenderParams) {
                displaymode = fss->guiDisplayMode;
-       } else {
+       }
+       else {
                displaymode = fss->renderDisplayMode;
        }
 
@@ -483,15 +484,15 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim
 
        dm = fluidsim_read_obj(targetFile, &mp_example);
 
-       if(!dm)
+       if (!dm)
        {
                // switch, abort background rendering when fluidsim mesh is missing
                const char *strEnvName2 = "BLENDER_ELBEEMBOBJABORT"; // from blendercall.cpp
 
-               if(G.background==1) {
-                       if(getenv(strEnvName2)) {
+               if (G.background==1) {
+                       if (getenv(strEnvName2)) {
                                int elevel = atoi(getenv(strEnvName2));
-                               if(elevel>0) {
+                               if (elevel>0) {
                                        printf("Env. var %s set, fluid sim mesh '%s' not found, aborting render...\n",strEnvName2, targetFile);
                                        exit(1);
                                }
@@ -509,7 +510,7 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim
                fluidsim_read_vel_cache(fluidmd, dm, targetFile);
        }
        else {
-               if(fss->meshVelocities)
+               if (fss->meshVelocities)
                        MEM_freeN(fss->meshVelocities);
 
                fss->meshVelocities = NULL;
@@ -532,11 +533,11 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
        framenr= (int)scene->r.cfra;
        
        // only handle fluidsim domains
-       if(fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN))
+       if (fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN))
                return dm;
        
        // sanity check
-       if(!fluidmd || (fluidmd && !fluidmd->fss))
+       if (!fluidmd || (fluidmd && !fluidmd->fss))
                return dm;
        
        fss = fluidmd->fss;
@@ -552,7 +553,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
        
        /* try to read from cache */
        /* if the frame is there, fine, otherwise don't do anything */
-       if((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams)))
+       if ((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams)))
                return result;
        
        return dm;
index 97e406c6960bc5c430b24e4161c8e8480f9392c3..d8fbb6f468faa90f9f8502f045de163a7448b7e5 100644 (file)
@@ -81,8 +81,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
        CustomDataMask dataMask = 0;
 
        /* ask for vertexgroups if we need them */
-       if(hmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-       if(hmd->indexar) dataMask |= CD_MASK_ORIGINDEX;
+       if (hmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+       if (hmd->indexar) dataMask |= CD_MASK_ORIGINDEX;
 
        return dataMask;
 }
@@ -130,12 +130,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 
 static float hook_falloff(float *co_1, float *co_2, const float falloff_squared, float fac)
 {
-       if(falloff_squared) {
+       if (falloff_squared) {
                float len_squared = len_squared_v3v3(co_1, co_2);
-               if(len_squared > falloff_squared) {
+               if (len_squared > falloff_squared) {
                        return 0.0f;
                }
-               else if(len_squared > 0.0f) {
+               else if (len_squared > 0.0f) {
                        return fac * (1.0f - (len_squared / falloff_squared));
                }
        }
@@ -178,28 +178,28 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
         * not correct them on exit editmode. - zr
         */
        
-       if(hmd->force == 0.0f) {
+       if (hmd->force == 0.0f) {
                /* do nothing, avoid annoying checks in the loop */
        }
-       else if(hmd->indexar) { /* vertex indices? */
+       else if (hmd->indexar) { /* vertex indices? */
                const float fac_orig= hmd->force;
                float fac;
                const int *origindex_ar;
                
                /* if DerivedMesh is present and has original index data, use it */
-               if(dm && (origindex_ar= dm->getVertDataArray(dm, CD_ORIGINDEX))) {
-                       for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
-                               if(*index_pt < numVerts) {
+               if (dm && (origindex_ar= dm->getVertDataArray(dm, CD_ORIGINDEX))) {
+                       for (i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
+                               if (*index_pt < numVerts) {
                                        int j;
                                        
-                                       for(j = 0; j < numVerts; j++) {
-                                               if(origindex_ar[j] == *index_pt) {
+                                       for (j = 0; j < numVerts; j++) {
+                                               if (origindex_ar[j] == *index_pt) {
                                                        float *co = vertexCos[j];
-                                                       if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
-                                                               if(dvert)
+                                                       if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+                                                               if (dvert)
                                                                        fac *= defvert_find_weight(dvert+j, defgrp_index);
                                                                
-                                                               if(fac) {
+                                                               if (fac) {
                                                                        mul_v3_m4v3(vec, mat, co);
                                                                        interp_v3_v3v3(co, co, vec, fac);
                                                                }
@@ -210,14 +210,14 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
                        }
                }
                else { /* missing dm or ORIGINDEX */
-                       for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
-                               if(*index_pt < numVerts) {
+                       for (i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
+                               if (*index_pt < numVerts) {
                                        float *co = vertexCos[*index_pt];
-                                       if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
-                                               if(dvert)
+                                       if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+                                               if (dvert)
                                                        fac *= defvert_find_weight(dvert+(*index_pt), defgrp_index);
                                                
-                                               if(fac) {
+                                               if (fac) {
                                                        mul_v3_m4v3(vec, mat, co);
                                                        interp_v3_v3v3(co, co, vec, fac);
                                                }
@@ -226,16 +226,16 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
                        }
                }
        }
-       else if(dvert) {        /* vertex group hook */
+       else if (dvert) {       /* vertex group hook */
                const float fac_orig= hmd->force;
                
-               for(i = 0; i < max_dvert; i++, dvert++) {
+               for (i = 0; i < max_dvert; i++, dvert++) {
                        float fac;
                        float *co = vertexCos[i];
                        
-                       if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+                       if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
                                fac *= defvert_find_weight(dvert, defgrp_index);
-                               if(fac) {
+                               if (fac) {
                                        mul_v3_m4v3(vec, mat, co);
                                        interp_v3_v3v3(co, co, vec, fac);
                                }
@@ -251,12 +251,12 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
        HookModifierData *hmd = (HookModifierData*) md;
        DerivedMesh *dm = derivedData;
        /* We need a valid dm for meshes when a vgroup is set... */
-       if(!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
+       if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
                dm = get_dm(ob, NULL, dm, NULL, 0);
 
        deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
 
-       if(derivedData != dm)
+       if (derivedData != dm)
                dm->release(dm);
 }
 
@@ -266,12 +266,12 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD
        HookModifierData *hmd = (HookModifierData*) md;
        DerivedMesh *dm = derivedData;
        /* We need a valid dm for meshes when a vgroup is set... */
-       if(!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
+       if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
                dm = get_dm(ob, editData, dm, NULL, 0);
 
        deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
 
-       if(derivedData != dm)
+       if (derivedData != dm)
                dm->release(dm);
 }
 
index 00a634e8838871a9695146b111aeb866283d3192..35503f9e4621b6edc6d597aafc2272bb1bf70620 100644 (file)
@@ -65,7 +65,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
        CustomDataMask dataMask = 0;
 
        /* ask for vertexgroups if we need them */
-       if(lmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+       if (lmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
        return dataMask;
 }
@@ -94,7 +94,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 {
        LatticeModifierData *lmd = (LatticeModifierData*) md;
 
-       if(lmd->object) {
+       if (lmd->object) {
                DagNode *latNode = dag_get_node(forest, lmd->object);
 
                dag_add_relation(forest, latNode, obNode,
@@ -124,11 +124,11 @@ static void deformVertsEM(
 {
        DerivedMesh *dm = derivedData;
 
-       if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
+       if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
 
        deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0);
 
-       if(!derivedData) dm->release(dm);
+       if (!derivedData) dm->release(dm);
 }
 
 
index b9768ff99993f59c8f63b4cb4a2504e507a6a2fe..da4a489838f23c752804862bded29d380a4f3782 100644 (file)
@@ -203,7 +203,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
                        for (j= dv->totweight; j > 0; j--, dw++) {
                                if (dw->def_nr < defbase_tot) {
                                        if (bone_select_array[dw->def_nr]) {
-                                               if(dw->weight != 0.0f) {
+                                               if (dw->weight != 0.0f) {
                                                        break;