diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-01-09 11:52:51 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-01-09 11:53:58 +0300 |
commit | 95847f6ac7ce074501d0f7f2b874ef4036601dc4 (patch) | |
tree | 3bbf615280a30c7fa6ceebc5d3e222b0be93810e /source/blender/blenkernel/intern/image.c | |
parent | 1b8240f5af34310017b9f245021e31e6b02ae3ce (diff) |
Fix T43159: Copying of linked datablocks using relpath leads to invalid paths in new copies.
Propper fix reverting most of rB60e70c0c6014e5, which was only partial specific fix.
This code uses generic `BKE_id_lib_local_paths()` func to handle all possible paths.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D977
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 3d55340d052..870c077ff78 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -365,11 +365,6 @@ Image *BKE_image_copy(Main *bmain, Image *ima) Image *nima = image_alloc(bmain, ima->id.name + 2, ima->source, ima->type); BLI_strncpy(nima->name, ima->name, sizeof(ima->name)); - if (ima->id.lib && BLI_path_is_rel(ima->name)) { - /* If path is relative, and source is a lib, path is relative to lib file, not main one! */ - BLI_path_abs(nima->name, ima->id.lib->filepath); - BLI_path_rel(nima->name, bmain->name); - } nima->flag = ima->flag; nima->tpageflag = ima->tpageflag; @@ -389,6 +384,10 @@ Image *BKE_image_copy(Main *bmain, Image *ima) if (ima->packedfile) nima->packedfile = dupPackedFile(ima->packedfile); + if (ima->id.lib) { + BKE_id_lib_local_paths(bmain, ima->id.lib, &nima->id); + } + return nima; } |