Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-01-09 11:52:51 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-01-09 11:53:58 +0300
commit95847f6ac7ce074501d0f7f2b874ef4036601dc4 (patch)
tree3bbf615280a30c7fa6ceebc5d3e222b0be93810e /source/blender/blenkernel/intern/text.c
parent1b8240f5af34310017b9f245021e31e6b02ae3ce (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/text.c')
-rw-r--r--source/blender/blenkernel/intern/text.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 86c7f6fcd1a..3a311bfb23b 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -455,17 +455,7 @@ Text *BKE_text_copy(Main *bmain, Text *ta)
/* file name can be NULL */
if (ta->name) {
- if (ta->id.lib && BLI_path_is_rel(ta->name)) {
- char tname[FILE_MAXFILE];
- /* If path is relative, and source is a lib, path is relative to lib file, not main one! */
- BLI_strncpy(tname, ta->name, sizeof(tname));
- BLI_path_abs(tname, ta->id.lib->filepath);
- BLI_path_rel(tname, bmain->name);
- tan->name = BLI_strdup(tname);
- }
- else {
- tan->name = BLI_strdup(ta->name);
- }
+ tan->name = BLI_strdup(ta->name);
}
else {
tan->name = NULL;
@@ -499,6 +489,10 @@ Text *BKE_text_copy(Main *bmain, Text *ta)
init_undo_text(tan);
+ if (ta->id.lib) {
+ BKE_id_lib_local_paths(bmain, ta->id.lib, &tan->id);
+ }
+
return tan;
}