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.
This commit is contained in:
parent
106e73da82
commit
3e0bf69bfd
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue