Revision: 42041
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42041
Author:   campbellbarton
Date:     2011-11-21 20:19:58 +0000 (Mon, 21 Nov 2011)
Log Message:
-----------
move image settings into their own structure so the interface can be shared 
where image saving settings are needed.
currently file out node and render output share this struct & UI.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_render.py
    trunk/blender/source/blender/blenkernel/BKE_image.h
    trunk/blender/source/blender/blenkernel/intern/image.c
    trunk/blender/source/blender/blenkernel/intern/ocean.c
    trunk/blender/source/blender/blenkernel/intern/scene.c
    trunk/blender/source/blender/blenkernel/intern/writeavi.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/include/UI_interface.h
    trunk/blender/source/blender/editors/render/render_internal.c
    trunk/blender/source/blender/editors/render/render_opengl.c
    trunk/blender/source/blender/editors/render/render_shading.c
    trunk/blender/source/blender/editors/screen/screendump.c
    trunk/blender/source/blender/editors/space_image/image_buttons.c
    trunk/blender/source/blender/editors/space_image/image_ops.c
    trunk/blender/source/blender/editors/space_node/drawnode.c
    trunk/blender/source/blender/makesdna/DNA_node_types.h
    trunk/blender/source/blender/makesdna/DNA_scene_types.h
    trunk/blender/source/blender/makesrna/RNA_access.h
    trunk/blender/source/blender/makesrna/RNA_enum_types.h
    trunk/blender/source/blender/makesrna/intern/rna_image_api.c
    trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
    trunk/blender/source/blender/makesrna/intern/rna_scene.c
    trunk/blender/source/blender/makesrna/intern/rna_scene_api.c
    trunk/blender/source/blender/makesrna/intern/rna_texture_api.c
    trunk/blender/source/blender/makesrna/intern/rna_ui_api.c
    
trunk/blender/source/blender/nodes/composite/nodes/node_composite_outputFile.c
    trunk/blender/source/blender/render/intern/source/pipeline.c
    trunk/blender/source/creator/creator.c
    trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_render.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_render.py    
2011-11-21 20:09:04 UTC (rev 42040)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_render.py    
2011-11-21 20:19:58 UTC (rev 42041)
@@ -452,21 +452,22 @@
         layout = self.layout
 
         rd = context.scene.render
-        file_format = rd.file_format
+        image_settings = rd.image_settings
+        file_format = rd.image_settings.file_format
 
         layout.prop(rd, "filepath", text="")
 
         split = layout.split()
 
         col = split.column()
-        col.prop(rd, "file_format", text="")
-        col.row().prop(rd, "color_mode", text="Color", expand=True)
+        col.template_image_settings(rd.image_settings)
 
         col = split.column()
         col.prop(rd, "use_file_extension")
         col.prop(rd, "use_overwrite")
         col.prop(rd, "use_placeholder")
 
+        """
         if file_format in {'AVI_JPEG', 'JPEG'}:
             layout.prop(rd, "file_quality", slider=True)
 
@@ -511,7 +512,9 @@
         elif file_format == 'TIFF':
             layout.prop(rd, "use_tiff_16bit")
 
-        elif file_format == 'QUICKTIME_CARBON':
+        elif  """
+
+        if file_format == 'QUICKTIME_CARBON':
             layout.operator("scene.render_data_set_quicktime_codec")
 
         elif file_format == 'QUICKTIME_QTKIT':
@@ -552,7 +555,7 @@
     @classmethod
     def poll(cls, context):
         rd = context.scene.render
-        return rd.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}
+        return rd.image_settings.file_format in {'FFMPEG', 'XVID', 'H264', 
'THEORA'}
 
     def draw(self, context):
         layout = self.layout

Modified: trunk/blender/source/blender/blenkernel/BKE_image.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_image.h 2011-11-21 20:09:04 UTC 
(rev 42040)
+++ trunk/blender/source/blender/blenkernel/BKE_image.h 2011-11-21 20:19:58 UTC 
(rev 42041)
@@ -43,6 +43,7 @@
 struct anim;
 struct Scene;
 struct Object;
+struct ImageFormatData;
 
 /* call from library */
 void   free_image(struct Image *me);
@@ -50,13 +51,19 @@
 void   BKE_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf 
*ibuf);
 void   BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char 
*rect, float *rectf, int width, int height, int channels);
 int            BKE_alphatest_ibuf(struct ImBuf *ibuf);
-int            BKE_write_ibuf_stamp(struct Scene *scene, struct Object 
*camera, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int 
quality);
-int            BKE_write_ibuf(struct ImBuf *ibuf, const char *name, int 
imtype, int subimtype, int quality);
+int            BKE_write_ibuf_stamp(struct Scene *scene, struct Object 
*camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
+int            BKE_write_ibuf(struct ImBuf *ibuf, const char *name, struct 
ImageFormatData *imf);
 void   BKE_makepicstring(char *string, const char *base, const char *relbase, 
int frame, int imtype, const short use_ext, const short use_frames);
 int            BKE_add_image_extension(char *string, int imtype);
 int            BKE_ftype_to_imtype(int ftype);
 int            BKE_imtype_to_ftype(int imtype);
+
 int            BKE_imtype_is_movie(int imtype);
+int            BKE_imtype_is_alpha_ok(int imtype);
+int            BKE_imtype_is_zbuf_ok(int imtype);
+int            BKE_imtype_is_compression_ok(int imtype);
+int            BKE_imtype_is_quality_ok(int imtype);
+int            BKE_imtype_is_depth_ok(int imtype);
 
 struct anim *openanim(const char *name, int flags, int streamindex);
 

Modified: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c      2011-11-21 
20:09:04 UTC (rev 42040)
+++ trunk/blender/source/blender/blenkernel/intern/image.c      2011-11-21 
20:19:58 UTC (rev 42041)
@@ -900,6 +900,76 @@
        return 0;
 }
 
+int BKE_imtype_is_alpha_ok(int imtype)
+{
+       switch(imtype) {
+       case R_TARGA:
+       case R_IRIS:
+       case R_PNG:
+       case R_BMP:
+       case R_RADHDR:
+       case R_TIFF:
+       case R_OPENEXR:
+       case R_MULTILAYER:
+       case R_DDS:
+       case R_JP2:
+                       return 1;
+       }
+       return 0;
+}
+
+int BKE_imtype_is_zbuf_ok(int imtype)
+{
+       switch(imtype) {
+       case R_IRIZ:
+       case R_OPENEXR: /* but not R_MULTILAYER */
+                       return 1;
+       }
+       return 0;
+}
+
+int BKE_imtype_is_compression_ok(int imtype)
+{
+       switch(imtype) {
+       case R_PNG:
+                       return 1;
+       }
+       return 0;
+}
+
+int BKE_imtype_is_quality_ok(int imtype)
+{
+       switch(imtype) {
+       case R_JPEG90:
+       case R_JP2:
+                       return 1;
+       }
+       return 0;
+}
+
+int BKE_imtype_is_depth_ok(int imtype)
+{
+       switch (imtype) {
+       case R_RADHDR:
+               return R_IMF_CHAN_DEPTH_32;
+       case R_TIFF:
+               return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_16;
+       case R_OPENEXR:
+               return R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_32;
+       case R_MULTILAYER:
+               return R_IMF_CHAN_DEPTH_32;
+       /* eeh, cineone does some strange 10bits per channel */
+       case R_DPX:
+       case R_CINEON:
+               return R_IMF_CHAN_DEPTH_12;
+       case R_JP2:
+               return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_12 | 
R_IMF_CHAN_DEPTH_16;
+       /* most formats are 8bit only */
+       default:
+               return R_IMF_CHAN_DEPTH_8;
+       }
+}
+
 int BKE_add_image_extension(char *string, int imtype)
 {
        const char *extension= NULL;
@@ -1371,10 +1441,13 @@
        return FALSE;
 }
 
-int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, 
int quality)
+int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
 {
+       char imtype= imf->imtype;
+       char compress= imf->compress;
+       char quality= imf->quality;
+
        int ok;
-       (void)subimtype; /* quies unused warnings */
 
        if(imtype == -1) {
                /* use whatever existing image type is set by 'ibuf' */
@@ -1391,7 +1464,7 @@
                ibuf->ftype= PNG;
 
                if(imtype==R_PNG)
-                       ibuf->ftype |= quality;  /* quality is actually 
compression 0-100 --> 0-9 */
+                       ibuf->ftype |= compress;
 
        }
 #ifdef WITH_DDS
@@ -1406,18 +1479,18 @@
        else if (imtype==R_TIFF) {
                ibuf->ftype= TIF;
 
-               if(subimtype & R_TIFF_16BIT)
+               if(imf->depth == R_IMF_CHAN_DEPTH_16)
                        ibuf->ftype |= TIF_16BIT;
        }
 #endif
 #ifdef WITH_OPENEXR
        else if (imtype==R_OPENEXR || imtype==R_MULTILAYER) {
                ibuf->ftype= OPENEXR;
-               if(subimtype & R_OPENEXR_HALF)
+               if(imf->depth == R_IMF_CHAN_DEPTH_16)
                        ibuf->ftype |= OPENEXR_HALF;
                ibuf->ftype |= (quality & OPENEXR_COMPRESS);
                
-               if(!(subimtype & R_OPENEXR_ZBUF))
+               if(!(imf->flag & R_IMF_FLAG_ZBUF))
                        ibuf->zbuf_float = NULL;        /* signal for exr 
saving */
                
        }
@@ -1441,19 +1514,19 @@
                if(quality < 10) quality= 90;
                ibuf->ftype= JP2|quality;
                
-               if (subimtype & R_JPEG2K_16BIT) {
+               if (imf->depth == R_IMF_CHAN_DEPTH_16) {
                        ibuf->ftype |= JP2_16BIT;
-               } else if (subimtype & R_JPEG2K_12BIT) {
+               } else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
                        ibuf->ftype |= JP2_12BIT;
                }
                
-               if (subimtype & R_JPEG2K_YCC) {
+               if (imf->jp2_flag & R_IMF_JP2_FLAG_YCC) {
                        ibuf->ftype |= JP2_YCC;
                }
-               
-               if (subimtype & R_JPEG2K_CINE_PRESET) {
+
+               if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_PRESET) {
                        ibuf->ftype |= JP2_CINE;
-                       if (subimtype & R_JPEG2K_CINE_48FPS)
+                       if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_48)
                                ibuf->ftype |= JP2_CINE_48FPS;
                }
        }
@@ -1475,12 +1548,12 @@
        return(ok);
 }
 
-int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, 
const char *name, int imtype, int subimtype, int quality)
+int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, 
const char *name, struct ImageFormatData *imf)
 {
        if(scene && scene->r.stamp & R_STAMP_ALL)
                BKE_stamp_info(scene, camera, ibuf);
 
-       return BKE_write_ibuf(ibuf, name, imtype, subimtype, quality);
+       return BKE_write_ibuf(ibuf, name, imf);
 }
 
 

Modified: trunk/blender/source/blender/blenkernel/intern/ocean.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/ocean.c      2011-11-21 
20:09:04 UTC (rev 42040)
+++ trunk/blender/source/blender/blenkernel/intern/ocean.c      2011-11-21 
20:19:58 UTC (rev 42041)
@@ -1185,6 +1185,8 @@
         * before use - campbell */
        OceanResult ocr;
 
+       ImageFormatData imf= {0};
+
        int f, i=0, x, y, cancel=0;
        float progress;
 
@@ -1201,6 +1203,13 @@
 
        BLI_srand(0);
 
+       /* setup image format */
+       imf.imtype= R_OPENEXR;
+       imf.depth=  R_IMF_CHAN_DEPTH_16;
+       imf.exr_codec= 2; /* ZIP */
+
+
+
        for (f=och->start, i=0; f<=och->end; f++, i++) {
 
                /* create a new imbuf to store image for this frame */
@@ -1292,18 +1301,18 @@
 
                /* write the images */
                cache_filename(string, och->bakepath, och->relbase, f, 
CACHE_TYPE_DISPLACE);
-               if(0 == BKE_write_ibuf(ibuf_disp, string, R_OPENEXR, 
R_OPENEXR_HALF, 2))  // 2 == ZIP exr codec
+               if(0 == BKE_write_ibuf(ibuf_disp, string, &imf))  // 2 == ZIP 
exr codec
                        printf("Cannot save Displacement File Output to %s\n", 
string);
 
                if (o->_do_jacobian) {
                        cache_filename(string, och->bakepath, och->relbase,  f, 
CACHE_TYPE_FOAM);
-                       if(0 == BKE_write_ibuf(ibuf_foam, string, R_OPENEXR, 
R_OPENEXR_HALF, 2))  // 2 == ZIP exr codec
+                       if(0 == BKE_write_ibuf(ibuf_foam, string, &imf))  // 2 
== ZIP exr codec
                                printf("Cannot save Foam File Output to %s\n", 
string);
                }
 
                if (o->_do_normals) {
                        cache_filename(string, och->bakepath,  och->relbase, f, 
CACHE_TYPE_NORMAL);
-                       if(0 == BKE_write_ibuf(ibuf_normal, string, R_OPENEXR, 
R_OPENEXR_HALF, 2))  // 2 == ZIP exr codec
+                       if(0 == BKE_write_ibuf(ibuf_normal, string, &imf))  // 
2 == ZIP exr codec
                                printf("Cannot save Normal File Output to 
%s\n", string);
                }
 

Modified: trunk/blender/source/blender/blenkernel/intern/scene.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/scene.c      2011-11-21 
20:09:04 UTC (rev 42040)
+++ trunk/blender/source/blender/blenkernel/intern/scene.c      2011-11-21 
20:19:58 UTC (rev 42041)
@@ -347,9 +347,11 @@
        sce->r.mblur_samples= 1;
        sce->r.filtertype= R_FILTER_MITCH;
        sce->r.size= 50;
-       sce->r.planes= 24;
-       sce->r.imtype= R_PNG;
-       sce->r.quality= 90;
+
+       sce->r.im_format.planes= R_PLANES24;
+       sce->r.im_format.imtype= R_PNG;
+       sce->r.im_format.quality= 90;
+
        sce->r.displaymode= R_OUTPUT_AREA;
        sce->r.framapto= 100;
        sce->r.images= 100;

Modified: trunk/blender/source/blender/blenkernel/intern/writeavi.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/writeavi.c   2011-11-21 
20:09:04 UTC (rev 42040)

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to