diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-05-30 19:44:39 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-05-30 20:06:39 +0300 |
commit | 9cae631059c22ad34ee7f74d98ebc42d899757c4 (patch) | |
tree | 5aa703d79b4d7baabae4dfcc19803da40f51e3bc /source/blender/editors | |
parent | d1d359b792fd30a109d8fe70444b8645c8f3998f (diff) |
Baking: Add logic to get material from API regardless of Mesh/Object ownership
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_bake_api.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 14224e9c939..b059e4f6ca7 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -51,6 +51,7 @@ #include "BKE_image.h" #include "BKE_library.h" #include "BKE_main.h" +#include "BKE_material.h" #include "BKE_node.h" #include "BKE_report.h" #include "BKE_modifier.h" @@ -411,19 +412,15 @@ static bool bake_object_check(Scene *scene, Object *ob, ReportList *reports) } } else { - if (ob->mat[i]) { + Material *mat = give_current_material(ob, i); + if (mat != NULL) { BKE_reportf(reports, RPT_ERROR, "No active image found in material \"%s\" (%d) for object \"%s\"", - ob->mat[i]->id.name + 2, i, ob->id.name + 2); - } - else if (((Mesh *) ob->data)->mat[i]) { - BKE_reportf(reports, RPT_ERROR, - "No active image found in material \"%s\" (%d) for object \"%s\"", - ((Mesh *) ob->data)->mat[i]->id.name + 2, i, ob->id.name + 2); + mat->id.name + 2, i, ob->id.name + 2); } else { BKE_reportf(reports, RPT_ERROR, - "No active image found in material (%d) for object \"%s\"", + "No active image found in material slot (%d) for object \"%s\"", i, ob->id.name + 2); } return false; |