[Bf-blender-cvs] [a26735ac91f] temp-gpencil-eval: Create duplication of material array for eval datablock

Antonio Vazquez noreply at git.blender.org
Thu Jan 16 13:19:50 CET 2020


Commit: a26735ac91f586426ff69e5385fabda2a7c6a7c2
Author: Antonio Vazquez
Date:   Thu Jan 16 13:19:40 2020 +0100
Branches: temp-gpencil-eval
https://developer.blender.org/rBa26735ac91f586426ff69e5385fabda2a7c6a7c2

Create duplication of material array for eval datablock

If this copy is not done, when the datablock is cleared, the first datablock that use the material array, destroy the array, and in the second time the pointer is used, it's invalid.

Now, each datablock, uses its own material array.

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

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

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

diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 78ba52555de..7f91b793be1 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -863,9 +863,12 @@ void BKE_gpencil_prepare_eval_data(Depsgraph *depsgraph, Scene *scene, Object *o
       /* Copy all relevant data of the datablock. */
       ListBase layers = gpd_eval->layers;
       bGPdata_Runtime runtime = gpd_eval->runtime;
+      MEM_SAFE_FREE(gpd_eval->mat);
+
       memcpy(gpd_eval, gpd_orig, sizeof(bGPdata));
       gpd_eval->layers = layers;
       gpd_eval->runtime = runtime;
+      gpd_eval->mat = MEM_dupallocN(gpd_orig->mat);
 
       /* Assign. */
       ob->data = ob->runtime.gpd_eval;



More information about the Bf-blender-cvs mailing list