[Bf-blender-cvs] [005d1d09330] temp-udim-images: Support saving tiled images
Lukas Stockner
noreply at git.blender.org
Tue Jun 12 00:08:05 CEST 2018
Commit: 005d1d09330b1bc9a7a56bde53e938822b251ff4
Author: Lukas Stockner
Date: Tue Jun 12 00:07:09 2018 +0200
Branches: temp-udim-images
https://developer.blender.org/rB005d1d09330b1bc9a7a56bde53e938822b251ff4
Support saving tiled images
===================================================================
M source/blender/editors/space_image/image_ops.c
===================================================================
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index dc8e24db379..2d4f4bfcf4a 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -226,7 +226,6 @@ static int space_image_file_exists_poll(bContext *C)
bool ret = false;
char name[FILE_MAX];
- /* TODO(lukas): Saving tiled images */
ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
if (ibuf) {
BLI_strncpy(name, ibuf->name, FILE_MAX);
@@ -1697,7 +1696,6 @@ static int save_image_options_init(Main *bmain, SaveImageOptions *simopts, Space
const bool guess_path, const bool save_as_render)
{
void *lock;
- /* TODO(lukas): Saving tiled images */
ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
if (ibuf) {
@@ -1879,19 +1877,16 @@ static void save_imbuf_post(ImBuf *ibuf, ImBuf *colormanaged_ibuf)
* \note ``ima->name`` and ``ibuf->name`` should end up the same.
* \note for multiview the first ``ibuf`` is important to get the settings.
*/
-static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveImageOptions *simopts, bool do_newpath)
+static bool save_image_single(bContext *C, SpaceImage *sima, wmOperator *op, SaveImageOptions *simopts, bool do_newpath, int tile)
{
Main *bmain = CTX_data_main(C);
Image *ima = ED_space_image(sima);
void *lock;
- /* TODO(lukas): Saving tiled images */
- ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
+ ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, tile);
Scene *scene;
RenderResult *rr = NULL;
bool ok = false;
- WM_cursor_wait(1);
-
if (ibuf) {
ImBuf *colormanaged_ibuf = NULL;
const char *relbase = ID_BLEND_PATH(CTX_data_main(C), &ima->id);
@@ -2105,11 +2100,38 @@ cleanup:
BKE_image_release_renderresult(scene, ima);
}
- WM_cursor_wait(0);
-
return ok;
}
+static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveImageOptions *simopts, bool do_newpath)
+{
+ Image *ima = ED_space_image(sima);
+
+ WM_cursor_wait(1);
+
+ if (!save_image_single(C, sima, op, simopts, do_newpath, 0)) {
+ WM_cursor_wait(0);
+ return false;
+ }
+
+ if (ima->source == IMA_SRC_TILED) {
+ char filepath[FILE_MAX];
+ BLI_strncpy(filepath, simopts->filepath, sizeof(filepath));
+ for (int tile = 1; tile < ima->num_tiles; tile++) {
+ char head[FILE_MAX], tail[FILE_MAX];
+ unsigned short numlen;
+ BLI_stringdec(filepath, head, tail, &numlen);
+ BLI_stringenc(simopts->filepath, head, tail, numlen, 1001 + tile);
+
+ save_image_single(C, sima, op, simopts, do_newpath, tile);
+ }
+ BLI_strncpy(simopts->filepath, filepath, sizeof(simopts->filepath));
+ }
+
+ WM_cursor_wait(0);
+ return true;
+}
+
static void image_save_as_free(wmOperator *op)
{
if (op->customdata) {
More information about the Bf-blender-cvs
mailing list