diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-11-24 00:00:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-11-24 00:05:24 +0300 |
commit | 888ab78edfad4f9c2bdd31764eb95eb347a8c2d8 (patch) | |
tree | f7d60d20fa245facea2963d483eb6cf40d656101 /source/blender/editors/space_view3d/view3d_edit.c | |
parent | 48a720055f736c5be257f85c22589f81f09247a8 (diff) |
Minor edits to T42649 fix
- only modify paths for newly loaded images
- don't attempt to read from library paths
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 1eed56a750b..4e997d0eec3 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -4283,6 +4283,7 @@ static int background_image_add_invoke(bContext *C, wmOperator *op, const wmEven Image *ima = NULL; BGpic *bgpic; char name[MAX_ID_NAME - 2]; + bool exists = false; const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); @@ -4291,20 +4292,22 @@ static int background_image_add_invoke(bContext *C, wmOperator *op, const wmEven char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); - ima = BKE_image_load_exists(path); + ima = BKE_image_load_exists_ex(path, &exists); } else if (RNA_struct_property_is_set(op->ptr, "name")) { RNA_string_get(op->ptr, "name", name); ima = (Image *)BKE_libblock_find_name(ID_IM, name); + exists = true; } bgpic = background_image_add(C); if (ima) { if (is_relative_path) { - Main *bmain = CTX_data_main(C); - const char *relbase = ID_BLEND_PATH(bmain, &ima->id); - BLI_path_rel(ima->name, relbase); + if (exists == false) { + Main *bmain = CTX_data_main(C); + BLI_path_rel(ima->name, bmain->name); + } } bgpic->ima = ima; |