(no commit message)
authorErvin Weber <ervin.weber@gmail.com>
Fri, 11 Mar 2011 07:59:43 +0000 (07:59 +0000)
committerErvin Weber <ervin.weber@gmail.com>
Fri, 11 Mar 2011 07:59:43 +0000 (07:59 +0000)
release/scripts/ui/properties_material.py
source/blender/blenkernel/BKE_blender.h
source/blender/blenloader/intern/readfile.c
source/blender/makesrna/intern/rna_material.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/shadeoutput.c

index 5554390e3a8044120f3bf2e7ff89dd6b171e0035..a8fe05ca11086d8066b657eb0b114271b1a158d1 100644 (file)
@@ -373,11 +373,12 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
             row.prop(mat, "transparency_method", expand=True)
 
         split = layout.split()
+        split.active = base_mat.use_transparency
 
         col = split.column()
         col.prop(mat, "alpha")
         row = col.row()
-        row.active = base_mat.use_transparency and (not mat.use_shadeless)
+        row.active = (base_mat.transparency_method != 'MASK') and (not mat.use_shadeless)
         row.prop(mat, "specular_alpha", text="Specular")
 
         col = split.column()
index f6bb4fbb6352b8a96ea7b274bfeb67ccad9bfef2..6cbc49e19c87c3455ccb074846ddc406da38ed58 100644 (file)
@@ -44,7 +44,7 @@ extern "C" {
  * and keep comment above the defines.
  * Use STRINGIFY() rather then defining with quotes */
 #define BLENDER_VERSION                        256
-#define BLENDER_SUBVERSION             2
+#define BLENDER_SUBVERSION             3
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0
index 27690cb595f90c4cb7a55ff9cafad13945969a63..3b69d73f7bfb7463d506e263bf2261eaaefaf078 100644 (file)
@@ -11488,6 +11488,29 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
 
+       if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)){
+
+               Material *mat;
+               int tex_nr, transp_tex;
+               
+               for(mat = main->mat.first; mat; mat = mat->id.next){
+                       if(!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)){
+                               
+                               transp_tex= 0;
+                               
+                               for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++){
+                                       if(!mat->mtex[tex_nr]) continue;
+                                       if(mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1;
+                               }
+                               
+                               if(mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex){
+                                       mat->mode |= MA_TRANSP;
+                                       mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP);
+                               }
+                       }
+               }
+       }
+
        /* put compatibility code here until next subversion bump */
 
        {
index 66939b58550442b70030f70d2913aed17cdc8d48..e593f3050948bfbe85d1a877b78071c60304fe69 100644 (file)
@@ -1569,6 +1569,7 @@ void RNA_def_material(BlenderRNA *brna)
                {MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles"},
                {0, NULL, 0, NULL, NULL}};
        static EnumPropertyItem transparency_items[] = {
+               {0, "MASK", 0, "Mask", "Mask the background"},
                {MA_ZTRANSP, "Z_TRANSPARENCY", 0, "Z Transparency", "Use alpha buffer for transparent faces"},
                {MA_RAYTRANSP, "RAYTRACE", 0, "Raytrace", "Use raytracing for transparent refraction rendering"},
                {0, NULL, 0, NULL, NULL}};
index 81652f5a290c1b0dbd3593520fc325aa5a878ea9..d7eb22b5fc7d210118ee56e1fdb38ccee5fb5388 100644 (file)
@@ -3350,7 +3350,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
                                
                                /* test for 100% transparant */
                                ok= 1;
-                               if(ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f) {
+                               if(ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f && (ma->mode & MA_TRANSP)) { 
                                        ok= 0;
                                        /* texture on transparency? */
                                        for(a=0; a<MAX_MTEX; a++) {
index 6f639de70d52ea10a6dbf3f363abbfb4580ad83a..c69507e6bf53bd5fe91d00a1a56ca02144972b5a 100644 (file)
@@ -762,7 +762,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
                if(depth>0) {
                        float fr, fg, fb, f, f1;
 
-                       if((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f) {
+                       if((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f && (shi.mat->mode_l & (MA_ZTRANSP | MA_RAYTRANSP))) { 
                                float nf, f, refract[3], tracol[4];
                                
                                tracol[0]= shi.r;
index 0081f809a0921857e9d8cb414a22ce522edbaab3..768f1425c6ff60e7c8c96629f88416ca15b941f4 100644 (file)
@@ -878,7 +878,9 @@ void shade_color(ShadeInput *shi, ShadeResult *shr)
 
        if(ma->fresnel_tra!=0.0f) 
                shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
-
+       
+       if (!(shi->mode & MA_TRANSP)) shi->alpha= 1.0f;
+       
        shr->diff[0]= shi->r;
        shr->diff[1]= shi->g;
        shr->diff[2]= shi->b;
@@ -1578,7 +1580,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
                                        accum = 1.0f - shaded;
                        }}
 
-                       shr->alpha= (shi->mat->alpha)*(accum);
+                       shr->alpha= (shi->alpha)*(accum);
                }
                else {
                        /* If "fully shaded", use full alpha even on areas that have no lights */
@@ -1638,6 +1640,8 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
        
        memset(shr, 0, sizeof(ShadeResult));
        
+       if(!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
+       
        /* separate loop */
        if(ma->mode & MA_ONLYSHADOW) {
                shade_lamp_loop_only_shadow(shi, shr);
@@ -1654,10 +1658,12 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
                        shi->g= shi->vcol[1];
                        shi->b= shi->vcol[2];
                        if(ma->mode & (MA_FACETEXTURE_ALPHA))
-                               shi->alpha= shi->vcol[3];
+                               shi->alpha= (shi->mode & MA_TRANSP) ? shi->vcol[3] : 1.0f;
                }
-               if(ma->texco)
+               if(ma->texco){
                        do_material_tex(shi);
+                       if (!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
+               }
                
                shr->col[0]= shi->r*shi->alpha;
                shr->col[1]= shi->g*shi->alpha;
@@ -1812,11 +1818,11 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
        
        /* alpha in end, spec can influence it */
        if(passflag & (SCE_PASS_COMBINED)) {
-               if(ma->fresnel_tra!=0.0f) 
+               if((ma->fresnel_tra!=0.0f) && (shi->mode & MA_TRANSP))
                        shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
                        
                /* note: shi->mode! */
-               if(shi->mode & MA_TRANSP) {
+               if(shi->mode & MA_TRANSP && (shi->mode & (MA_ZTRANSP|MA_RAYTRANSP))) {
                        if(shi->spectra!=0.0f) {
                                float t = MAX3(shr->spec[0], shr->spec[1], shr->spec[2]);
                                t *= shi->spectra;
@@ -1886,7 +1892,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
                        shr->combined[0] *= obcol[0];
                        shr->combined[1] *= obcol[1];
                        shr->combined[2] *= obcol[2];
-                       shr->alpha *= obcol[3];
+                       if (shi->mode & MA_TRANSP) shr->alpha *= obcol[3];
                }
        }