diff options
21 files changed, 119 insertions, 34 deletions
diff --git a/source/blender/avi/intern/avi_mjpeg.c b/source/blender/avi/intern/avi_mjpeg.c index 5ecb3edf92f..91b8fa5a060 100644 --- a/source/blender/avi/intern/avi_mjpeg.c +++ b/source/blender/avi/intern/avi_mjpeg.c @@ -206,7 +206,7 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign return 1; } -static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *inBuffer, int width, int height, int bufsize) +static void Compress_JPEG(int quality, unsigned char *outbuffer, const unsigned char *inBuffer, int width, int height, int bufsize) { int i, rowstride; unsigned int y; diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 1f9630d9fce..499609932d1 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -60,8 +60,10 @@ int BKE_imbuf_alpha_test(struct ImBuf *ibuf); int BKE_imbuf_write_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf); int BKE_imbuf_write(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf); int BKE_imbuf_write_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const short is_copy); -void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype, const short use_ext, const short use_frames); -int BKE_add_image_extension(char *string, const char imtype); +void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, const struct ImageFormatData *im_format, const short use_ext, const short use_frames); +void BKE_makepicstring_from_type(char *string, const char *base, const char *relbase, int frame, const char imtype, const short use_ext, const short use_frames); +int BKE_add_image_extension(char *string, const struct ImageFormatData *im_format); +int BKE_add_image_extension_from_type(char *string, const char imtype); char BKE_ftype_to_imtype(const int ftype); int BKE_imtype_to_ftype(const char imtype); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 0efbd92641b..fff51ab2a59 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2689,7 +2689,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam if (format == R_IMF_IMTYPE_OPENEXR) format = R_IMF_IMTYPE_PNG; #endif BLI_strncpy(output_file, filename, sizeof(output_file)); - BKE_add_image_extension(output_file, format); + BKE_add_image_extension_from_type(output_file, format); /* Validate output file path */ BLI_path_abs(output_file, G.main->name); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index f3cdf11d664..0e83f0f1988 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1165,7 +1165,7 @@ char BKE_imtype_from_arg(const char *imtype_arg) else return R_IMF_IMTYPE_INVALID; } -int BKE_add_image_extension(char *string, const char imtype) +static int do_add_image_extension(char *string, const char imtype, const ImageFormatData *im_format) { const char *extension = NULL; @@ -1232,8 +1232,22 @@ int BKE_add_image_extension(char *string, const char imtype) } #ifdef WITH_OPENJPEG else if (imtype == R_IMF_IMTYPE_JP2) { - if (!BLI_testextensie(string, ".jp2")) - extension = ".jp2"; + if (im_format) { + if (im_format->jp2_codec == R_IMF_JP2_CODEC_JP2) { + if (!BLI_testextensie(string, ".jp2")) + extension = ".jp2"; + } + else if (im_format->jp2_codec == R_IMF_JP2_CODEC_J2K) { + if (!BLI_testextensie(string, ".j2c")) + extension = ".j2c"; + } + else + BLI_assert(!"Unsupported jp2 codec was specified in im_format->jp2_codec"); + } + else { + if (!BLI_testextensie(string, ".jp2")) + extension = ".jp2"; + } } #endif else { // R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG, R_IMF_IMTYPE_JPEG90, R_IMF_IMTYPE_QUICKTIME etc @@ -1259,6 +1273,16 @@ int BKE_add_image_extension(char *string, const char imtype) } } +int BKE_add_image_extension(char *string, const ImageFormatData *im_format) +{ + return do_add_image_extension(string, im_format->imtype, im_format); +} + +int BKE_add_image_extension_from_type(char *string, const char imtype) +{ + return do_add_image_extension(string, imtype, NULL); +} + void BKE_imformat_defaults(ImageFormatData *im_format) { memset(im_format, 0, sizeof(*im_format)); @@ -1351,6 +1375,13 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i if (ftype & JP2_CINE_48FPS) im_format->jp2_flag |= R_IMF_JP2_FLAG_CINE_48; } + + if (ftype & JP2_JP2) + im_format->jp2_codec = R_IMF_JP2_CODEC_JP2; + else if (ftype & JP2_J2K) + im_format->jp2_codec = R_IMF_JP2_CODEC_J2K; + else + BLI_assert(!"Unsupported jp2 codec was specified in file type"); } #endif @@ -1906,6 +1937,13 @@ int BKE_imbuf_write(ImBuf *ibuf, const char *name, ImageFormatData *imf) if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_48) ibuf->ftype |= JP2_CINE_48FPS; } + + if (imf->jp2_codec == R_IMF_JP2_CODEC_JP2) + ibuf->ftype |= JP2_JP2; + else if (imf->jp2_codec == R_IMF_JP2_CODEC_J2K) + ibuf->ftype |= JP2_J2K; + else + BLI_assert(!"Unsupported jp2 codec was specified in im_format->jp2_codec"); } #endif else { @@ -1956,7 +1994,8 @@ int BKE_imbuf_write_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, cons } -void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype, const short use_ext, const short use_frames) +static void do_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype, + const ImageFormatData *im_format, const short use_ext, const short use_frames) { if (string == NULL) return; BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */ @@ -1966,8 +2005,17 @@ void BKE_makepicstring(char *string, const char *base, const char *relbase, int BLI_path_frame(string, frame, 4); if (use_ext) - BKE_add_image_extension(string, imtype); + do_add_image_extension(string, imtype, im_format); +} +void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, const ImageFormatData *im_format, const short use_ext, const short use_frames) +{ + do_makepicstring(string, base, relbase, frame, im_format->imtype, im_format, use_ext, use_frames); +} + +void BKE_makepicstring_from_type(char *string, const char *base, const char *relbase, int frame, const char imtype, const short use_ext, const short use_frames) +{ + do_makepicstring(string, base, relbase, frame, imtype, NULL, use_ext, use_frames); } /* used by sequencer too */ diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index e694a7e7eb3..57234a5feae 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -967,7 +967,7 @@ static void cache_filename(char *string, const char *path, const char *relbase, BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname); - BKE_makepicstring(string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, 1, TRUE); + BKE_makepicstring_from_type(string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, 1, TRUE); } /* silly functions but useful to inline when the args do a lot of indirections */ diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp index 7d05202df96..47b69ec87f9 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp @@ -141,7 +141,7 @@ void OutputSingleLayerOperation::deinitExecution() IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, m_viewSettings, m_displaySettings, this->m_format); - BKE_makepicstring(filename, this->m_path, bmain->name, this->m_rd->cfra, this->m_format->imtype, + BKE_makepicstring(filename, this->m_path, bmain->name, this->m_rd->cfra, this->m_format, (this->m_rd->scemode & R_EXTENSION), true); if (0 == BKE_imbuf_write(ibuf, filename, this->m_format)) @@ -205,7 +205,7 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() char filename[FILE_MAX]; void *exrhandle = IMB_exr_get_handle(); - BKE_makepicstring(filename, this->m_path, bmain->name, this->m_rd->cfra, R_IMF_IMTYPE_MULTILAYER, + BKE_makepicstring_from_type(filename, this->m_path, bmain->name, this->m_rd->cfra, R_IMF_IMTYPE_MULTILAYER, (this->m_rd->scemode & R_EXTENSION), true); BLI_make_existing_file(filename); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 16fe94ff2e5..cbc076b3342 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -281,7 +281,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) IMB_color_to_bw(ibuf); } - BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, FALSE); + BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, &scene->r.im_format, scene->r.scemode & R_EXTENSION, FALSE); ok = BKE_imbuf_write_as(ibuf, name, &scene->r.im_format, TRUE); /* 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); @@ -505,7 +505,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) is_movie = BKE_imtype_is_movie(scene->r.im_format.imtype); if (!is_movie) { - BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE); + BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, &scene->r.im_format, scene->r.scemode & R_EXTENSION, TRUE); if ((scene->r.mode & R_NO_OVERWRITE) && BLI_exists(name)) { printf("skipping existing frame \"%s\"\n", name); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index eef5e705ce7..53e1f49d544 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -688,7 +688,7 @@ static int envmap_save_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); if (scene->r.scemode & R_EXTENSION) { - BKE_add_image_extension(path, imtype); + BKE_add_image_extension(path, &scene->r.im_format); } WM_cursor_wait(1); diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index ca85daadf3b..2982e1f21af 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -223,7 +223,7 @@ static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event) static int screenshot_check(bContext *UNUSED(C), wmOperator *op) { ScreenshotData *scd = op->customdata; - return WM_operator_filesel_ensure_ext_imtype(op, scd->im_format.imtype); + return WM_operator_filesel_ensure_ext_imtype(op, &scd->im_format); } static int screenshot_cancel(bContext *UNUSED(C), wmOperator *op) @@ -361,7 +361,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float char name[FILE_MAX]; int ok; - BKE_makepicstring(name, rd.pic, sj->bmain->name, rd.cfra, rd.im_format.imtype, rd.scemode & R_EXTENSION, TRUE); + BKE_makepicstring(name, rd.pic, sj->bmain->name, rd.cfra, &rd.im_format, rd.scemode & R_EXTENSION, TRUE); ibuf->rect = sj->dumprect; ok = BKE_imbuf_write(ibuf, name, &rd.im_format); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index d02186e59dd..51fbbacc07c 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -796,6 +796,8 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man } if (imf->imtype == R_IMF_IMTYPE_JP2) { + uiItemR(col, imfptr, "jpeg2k_codec", 0, NULL, ICON_NONE); + row = uiLayoutRow(col, FALSE); uiItemR(row, imfptr, "use_jpeg2k_cinema_preset", 0, NULL, ICON_NONE); uiItemR(row, imfptr, "use_jpeg2k_cinema_48", 0, NULL, ICON_NONE); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 0d0fdc6be1c..070330c2d47 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1217,7 +1217,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, simopts->im_format.imtype = R_IMF_IMTYPE_PNG; } else { - simopts->im_format.imtype = BKE_ftype_to_imtype(ibuf->ftype); + BKE_imbuf_to_image_format(&simopts->im_format, ibuf); } //simopts->subimtype = scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */ simopts->im_format.quality = ibuf->ftype & 0xff; @@ -1434,7 +1434,7 @@ static int image_save_as_exec(bContext *C, wmOperator *op) static int image_save_as_check(bContext *UNUSED(C), wmOperator *op) { ImageFormatData *imf = op->customdata; - return WM_operator_filesel_ensure_ext_imtype(op, imf->imtype); + return WM_operator_filesel_ensure_ext_imtype(op, imf); } static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) @@ -1559,6 +1559,7 @@ static int image_save_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); SaveImageOptions simopts; + save_image_options_defaults(&simopts); if (save_image_options_init(&simopts, sima, scene, FALSE) == 0) return OPERATOR_CANCELLED; save_image_options_from_op(&simopts, op); diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h index 28e62d496b2..433123914ce 100644 --- a/source/blender/imbuf/IMB_imbuf_types.h +++ b/source/blender/imbuf/IMB_imbuf_types.h @@ -217,6 +217,8 @@ typedef struct ImBuf { #define JP2_YCC (1 << 15) #define JP2_CINE (1 << 14) #define JP2_CINE_48FPS (1 << 13) +#define JP2_JP2 (1 << 12) +#define JP2_J2K (1 << 11) #endif #define RAWTGA (TGA | 1) diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 3a2bf99c75c..8d6218a389e 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -228,6 +228,10 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags, char co } ibuf->ftype = JP2; + if (is_jp2) + ibuf->ftype |= JP2_JP2; + else + ibuf->ftype |= JP2_J2K; if (use_float) { float *rect_float = ibuf->rect_float; @@ -852,9 +856,15 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) int codestream_length; opj_cio_t *cio = NULL; FILE *f = NULL; + opj_cinfo_t *cinfo = NULL; /* get a JP2 compressor handle */ - opj_cinfo_t *cinfo = opj_create_compress(CODEC_JP2); + if (ibuf->ftype & JP2_JP2) + cinfo = opj_create_compress(CODEC_JP2); + else if (ibuf->ftype & JP2_J2K) + cinfo = opj_create_compress(CODEC_J2K); + else + BLI_assert(!"Unsupported codec was specified in save settings"); /* catch events using our callbacks and give a local context */ opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr); diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index a01785a29ca..5e06a3084ac 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -271,8 +271,9 @@ typedef struct ImageFormatData { /* Jpeg2000 */ char jp2_flag; + char jp2_codec; - char pad[7]; + char pad[6]; /* color management */ ColorManagedViewSettings view_settings; @@ -341,6 +342,10 @@ typedef struct ImageFormatData { #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.jp2_codec */ +#define R_IMF_JP2_CODEC_JP2 0 +#define R_IMF_JP2_CODEC_J2K 1 + /* ImageFormatData.cineon_flag */ #define R_IMF_CINEON_FLAG_LOG (1<<0) /* was R_CINEON_LOG */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index c4b5d8d5109..1ead8e6e975 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -873,7 +873,7 @@ static int rna_SceneRender_file_ext_length(PointerRNA *ptr) RenderData *rd = (RenderData *)ptr->data; char ext[8]; ext[0] = '\0'; - BKE_add_image_extension(ext, rd->im_format.imtype); + BKE_add_image_extension(ext, &rd->im_format); return strlen(ext); } @@ -881,7 +881,7 @@ static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str) { RenderData *rd = (RenderData *)ptr->data; str[0] = '\0'; - BKE_add_image_extension(str, rd->im_format.imtype); + BKE_add_image_extension(str, &rd->im_format); } #ifdef WITH_QUICKTIME @@ -2881,6 +2881,14 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) }; #endif +#ifdef WITH_OPENJPEG + static EnumPropertyItem jp2_codec_items[] = { + {R_IMF_JP2_CODEC_JP2, "JP2", 0, "JP2", ""}, + {R_IMF_JP2_CODEC_J2K, "J2K", 0, "J2K", ""}, + {0, NULL, 0, NULL, NULL} + }; +#endif + StructRNA *srna; PropertyRNA *prop; @@ -2968,6 +2976,12 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_48); RNA_def_property_ui_text(prop, "Cinema (48)", "Use Openjpeg Cinema Preset (48fps)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "jpeg2k_codec", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "jp2_codec"); + RNA_def_property_enum_items(prop, jp2_codec_items); + RNA_def_property_ui_text(prop, "Codec", "Codec settings for Jpek2000"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); #endif /* Cineon and DPX */ diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 012767b5845..9b5a858a581 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -84,7 +84,7 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name if (BKE_imtype_is_movie(rd->im_format.imtype)) BKE_movie_filepath_get(name, rd); else - BKE_makepicstring(name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, rd->im_format.imtype, + BKE_makepicstring(name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, &rd->im_format, rd->scemode & R_EXTENSION, TRUE); } diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index 214617c91e5..fe23f7373fb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -269,7 +269,7 @@ static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack /* get full path */ BLI_join_dirfile(path, FILE_MAX, nimf->base_path, sockdata->path); - BKE_makepicstring(filename, path, bmain->name, rd->cfra, format->imtype, (rd->scemode & R_EXTENSION), TRUE); + BKE_makepicstring(filename, path, bmain->name, rd->cfra, format, (rd->scemode & R_EXTENSION), TRUE); if (0 == BKE_imbuf_write(ibuf, filename, format)) printf("Cannot save Node File Output to %s\n", filename); @@ -304,7 +304,7 @@ static void exec_output_file_multilayer(RenderData *rd, bNode *node, bNodeStack int recty = -1; int has_preview = 0; - BKE_makepicstring(filename, nimf->base_path, bmain->name, rd->cfra, R_IMF_IMTYPE_MULTILAYER, (rd->scemode & R_EXTENSION), TRUE); + BKE_makepicstring_from_type(filename, nimf->base_path, bmain->name, rd->cfra, R_IMF_IMTYPE_MULTILAYER, (rd->scemode & R_EXTENSION), TRUE); BLI_make_existing_file(filename); for (sock=node->inputs.first, i=0; sock; sock=sock->next, ++i) { diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 413d7cb959e..35ac038f2f2 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2117,7 +2117,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr } else { char name[FILE_MAX]; - BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, FALSE); + BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, &scene->r.im_format, scene->r.scemode & R_EXTENSION, FALSE); /* reports only used for Movie */ do_write_image_or_movie(re, bmain, scene, NULL, name); @@ -2176,7 +2176,7 @@ 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.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE); + BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, &scene->r.im_format, scene->r.scemode & R_EXTENSION, TRUE); if (re->r.im_format.imtype == R_IMF_IMTYPE_MULTILAYER) { if (re->result) { @@ -2204,7 +2204,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie if (BLI_testextensie(name, ".exr")) name[strlen(name) - 4] = 0; - BKE_add_image_extension(name, R_IMF_IMTYPE_JPEG90); + BKE_add_image_extension(name, &imf); ibuf->planes = 24; IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, &scene->view_settings, @@ -2309,7 +2309,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri /* Touch/NoOverwrite options are only valid for image's */ 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.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE); + BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, &scene->r.im_format, scene->r.scemode & R_EXTENSION, TRUE); if (scene->r.mode & R_NO_OVERWRITE && BLI_exists(name)) { printf("skipping existing frame \"%s\"\n", name); diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 75ab0f5bcd7..c418b07401d 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -62,6 +62,7 @@ struct MenuType; struct wmDropBox; struct wmDrag; struct ImBuf; +struct ImageFormatData; typedef struct wmJob wmJob; @@ -185,7 +186,7 @@ int WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, struct wm int WM_operator_confirm (struct bContext *C, struct wmOperator *op, struct wmEvent *event); /* invoke callback, file selector "filepath" unset + exec */ int WM_operator_filesel (struct bContext *C, struct wmOperator *op, struct wmEvent *event); -int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const char imtype); +int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format); /* poll callback, context checks */ int WM_operator_winactive (struct bContext *C); /* invoke callback, exec + redo popup */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index b5f1d590f37..8867101779a 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -976,14 +976,14 @@ int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) } } -int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const char imtype) +int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format) { PropertyRNA *prop; char filepath[FILE_MAX]; /* dont NULL check prop, this can only run on ops with a 'filepath' */ prop = RNA_struct_find_property(op->ptr, "filepath"); RNA_property_string_get(op->ptr, prop, filepath); - if (BKE_add_image_extension(filepath, imtype)) { + if (BKE_add_image_extension(filepath, im_format)) { RNA_property_string_set(op->ptr, prop, filepath); /* note, we could check for and update 'filename' here, * but so far nothing needs this. */ diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index 00836fa8ecb..f8ad8870e83 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -259,7 +259,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_IMF_IMTYPE_PNG); /* scene->r.im_format.imtype */ + BKE_add_image_extension_from_type(path, R_IMF_IMTYPE_PNG); /* scene->r.im_format.imtype */ ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0); ibuf->rect= dumprect; ibuf->ftype= PNG; |