diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-07-15 18:25:07 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-07-15 18:26:27 +0300 |
commit | ae4098e234a0fd80c3a67d35bffa04708875f2e2 (patch) | |
tree | 18e50397760df613af9e5fb5064bfd577eb3020c /source/blender/editors/gpencil/gpencil_mesh.c | |
parent | 36e836d0e9df5dda49d748264056a9fa68ec8a02 (diff) |
GPencil: Fix unreported error baking mesh animation
When the mesh is linked, the materials can not be available or be the same assigned to mesh. Now, if the mesh is linked, a simple two materials conversion is used.
To get the full list of materials, the mesh must not be linked.
Also checked some indexes to be sure never get a wrong value and that materials are not created again and again.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_mesh.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_mesh.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/gpencil/gpencil_mesh.c b/source/blender/editors/gpencil/gpencil_mesh.c index 68ab5100bf4..11f42f7d3ac 100644 --- a/source/blender/editors/gpencil/gpencil_mesh.c +++ b/source/blender/editors/gpencil/gpencil_mesh.c @@ -104,9 +104,10 @@ static void gpencil_bake_duplilist(Depsgraph *depsgraph, Scene *scene, Object *o free_object_duplilist(lb); } -static void gpencil_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene, ListBase *list) +static bool gpencil_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene, ListBase *list) { GpBakeOb *elem = NULL; + bool simple_material = false; /* Add active object. In some files this could not be in selected array. */ Object *obact = CTX_data_active_object(C); @@ -119,6 +120,7 @@ static void gpencil_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene /* Add duplilist. */ else if (obact->type == OB_EMPTY) { gpencil_bake_duplilist(depsgraph, scene, obact, list); + simple_material |= true; } /* Add other selected objects. */ @@ -139,6 +141,8 @@ static void gpencil_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene } } CTX_DATA_END; + + return simple_material; } static void gpencil_bake_free_ob_list(ListBase *list) @@ -158,7 +162,7 @@ static int gpencil_bake_mesh_animation_exec(bContext *C, wmOperator *op) Object *ob_gpencil = NULL; ListBase list = {NULL, NULL}; - gpencil_bake_ob_list(C, depsgraph, scene, &list); + const bool simple_material = gpencil_bake_ob_list(C, depsgraph, scene, &list); /* Cannot check this in poll because the active object changes. */ if (list.first == NULL) { @@ -260,7 +264,8 @@ static int gpencil_bake_mesh_animation_exec(bContext *C, wmOperator *op) ob_eval->obmat, frame_offset, use_seams, - use_faces); + use_faces, + simple_material); /* Reproject all untaged created strokes. */ if (project_type != GP_REPROJECT_KEEP) { |