Revision: 16252
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16252
Author:   unclezeiv
Date:     2008-08-25 18:52:58 +0200 (Mon, 25 Aug 2008)

Log Message:
-----------
Minor fixes:
- fixed typo in deallocation function that could give memory errors
- vpl visualization mesh: avoid creating mesh if no vpl were generated
- default values in do_versions are now set for versions <= 247

Modified Paths:
--------------
    branches/soc-2008-unclezeiv/source/blender/blenloader/intern/readfile.c
    branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c

Modified: 
branches/soc-2008-unclezeiv/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/blenloader/intern/readfile.c     
2008-08-25 15:33:18 UTC (rev 16251)
+++ branches/soc-2008-unclezeiv/source/blender/blenloader/intern/readfile.c     
2008-08-25 16:52:58 UTC (rev 16252)
@@ -7727,33 +7727,6 @@
                idproperties_fix_group_lengths(main->brush);
                idproperties_fix_group_lengths(main->particle);         
        }
-       
-       if(main->versionfile <= 246) {
-               Scene *sce= main->scene.first;
-               RenderData *r;
-               
-               while(sce) {
-                       r= &sce->r;
-                       if(r) {
-                               if(r->lightcuts_max_error<=0.0)
-                                       r->lightcuts_max_error= 0.02;
-                               if(r->lightcuts_max_cut<=0)
-                                       r->lightcuts_max_cut= 1000;
-                               if(r->lightcuts_indir_fac<=0.0f)
-                                       r->lightcuts_indir_fac= 100.0f;
-                               if(r->lightcuts_env_map<=0.0f)
-                                       r->lightcuts_env_map= 4096.0f;
-                               if(r->lightcuts_area_lights<=0.0f)
-                                       r->lightcuts_area_lights= 4000.0f;
-                               if(r->lightcuts_indir_dist<=0.0f)
-                                       r->lightcuts_indir_dist= 5.0f;
-                               if(r->lightcuts_color_weight==0)
-                                       r->lightcuts_color_weight= 1;
-                       }
-                       
-                       sce= sce->id.next;
-               }
-       }
 
        /* sun/sky */
        if(main->versionfile < 246) {
@@ -7788,6 +7761,34 @@
                                ob->pd->f_noise = 0.0;
                }
        }
+       
+       /* lightcuts stuff */
+       if(main->versionfile <= 247) {
+               Scene *sce= main->scene.first;
+               RenderData *r;
+               
+               while(sce) {
+                       r= &sce->r;
+                       if(r) {
+                               if(r->lightcuts_max_error<=0.0)
+                                       r->lightcuts_max_error= 0.02;
+                               if(r->lightcuts_max_cut<=0)
+                                       r->lightcuts_max_cut= 1000;
+                               if(r->lightcuts_indir_fac<=0.0f)
+                                       r->lightcuts_indir_fac= 100.0f;
+                               if(r->lightcuts_env_map<=0.0f)
+                                       r->lightcuts_env_map= 4096.0f;
+                               if(r->lightcuts_area_lights<=0.0f)
+                                       r->lightcuts_area_lights= 4000.0f;
+                               if(r->lightcuts_indir_dist<=0.0f)
+                                       r->lightcuts_indir_dist= 5.0f;
+                               if(r->lightcuts_color_weight==0)
+                                       r->lightcuts_color_weight= 1;
+                       }
+                       
+                       sce= sce->id.next;
+               }
+       }
 
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! 
*/
        /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */

Modified: 
branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 
2008-08-25 15:33:18 UTC (rev 16251)
+++ branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 
2008-08-25 16:52:58 UTC (rev 16252)
@@ -1628,7 +1628,8 @@
                
                max_vpl= (nlights + re->r.lightcuts_area_lights + 
re->r.lightcuts_env_map) * lcd->do_indir;
                
-               lcd->dbg_vis_vpl= MEM_callocN(sizeof(float) * 3 * max_vpl, 
"lc_vpl_visualization");
+               if (max_vpl != 0)
+                       lcd->dbg_vis_vpl= MEM_callocN(sizeof(float) * 3 * 
max_vpl, "lc_vpl_visualization");
        }
        
        /* TODO: we could do some form of importance sampling here */
@@ -1735,7 +1736,7 @@
        /* XXX: restore mode (terrible hack needed by get_bounce_color) */
        R.r.mode|= R_LIGHTCUTS;
        
-       if (lcd->options & LC_OPT_INDIR_MESH)
+       if (lcd->options & LC_OPT_INDIR_MESH && lcd->vpl_counter > 0)
                dbg_create_vpl_mesh(re, lcd);
 }
 
@@ -2396,7 +2397,7 @@
                                MEM_freeN(lcd->trees[i].array);
                BLI_freelistN(&lcd->pointlights);
                MEM_freeN(lcd->cut_nodes);
-               if (lcd->dbg_vis_vpl);
+               if (lcd->dbg_vis_vpl)
                        MEM_freeN(lcd->dbg_vis_vpl);
                MEM_freeN(lcd);
        }


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to