Render feature request; when saving EXR files during anim render, it can
authorTon Roosendaal <ton@blender.org>
Fri, 3 Feb 2006 21:38:59 +0000 (21:38 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 3 Feb 2006 21:38:59 +0000 (21:38 +0000)
optionally save a jpg next to it, with compression as set in buttons.

This allows quick previews or download from farms.

Button: next to the 'half' and 'zbuf' options for exr.

source/blender/makesdna/DNA_scene_types.h
source/blender/render/intern/source/pipeline.c
source/blender/src/buttons_scene.c

index 9c1e2d3ec9a234a1f169a34b0512a179ec7a2359..ca6823bc95986acb84cd63f5ea41fa8db7fdb6e1 100644 (file)
@@ -447,6 +447,7 @@ typedef struct Scene {
 /* subimtype, flag options for imtype */
 #define R_OPENEXR_HALF 1
 #define R_OPENEXR_ZBUF 2
+#define R_PREVIEW_JPG  4
 
 
 /* **************** SCENE ********************* */
index 97e45abe59602855e78d35622633da27163d2e12..83c0f88ae71276b32141f015a749333d99d8fec4 100644 (file)
@@ -1055,13 +1055,21 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra)
                                ibuf->rect_float= rres.rectf;
                                ibuf->zbuf_float= rres.rectz;
                                ok= BKE_write_ibuf(ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
-                               IMB_freeImBuf(ibuf);    /* imbuf knows which rects are not part of ibuf */
-
                                if(ok==0) {
                                        printf("Render error: cannot save %s\n", name);
                                        break;
                                }
                                else printf("Saved: %s", name);
+                               
+                               /* optional preview images for exr */
+                               if(ok && scene->r.imtype==R_OPENEXR && (scene->r.subimtype & R_PREVIEW_JPG)) {
+                                       if(BLI_testextensie(name, ".exr")) name[strlen(name)-4]= 0;
+                                       BKE_add_image_extension(name, R_JPEG90);
+                                       BKE_write_ibuf(ibuf, name, R_JPEG90, scene->r.subimtype, scene->r.quality);
+                                       printf("Saved: %s", name);
+                               }
+                                  
+                               IMB_freeImBuf(ibuf);    /* imbuf knows which rects are not part of ibuf */
                        }
                        
                        BLI_timestr(re->i.lastframetime, name);
index 43bcb30ecca5cf343dce46ecc23eeb85114c8854..e4dc75a413147f7655b8d2338af0a29ee380fc8c 100644 (file)
@@ -1268,8 +1268,7 @@ static void render_panel_format(void)
 #endif
 
        
-       uiDefButS(block, MENU,B_FILETYPEMENU,imagetype_pup(),   892,yofs,174,20, &G.scene->r.imtype, 0, 0, 0, 0, "Images are saved in this file format");
-       uiDefButBitI(block, TOG, R_MOVIECROP, B_DIFF, "Crop",   1068,yofs,51,20, &G.scene->r.mode, 0, 0, 0, 0, "Exclude border rendering from total image");
+       uiDefButS(block, MENU,B_FILETYPEMENU,imagetype_pup(),   892,yofs,225,20, &G.scene->r.imtype, 0, 0, 0, 0, "Images are saved in this file format");
 
        yofs -= 22;
 
@@ -1312,6 +1311,7 @@ static void render_panel_format(void)
                uiDefButBitS(block, TOG, R_OPENEXR_HALF, B_NOP,"Half",  892,yofs+44,60,20, &G.scene->r.subimtype, 0, 0, 0, 0, "Use 16 bits float 'Half' type");
                uiDefButBitS(block, TOG, R_OPENEXR_ZBUF, B_NOP,"Zbuf",  952,yofs+44,60,20, &G.scene->r.subimtype, 0, 0, 0, 0, "Save the zbuffer as 32 bits unsigned int");
                uiBlockEndAlign(block);
+               uiDefButBitS(block, TOG, R_PREVIEW_JPG, B_NOP,"Preview",1027,yofs+44,90,20, &G.scene->r.subimtype, 0, 0, 0, 0, "When animation render, save JPG preview images in same directory");
                
                uiDefButS(block, MENU,B_NOP, "Codec %t|None %x0|Pxr24 (lossy) %x1|ZIP (lossless) %x2|PIZ (lossless) %x3|RLE (lossless) %x4",  
                                                                                                                        892,yofs,112,20, &G.scene->r.quality, 0, 0, 0, 0, "Set codec settings for OpenEXR");