[Bf-blender-cvs] [106e73da829] blender2.8: Fix T56270: Crash when save a grease pencil file with instance modifier.
Antonioya
noreply at git.blender.org
Wed Aug 8 11:11:31 CEST 2018
Commit: 106e73da8298697e8b96d878a279bbc98bdfa6ca
Author: Antonioya
Date: Wed Aug 8 11:10:56 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB106e73da8298697e8b96d878a279bbc98bdfa6ca
Fix T56270: Crash when save a grease pencil file with instance modifier.
The error was related to duplicate names in the internal hash used to order instances in z-depth.
===================================================================
M source/blender/draw/engines/gpencil/gpencil_draw_utils.c
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index dba5f7b9c20..93269d4543f 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1263,6 +1263,8 @@ 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 */
for (int x = 0; x < mmd->count[0]; x++) {
@@ -1284,6 +1286,14 @@ 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.
+ * the name must be unique in the hash, not in the scene because
+ * the object never is linked to scene.
+ */
+ sprintf(buf, "___%d", e++);
+ strncat(newob->id.name, buf, sizeof(newob->id.name));
+
mul_m4_m4m4(newob->obmat, ob->obmat, mat);
/* apply scale */
More information about the Bf-blender-cvs
mailing list