From d036ad552faf7e1a245d7b939cef1ddab2c5153a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Jan 2015 16:48:23 +1100 Subject: BKE_image: use BKE_image_*** prefix use bools for return values and some api naming consistency. --- source/blender/blenkernel/BKE_customdata_file.h | 12 +++---- source/blender/blenkernel/BKE_image.h | 25 ++++++++------ source/blender/blenkernel/intern/customdata_file.c | 12 +++---- source/blender/blenkernel/intern/dynamicpaint.c | 2 +- source/blender/blenkernel/intern/image.c | 39 ++++++++++++---------- source/blender/blenkernel/intern/ocean.c | 2 +- source/blender/blenkernel/intern/writeavi.c | 2 +- source/blender/collada/ImageExporter.cpp | 2 +- .../operations/COM_OutputFileOperation.cpp | 10 +++--- source/blender/editors/object/object_bake_api.c | 2 +- source/blender/editors/render/render_opengl.c | 15 +++++---- source/blender/editors/render/render_shading.c | 2 +- source/blender/editors/screen/screendump.c | 5 +-- source/blender/editors/space_image/image_buttons.c | 2 +- source/blender/imbuf/intern/colormanagement.c | 2 +- source/blender/makesrna/intern/rna_image.c | 4 +-- source/blender/makesrna/intern/rna_scene.c | 4 +-- source/blender/makesrna/intern/rna_scene_api.c | 11 +++--- source/blender/render/intern/source/pipeline.c | 21 +++++++----- source/blender/windowmanager/intern/wm_operators.c | 2 +- 20 files changed, 100 insertions(+), 76 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_customdata_file.h b/source/blender/blenkernel/BKE_customdata_file.h index 978db8a6c1a..242897f968f 100644 --- a/source/blender/blenkernel/BKE_customdata_file.h +++ b/source/blender/blenkernel/BKE_customdata_file.h @@ -40,14 +40,14 @@ void cdf_free(CDataFile *cdf); /* File read/write/remove */ -int cdf_read_open(CDataFile *cdf, const char *filename); -int cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay); -int cdf_read_data(CDataFile *cdf, unsigned int size, void *data); +bool cdf_read_open(CDataFile *cdf, const char *filename); +bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay); +bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data); void cdf_read_close(CDataFile *cdf); -int cdf_write_open(CDataFile *cdf, const char *filename); -int cdf_write_layer(CDataFile *cdf, CDataFileLayer *blay); -int cdf_write_data(CDataFile *cdf, unsigned int size, void *data); +bool cdf_write_open(CDataFile *cdf, const char *filename); +bool cdf_write_layer(CDataFile *cdf, CDataFileLayer *blay); +bool cdf_write_data(CDataFile *cdf, unsigned int size, void *data); void cdf_write_close(CDataFile *cdf); void cdf_remove(const char *filename); diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index a225a27a00b..5ee8ae231d8 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -57,19 +57,25 @@ void BKE_image_free_buffers(struct Image *image); void BKE_image_free(struct Image *image); void BKE_imbuf_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); +void BKE_image_stamp_buf( + struct Scene *scene, struct Object *camera, + unsigned char *rect, float *rectf, int width, int height, int channels); bool 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 bool is_copy); -void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, - const struct ImageFormatData *im_format, const bool use_ext, const bool use_frames); -void BKE_makepicstring_from_type(char *string, const char *base, const char *relbase, int frame, - const char imtype, const bool use_ext, const bool 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); + +void BKE_image_path_from_imformat( + char *string, const char *base, const char *relbase, int frame, + const struct ImageFormatData *im_format, const bool use_ext, const bool use_frames); +void BKE_image_path_from_imtype( + char *string, const char *base, const char *relbase, int frame, + const char imtype, const bool use_ext, const bool use_frames); + +bool BKE_image_path_ensure_ext_from_imformat(char *string, const struct ImageFormatData *im_format); +bool BKE_image_path_ensure_ext_from_imtype(char *string, const char imtype); +char BKE_image_ftype_to_imtype(const int ftype); +int BKE_image_imtype_to_ftype(const char imtype); bool BKE_imtype_is_movie(const char imtype); int BKE_imtype_supports_zbuf(const char imtype); @@ -91,7 +97,6 @@ void BKE_image_de_interlace(struct Image *ima, int odd); void BKE_image_make_local(struct Image *ima); void BKE_image_tag_time(struct Image *ima); -void free_old_images(void); /* ********************************** NEW IMAGE API *********************** */ diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c index c72eea50e40..97972cca30c 100644 --- a/source/blender/blenkernel/intern/customdata_file.c +++ b/source/blender/blenkernel/intern/customdata_file.c @@ -276,7 +276,7 @@ static int cdf_write_header(CDataFile *cdf) return 1; } -int cdf_read_open(CDataFile *cdf, const char *filename) +bool cdf_read_open(CDataFile *cdf, const char *filename) { FILE *f; @@ -299,7 +299,7 @@ int cdf_read_open(CDataFile *cdf, const char *filename) return 1; } -int cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay) +bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay) { size_t offset; int a; @@ -316,7 +316,7 @@ int cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay) return (fseek(cdf->readf, offset, SEEK_SET) == 0); } -int cdf_read_data(CDataFile *cdf, unsigned int size, void *data) +bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data) { /* read data */ if (!fread(data, size, 1, cdf->readf)) @@ -338,7 +338,7 @@ void cdf_read_close(CDataFile *cdf) } } -int cdf_write_open(CDataFile *cdf, const char *filename) +bool cdf_write_open(CDataFile *cdf, const char *filename) { CDataFileHeader *header; CDataFileImageHeader *image; @@ -380,12 +380,12 @@ int cdf_write_open(CDataFile *cdf, const char *filename) return 1; } -int cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay)) +bool cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay)) { return 1; } -int cdf_write_data(CDataFile *cdf, unsigned int size, void *data) +bool cdf_write_data(CDataFile *cdf, unsigned int size, void *data) { /* write data */ if (!fwrite(data, size, 1, cdf->writef)) diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index e3fa4733e6c..3541b3fba3f 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2705,7 +2705,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_from_type(output_file, format); + BKE_image_path_ensure_ext_from_imtype(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 870c077ff78..27165042cb2 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1011,7 +1011,7 @@ void BKE_image_all_free_anim_ibufs(int cfra) /* *********** READ AND WRITE ************** */ -int BKE_imtype_to_ftype(const char imtype) +int BKE_image_imtype_to_ftype(const char imtype) { if (imtype == R_IMF_IMTYPE_TARGA) return TGA; @@ -1051,7 +1051,7 @@ int BKE_imtype_to_ftype(const char imtype) return JPG | 90; } -char BKE_ftype_to_imtype(const int ftype) +char BKE_image_ftype_to_imtype(const int ftype) { if (ftype == 0) return R_IMF_IMTYPE_TARGA; @@ -1258,7 +1258,7 @@ char BKE_imtype_from_arg(const char *imtype_arg) else return R_IMF_IMTYPE_INVALID; } -static bool do_add_image_extension(char *string, const char imtype, const ImageFormatData *im_format) +static bool image_path_ensure_ext(char *string, const char imtype, const ImageFormatData *im_format) { const char *extension = NULL; const char *extension_test; @@ -1368,14 +1368,14 @@ static bool do_add_image_extension(char *string, const char imtype, const ImageF } } -int BKE_add_image_extension(char *string, const ImageFormatData *im_format) +bool BKE_image_path_ensure_ext_from_imformat(char *string, const ImageFormatData *im_format) { - return do_add_image_extension(string, im_format->imtype, im_format); + return image_path_ensure_ext(string, im_format->imtype, im_format); } -int BKE_add_image_extension_from_type(char *string, const char imtype) +bool BKE_image_path_ensure_ext_from_imtype(char *string, const char imtype) { - return do_add_image_extension(string, imtype, NULL); + return image_path_ensure_ext(string, imtype, NULL); } void BKE_imformat_defaults(ImageFormatData *im_format) @@ -1651,7 +1651,9 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d } } -void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels) +void BKE_image_stamp_buf( + Scene *scene, Object *camera, + unsigned char *rect, float *rectf, int width, int height, int channels) { struct StampData stamp_data; float w, h, pad; @@ -2076,8 +2078,9 @@ int BKE_imbuf_write_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, cons } -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) +static void image_path_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 */ @@ -2087,19 +2090,21 @@ static void do_makepicstring(char *string, const char *base, const char *relbase BLI_path_frame(string, frame, 4); if (use_ext) - do_add_image_extension(string, imtype, im_format); + image_path_ensure_ext(string, imtype, im_format); } -void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, - const ImageFormatData *im_format, const bool use_ext, const bool use_frames) +void BKE_image_path_from_imformat( + char *string, const char *base, const char *relbase, int frame, + const ImageFormatData *im_format, const bool use_ext, const bool use_frames) { - do_makepicstring(string, base, relbase, frame, im_format->imtype, im_format, use_ext, use_frames); + image_path_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 bool use_ext, const bool use_frames) +void BKE_image_path_from_imtype( + char *string, const char *base, const char *relbase, int frame, + const char imtype, const bool use_ext, const bool use_frames) { - do_makepicstring(string, base, relbase, frame, imtype, NULL, use_ext, use_frames); + image_path_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 373ad34e7bd..12e82d3a34f 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -1002,7 +1002,7 @@ static void cache_filename(char *string, const char *path, const char *relbase, BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname); - BKE_makepicstring_from_type(string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, true, true); + BKE_image_path_from_imtype(string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, true, true); } /* silly functions but useful to inline when the args do a lot of indirections */ diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index 8a6a0438b84..85eac1f21ed 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -253,7 +253,7 @@ static void end_avi(void) } #endif /* WITH_AVI */ -/* similar to BKE_makepicstring() */ +/* similar to BKE_image_path_from_imformat() */ void BKE_movie_filepath_get(char *string, RenderData *rd) { bMovieHandle *mh = BKE_movie_handle_get(rd->im_format.imtype); diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index 5fd5fab3492..a5c1493208b 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -89,7 +89,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies) // make absolute destination path BLI_strncpy(export_file, name.c_str(), sizeof(export_file)); - BKE_add_image_extension(export_file, &imageFormat); + BKE_image_path_ensure_ext_from_imformat(export_file, &imageFormat); BLI_join_dirfile(export_path, sizeof(export_path), export_dir, export_file); diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp index 92e8f309ea1..2f92351c00d 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp @@ -140,8 +140,9 @@ 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, (this->m_rd->scemode & R_EXTENSION) != 0, true); + BKE_image_path_from_imformat( + filename, this->m_path, bmain->name, this->m_rd->cfra, + this->m_format, (this->m_rd->scemode & R_EXTENSION) != 0, true); if (0 == BKE_imbuf_write(ibuf, filename, this->m_format)) printf("Cannot save Node File Output to %s\n", filename); @@ -211,8 +212,9 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() char filename[FILE_MAX]; void *exrhandle = IMB_exr_get_handle(); - BKE_makepicstring_from_type(filename, this->m_path, bmain->name, this->m_rd->cfra, R_IMF_IMTYPE_MULTILAYER, - (this->m_rd->scemode & R_EXTENSION) != 0, true); + BKE_image_path_from_imtype( + filename, this->m_path, bmain->name, this->m_rd->cfra, R_IMF_IMTYPE_MULTILAYER, + (this->m_rd->scemode & R_EXTENSION) != 0, true); BLI_make_existing_file(filename); for (unsigned int i = 0; i < this->m_layers.size(); ++i) { diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 83eeedfef52..fca527f8931 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -916,7 +916,7 @@ cage_cleanup: BakeData *bake = &scene->r.bake; char name[FILE_MAX]; - BKE_makepicstring_from_type(name, filepath, bmain->name, 0, bake->im_format.imtype, true, false); + BKE_image_path_from_imtype(name, filepath, bmain->name, 0, bake->im_format.imtype, true, false); if (is_automatic_name) { BLI_path_suffix(name, FILE_MAX, ob_low->id.name + 2, "_"); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 8024add41cf..fc6ff4eb0c0 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -315,8 +315,9 @@ static void screen_opengl_render_apply(OGLRender *oglrender) /* rr->rectf is now filled with image data */ - if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW)) - BKE_stamp_buf(scene, camera, rect, rr->rectf, rr->rectx, rr->recty, 4); + if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW)) { + BKE_image_stamp_buf(scene, camera, rect, rr->rectf, rr->rectx, rr->recty, 4); + } RE_ReleaseResult(oglrender->re); @@ -335,8 +336,9 @@ 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, (scene->r.scemode & R_EXTENSION) != 0, false); + BKE_image_path_from_imformat( + name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, + &scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, 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); @@ -564,8 +566,9 @@ static bool 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, (scene->r.scemode & R_EXTENSION) != 0, true); + BKE_image_path_from_imformat( + name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, + &scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, true); if ((scene->r.mode & R_NO_OVERWRITE) && BLI_exists(name)) { BKE_reportf(op->reports, RPT_INFO, "Skipping existing frame \"%s\"", name); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 91c689373be..94a3defa95a 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -1412,7 +1412,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, &scene->r.im_format); + BKE_image_path_ensure_ext_from_imformat(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 e7f256e414a..9c05f1d4780 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -377,8 +377,9 @@ 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, (rd.scemode & R_EXTENSION) != 0, true); + BKE_image_path_from_imformat( + name, rd.pic, sj->bmain->name, rd.cfra, + &rd.im_format, (rd.scemode & R_EXTENSION) != 0, 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 05868283b2e..1dcf91029c8 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -780,7 +780,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char bool has_alpha = true; if (ibuf) { - int imtype = BKE_ftype_to_imtype(ibuf->ftype); + int imtype = BKE_image_ftype_to_imtype(ibuf->ftype); char valid_channels = BKE_imtype_valid_channels(imtype, false); has_alpha = (valid_channels & IMA_CHAN_FLAG_ALPHA) != 0; diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 049d8bdcff1..e5e22da1524 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -1918,7 +1918,7 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, bool save_as_render, boo * should be pretty safe since this image buffer is supposed to be used for * saving only and ftype would be overwritten a bit later by BKE_imbuf_write */ - colormanaged_ibuf->ftype = BKE_imtype_to_ftype(image_format_data->imtype); + colormanaged_ibuf->ftype = BKE_image_imtype_to_ftype(image_format_data->imtype); /* if file format isn't able to handle float buffer itself, * we need to allocate byte buffer and store color managed diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index b1935b34251..bfce1b9054c 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -193,7 +193,7 @@ static int rna_Image_file_format_get(PointerRNA *ptr) { Image *image = (Image *)ptr->data; ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL); - int imtype = BKE_ftype_to_imtype(ibuf ? ibuf->ftype : 0); + int imtype = BKE_image_ftype_to_imtype(ibuf ? ibuf->ftype : 0); BKE_image_release_ibuf(image, ibuf, NULL); @@ -204,7 +204,7 @@ static void rna_Image_file_format_set(PointerRNA *ptr, int value) { Image *image = (Image *)ptr->data; if (BKE_imtype_is_movie(value) == 0) { /* should be able to throw an error here */ - int ftype = BKE_imtype_to_ftype(value); + int ftype = BKE_image_imtype_to_ftype(value); BKE_image_file_format_set(image, ftype); } } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 57d50958e2c..7dd0185b3c6 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -942,7 +942,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); + BKE_image_path_ensure_ext_from_imformat(ext, &rd->im_format); return strlen(ext); } @@ -950,7 +950,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); + BKE_image_path_ensure_ext_from_imformat(str, &rd->im_format); } #ifdef WITH_QUICKTIME diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index be618c5d1a3..36657c8a898 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -121,11 +121,14 @@ 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->im_format.imtype)) + 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, (rd->scemode & R_EXTENSION) != 0, true); + } + else { + BKE_image_path_from_imformat( + name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, + &rd->im_format, (rd->scemode & R_EXTENSION) != 0, true); + } } static void rna_Scene_ray_cast(Scene *scene, float ray_start[3], float ray_end[3], diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 87961c03ed2..7605d7d9ea7 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2350,7 +2350,9 @@ static void renderresult_stampinfo(Render *re) /* this is the basic trick to get the displayed float or char rect from render result */ RE_AcquireResultImage(re, &rres); - BKE_stamp_buf(re->scene, RE_GetCamera(re), (unsigned char *)rres.rect32, rres.rectf, rres.rectx, rres.recty, 4); + BKE_image_stamp_buf( + re->scene, RE_GetCamera(re), + (unsigned char *)rres.rect32, rres.rectf, rres.rectx, rres.recty, 4); RE_ReleaseResultImage(re); } @@ -2831,8 +2833,9 @@ 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, (scene->r.scemode & R_EXTENSION) != 0, false); + BKE_image_path_from_imformat( + name, scene->r.pic, bmain->name, scene->r.cfra, + &scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, false); /* reports only used for Movie */ do_write_image_or_movie(re, bmain, scene, NULL, name); @@ -2917,8 +2920,9 @@ 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, (scene->r.scemode & R_EXTENSION) != 0, true); + BKE_image_path_from_imformat( + name, scene->r.pic, bmain->name, scene->r.cfra, + &scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, true); if (re->r.im_format.imtype == R_IMF_IMTYPE_MULTILAYER) { if (re->result) { @@ -2946,7 +2950,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, &imf); + BKE_image_path_ensure_ext_from_imformat(name, &imf); ibuf->planes = 24; IMB_colormanagement_imbuf_for_write(ibuf, true, false, &scene->view_settings, @@ -3079,8 +3083,9 @@ 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, (scene->r.scemode & R_EXTENSION) != 0, true); + BKE_image_path_from_imformat( + name, scene->r.pic, bmain->name, scene->r.cfra, + &scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, true); if (scene->r.mode & R_NO_OVERWRITE && BLI_exists(name)) { printf("skipping existing frame \"%s\"\n", name); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index d49a298c424..000f9f1eada 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1187,7 +1187,7 @@ bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFor /* 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, im_format)) { + if (BKE_image_path_ensure_ext_from_imformat(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. */ -- cgit v1.2.3