Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/startup/bl_ui/properties_render.py13
-rw-r--r--source/blender/blenkernel/BKE_image.h11
-rw-r--r--source/blender/blenkernel/intern/image.c101
-rw-r--r--source/blender/blenkernel/intern/ocean.c15
-rw-r--r--source/blender/blenkernel/intern/scene.c8
-rw-r--r--source/blender/blenkernel/intern/writeavi.c6
-rw-r--r--source/blender/blenloader/intern/readfile.c67
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/render/render_internal.c4
-rw-r--r--source/blender/editors/render/render_opengl.c24
-rw-r--r--source/blender/editors/render/render_shading.c4
-rw-r--r--source/blender/editors/screen/screendump.c14
-rw-r--r--source/blender/editors/space_image/image_buttons.c68
-rw-r--r--source/blender/editors/space_image/image_ops.c42
-rw-r--r--source/blender/editors/space_node/drawnode.c22
-rw-r--r--source/blender/makesdna/DNA_node_types.h3
-rw-r--r--source/blender/makesdna/DNA_scene_types.h89
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/RNA_enum_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c51
-rw-r--r--source/blender/makesrna/intern/rna_scene.c483
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_texture_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_outputFile.c13
-rw-r--r--source/blender/render/intern/source/pipeline.c47
-rw-r--r--source/creator/creator.c51
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.cpp2
29 files changed, 821 insertions, 338 deletions
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 145ae292e11..e8da457f296 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -452,21 +452,22 @@ class RENDER_PT_output(RenderButtonsPanel, Panel):
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 @@ class RENDER_PT_output(RenderButtonsPanel, Panel):
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 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel):
@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
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index a3e0b5b6d5a..c24abfdf6f7 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -43,6 +43,7 @@ struct Tex;
struct anim;
struct Scene;
struct Object;
+struct ImageFormatData;
/* call from library */
void free_image(struct Image *me);
@@ -50,13 +51,19 @@ void free_image(struct Image *me);
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);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index a61ae705020..6a4cb049be7 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -900,6 +900,76 @@ int BKE_imtype_is_movie(int imtype)
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 @@ int BKE_alphatest_ibuf(ImBuf *ibuf)
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 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int
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 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int
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 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int
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 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int
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);
}
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 85b9b0fbf22..dbcdf5555ab 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -1185,6 +1185,8 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
* before use - campbell */
OceanResult ocr;
+ ImageFormatData imf= {0};
+
int f, i=0, x, y, cancel=0;
float progress;
@@ -1201,6 +1203,13 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
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 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
/* 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);
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 483e95f2abb..68e5ebeed4f 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -347,9 +347,11 @@ Scene *add_scene(const char *name)
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;
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 03091a08c58..e7e375928e1 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -154,7 +154,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
x = rectx;
y = recty;
- quality= rd->quality;
+ quality= rd->im_format.quality;
framerate= (double) rd->frs_sec / (double) rd->frs_sec_base;
avi = MEM_mallocN (sizeof(AviMovie), "avimovie");
@@ -162,7 +162,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
/* RPW 11-21-2002
if (rd->imtype != AVI_FORMAT_MJPEG) format = AVI_FORMAT_AVI_RGB;
*/
- if (rd->imtype != R_AVIJPEG ) format = AVI_FORMAT_AVI_RGB;
+ if (rd->im_format.imtype != R_AVIJPEG ) format = AVI_FORMAT_AVI_RGB;
else format = AVI_FORMAT_MJPEG;
if (AVI_open_compress (name, avi, 1, format) != AVI_ERROR_NONE) {
@@ -233,7 +233,7 @@ static void end_avi(void)
/* similar to BKE_makepicstring() */
void BKE_makeanimstring(char *string, RenderData *rd)
{
- bMovieHandle *mh= BKE_get_movie_handle(rd->imtype);
+ bMovieHandle *mh= BKE_get_movie_handle(rd->im_format.imtype);
if(mh->get_movie_path)
mh->get_movie_path(string, rd);
else
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index b1ddb894e67..dcde4ac421b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7348,6 +7348,67 @@ static void do_versions_nodetree_convert_angle(bNodeTree *ntree)
}
}
+void do_versions_image_settings_2_60(Scene *sce)
+{
+ /* note: rd->subimtype is moved into indervidual settings now and no longer
+ * exists */
+ RenderData *rd= &sce->r;
+ ImageFormatData *imf= &sce->r.im_format;
+
+ imf->imtype= rd->imtype;
+ imf->planes= rd->planes;
+ imf->compress= rd->quality;
+ imf->quality= rd->quality;
+
+ /* default, was stored in multiple places, may override later */
+ imf->depth= R_IMF_CHAN_DEPTH_8;
+
+ /* openexr */
+ imf->exr_codec = rd->quality & 7; /* strange but true! 0-4 are valid values */
+
+ switch (imf->imtype) {
+ case R_OPENEXR:
+ imf->depth= (rd->subimtype & R_OPENEXR_HALF) ? R_IMF_CHAN_DEPTH_16 : R_IMF_CHAN_DEPTH_32;
+ if (rd->subimtype & R_PREVIEW_JPG) {
+ imf->flag |= R_IMF_FLAG_PREVIEW_JPG;
+ }
+ if (rd->subimtype & R_OPENEXR_ZBUF) {
+ imf->flag |= R_IMF_FLAG_ZBUF;
+ }
+ break;
+ case R_TIFF:
+ if (rd->subimtype & R_TIFF_16BIT) {
+ imf->depth= R_IMF_CHAN_DEPTH_16;
+ }
+ break;
+ case R_JP2:
+ if (rd->subimtype & R_JPEG2K_16BIT) {
+ imf->depth= R_IMF_CHAN_DEPTH_16;
+ }
+ else if (rd->subimtype & R_JPEG2K_12BIT) {
+ imf->depth= R_IMF_CHAN_DEPTH_12;
+ }
+
+ if (rd->subimtype & R_JPEG2K_YCC) {
+ imf->jp2_flag |= R_IMF_JP2_FLAG_YCC;
+ }
+ if (rd->subimtype & R_JPEG2K_CINE_PRESET) {
+ imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_PRESET;
+ }
+ if (rd->subimtype & R_JPEG2K_CINE_48FPS) {
+ imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_48;
+ }
+ break;
+ case R_CINEON:
+ case R_DPX:
+ if (rd->subimtype & R_CINEON_LOG) {
+ imf->cineon_flag |= R_IMF_CINEON_FLAG_LOG;
+ }
+ break;
+ }
+
+}
+
static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
@@ -12544,6 +12605,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* put compatibility code here until next subversion bump */
{
+ Scene *sce;
+ for(sce = main->scene.first; sce; sce = sce->id.next) {
+ if (sce->r.im_format.depth == 0) {
+ do_versions_image_settings_2_60(sce);
+ }
+ }
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index a0b477413e4..4b8817334f0 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -748,6 +748,7 @@ void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, const char *
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
PointerRNA *used_ptr, const char *used_propname, int active_layer);
void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact);
+void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr);
void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser);
void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C);
void uiTemplateOperatorSearch(uiLayout *layout);
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 6931b0b86db..dbd1e27024e 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -235,7 +235,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
/* custom scene and single layer re-render */
screen_render_scene_layer_set(op, mainp, &scene, &srl);
- if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.imtype)) {
+ if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
return OPERATOR_CANCELLED;
}
@@ -516,7 +516,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_CANCELLED;
}
- if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.imtype)) {
+ if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 188a61181ce..97e93eb2e7f 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -220,12 +220,12 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
char name[FILE_MAX];
int ok;
- if(scene->r.planes == 8) {
+ if(scene->r.im_format.planes == R_IMF_CHAN_DEPTH_8) {
IMB_color_to_bw(ibuf);
}
- BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
- ok= BKE_write_ibuf(ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality); /* no need to stamp here */
+ BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, FALSE);
+ ok= BKE_write_ibuf(ibuf, name, &scene->r.im_format); /* no need to stamp here */
if(ok) printf("OpenGL Render written to '%s'\n", name);
else printf("OpenGL Render failed to write '%s'\n", name);
}
@@ -263,7 +263,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
return 0;
}
- if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.imtype)) {
+ if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
return 0;
}
@@ -332,7 +332,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
Scene *scene= oglrender->scene;
if(oglrender->mh) {
- if(BKE_imtype_is_movie(scene->r.imtype))
+ if(BKE_imtype_is_movie(scene->r.im_format.imtype))
oglrender->mh->end_movie();
}
@@ -371,8 +371,8 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
scene= oglrender->scene;
oglrender->reports= op->reports;
- oglrender->mh= BKE_get_movie_handle(scene->r.imtype);
- if(BKE_imtype_is_movie(scene->r.imtype)) {
+ oglrender->mh= BKE_get_movie_handle(scene->r.im_format.imtype);
+ if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
if(!oglrender->mh->start_movie(scene, &scene->r, oglrender->sizex, oglrender->sizey, oglrender->reports)) {
screen_opengl_render_end(C, oglrender);
return 0;
@@ -440,7 +440,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
if(ibuf) {
/* color -> greyscale */
/* editing directly would alter the render view */
- if(scene->r.planes == 8) {
+ if(scene->r.im_format.planes == R_PLANESBW) {
ImBuf *ibuf_bw= IMB_dupImBuf(ibuf);
IMB_color_to_bw(ibuf_bw);
// IMB_freeImBuf(ibuf); /* owned by the image */
@@ -449,14 +449,14 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
else {
/* this is lightweight & doesnt re-alloc the buffers, only do this
* to save the correct bit depth since the image is always RGBA */
- ImBuf *ibuf_cpy= IMB_allocImBuf(ibuf->x, ibuf->y, scene->r.planes, 0);
+ ImBuf *ibuf_cpy= IMB_allocImBuf(ibuf->x, ibuf->y, scene->r.im_format.planes, 0);
ibuf_cpy->rect= ibuf->rect;
ibuf_cpy->rect_float= ibuf->rect_float;
ibuf_cpy->zbuf_float= ibuf->zbuf_float;
ibuf= ibuf_cpy;
}
- if(BKE_imtype_is_movie(scene->r.imtype)) {
+ if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
ok= oglrender->mh->append_movie(&scene->r, CFRA, (int*)ibuf->rect, oglrender->sizex, oglrender->sizey, oglrender->reports);
if(ok) {
printf("Append frame %d", scene->r.cfra);
@@ -464,8 +464,8 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
}
}
else {
- BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
- ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
+ BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE);
+ ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format);
if(ok==0) {
printf("Write error: cannot save %s\n", name);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index e2e48a489b6..cf14432754f 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -680,7 +680,7 @@ static int envmap_save_exec(bContext *C, wmOperator *op)
Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
Scene *scene = CTX_data_scene(C);
//int imtype = RNA_enum_get(op->ptr, "file_type");
- int imtype = scene->r.imtype;
+ int imtype = scene->r.im_format.imtype;
char path[FILE_MAX];
RNA_string_get(op->ptr, "filepath", path);
@@ -707,7 +707,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
if(RNA_property_is_set(op->ptr, "filepath"))
return envmap_save_exec(C, op);
- //RNA_enum_set(op->ptr, "file_type", scene->r.imtype);
+ //RNA_enum_set(op->ptr, "file_type", scene->r.im_format.imtype);
RNA_string_set(op->ptr, "filepath", G.main->name);
WM_event_add_fileselect(C, op);
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 8a90aadbee2..48970dffce0 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -161,12 +161,12 @@ static int screenshot_exec(bContext *C, wmOperator *op)
/* BKE_add_image_extension() checks for if extension was already set */
if(scene->r.scemode & R_EXTENSION)
if(strlen(path)<FILE_MAXDIR+FILE_MAXFILE-5)
- BKE_add_image_extension(path, scene->r.imtype);
+ BKE_add_image_extension(path, scene->r.im_format.imtype);
ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
ibuf->rect= scd->dumprect;
- BKE_write_ibuf(ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality);
+ BKE_write_ibuf(ibuf, path, &scene->r.im_format);
IMB_freeImBuf(ibuf);
}
@@ -261,14 +261,14 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
{
ScreenshotJob *sj= sjv;
RenderData rd= sj->scene->r;
- bMovieHandle *mh= BKE_get_movie_handle(sj->scene->r.imtype);
+ bMovieHandle *mh= BKE_get_movie_handle(sj->scene->r.im_format.imtype);
int cfra= 1;
/* we need this as local variables for renderdata */
rd.frs_sec= U.scrcastfps;
rd.frs_sec_base= 1.0f;
- if(BKE_imtype_is_movie(rd.imtype)) {
+ if(BKE_imtype_is_movie(rd.im_format.imtype)) {
if(!mh->start_movie(sj->scene, &rd, sj->dumpsx, sj->dumpsy, &sj->reports)) {
printf("screencast job stopped\n");
return;
@@ -294,14 +294,14 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
break;
}
else {
- ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.planes, 0);
+ ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.im_format.planes, 0);
char name[FILE_MAXDIR+FILE_MAXFILE];
int ok;
- BKE_makepicstring(name, rd.pic, sj->bmain->name, cfra, rd.imtype, rd.scemode & R_EXTENSION, TRUE);
+ BKE_makepicstring(name, rd.pic, sj->bmain->name, cfra, rd.im_format.imtype, rd.scemode & R_EXTENSION, TRUE);
ibuf->rect= sj->dumprect;
- ok= BKE_write_ibuf(ibuf, name, rd.imtype, rd.subimtype, rd.quality);
+ ok= BKE_write_ibuf(ibuf, name, &rd.im_format);
if(ok==0) {
printf("Write error: cannot save %s\n", name);
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index df5c8d4c7cd..48627e9d1ed 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -817,6 +817,74 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
MEM_freeN(cb);
}
+void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
+{
+ ImageFormatData *imf= imfptr->data;
+ ID *id= imfptr->id.data;
+ const int depth_ok= BKE_imtype_is_depth_ok(imf->imtype);
+ /* some settings depend on this being a scene thats rendered */
+ const short is_render_out= (id && GS(id->name) == ID_SCE);
+
+ uiLayout *col, *row;
+
+ col= uiLayoutColumn(layout, 0);
+
+ uiItemR(col, imfptr, "file_format", 0, "", ICON_NONE);
+
+ row= uiLayoutRow(col, 0);
+ uiItemR(row, imfptr, "color_mode", UI_ITEM_R_EXPAND, "Color", ICON_NONE);
+
+ /* only display depth setting if multiple depths can be used */
+ if((ELEM6(depth_ok,
+ R_IMF_CHAN_DEPTH_1,
+ R_IMF_CHAN_DEPTH_8,
+ R_IMF_CHAN_DEPTH_12,
+ R_IMF_CHAN_DEPTH_16,
+ R_IMF_CHAN_DEPTH_24,
+ R_IMF_CHAN_DEPTH_32)) == 0)
+ {
+ row= uiLayoutRow(col, 0);
+ uiItemR(row, imfptr, "color_depth", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ }
+
+ if (BKE_imtype_is_quality_ok(imf->imtype)) {
+ uiItemR(col, imfptr, "quality", 0, NULL, ICON_NONE);
+ }
+
+ if (BKE_imtype_is_compression_ok(imf->imtype)) {
+ uiItemR(col, imfptr, "compression", 0, NULL, ICON_NONE);
+ }
+
+ if (BKE_imtype_is_zbuf_ok(imf->imtype)) {
+ uiItemR(col, imfptr, "use_zbuffer", 0, NULL, ICON_NONE);
+ }
+
+ if (ELEM(imf->imtype, R_OPENEXR, R_MULTILAYER)) {
+ uiItemR(col, imfptr, "exr_codec", 0, NULL, ICON_NONE);
+
+ if (is_render_out && (imf->imtype == R_OPENEXR)) {
+ uiItemR(col, imfptr, "use_preview", 0, NULL, ICON_NONE);
+ }
+ }
+
+ if (imf->imtype == R_JP2) {
+ uiItemR(col, imfptr, "use_jpeg2k_ycc", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "use_jpeg2k_cinema_preset", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "use_jpeg2k_cinema_48", 0, NULL, ICON_NONE);
+ }
+
+ if (imf->imtype == R_CINEON) {
+#if 1
+ uiItemL(col, "FIXME: hard coded Non-Linear, Gamma:1.0", ICON_NONE);
+#else
+ uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "cineon_black", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "cineon_white", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "cineon_gamma", 0, NULL, ICON_NONE);
+#endif
+ }
+}
+
void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
{
Scene *scene= CTX_data_scene(C);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 77c92b2d9c3..448e109e98a 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -967,8 +967,8 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
simopts->planes= ibuf->depth;
if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
- simopts->imtype= scene->r.imtype;
- simopts->planes= scene->r.planes;
+ simopts->imtype= scene->r.im_format.imtype;
+ simopts->planes= scene->r.im_format.planes;
}
else if (ima->source == IMA_SRC_GENERATED) {
simopts->imtype= R_PNG;
@@ -976,7 +976,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
else {
simopts->imtype= BKE_ftype_to_imtype(ibuf->ftype);
}
- simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
+ //simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
simopts->quality= ibuf->ftype & 0xff;
BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath));
@@ -990,7 +990,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
/* some formats dont use quality so fallback to scenes quality */
if (simopts->quality == 0) {
- simopts->quality= scene->r.quality;
+ simopts->quality= scene->r.im_format.quality;
}
/* check for empty path */
@@ -1017,7 +1017,8 @@ static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op
#if 0
if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX
#else
- simopts->subimtype= evil_scene->r.subimtype;
+// simopts->subimtype= evil_scene->r.subimtype;
+ (void)evil_scene;
#endif
if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality");
@@ -1086,8 +1087,18 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
}
BKE_image_release_renderresult(scene, ima);
}
- else if (BKE_write_ibuf(ibuf, simopts->filepath, simopts->imtype, simopts->subimtype, simopts->quality)) {
- ok= TRUE;
+ else {
+ ImageFormatData imf= {0};
+
+ /* todo, make operator use template, this works for now */
+ imf.imtype= simopts->imtype;
+ imf.quality= simopts->quality;
+ imf.compress= simopts->quality;
+ imf.depth= R_IMF_CHAN_DEPTH_8;
+
+ if (BKE_write_ibuf(ibuf, simopts->filepath, &imf)) {
+ ok= TRUE;
+ }
}
if (ok) {
@@ -1191,6 +1202,22 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
return OPERATOR_RUNNING_MODAL;
}
+#if 0
+static void image_save_as_draw(bContext *C, wmOperator *op)
+{
+ ImageFormatData *imf= op->customdata;
+ PointerRNA ptr;
+
+ /* image template */
+ RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &ptr);
+ uiTemplateImageSettings(layout, &ptr);
+
+ /* main draw call */
+ RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
+ uiDefAutoButsRNA(layout, &ptr, NULL, '\0');
+}
+#endif
+
void IMAGE_OT_save_as(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1203,6 +1230,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
ot->exec= image_save_as_exec;
ot->check= image_save_as_check;
ot->invoke= image_save_as_invoke;
+ // ot->ui= image_save_as_draw;
ot->poll= space_image_buffer_exists_poll;
/* flags */
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 92592a7c071..47cfa5c763d 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1633,24 +1633,18 @@ static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), Po
static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
+ bNode *node= ptr->data;
+ NodeImageFile *nif= node->storage;
+ PointerRNA imfptr;
+
uiLayout *col, *row;
col= uiLayoutColumn(layout, 0);
uiItemR(col, ptr, "filepath", 0, "", ICON_NONE);
- uiItemR(col, ptr, "image_type", 0, "", ICON_NONE);
-
- row= uiLayoutRow(layout, 0);
- if (RNA_enum_get(ptr, "image_type")== R_OPENEXR) {
- uiItemR(row, ptr, "use_exr_half", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "exr_codec", 0, "", ICON_NONE);
- }
- else if (RNA_enum_get(ptr, "image_type")== R_JPEG90) {
- uiItemR(row, ptr, "quality", UI_ITEM_R_SLIDER, "Quality", ICON_NONE);
- }
- else if (RNA_enum_get(ptr, "image_type")== R_PNG) {
- uiItemR(row, ptr, "quality", UI_ITEM_R_SLIDER, "Compression", ICON_NONE);
- }
-
+
+ RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &nif->im_format, &imfptr);
+ uiTemplateImageSettings(layout, &imfptr);
+
row= uiLayoutRow(layout, 1);
uiItemR(row, ptr, "frame_start", 0, "Start", ICON_NONE);
uiItemR(row, ptr, "frame_end", 0, "End", ICON_NONE);
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 1897f8a0353..8f22b1b31cb 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -36,6 +36,7 @@
#include "DNA_vec_types.h"
#include "DNA_listBase.h"
#include "DNA_texture_types.h"
+#include "DNA_scene_types.h"
struct ID;
struct ListBase;
@@ -345,7 +346,7 @@ typedef struct NodeHueSat {
typedef struct NodeImageFile {
char name[256];
- short imtype, subimtype, quality, codec;
+ struct ImageFormatData im_format;
int sfra, efra;
} NodeImageFile;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 27e21290a9b..ce9903e91ee 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -209,13 +209,68 @@ typedef struct SceneRenderLayer {
/* note, srl->passflag is treestore element 'nr' in outliner, short still... */
+/* generic image format settings,
+ * no video codec info however */
+typedef struct ImageFormatData {
+ char imtype; /* R_PNG, R_... */
+ /* note, video types should only ever be set from this
+ * structure when used from RenderData */
+ char depth; /* bits per channel, R_IMF_CHAN_DEPTH_8 -> 32,
+ * not a flag, only set 1 at a time */
+
+ char planes ; /* - R_PLANESBW, R_PLANES24, R_PLANES32 */
+ char flag; /* generic options for all image types, alpha zbuffer */
+
+ char quality; /* (0 - 100), eg: jpeg quality */
+ char compress; /* (0 - 100), eg: png compression */
+
+
+ /* --- format specific --- */
+
+ /* OpenEXR */
+ char exr_codec;
+
+ /* Cineon */
+ char cineon_flag;
+ short cineon_white, cineon_black;
+ float cineon_gamma;
+
+ /* Jpeg2000 */
+ char jp2_flag;
+
+ char pad[7];
+
+} ImageFormatData;
+
+/* ImageFormatData.flag */
+#define R_IMF_FLAG_ZBUF (1<<0) /* was R_OPENEXR_ZBUF */
+#define R_IMF_FLAG_PREVIEW_JPG (1<<1) /* was R_PREVIEW_JPG */
+
+/* ImageFormatData.jp2_flag */
+#define R_IMF_JP2_FLAG_YCC (1<<0) /* when disabled use RGB */ /* was R_JPEG2K_YCC */
+#define R_IMF_JP2_FLAG_CINE_PRESET (1<<1) /* was R_JPEG2K_CINE_PRESET */
+#define R_IMF_JP2_FLAG_CINE_48 (1<<2) /* was R_JPEG2K_CINE_48FPS */
+
+/* ImageFormatData.cineon_flag */
+#define R_IMF_CINEON_FLAG_LOG (1<<0) /* was R_CINEON_LOG */
+
+/* return values from BKE_imtype_is_depth_ok, note this is depts per channel */
+#define R_IMF_CHAN_DEPTH_1 (1<<0) /* 1bits (unused) */
+#define R_IMF_CHAN_DEPTH_8 (1<<1) /* 8bits (default) */
+#define R_IMF_CHAN_DEPTH_12 (1<<2) /* 12bits (uncommon, jp2 supports) */
+#define R_IMF_CHAN_DEPTH_16 (1<<3) /* 16bits (tiff, halff float exr) */
+#define R_IMF_CHAN_DEPTH_24 (1<<4) /* 24bits (unused) */
+#define R_IMF_CHAN_DEPTH_32 (1<<5) /* 32bits (full float exr) */
+
+
typedef struct RenderData {
+ struct ImageFormatData im_format;
struct AviCodecData *avicodecdata;
struct QuicktimeCodecData *qtcodecdata;
struct QuicktimeCodecSettings qtcodecsettings;
struct FFMpegCodecData ffcodecdata;
-
+
int cfra, sfra, efra; /* frames as in 'images' */
float subframe; /* subframe offset from cfra, in 0.0-1.0 */
int psfra, pefra; /* start+end frames of preview range */
@@ -256,8 +311,8 @@ typedef struct RenderData {
* The number of part to use in the y direction
*/
short yparts;
-
- short planes, imtype, subimtype, quality;
+
+ short planes, imtype, subimtype, quality; /*deprecated!*/
/**
* Render to image editor, fullscreen or to new window.
@@ -370,11 +425,11 @@ typedef struct RenderData {
float simplify_aosss;
/* cineon */
- short cineonwhite, cineonblack;
- float cineongamma;
+ short cineonwhite, cineonblack; /*deprecated*/
+ float cineongamma; /*deprecated*/
/* jpeg2000 */
- short jp2_preset, jp2_depth;
+ short jp2_preset, jp2_depth; /*deprecated*/
int rpad3;
/* Dome variables */ // XXX deprecated since 2.5
@@ -1027,17 +1082,17 @@ typedef struct Scene {
#define R_THEORA 33
/* subimtype, flag options for imtype */
-#define R_OPENEXR_HALF 1
-#define R_OPENEXR_ZBUF 2
-#define R_PREVIEW_JPG 4
-#define R_CINEON_LOG 8
-#define R_TIFF_16BIT 16
-
-#define R_JPEG2K_12BIT 32 /* Jpeg2000 */
-#define R_JPEG2K_16BIT 64
-#define R_JPEG2K_YCC 128 /* when disabled use RGB */
-#define R_JPEG2K_CINE_PRESET 256
-#define R_JPEG2K_CINE_48FPS 512
+#define R_OPENEXR_HALF 1 /*deprecated*/
+#define R_OPENEXR_ZBUF 2 /*deprecated*/
+#define R_PREVIEW_JPG 4 /*deprecated*/
+#define R_CINEON_LOG 8 /*deprecated*/
+#define R_TIFF_16BIT 16 /*deprecated*/
+
+#define R_JPEG2K_12BIT 32 /* Jpeg2000 */ /*deprecated*/
+#define R_JPEG2K_16BIT 64 /*deprecated*/
+#define R_JPEG2K_YCC 128 /* when disabled use RGB */ /*deprecated*/
+#define R_JPEG2K_CINE_PRESET 256 /*deprecated*/
+#define R_JPEG2K_CINE_48FPS 512 /*deprecated*/
/* bake_mode: same as RE_BAKE_xxx defines */
/* bake_flag: */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 08e3d1a72a2..54711a2b025 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -255,6 +255,7 @@ extern StructRNA RNA_HookModifier;
extern StructRNA RNA_ID;
extern StructRNA RNA_IKParam;
extern StructRNA RNA_Image;
+extern StructRNA RNA_ImageFormatSettings;
extern StructRNA RNA_ImagePaint;
extern StructRNA RNA_ImageSequence;
extern StructRNA RNA_ImageTexture;
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index a4866238caa..91e5d06fe5e 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -53,6 +53,7 @@ extern EnumPropertyItem boidrule_type_items[];
extern EnumPropertyItem image_type_items[];
extern EnumPropertyItem image_color_mode_items[];
+extern EnumPropertyItem image_depth_mode_items[];
extern EnumPropertyItem beztriple_keyframe_type_items[];
extern EnumPropertyItem beztriple_handle_type_items[];
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 07271cb1aca..09af7fe1c5b 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -84,9 +84,9 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
/* temp swap out the color */
const unsigned char imb_depth_back= ibuf->depth;
const float dither_back= ibuf->dither;
- ibuf->depth= scene->r.planes;
+ ibuf->depth= scene->r.im_format.planes;
ibuf->dither= scene->r.dither_intensity;
- if (!BKE_write_ibuf(ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality)) {
+ if (!BKE_write_ibuf(ibuf, path, &scene->r.im_format)) {
BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path);
}
ibuf->depth= imb_depth_back;
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 30889bb25f6..cd1b74f2b38 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1688,30 +1688,6 @@ static void def_cmp_output_file(StructRNA *srna)
{
PropertyRNA *prop;
- static EnumPropertyItem type_items[] = {
- {R_TARGA, "TARGA", 0, "Targa", ""},
- {R_RAWTGA, "RAW_TARGA", 0, "Targa Raw", ""},
- {R_PNG, "PNG", 0, "PNG", ""},
-#ifdef WITH_DDS
- {R_DDS, "DDS", 0, "DirectDraw Surface", ""},
-#endif
- {R_BMP, "BMP", 0, "BMP", ""},
- {R_JPEG90, "JPEG", 0, "JPEG", ""},
- {R_IRIS, "IRIS", 0, "IRIS", ""},
- {R_RADHDR, "RADIANCE_HDR", 0, "Radiance HDR", ""},
- {R_CINEON, "CINEON", 0, "Cineon", ""},
- {R_DPX, "DPX", 0, "DPX", ""},
- {R_OPENEXR, "OPENEXR", 0, "OpenEXR", ""},
- {0, NULL, 0, NULL, NULL}};
-
- static EnumPropertyItem openexr_codec_items[] = {
- {0, "NONE", 0, "None", ""},
- {1, "PXR24", 0, "Pxr24 (lossy)", ""},
- {2, "ZIP", 0, "ZIP (lossless)", ""},
- {3, "PIZ", 0, "PIZ (lossless)", ""},
- {4, "RLE", 0, "RLE (lossless)", ""},
- {0, NULL, 0, NULL, NULL}};
-
RNA_def_struct_sdna_from(srna, "NodeImageFile", "storage");
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
@@ -1719,28 +1695,11 @@ static void def_cmp_output_file(StructRNA *srna)
RNA_def_property_ui_text(prop, "File Path", "Output path for the image, same functionality as render output");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "image_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "imtype");
- RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_ui_text(prop, "Image Type", "");
- RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_exr_half", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_OPENEXR_HALF);
- RNA_def_property_ui_text(prop, "Half", "");
- RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "codec");
- RNA_def_property_enum_items(prop, openexr_codec_items);
- RNA_def_property_ui_text(prop, "Codec", "");
- RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "quality");
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_text(prop, "Quality", "");
- RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+ prop= RNA_def_property(srna, "image_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "im_format");
+ RNA_def_property_struct_type(prop, "ImageFormatSettings");
+ RNA_def_property_ui_text(prop, "Image Format", "");
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "sfra");
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 50a58e43a80..e862652e9fb 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -102,8 +102,55 @@ EnumPropertyItem snap_element_items[] = {
{SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"},
{0, NULL, 0, NULL, NULL}};
+
+/* note on duplicate block, perhaps we should use some trick to avoid
+ * the duplicate, but with the inline defines it becomes very tricky
+ * this awaits someone who has very good preprocessor-fu.
+ * for now just make sure they stay in sync - campbell */
+
+EnumPropertyItem image_only_type_items[] = {
+
+
+ /* --- duplicate block warning (see below) --- */
+#define IMAGE_TYPE_ITEMS_IMAGE_ONLY
+ {R_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
+#ifdef WITH_DDS
+ {R_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
+#endif
+ {R_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"},
+ {R_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
+ {R_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
+#ifdef WITH_OPENJPEG
+ {R_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"},
+#endif
+ {R_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
+ {R_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"},
+ {0, "", 0, " ", NULL},
+#ifdef WITH_CINEON
+ {R_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"},
+ {R_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
+#endif
+#ifdef WITH_OPENEXR
+ {R_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", "Output image in multilayer OpenEXR format"},
+ {R_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"},
+#endif
+#ifdef WITH_HDR
+ {R_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"},
+#endif
+#ifdef WITH_TIFF
+ {R_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
+#endif
+ /* --- end duplicate block (see below) --- */
+
+
+ {0, NULL, 0, NULL, NULL}};
+
EnumPropertyItem image_type_items[] = {
{0, "", 0, "Image", NULL},
+
+
+ /* --- duplicate block warning (see above) --- */
+#define IMAGE_TYPE_ITEMS_IMAGE_ONLY
{R_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
#ifdef WITH_DDS
{R_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
@@ -131,6 +178,9 @@ EnumPropertyItem image_type_items[] = {
#ifdef WITH_TIFF
{R_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
#endif
+ /* --- end duplicate block (see above) --- */
+
+
{0, "", 0, "Movie", NULL},
#ifdef _WIN32
{R_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", "Output video in AVI format"}, // XXX Missing codec menu
@@ -163,6 +213,15 @@ EnumPropertyItem image_color_mode_items[] ={
{R_PLANES32, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
{0, NULL, 0, NULL, NULL}};
+EnumPropertyItem image_color_depth_items[] = {
+ /* 1 (monochrome) not used */
+ {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8 bit color channels"},
+ {R_IMF_CHAN_DEPTH_12, "12", 0, "12", "12 bit color channels"},
+ {R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16 bit color channels"},
+ /* 24 not used */
+ {R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32 bit color channels"},
+ {0, NULL, 0, NULL, NULL}};
+
#ifdef RNA_RUNTIME
#include "DNA_anim_types.h"
@@ -529,7 +588,7 @@ static int rna_RenderSettings_threads_get(PointerRNA *ptr)
static int rna_RenderSettings_is_movie_fomat_get(PointerRNA *ptr)
{
RenderData *rd= (RenderData*)ptr->data;
- return BKE_imtype_is_movie(rd->imtype);
+ return BKE_imtype_is_movie(rd->im_format.imtype);
}
static int rna_RenderSettings_save_buffers_get(PointerRNA *ptr)
@@ -548,71 +607,156 @@ static int rna_RenderSettings_full_sample_get(PointerRNA *ptr)
return (rd->scemode & R_FULL_SAMPLE) && !(rd->mode & R_BORDER);
}
-static void rna_RenderSettings_file_format_set(PointerRNA *ptr, int value)
+static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
{
- RenderData *rd= (RenderData*)ptr->data;
+ ImageFormatData *imf= (ImageFormatData *)ptr->data;
+ ID *id= ptr->id.data;
+
+ imf->imtype= value;
+
+ /* ensure depth and color settings match */
+ if (!BKE_imtype_is_alpha_ok(imf->imtype)) {
+ imf->planes= R_PLANES24;
+ }
+
+ /* ensure usable depth */
+ {
+ const int depth_ok= BKE_imtype_is_depth_ok(imf->imtype);
+ if ((imf->depth & depth_ok) == 0) {
+ /* set first available depth */
+ char depth_ls[]= {R_IMF_CHAN_DEPTH_32,
+ R_IMF_CHAN_DEPTH_24,
+ R_IMF_CHAN_DEPTH_16,
+ R_IMF_CHAN_DEPTH_12,
+ R_IMF_CHAN_DEPTH_8,
+ R_IMF_CHAN_DEPTH_1,
+ 0};
+ int i;
+
+ for (i= 0; depth_ls[i]; i++) {
+ if (depth_ok & depth_ls[i]) {
+ imf->depth= depth_ls[i];
+ break;
+ }
+ }
+ }
+ }
- rd->imtype= value;
+ if (id && GS(id->name) == ID_SCE) {
+ Scene *scene= ptr->id.data;
+ RenderData *rd= &scene->r;
#ifdef WITH_FFMPEG
- ffmpeg_verify_image_type(rd);
+ ffmpeg_verify_image_type(rd);
#endif
#ifdef WITH_QUICKTIME
- quicktime_verify_image_type(rd);
+ quicktime_verify_image_type(rd);
#endif
+ (void)rd;
+ }
}
-static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
+static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *C, PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *free)
{
- RenderData *rd= (RenderData*)ptr->data;
- char ext[8];
- ext[0]= '\0';
- BKE_add_image_extension(ext, rd->imtype);
- return strlen(ext);
+ ID *id= ptr->id.data;
+ if (id && GS(id->name) == ID_SCE) {
+ return image_type_items;
+ }
+ else {
+ return image_only_type_items;
+ }
}
-static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
+static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *free)
{
- RenderData *rd= (RenderData*)ptr->data;
- str[0]= '\0';
- BKE_add_image_extension(str, rd->imtype);
+ ImageFormatData *imf= (ImageFormatData *)ptr->data;
+
+ if ((imf == NULL) || BKE_imtype_is_alpha_ok(imf->imtype)) {
+ return image_color_mode_items;
+ }
+ else {
+ static EnumPropertyItem color_mode_items[] ={
+ {R_PLANESBW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
+ {R_PLANES24, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
+ {0, NULL, 0, NULL, NULL}};
+ return color_mode_items;
+ }
}
-void rna_RenderSettings_jpeg2k_preset_update(RenderData *rd)
+static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C, PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), int *free)
{
- rd->subimtype &= ~(R_JPEG2K_12BIT|R_JPEG2K_16BIT | R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS);
-
- switch(rd->jp2_depth) {
- case 8: break;
- case 12: rd->subimtype |= R_JPEG2K_12BIT; break;
- case 16: rd->subimtype |= R_JPEG2K_16BIT; break;
+ ImageFormatData *imf= (ImageFormatData *)ptr->data;
+
+ if (imf == NULL) {
+ return image_color_depth_items;
}
-
- switch(rd->jp2_preset) {
- case 1: rd->subimtype |= R_JPEG2K_CINE_PRESET; break;
- case 2: rd->subimtype |= R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS; break;
- case 3: rd->subimtype |= R_JPEG2K_CINE_PRESET; break;
- case 4: rd->subimtype |= R_JPEG2K_CINE_PRESET; break;
- case 5: rd->subimtype |= R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS; break;
- case 6: rd->subimtype |= R_JPEG2K_CINE_PRESET; break;
- case 7: rd->subimtype |= R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS; break;
+ else {
+ const int depth_ok= BKE_imtype_is_depth_ok(imf->imtype);
+ const int is_float= ELEM3(imf->imtype, R_RADHDR, R_OPENEXR, R_MULTILAYER);
+
+ EnumPropertyItem *item_8bit= &image_color_depth_items[0];
+ EnumPropertyItem *item_12bit= &image_color_depth_items[1];
+ EnumPropertyItem *item_16bit= &image_color_depth_items[2];
+ EnumPropertyItem *item_32bit= &image_color_depth_items[3];
+
+ int totitem= 0;
+ EnumPropertyItem *item= NULL;
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+
+ if (depth_ok & R_IMF_CHAN_DEPTH_8) {
+ RNA_enum_item_add(&item, &totitem, item_8bit);
+ }
+
+ if (depth_ok & R_IMF_CHAN_DEPTH_12) {
+ RNA_enum_item_add(&item, &totitem, item_12bit);
+ }
+
+ if (depth_ok & R_IMF_CHAN_DEPTH_16) {
+ if (is_float) {
+ tmp= *item_16bit;
+ tmp.name= "Float (Half)";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ else {
+ RNA_enum_item_add(&item, &totitem, item_16bit);
+ }
+ }
+
+ if (depth_ok & R_IMF_CHAN_DEPTH_32) {
+ if (is_float) {
+ tmp= *item_32bit;
+ tmp.name= "Float (Full)";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ else {
+ RNA_enum_item_add(&item, &totitem, item_32bit);
+ }
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *free= 1;
+
+ return item;
}
}
-#ifdef WITH_OPENJPEG
-static void rna_RenderSettings_jpeg2k_preset_set(PointerRNA *ptr, int value)
+static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
{
RenderData *rd= (RenderData*)ptr->data;
- rd->jp2_preset= value;
- rna_RenderSettings_jpeg2k_preset_update(rd);
+ char ext[8];
+ ext[0]= '\0';
+ BKE_add_image_extension(ext, rd->im_format.imtype);
+ return strlen(ext);
}
-static void rna_RenderSettings_jpeg2k_depth_set(PointerRNA *ptr, int value)
+static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
{
RenderData *rd= (RenderData*)ptr->data;
- rd->jp2_depth= value;
- rna_RenderSettings_jpeg2k_preset_update(rd);
+ str[0]= '\0';
+ BKE_add_image_extension(str, rd->im_format.imtype);
}
-#endif
#ifdef WITH_QUICKTIME
static int rna_RenderSettings_qtcodecsettings_codecType_get(PointerRNA *ptr)
@@ -2246,6 +2390,135 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
+/* use for render output and image save operator */
+
+static void rna_def_scene_image_format_data(BlenderRNA *brna)
+{
+#ifdef WITH_OPENEXR
+ static EnumPropertyItem exr_codec_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {1, "PXR24", 0, "Pxr24 (lossy)", ""},
+ {2, "ZIP", 0, "ZIP (lossless)", ""},
+ {3, "PIZ", 0, "PIZ (lossless)", ""},
+ {4, "RLE", 0, "RLE (lossless)", ""},
+ {0, NULL, 0, NULL, NULL}};
+#endif
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "ImageFormatSettings", NULL);
+ RNA_def_struct_sdna(srna, "ImageFormatData");
+ RNA_def_struct_nested(brna, srna, "Scene");
+ // RNA_def_struct_path_func(srna, "rna_RenderSettings_path"); // no need for the path, its not animated!
+ RNA_def_struct_ui_text(srna, "Image Format", "Settings for image formats");
+
+ prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "imtype");
+ RNA_def_property_enum_items(prop, image_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_ImageFormatSettings_file_format_set", "rna_ImageFormatSettings_file_format_itemf");
+ RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "planes");
+ RNA_def_property_enum_items(prop, image_color_mode_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_mode_itemf");
+ RNA_def_property_ui_text(prop, "Color Mode",
+ "Choose BW for saving greyscale images, RGB for saving red, green and blue channels, "
+ "and RGBA for saving red, green, blue and alpha channels");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "color_depth", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "depth");
+ RNA_def_property_enum_items(prop, image_color_depth_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_depth_itemf");
+ RNA_def_property_ui_text(prop, "Color Depth", "Bit depth per channel");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ /* was 'file_quality' */
+ prop= RNA_def_property(srna, "quality", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "quality");
+ RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
+ RNA_def_property_ui_text(prop, "Quality", "Quality for image formats that support lossy compression");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ /* was shared with file_quality */
+ prop= RNA_def_property(srna, "compression", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "compress");
+ RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
+ RNA_def_property_ui_text(prop, "Compression", "Compression level for formats that support lossless compression");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ /* flag */
+ prop= RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_ZBUF);
+ RNA_def_property_ui_text(prop, "Z Buffer", "Save the z-depth per pixel (32 bit unsigned int z-buffer)Save the z-depth per pixel (32 bit unsigned int z-buffer)");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_PREVIEW_JPG);
+ RNA_def_property_ui_text(prop, "Preview", "When rendering animations, save JPG preview images in same directory");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ /* format spesific */
+
+#ifdef WITH_OPENEXR
+ /* OpenEXR */
+
+ prop= RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "exr_codec");
+ RNA_def_property_enum_items(prop, exr_codec_items);
+ RNA_def_property_ui_text(prop, "Codec", "Codec settings for OpenEXR");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+#endif
+
+
+#ifdef WITH_OPENJPEG
+ /* Jpeg 2000 */
+ prop= RNA_def_property(srna, "use_jpeg2k_ycc", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_YCC);
+ RNA_def_property_ui_text(prop, "YCC", "Save luminance-chrominance-chrominance channels instead of RGB colors");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "use_jpeg2k_cinema_preset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_PRESET);
+ RNA_def_property_ui_text(prop, "Cinema", "Use Openjpeg Cinema Preset");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "use_jpeg2k_cinema_48", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_PRESET);
+ RNA_def_property_ui_text(prop, "Cinema (48)", "Use Openjpeg Cinema Preset (48fps)");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+#endif
+
+ /* Cineon and DPX */
+
+ prop= RNA_def_property(srna, "use_cineon_log", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cineon_flag", R_CINEON_LOG);
+ RNA_def_property_ui_text(prop, "Log", "Convert to logarithmic color space");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "cineon_black", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "cineon_black");
+ RNA_def_property_range(prop, 0, 1024);
+ RNA_def_property_ui_text(prop, "B", "Log conversion reference blackpoint");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "cineon_white", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "cineon_white");
+ RNA_def_property_range(prop, 0, 1024);
+ RNA_def_property_ui_text(prop, "W", "Log conversion reference whitepoint");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "cineon_gamma", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cineon_gamma");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "G", "Log conversion gamma");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+}
+
static void rna_def_scene_render_data(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2336,35 +2609,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
{0, "AUTO", 0, "Auto-detect", "Automatically determine the number of threads, based on CPUs"},
{R_FIXED_THREADS, "FIXED", 0, "Fixed", "Manually determine the number of threads"},
{0, NULL, 0, NULL, NULL}};
-
-#ifdef WITH_OPENEXR
- static EnumPropertyItem exr_codec_items[] = {
- {0, "NONE", 0, "None", ""},
- {1, "PXR24", 0, "Pxr24 (lossy)", ""},
- {2, "ZIP", 0, "ZIP (lossless)", ""},
- {3, "PIZ", 0, "PIZ (lossless)", ""},
- {4, "RLE", 0, "RLE (lossless)", ""},
- {0, NULL, 0, NULL, NULL}};
-#endif
-
-#ifdef WITH_OPENJPEG
- static EnumPropertyItem jp2_preset_items[] = {
- {0, "NO_PRESET", 0, "No Preset", ""},
- {1, "CINE_24FPS", 0, "Cinema 24fps 2048x1080", ""},
- {2, "CINE_48FPS", 0, "Cinema 48fps 2048x1080", ""},
- {3, "CINE_24FPS_4K", 0, "Cinema 24fps 4096x2160", ""},
- {4, "CINE_SCOPE_24FPS", 0, "Cine-Scope 24fps 2048x858", ""},
- {5, "CINE_SCOPE_48FPS", 0, "Cine-Scope 48fps 2048x858", ""},
- {6, "CINE_FLAT_24FPS", 0, "Cine-Flat 24fps 1998x1080", ""},
- {7, "CINE_FLAT_48FPS", 0, "Cine-Flat 48fps 1998x1080", ""},
- {0, NULL, 0, NULL, NULL}};
-
- static EnumPropertyItem jp2_depth_items[] = {
- {8, "8", 0, "8", "8 bit color channels"},
- {12, "12", 0, "12", "12 bit color channels"},
- {16, "16", 0, "16", "16 bit color channels"},
- {0, NULL, 0, NULL, NULL}};
-#endif
#ifdef WITH_QUICKTIME
static EnumPropertyItem quicktime_codec_type_items[] = {
@@ -2460,7 +2704,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_struct_nested(brna, srna, "Scene");
RNA_def_struct_path_func(srna, "rna_RenderSettings_path");
RNA_def_struct_ui_text(srna, "Render Data", "Rendering settings for a Scene datablock");
-
+
+#if 0 /* moved */
+
prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "planes");
RNA_def_property_enum_items(prop, image_color_mode_items);
@@ -2469,6 +2715,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
"and RGBA for saving red, green, blue and alpha channels");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+#endif
+
+ /* Render Data */
+ prop= RNA_def_property(srna, "image_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "im_format");
+ RNA_def_property_struct_type(prop, "ImageFormatSettings");
+ RNA_def_property_ui_text(prop, "Image Format", "");
+
prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "xsch");
RNA_def_property_range(prop, 4, 10000);
@@ -2513,90 +2768,23 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
/* JPEG and AVI JPEG */
-
+
+#if 0 /* moved */
+
prop= RNA_def_property(srna, "file_quality", PROP_INT, PROP_PERCENTAGE);
RNA_def_property_int_sdna(prop, NULL, "quality");
RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies, compression for PNG's");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
- /* Tiff */
-
- prop= RNA_def_property(srna, "use_tiff_16bit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_TIFF_16BIT);
- RNA_def_property_ui_text(prop, "16 Bit", "Save TIFF with 16 bits per channel");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
- /* Cineon and DPX */
-
- prop= RNA_def_property(srna, "use_cineon_log", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_CINEON_LOG);
- RNA_def_property_ui_text(prop, "Log", "Convert to logarithmic color space");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
- prop= RNA_def_property(srna, "cineon_black", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "cineonblack");
- RNA_def_property_range(prop, 0, 1024);
- RNA_def_property_ui_text(prop, "B", "Log conversion reference blackpoint");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
- prop= RNA_def_property(srna, "cineon_white", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "cineonwhite");
- RNA_def_property_range(prop, 0, 1024);
- RNA_def_property_ui_text(prop, "W", "Log conversion reference whitepoint");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
- prop= RNA_def_property(srna, "cineon_gamma", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cineongamma");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "G", "Log conversion gamma");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
-#ifdef WITH_OPENEXR
- /* OpenEXR */
- prop= RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "quality");
- RNA_def_property_enum_items(prop, exr_codec_items);
- RNA_def_property_ui_text(prop, "Codec", "Codec settings for OpenEXR");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
- prop= RNA_def_property(srna, "use_exr_half", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_OPENEXR_HALF);
- RNA_def_property_ui_text(prop, "Half", "Use 16 bit floats instead of 32 bit floats per channel");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
- prop= RNA_def_property(srna, "exr_zbuf", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_OPENEXR_ZBUF);
- RNA_def_property_ui_text(prop, "Zbuf", "Save the z-depth per pixel (32 bit unsigned int z-buffer)");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
- prop= RNA_def_property(srna, "exr_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_PREVIEW_JPG);
- RNA_def_property_ui_text(prop, "Preview", "When rendering animations, save JPG preview images in same directory");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
#endif
-#ifdef WITH_OPENJPEG
- /* Jpeg 2000 */
-
- prop= RNA_def_property(srna, "jpeg2k_preset", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "jp2_preset");
- RNA_def_property_enum_items(prop, jp2_preset_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_jpeg2k_preset_set", NULL);
- RNA_def_property_ui_text(prop, "Preset", "Use a DCI Standard preset for saving jpeg2000");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
- prop= RNA_def_property(srna, "jpeg2k_depth", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "jp2_depth");
- RNA_def_property_enum_items(prop, jp2_depth_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_jpeg2k_depth_set", NULL);
- RNA_def_property_ui_text(prop, "Depth", "Bit depth per channel");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+ /* Tiff */
- prop= RNA_def_property(srna, "jpeg2k_ycc", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_JPEG2K_YCC);
- RNA_def_property_ui_text(prop, "YCC", "Save luminance-chrominance-chrominance channels instead of RGB colors");
+#if 0 /* replaced, use generic */
+ prop= def_property(srna, "use_tiff_16bit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_TIFF_16BIT);
+ RNA_def_property_ui_text(prop, "16 Bit", "Save TIFF with 16 bits per channel");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
#endif
@@ -3021,13 +3209,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "File Extensions",
"Add the file format extensions to the rendered file name (eg: filename + .jpg)");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
+
+#if 0 /* moved */
prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "imtype");
RNA_def_property_enum_items(prop, image_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_file_format_set", NULL);
RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+#endif
prop= RNA_def_property(srna, "file_extension", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_SceneRender_file_ext_get", "rna_SceneRender_file_ext_length", NULL);
@@ -3808,6 +3998,7 @@ void RNA_def_scene(BlenderRNA *brna)
/* Nestled Data */
rna_def_tool_settings(brna);
rna_def_unit_settings(brna);
+ rna_def_scene_image_format_data(brna);
rna_def_scene_render_data(brna);
rna_def_scene_game_data(brna);
rna_def_scene_render_layer(brna);
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 6816903090d..9d0149726c3 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -74,10 +74,10 @@ static void rna_Scene_update_tagged(Scene *scene)
static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name)
{
- if(BKE_imtype_is_movie(rd->imtype))
+ if(BKE_imtype_is_movie(rd->im_format.imtype))
BKE_makeanimstring(name, rd);
else
- BKE_makepicstring(name, rd->pic, G.main->name, (frame==INT_MIN) ? rd->cfra : frame, rd->imtype, rd->scemode & R_EXTENSION, TRUE);
+ BKE_makepicstring(name, rd->pic, G.main->name, (frame==INT_MIN) ? rd->cfra : frame, rd->im_format.imtype, rd->scemode & R_EXTENSION, TRUE);
}
#ifdef WITH_COLLADA
diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c
index f1a6bb1b921..88ea78cd0da 100644
--- a/source/blender/makesrna/intern/rna_texture_api.c
+++ b/source/blender/makesrna/intern/rna_texture_api.c
@@ -49,7 +49,7 @@ void save_envmap(struct EnvMap *env, bContext *C, ReportList *reports, const cha
scene = CTX_data_scene(C);
}
- RE_WriteEnvmapResult(reports, scene, env, filepath, scene->r.imtype, layout);
+ RE_WriteEnvmapResult(reports, scene, env, filepath, scene->r.im_format.imtype, layout);
}
void clear_envmap(struct EnvMap *env, bContext *C)
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 4c97a926513..3c759bc007b 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -397,6 +397,14 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
+ func= RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings");
+ RNA_def_function_ui_description(func, "User interface for setting image format options");
+ // RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ // api_ui_item_rna_common(func);
+ parm= RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
+ // RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
+
func= RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index b2177002e82..7bdcad61625 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -70,14 +70,14 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack *
if(in[1]->data) {
CompBuf *zbuf= in[1]->data;
if(zbuf->type==CB_VAL && zbuf->x==cbuf->x && zbuf->y==cbuf->y) {
- nif->subimtype|= R_OPENEXR_ZBUF;
+ nif->im_format.flag |= R_IMF_FLAG_ZBUF;
ibuf->zbuf_float= zbuf->rect;
}
}
- BKE_makepicstring(string, nif->name, bmain->name, rd->cfra, nif->imtype, (rd->scemode & R_EXTENSION), TRUE);
+ BKE_makepicstring(string, nif->name, bmain->name, rd->cfra, nif->im_format.imtype, (rd->scemode & R_EXTENSION), TRUE);
- if(0 == BKE_write_ibuf(ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality))
+ if(0 == BKE_write_ibuf(ibuf, string, &nif->im_format))
printf("Cannot save Node File Output to %s\n", string);
else
printf("Saved: %s\n", string);
@@ -100,9 +100,10 @@ static void node_composit_init_output_file(bNodeTree *UNUSED(ntree), bNode* node
if(scene) {
BLI_strncpy(nif->name, scene->r.pic, sizeof(nif->name));
- nif->imtype= scene->r.imtype;
- nif->subimtype= scene->r.subimtype;
- nif->quality= scene->r.quality;
+ nif->im_format= scene->r.im_format;
+ if (BKE_imtype_is_movie(nif->im_format.imtype)) {
+ nif->im_format.imtype= R_OPENEXR;
+ }
nif->sfra= scene->r.sfra;
nif->efra= scene->r.efra;
}
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index ca019e3ffe8..9f96d28f1e6 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1279,7 +1279,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
re->recty= winy;
}
- if(re->rectx < 2 || re->recty < 2 || (BKE_imtype_is_movie(rd->imtype) &&
+ if(re->rectx < 2 || re->recty < 2 || (BKE_imtype_is_movie(rd->im_format.imtype) &&
(re->rectx < 16 || re->recty < 16) )) {
BKE_report(re->reports, RPT_ERROR, "Image too small");
re->ok= 0;
@@ -2958,13 +2958,13 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
do_render_all_options(re);
if(write_still && !G.afbreek) {
- if(BKE_imtype_is_movie(scene->r.imtype)) {
+ if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
/* operator checks this but incase its called from elsewhere */
printf("Error: cant write single images with a movie format!\n");
}
else {
char name[FILE_MAX];
- BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
+ BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, FALSE);
/* reports only used for Movie */
do_write_image_or_movie(re, bmain, scene, NULL, name);
@@ -2988,7 +2988,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
RE_AcquireResultImage(re, &rres);
/* write movie or image */
- if(BKE_imtype_is_movie(scene->r.imtype)) {
+ if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
int dofree = 0;
/* note; the way it gets 32 bits rects is weak... */
if(rres.rect32==NULL) {
@@ -3006,16 +3006,16 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
if(name_override)
BLI_strncpy(name, name_override, sizeof(name));
else
- BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
+ BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE);
- if(re->r.imtype==R_MULTILAYER) {
+ if(re->r.im_format.imtype==R_MULTILAYER) {
if(re->result) {
- RE_WriteRenderResult(re->reports, re->result, name, scene->r.quality);
+ RE_WriteRenderResult(re->reports, re->result, name, scene->r.im_format.compress);
printf("Saved: %s", name);
}
}
else {
- ImBuf *ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0);
+ ImBuf *ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.im_format.planes, 0);
/* if not exists, BKE_write_ibuf makes one */
ibuf->rect= (unsigned int *)rres.rect32;
@@ -3030,7 +3030,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
/* sequence editor can generate 8bpc render buffers */
if (ibuf->rect) {
ibuf->profile = IB_PROFILE_SRGB;
- if (ELEM(scene->r.imtype, R_OPENEXR, R_RADHDR))
+ if (BKE_imtype_is_depth_ok(scene->r.im_format.imtype) & (R_IMF_CHAN_DEPTH_12|R_IMF_CHAN_DEPTH_16|R_IMF_CHAN_DEPTH_24|R_IMF_CHAN_DEPTH_32))
IMB_float_from_rect(ibuf);
} else {
ibuf->profile = IB_PROFILE_LINEAR_RGB;
@@ -3039,14 +3039,14 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
/* color -> greyscale */
/* editing directly would alter the render view */
- if(scene->r.planes == 8) {
+ if(scene->r.im_format.planes == R_PLANESBW) {
ImBuf *ibuf_bw= IMB_dupImBuf(ibuf);
IMB_color_to_bw(ibuf_bw);
IMB_freeImBuf(ibuf);
ibuf= ibuf_bw;
}
- ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
+ ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format);
if(ok==0) {
printf("Render error: cannot save %s\n", name);
@@ -3054,12 +3054,15 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
else printf("Saved: %s", name);
/* optional preview images for exr */
- if(ok && scene->r.imtype==R_OPENEXR && (scene->r.subimtype & R_PREVIEW_JPG)) {
+ if(ok && scene->r.im_format.imtype==R_OPENEXR && (scene->r.im_format.flag & R_IMF_FLAG_PREVIEW_JPG)) {
+ ImageFormatData imf= scene->r.im_format;
+ imf.imtype= R_JPEG90;
+
if(BLI_testextensie(name, ".exr"))
name[strlen(name)-4]= 0;
BKE_add_image_extension(name, R_JPEG90);
ibuf->depth= 24;
- BKE_write_ibuf_stamp(scene, camera, ibuf, name, R_JPEG90, scene->r.subimtype, scene->r.quality);
+ BKE_write_ibuf_stamp(scene, camera, ibuf, name, &imf);
printf("\nSaved: %s", name);
}
@@ -3080,7 +3083,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
/* saves images to disk */
void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_override, unsigned int lay, int sfra, int efra, int tfra)
{
- bMovieHandle *mh= BKE_get_movie_handle(scene->r.imtype);
+ bMovieHandle *mh= BKE_get_movie_handle(scene->r.im_format.imtype);
int cfrao= scene->r.cfra;
int nfra;
@@ -3094,7 +3097,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
re->flag |= R_ANIMATION;
- if(BKE_imtype_is_movie(scene->r.imtype))
+ if(BKE_imtype_is_movie(scene->r.im_format.imtype))
if(!mh->start_movie(scene, &re->r, re->rectx, re->recty, re->reports))
G.afbreek= 1;
@@ -3149,9 +3152,9 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
nfra+= tfra;
/* Touch/NoOverwrite options are only valid for image's */
- if(BKE_imtype_is_movie(scene->r.imtype) == 0) {
+ if(BKE_imtype_is_movie(scene->r.im_format.imtype) == 0) {
if(scene->r.mode & (R_NO_OVERWRITE | R_TOUCH))
- BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
+ BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE);
if(scene->r.mode & R_NO_OVERWRITE && BLI_exists(name)) {
printf("skipping existing frame \"%s\"\n", name);
@@ -3181,7 +3184,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
if(G.afbreek==1) {
/* remove touched file */
- if(BKE_imtype_is_movie(scene->r.imtype) == 0) {
+ if(BKE_imtype_is_movie(scene->r.im_format.imtype) == 0) {
if (scene->r.mode & R_TOUCH && BLI_exists(name) && BLI_file_size(name) == 0) {
BLI_delete(name, 0, 0);
}
@@ -3197,7 +3200,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
}
/* end movie */
- if(BKE_imtype_is_movie(scene->r.imtype))
+ if(BKE_imtype_is_movie(scene->r.im_format.imtype))
mh->end_movie();
scene->r.cfra= cfrao;
@@ -3342,6 +3345,7 @@ const float default_envmap_layout[] = { 0,0, 1,0, 2,0, 0,1, 1,1, 2,1 };
int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env, const char *relpath, int imtype, float layout[12])
{
+ ImageFormatData imf;
ImBuf *ibuf=NULL;
int ok;
int dx;
@@ -3353,6 +3357,9 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
return 0;
}
+ imf= scene->r.im_format;
+ imf.imtype= imtype;
+
dx= env->cube[1]->x;
if (env->type == ENV_CUBE) {
@@ -3383,7 +3390,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
BLI_strncpy(filepath, relpath, sizeof(filepath));
BLI_path_abs(filepath, G.main->name);
- ok= BKE_write_ibuf(ibuf, filepath, imtype, scene->r.subimtype, scene->r.quality);
+ ok= BKE_write_ibuf(ibuf, filepath, &imf);
IMB_freeImBuf(ibuf);
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 38f9527e64b..67646a19cb7 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -582,40 +582,47 @@ static int set_image_type(int argc, const char **argv, void *data)
const char *imtype = argv[1];
Scene *scene= CTX_data_scene(C);
if (scene) {
- if (!strcmp(imtype,"TGA")) scene->r.imtype = R_TARGA;
- else if (!strcmp(imtype,"IRIS")) scene->r.imtype = R_IRIS;
+ char imtype_new;
+
+ if (!strcmp(imtype,"TGA")) imtype_new = R_TARGA;
+ else if (!strcmp(imtype,"IRIS")) imtype_new = R_IRIS;
#ifdef WITH_DDS
- else if (!strcmp(imtype,"DDS")) scene->r.imtype = R_DDS;
+ else if (!strcmp(imtype,"DDS")) imtype_new = R_DDS;
#endif
- else if (!strcmp(imtype,"JPEG")) scene->r.imtype = R_JPEG90;
- else if (!strcmp(imtype,"IRIZ")) scene->r.imtype = R_IRIZ;
- else if (!strcmp(imtype,"RAWTGA")) scene->r.imtype = R_RAWTGA;
- else if (!strcmp(imtype,"AVIRAW")) scene->r.imtype = R_AVIRAW;
- else if (!strcmp(imtype,"AVIJPEG")) scene->r.imtype = R_AVIJPEG;
- else if (!strcmp(imtype,"PNG")) scene->r.imtype = R_PNG;
- else if (!strcmp(imtype,"AVICODEC")) scene->r.imtype = R_AVICODEC;
- else if (!strcmp(imtype,"QUICKTIME")) scene->r.imtype = R_QUICKTIME;
- else if (!strcmp(imtype,"BMP")) scene->r.imtype = R_BMP;
+ else if (!strcmp(imtype,"JPEG")) imtype_new = R_JPEG90;
+ else if (!strcmp(imtype,"IRIZ")) imtype_new = R_IRIZ;
+ else if (!strcmp(imtype,"RAWTGA")) imtype_new = R_RAWTGA;
+ else if (!strcmp(imtype,"AVIRAW")) imtype_new = R_AVIRAW;
+ else if (!strcmp(imtype,"AVIJPEG")) imtype_new = R_AVIJPEG;
+ else if (!strcmp(imtype,"PNG")) imtype_new = R_PNG;
+ else if (!strcmp(imtype,"AVICODEC")) imtype_new = R_AVICODEC;
+ else if (!strcmp(imtype,"QUICKTIME")) imtype_new = R_QUICKTIME;
+ else if (!strcmp(imtype,"BMP")) imtype_new = R_BMP;
#ifdef WITH_HDR
- else if (!strcmp(imtype,"HDR")) scene->r.imtype = R_RADHDR;
+ else if (!strcmp(imtype,"HDR")) imtype_new = R_RADHDR;
#endif
#ifdef WITH_TIFF
- else if (!strcmp(imtype,"TIFF")) scene->r.imtype = R_TIFF;
+ else if (!strcmp(imtype,"TIFF")) imtype_new = R_TIFF;
#endif
#ifdef WITH_OPENEXR
- else if (!strcmp(imtype,"EXR")) scene->r.imtype = R_OPENEXR;
- else if (!strcmp(imtype,"MULTILAYER")) scene->r.imtype = R_MULTILAYER;
+ else if (!strcmp(imtype,"EXR")) imtype_new = R_OPENEXR;
+ else if (!strcmp(imtype,"MULTILAYER")) imtype_new = R_MULTILAYER;
#endif
- else if (!strcmp(imtype,"MPEG")) scene->r.imtype = R_FFMPEG;
- else if (!strcmp(imtype,"FRAMESERVER")) scene->r.imtype = R_FRAMESERVER;
+ else if (!strcmp(imtype,"MPEG")) imtype_new = R_FFMPEG;
+ else if (!strcmp(imtype,"FRAMESERVER")) imtype_new = R_FRAMESERVER;
#ifdef WITH_CINEON
- else if (!strcmp(imtype,"CINEON")) scene->r.imtype = R_CINEON;
- else if (!strcmp(imtype,"DPX")) scene->r.imtype = R_DPX;
+ else if (!strcmp(imtype,"CINEON")) imtype_new = R_CINEON;
+ else if (!strcmp(imtype,"DPX")) imtype_new = R_DPX;
#endif
#ifdef WITH_OPENJPEG
- else if (!strcmp(imtype,"JP2")) scene->r.imtype = R_JP2;
+ else if (!strcmp(imtype,"JP2")) imtype_new = R_JP2;
#endif
- else printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n");
+ else {
+ printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n");
+ imtype_new= imtype_new;
+ }
+
+ scene->r.im_format.imtype= imtype_new;
}
else {
printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n");
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
index 9d2e8751a41..846c7a1fb36 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
@@ -265,7 +265,7 @@ void BL_MakeScreenShot(ScrArea *curarea, const char* filename)
ImBuf *ibuf;
BLI_path_abs(path, G.main->name);
/* BKE_add_image_extension() checks for if extension was already set */
- BKE_add_image_extension(path, R_PNG); /* scene->r.imtype */
+ BKE_add_image_extension(path, R_PNG); /* scene->r.im_format.imtype */
ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0);
ibuf->rect= dumprect;
ibuf->ftype= PNG;