[Bf-blender-cvs] [2542868ccd8] greasepencil-object: GPencil: Check if original Object has materials to append

Antonio Vazquez noreply at git.blender.org
Wed May 5 16:13:26 CEST 2021


Commit: 2542868ccd8b0cfa47f03386533725d1201019b9
Author: Antonio Vazquez
Date:   Wed May 5 16:13:10 2021 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2542868ccd8b0cfa47f03386533725d1201019b9

GPencil: Check if original Object has materials to append

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

M	source/blender/editors/gpencil/gpencil_data.c

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

diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index b6888dc3769..9b84feac922 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -3597,6 +3597,10 @@ static bool gpencil_materials_append_to_object_poll(bContext *C)
   if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
     return false;
   }
+  short *totcolp = BKE_object_material_len_p(ob);
+  if (*totcolp == 0) {
+    return false;
+  }
 
   /* check there are more grease pencil objects */
   LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {



More information about the Bf-blender-cvs mailing list