diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-07-19 16:24:34 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-07-19 16:26:24 +0400 |
commit | 1f3c8466a827f4851bd7babec18b58fc148d85cc (patch) | |
tree | d325b1c5d47a8a25783e05d2d99da670db0ef16f | |
parent | 00cb9e5f1cfab142b0972f7a35c3247b00d56423 (diff) |
Fix T41100: draw other object UVs doesn't work when both objects have no image.
-rw-r--r-- | source/blender/editors/uvedit/uvedit_draw.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index a1cc23f735b..177b442b583 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -403,20 +403,28 @@ static void draw_uvs_other_mesh_new_shading(Object *ob, const Image *curimage) int a; BLI_bitmap *mat_test_array; bool ok = false; + int totcol = 0; if (me->mloopuv == NULL) { return; } - if (ob->totcol == 0) { + if (curimage && ob->totcol == 0) { return; } - mat_test_array = BLI_BITMAP_NEW_ALLOCA(ob->totcol); + totcol = max_ii(ob->totcol, 1); + mat_test_array = BLI_BITMAP_NEW_ALLOCA(totcol); - for (a = 0; a < ob->totcol; a++) { + for (a = 0; a < totcol; a++) { Image *image; - ED_object_get_active_image(ob, a + 1, &image, NULL, NULL); + + /* if no materials, assume a default material with no image */ + if(ob->totcol) + ED_object_get_active_image(ob, a + 1, &image, NULL, NULL); + else + image = NULL; + if (image == curimage) { BLI_BITMAP_ENABLE(mat_test_array, a); ok = true; @@ -429,7 +437,7 @@ static void draw_uvs_other_mesh_new_shading(Object *ob, const Image *curimage) for (a = me->totpoly; a != 0; a--, mpoly++) { const int mat_nr = mpoly->mat_nr; - if ((mat_nr >= ob->totcol) || + if ((mat_nr >= totcol) || (BLI_BITMAP_TEST(mat_test_array, mat_nr)) == 0) { continue; |