diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-09-06 17:28:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-09-06 17:28:57 +0400 |
commit | f6c68f10196fd2e7a1831fdfdced6e39ce862e6d (patch) | |
tree | bb87f027bfd9216eaae23b3874cc85ba2d3774f3 /source | |
parent | 259b4c12e3010692a2f45d1493005b242f14cb6c (diff) |
bugfix [#23663] relative path dind work on linux
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 9992ffe781e..11b39af2e03 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -846,14 +846,14 @@ void IMAGE_OT_replace(wmOperatorType *ot) /* assumes name is FILE_MAX */ /* ima->name and ibuf->name should end up the same */ -static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOperator *op, char *path) +static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOperator *op, char *path, int do_newpath) { Image *ima= ED_space_image(sima); void *lock; ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock); if (ibuf) { - int relative= RNA_boolean_get(op->ptr, "relative_path"); + int relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path")); int save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy")); BLI_path_abs(path, G.sce); @@ -879,8 +879,10 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera BLI_path_rel(path, G.sce); /* only after saving */ if(!save_copy) { - BLI_strncpy(ima->name, path, sizeof(ima->name)); - BLI_strncpy(ibuf->name, path, sizeof(ibuf->name)); + if(do_newpath) { + BLI_strncpy(ima->name, path, sizeof(ima->name)); + BLI_strncpy(ibuf->name, path, sizeof(ibuf->name)); + } /* should be function? nevertheless, saving only happens here */ for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) @@ -897,9 +899,10 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera BLI_path_rel(path, G.sce); /* only after saving */ if(!save_copy) { - - BLI_strncpy(ima->name, path, sizeof(ima->name)); - BLI_strncpy(ibuf->name, path, sizeof(ibuf->name)); + if(do_newpath) { + BLI_strncpy(ima->name, path, sizeof(ima->name)); + BLI_strncpy(ibuf->name, path, sizeof(ibuf->name)); + } ibuf->userflags &= ~IB_BITMAPDIRTY; @@ -952,7 +955,7 @@ static int save_as_exec(bContext *C, wmOperator *op) sima->imtypenr= RNA_enum_get(op->ptr, "file_type"); RNA_string_get(op->ptr, "filepath", str); - save_image_doit(C, sima, scene, op, str); + save_image_doit(C, sima, scene, op, str, TRUE); return OPERATOR_FINISHED; } @@ -1051,7 +1054,7 @@ static int save_exec(bContext *C, wmOperator *op) /* if exists, saves over without fileselect */ - BLI_strncpy(name, ibuf->name, FILE_MAX); + BLI_strncpy(name, ima->name, FILE_MAX); if(name[0]==0) BLI_strncpy(name, G.ima, FILE_MAX); else @@ -1068,7 +1071,7 @@ static int save_exec(bContext *C, wmOperator *op) BKE_image_release_renderresult(scene, ima); ED_space_image_release_buffer(sima, lock); - save_image_doit(C, sima, scene, op, name); + save_image_doit(C, sima, scene, op, name, FALSE); } else { ED_space_image_release_buffer(sima, lock); |