[Bf-blender-cvs] [34b28850bf8] master: Fix wrong material indicated in the error message when baking

Germano Cavalcante noreply at git.blender.org
Wed Apr 8 14:45:08 CEST 2020


Commit: 34b28850bf86d674df428cddf0920c2853ebadb9
Author: Germano Cavalcante
Date:   Wed Apr 8 09:44:26 2020 -0300
Branches: master
https://developer.blender.org/rB34b28850bf86d674df428cddf0920c2853ebadb9

Fix wrong material indicated in the error message when baking

The material displayed in the error message due to the lack of active
texture was that of the previous slot.

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

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 d625b770164..debad321583 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -446,7 +446,8 @@ static bool bake_object_check(ViewLayer *view_layer, Object *ob, ReportList *rep
   for (i = 0; i < ob->totcol; i++) {
     bNodeTree *ntree = NULL;
     bNode *node = NULL;
-    ED_object_get_active_image(ob, i + 1, &image, NULL, &node, &ntree);
+    const int mat_nr = i + 1;
+    ED_object_get_active_image(ob, mat_nr, &image, NULL, &node, &ntree);
 
     if (image) {
       ImBuf *ibuf;
@@ -481,7 +482,7 @@ static bool bake_object_check(ViewLayer *view_layer, Object *ob, ReportList *rep
       }
     }
     else {
-      Material *mat = BKE_object_material_get(ob, i);
+      Material *mat = BKE_object_material_get(ob, mat_nr);
       if (mat != NULL) {
         BKE_reportf(reports,
                     RPT_INFO,



More information about the Bf-blender-cvs mailing list