diff options
author | Antonioya <blendergit@gmail.com> | 2018-08-08 12:48:18 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-08-08 12:48:18 +0300 |
commit | 3e0bf69bfd8360b3a4b90940d59d231832962bf4 (patch) | |
tree | c85e3e8d104dc84e445bc137d1272fe59abbecc9 /source/blender/draw/engines | |
parent | 106e73da8298697e8b96d878a279bbc98bdfa6ca (diff) |
GP: Change to make the temp name unique
The previous commit could fail if some corner situations. This new temp name must be unique always.
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_draw_utils.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c index 93269d4543f..499eb14e254 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@ -1263,7 +1263,6 @@ static void gp_instance_modifier_make_instances(GPENCIL_StorageList *stl, Object { /* reset random */ mmd->rnd[0] = 1; - char buf[8]; int e = 0; /* Generate instances */ @@ -1287,12 +1286,16 @@ static void gp_instance_modifier_make_instances(GPENCIL_StorageList *stl, Object /* add object to cache */ newob = MEM_dupallocN(ob); - /* create a unique name or the object hash used in draw will fail. + /* Create a unique name or the object hash used in draw will fail. * the name must be unique in the hash, not in the scene because - * the object never is linked to scene. + * the object never is linked to scene and is removed after drawing. + * + * It uses special characters to be sure the name cannot be equal + * to any existing name because UI limits the use of special characters. + * + * Name = OB\t_{pointer}_{index} */ - sprintf(buf, "___%d", e++); - strncat(newob->id.name, buf, sizeof(newob->id.name)); + sprintf(newob->id.name, "OB\t_%p_%d", &ob, e++); mul_m4_m4m4(newob->obmat, ob->obmat, mat); |