* Fix for old files loading up with gloss = 0.0 and gloss samples = 0.
authorMatt Ebb <matt@mke3.net>
Thu, 20 Sep 2007 05:56:57 +0000 (05:56 +0000)
committerMatt Ebb <matt@mke3.net>
Thu, 20 Sep 2007 05:56:57 +0000 (05:56 +0000)
I blame the 2.45 version-raising!

source/blender/blenloader/intern/readfile.c
source/blender/src/buttons_shading.c

index 624bfedf6cd1a1fcb5f67c6dcacc5f4059137235..6b4444e03119d9d5ec6cd833d903dda44dc8d2c7 100644 (file)
@@ -6648,15 +6648,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                }
                        }
                        
-                       for(ma=main->mat.first; ma; ma= ma->id.next) {
-                               ma->gloss_mir = ma->gloss_tra= 1.0;
-                               ma->aniso_gloss_mir = 1.0;
-                               ma->samp_gloss_mir = ma->samp_gloss_tra= 18;
-                               ma->adapt_thresh_mir = ma->adapt_thresh_tra = 0.005;
-                               ma->dist_mir = 0.0;
-                               ma->fadeto_mir = MA_RAYMIR_FADETOSKY;
-                       }
-                       
                        for(wrld=main->world.first; wrld; wrld= wrld->id.next) {
                                if (wrld->mode & WO_AMB_OCC)
                                        wrld->ao_samp_method = WO_AOSAMP_CONSTANT;
@@ -6677,22 +6668,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
        if(main->versionfile <= 245) {
-               Lamp *la;
-               if (main->versionfile != 245 || main->subversionfile < 1) {
-                       for(la=main->lamp.first; la; la= la->id.next) {
-                               if (la->mode & LA_QUAD) la->falloff_type = LA_FALLOFF_SLIDERS;
-                               else la->falloff_type = LA_FALLOFF_INVLINEAR;
-                                       
-                               la->curfalloff = curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f);
-                               curvemapping_initialize(la->curfalloff);
-                       }
-               }
-       }
-
-       if (main->versionfile <= 245) {
                bScreen *sc;
                Image* ima;
-
+               Lamp *la;
+               Material *ma;
+               
                /* fix all versions before 2.45 */
                if (main->versionfile != 245) {
 
@@ -6745,7 +6725,30 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                }
                        }
                }
-
+               
+               if (main->versionfile != 245 || main->subversionfile < 1) {
+                       for(la=main->lamp.first; la; la= la->id.next) {
+                               if (la->mode & LA_QUAD) la->falloff_type = LA_FALLOFF_SLIDERS;
+                               else la->falloff_type = LA_FALLOFF_INVLINEAR;
+                               
+                               if (la->curfalloff == NULL) {
+                                       la->curfalloff = curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f);
+                                       curvemapping_initialize(la->curfalloff);
+                               }
+                       }
+               }               
+               
+               for(ma=main->mat.first; ma; ma= ma->id.next) {
+                       if (ma->samp_gloss_mir == 0) {
+                               ma->gloss_mir = ma->gloss_tra= 1.0;
+                               ma->aniso_gloss_mir = 1.0;
+                               ma->samp_gloss_mir = ma->samp_gloss_tra= 18;
+                               ma->adapt_thresh_mir = ma->adapt_thresh_tra = 0.005;
+                               ma->dist_mir = 0.0;
+                               ma->fadeto_mir = MA_RAYMIR_FADETOSKY;
+                       }
+               }
+               
        }
 
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
index a26ef722a1056871a0c6581368a2edf60d2d6a88..e3bb782aceff0a3004babf58e2b528b4fdc5b0c7 100644 (file)
@@ -1361,7 +1361,7 @@ static void texture_panel_envmap(Tex *tex)
                uiDefButF(block, NUM, B_TEXPRV, "Filter :",                             10,65,150,20, &tex->filtersize, 0.1, 25.0, 0, 3, "Adjusts sharpness or blurriness of the reflection"),
                        uiDefButS(block, NUM, B_ENV_FREE, "Depth:",                             160,65,150,20, &env->depth, 0, 5.0, 0, 0, "Sets the number of times a map will be rendered recursively mirror effects"),
                        uiDefButF(block, NUM, REDRAWVIEW3D,     "ClipSta",              10,40,150,20, &env->clipsta, 0.01, 50.0, 100, 0, "Sets start value for clipping: objects nearer than this are not visible to map");
-               uiDefButF(block, NUM, B_NOP,    "ClipEnd",                                      160,40,150,20, &env->clipend, 0.1, 10000.0, 1000, 0, "Sets end value for clipping beyond which objects are not visible to map");
+               uiDefButF(block, NUM, B_NOP,    "ClipEnd",                                      160,40,150,20, &env->clipend, 0.1, 20000.0, 1000, 0, "Sets end value for clipping beyond which objects are not visible to map");
                uiBlockEndAlign(block);
                
                uiDefBut(block, LABEL, 0, "Don't render layer:",                10,10,140,22, 0, 0.0, 0.0, 0, 0, "");   
@@ -3324,7 +3324,7 @@ static void material_panel_tramir(Material *ma)
        uiDefButF(block, NUMSLI, B_MATPRV, "Aniso: ",
                X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->aniso_gloss_mir), 0.0, 1.0, 100, 0, "The shape of the reflection, from 0. (circular) to 1.0 (fully stretched along the tangent)");
        uiDefButS(block, NUM, B_MATPRV, "Samples:",
-               X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->samp_gloss_mir), 0.0, 1024.0, 100, 0, "Number of cone samples averaged for blurry reflections");  
+               X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->samp_gloss_mir), 1.0, 1024.0, 100, 0, "Number of cone samples averaged for blurry reflections");  
        uiDefButF(block, NUM, B_MATPRV, "Thresh: ",
                X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->adapt_thresh_mir), 0.0, 1.0, 100, 0, "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped");
        uiBlockEndAlign(block);
@@ -3925,7 +3925,7 @@ static void material_panel_links(Object *ob, Material *ma)
        uiBlockBeginAlign(block);
        uiDefButBitI(block, TOG, MA_HALO, B_MATHALO, "Halo",            10,50,100,19, &(ma->mode), 0, 0, 0, 0, "Renders material as a halo");
        uiDefButBitI(block, TOG, MA_ZTRA, B_MATZTRANSP,"ZTransp",       110,50,100,19, &(ma->mode), 0, 0, 0, 0, "Enables Z-Buffering of transparent faces");
-       uiDefButF(block, NUM, B_DIFF, "Zoffs:",                                         210,50,100,19, &(ma->zoffs), 0.0, 10.0, 100, 0, "Gives faces an artificial offset in the Z buffer for Ztransp option");
+       uiDefButF(block, NUM, B_DIFF, "Zoffs:",                                         210,50,100,19, &(ma->zoffs), 0.0, 100.0, 100, 0, "Gives faces an artificial offset in the Z buffer for Ztransp option");
                                  
        uiDefButBitI(block, TOG, MA_FULL_OSA, 0, "Full Osa",            10,30,75,19, &(ma->mode), 0.0, 10.0, 0, 0, "Forces to render all OSA samples, for shading and texture antialiasing");
        uiDefButBitI(block, TOG, MA_WIRE, B_MATPRV,     "Wire",                         85,30,75,19, &(ma->mode), 0, 0, 0, 0, "Renders only the edges of faces as a wireframe");