From 45acf427a7352bbffffcec93d43b50220febbd04 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Tue, 23 Sep 2008 08:00:55 +0000 Subject: [PATCH] * bugfix, old files (including default cube) weren't loading up with correctly initialised volume settings --- source/blender/blenloader/intern/readfile.c | 28 ++++++++++++--------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 41035b1c373..e106dd6cb59 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7720,7 +7720,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Scene *sce= main->scene.first; Sequence *seq; Editing *ed; - Material *ma; while(sce) { ed= sce->ed; @@ -7735,17 +7734,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce= sce->id.next; } - - for(ma=main->mat.first; ma; ma= ma->id.next) { - /* trigger for non-volumetric file */ - if (ma->vol_shade_stepsize < 0.0001f) { - ma->vol_shade_stepsize = 0.2f; - ma->vol_stepsize = 0.2f; - ma->vol_absorption = 1.0f; - ma->vol_scattering = 1.0f; - ma->vol_absorption_col[0] = ma->vol_absorption_col[1] = ma->vol_absorption_col[2] = 0.0f; - } - } } /*fix broken group lengths in id properties*/ @@ -7869,6 +7857,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main) la->skyblendtype= MA_RAMP_ADD; la->skyblendfac= 1.0f; } + + } + + if (main->versionfile <= 247) { + Material *ma; + + for(ma=main->mat.first; ma; ma= ma->id.next) { + /* trigger for non-volumetric file */ + if (ma->vol_shade_stepsize < 0.0001f) { + ma->vol_shade_stepsize = 0.2f; + ma->vol_stepsize = 0.2f; + ma->vol_absorption = 1.0f; + ma->vol_scattering = 1.0f; + ma->vol_absorption_col[0] = ma->vol_absorption_col[1] = ma->vol_absorption_col[2] = 0.0f; + } + } } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */