diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-01-08 16:38:48 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-01-08 16:38:48 +0300 |
commit | 60e70c0c6014e51954473e075a7679ad24648acd (patch) | |
tree | 55454702573809436f98d5e6dbee2d13325146de /source/blender/blenkernel/intern/image.c | |
parent | 72ca9526411797220ea3b14d63d49c72a15ea2c1 (diff) |
Fix T43159: Copying of linked datablocks using relpath leads to invalid paths in new copies.
Simply have to rebase onto main filepath when copying, if source datablock is lib and path is relative.
Afaict, only affected Image and Text datablocks. MovieClip would also be a candidate, but has
no copy implemented currently.
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index bb68f963c2e..3d55340d052 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -365,6 +365,11 @@ 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; |