code cleanup: favor braces when blocks have mixed brace use.
[blender.git] / source / blender / editors / render / render_preview.c
index 33b00cb..5caa874 100644 (file)
@@ -110,7 +110,7 @@ ImBuf *get_brush_icon(Brush *brush)
        static const int flags = IB_rect | IB_multilayer | IB_metadata;
 
        char path[FILE_MAX];
-       char *folder;
+       const char *folder;
 
        if (!(brush->icon_imbuf)) {
                if (brush->flag & BRUSH_CUSTOM_ICON) {
@@ -362,7 +362,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
                                }
                                else {
                                        /* use current scene world to light sphere */
-                                       if (ma->pr_type == MA_SPHERE_A)
+                                       if (mat->pr_type == MA_SPHERE_A)
                                                sce->world = scene->world;
                                }
                                
@@ -425,15 +425,16 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
                                                
                                                if (tex && sp->slot)
                                                        mat->mtex[0]->which_output = sp->slot->which_output;
-                                               
+
+                                               mat->mtex[0]->mapto &= ~MAP_ALPHA;
+                                               mat->alpha = 1.0f;
+
                                                /* show alpha in this case */
                                                if (tex == NULL || (tex->flag & TEX_PRV_ALPHA)) {
-                                                       mat->mtex[0]->mapto |= MAP_ALPHA;
-                                                       mat->alpha = 0.0f;
-                                               }
-                                               else {
-                                                       mat->mtex[0]->mapto &= ~MAP_ALPHA;
-                                                       mat->alpha = 1.0f;
+                                                       if (!(tex && tex->type == TEX_IMAGE && (tex->imaflag & (TEX_USEALPHA | TEX_CALCALPHA)) == 0)) {
+                                                               mat->mtex[0]->mapto |= MAP_ALPHA;
+                                                               mat->alpha = 0.0f;
+                                                       }
                                                }
                                        }
                                }
@@ -670,8 +671,10 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
                if (first) sizex = sp->sizex / 2;
                else sizex = sp->sizex - sp->sizex / 2;
        }
-       else sizex = sp->sizex;
-       
+       else {
+               sizex = sp->sizex;
+       }
+
        /* we have to set preview variables first */
        sce = preview_get_scene(pr_main);
        if (sce) {