Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2020-07-15 18:25:07 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-07-15 18:26:27 +0300
commitae4098e234a0fd80c3a67d35bffa04708875f2e2 (patch)
tree18e50397760df613af9e5fb5064bfd577eb3020c /source/blender/editors
parent36e836d0e9df5dda49d748264056a9fa68ec8a02 (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')
-rw-r--r--source/blender/editors/gpencil/gpencil_mesh.c11
-rw-r--r--source/blender/editors/object/object_add.c3
2 files changed, 10 insertions, 4 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) {
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 48b50be411e..ff49e0a9c5a 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -2451,7 +2451,8 @@ static int object_convert_exec(bContext *C, wmOperator *op)
matrix,
0,
use_seams,
- use_faces);
+ use_faces,
+ false);
gpencilConverted = true;
/* Remove unused materials. */