From 8eb594b74be479eda1cddc28291d7df27aa70dd5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 21 Jul 2010 14:09:45 +0000 Subject: [PATCH] Fix #22870: Can't save modified non-packed images. File exist check wasn't taking into account that there could be relative paths. --- source/blender/editors/space_image/image_ops.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 3e269634b27..03fc7dad016 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -127,10 +127,15 @@ static int space_image_file_exists_poll(bContext *C) SpaceImage *sima= CTX_wm_space_image(C); ImBuf *ibuf; void *lock; - int poll; - + int poll= 0; + char name[FILE_MAX]; + ibuf= ED_space_image_acquire_buffer(sima, &lock); - poll= (ibuf && BLI_exists(ibuf->name) && BLI_is_writable(ibuf->name)); + if(ibuf) { + BLI_strncpy(name, ibuf->name, FILE_MAX); + BLI_path_abs(name, G.sce); + poll= (BLI_exists(name) && BLI_is_writable(name)); + } ED_space_image_release_buffer(sima, lock); return poll; @@ -1030,6 +1035,8 @@ static int save_exec(bContext *C, wmOperator *op) BLI_strncpy(name, ibuf->name, FILE_MAX); if(name[0]==0) BLI_strncpy(name, G.ima, FILE_MAX); + else + BLI_path_abs(name, G.sce); if(BLI_exists(name) && BLI_is_writable(name)) { rr= BKE_image_acquire_renderresult(scene, ima);