Commit: 0dabd312d49ff9fd28517e355f7700b8a75ca2cb
Author: Campbell Barton
Date:   Fri Dec 21 08:33:36 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB0dabd312d49ff9fd28517e355f7700b8a75ca2cb

Library: correct BKE_id_to_unique_string_key fix

===================================================================

M       source/blender/blenkernel/intern/library.c

===================================================================

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);
        }
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to