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:
authorCampbell Barton <ideasman42@gmail.com>2018-12-21 00:33:36 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-12-21 00:37:18 +0300
commit0dabd312d49ff9fd28517e355f7700b8a75ca2cb (patch)
treea5273ec90302ca15ffe752c36c71d585cd66a28d /source/blender/blenkernel/intern
parent4d9606ef19b55e892349f651619ae50cb0c43556 (diff)
Library: correct BKE_id_to_unique_string_key fix
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/library.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 070530ca642..5c867c075ac 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -2213,9 +2213,11 @@ char *BKE_id_to_unique_string_key(const struct ID *id)
return BLI_strdup(id->name);
}
else {
- /* Important library comes first since we can't ensure an object name won't include a library
- * like identifier at the end, but we _can_ ensure every library has an ID after it. */
- return BLI_string_joinN(id->lib->id.name, id->name);
+ /* Prefix with an ascii character in the range of 32..96 (visible)
+ * this ensures we can't have a library ID pair that collide.
+ * Where 'LIfooOBbarOBbaz' could be ('LIfoo, OBbarOBbaz') or ('LIfooOBbar', 'OBbaz'). */
+ const char ascii_len = strlen(id->lib->id.name + 2) + 32;
+ return BLI_sprintfN("%c%s%s", ascii_len, id->lib->id.name, id->name);
}
}