diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-01-05 19:56:41 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-01-07 00:26:20 +0300 |
commit | 211e161d763cdfc1688236cc3adbfad8ae926831 (patch) | |
tree | c51304a917cf2460c5a914f78975173fa82a838b /source/blender/editors/object/object_bake_api.c | |
parent | 6ea01dc509f82458b2e7f1d040dc4d2f0e7820fe (diff) |
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
Diffstat (limited to 'source/blender/editors/object/object_bake_api.c')
-rw-r--r-- | source/blender/editors/object/object_bake_api.c | 21 |
1 files changed, 16 insertions, 5 deletions
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; |