diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-11-24 00:48:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-11-24 00:48:48 +0300 |
commit | 929dbc66445ba2004be52bd29f5bd06bcd1f8a26 (patch) | |
tree | 8631422ffb9b089abbbdae5bc187df6d5b71dae7 /source/blender/editors/space_image | |
parent | 888ab78edfad4f9c2bdd31764eb95eb347a8c2d8 (diff) |
Cleanup: de-duplicate image drag & drop logic
also don't make library paths relative on image load.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 2a03dc66ebd..50aee934841 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1052,6 +1052,7 @@ static int image_open_exec(bContext *C, wmOperator *op) char path[FILE_MAX]; int frame_seq_len = 0; int frame_ofs = 1; + bool exists = false; const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); @@ -1070,7 +1071,7 @@ static int image_open_exec(bContext *C, wmOperator *op) errno = 0; - ima = BKE_image_load_exists(path); + ima = BKE_image_load_exists_ex(path, &exists); if (!ima) { if (op->customdata) MEM_freeN(op->customdata); @@ -1084,8 +1085,9 @@ static int image_open_exec(bContext *C, wmOperator *op) /* only image path after save, never ibuf */ if (is_relative_path) { - const char *relbase = ID_BLEND_PATH(bmain, &ima->id); - BLI_path_rel(ima->name, relbase); + if (!exists) { + BLI_path_rel(ima->name, bmain->name); + } } /* hook into UI */ |