[Bf-blender-cvs] [211e161d763] master: Fix T84416: Vertex color baking checks for UVMap

Philipp Oeser noreply at git.blender.org
Wed Jan 6 22:33:32 CET 2021


Commit: 211e161d763cdfc1688236cc3adbfad8ae926831
Author: Philipp Oeser
Date:   Tue Jan 5 17:56:41 2021 +0100
Branches: master
https://developer.blender.org/rB211e161d763cdfc1688236cc3adbfad8ae926831

Fix T84416: Vertex color baking checks for UVMap

Since the introduction in rB2221389d6e8e, baking to vertex colors would
still check for the existence of a valid UVMap (as if baking to image
textures).

Now check for vertex colors instead if target is
R_BAKE_TARGET_VERTEX_COLORS.

Maniphest Tasks: T84416

Differential Revision: https://developer.blender.org/D10006

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

M	source/blender/editors/object/object_bake_api.c

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

diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 37dd320dcd0..8a63ab22b36 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -441,13 +441,24 @@ static bool bake_object_check(ViewLayer *view_layer,
   }
 
   Mesh *me = (Mesh *)ob->data;
-  if (CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV) == -1) {
-    BKE_reportf(
-        reports, RPT_ERROR, "No active UV layer found in the object \"%s\"", ob->id.name + 2);
-    return false;
+  if (target == R_BAKE_TARGET_VERTEX_COLORS) {
+    MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR);
+    MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_MLOOPCOL);
+    if (mcol == NULL && mloopcol == NULL) {
+      BKE_reportf(reports,
+                  RPT_ERROR,
+                  "No vertex colors layer found in the object \"%s\"",
+                  ob->id.name + 2);
+      return false;
+    }
   }
+  else if (target == R_BAKE_TARGET_IMAGE_TEXTURES) {
+    if (CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV) == -1) {
+      BKE_reportf(
+          reports, RPT_ERROR, "No active UV layer found in the object \"%s\"", ob->id.name + 2);
+      return false;
+    }
 
-  if (target == R_BAKE_TARGET_IMAGE_TEXTURES) {
     for (int i = 0; i < ob->totcol; i++) {
       bNodeTree *ntree = NULL;
       bNode *node = NULL;



More information about the Bf-blender-cvs mailing list