diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_draw.c | 44 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 14 |
3 files changed, 52 insertions, 16 deletions
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 94d69a0169f..5c5e84ee5f0 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -377,7 +377,7 @@ static void draw_uvs_lineloop_mpoly(Mesh *me, MPoly *mpoly) glEnd(); } -static void draw_uvs_other_mesh_texface(Object *ob, const Image *curimage) +static void draw_uvs_other_mesh_texface(Object *ob, const Image *curimage, const int other_uv_filter) { Mesh *me = ob->data; MPoly *mpoly = me->mpoly; @@ -389,14 +389,19 @@ static void draw_uvs_other_mesh_texface(Object *ob, const Image *curimage) } for (a = me->totpoly; a != 0; a--, mpoly++, mtpoly++) { - if (mtpoly->tpage != curimage) { - continue; + if (other_uv_filter == SI_FILTER_ALL) { + /* Nothing to compare, all UV faces are visible. */ + } + else if (other_uv_filter == SI_FILTER_SAME_IMAGE) { + if (mtpoly->tpage != curimage) { + continue; + } } draw_uvs_lineloop_mpoly(me, mpoly); } } -static void draw_uvs_other_mesh_new_shading(Object *ob, const Image *curimage) +static void draw_uvs_other_mesh_new_shading(Object *ob, const Image *curimage, const int other_uv_filter) { Mesh *me = ob->data; MPoly *mpoly = me->mpoly; @@ -436,27 +441,34 @@ 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 >= totcol) || - (BLI_BITMAP_TEST(mat_test_array, mat_nr)) == 0) - { - continue; + if (other_uv_filter == SI_FILTER_ALL) { + /* Nothing to compare, all UV faces are visible. */ + } + else if (other_uv_filter == SI_FILTER_SAME_IMAGE) { + const int mat_nr = mpoly->mat_nr; + if ((mat_nr >= totcol) || + (BLI_BITMAP_TEST(mat_test_array, mat_nr)) == 0) + { + continue; + } } draw_uvs_lineloop_mpoly(me, mpoly); } } -static void draw_uvs_other_mesh(Object *ob, const Image *curimage, const bool new_shading_nodes) +static void draw_uvs_other_mesh(Object *ob, const Image *curimage, const bool new_shading_nodes, + const int other_uv_filter) { if (new_shading_nodes) { - draw_uvs_other_mesh_new_shading(ob, curimage); + draw_uvs_other_mesh_new_shading(ob, curimage, other_uv_filter); } else { - draw_uvs_other_mesh_texface(ob, curimage); + draw_uvs_other_mesh_texface(ob, curimage, other_uv_filter); } } -static void draw_uvs_other(Scene *scene, Object *obedit, const Image *curimage, const bool new_shading_nodes) +static void draw_uvs_other(Scene *scene, Object *obedit, const Image *curimage, const bool new_shading_nodes, + const int other_uv_filter) { Base *base; @@ -470,7 +482,7 @@ static void draw_uvs_other(Scene *scene, Object *obedit, const Image *curimage, if (ob->restrictflag & OB_RESTRICT_VIEW) continue; if ((ob->type == OB_MESH) && (ob != obedit) && ((Mesh *)ob->data)->mloopuv) { - draw_uvs_other_mesh(ob, curimage, new_shading_nodes); + draw_uvs_other_mesh(ob, curimage, new_shading_nodes, other_uv_filter); } } } @@ -483,7 +495,7 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, Object *ob) Material *ma; if (sima->flag & SI_DRAW_OTHER) { - draw_uvs_other(scene, ob, curimage, new_shading_nodes); + draw_uvs_other(scene, ob, curimage, new_shading_nodes, sima->other_uv_filter); } UI_ThemeColor(TH_UV_SHADOW); @@ -586,7 +598,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) curimage = (activetf) ? activetf->tpage : ima; } - draw_uvs_other(scene, obedit, curimage, new_shading_nodes); + draw_uvs_other(scene, obedit, curimage, new_shading_nodes, sima->other_uv_filter); } /* 1. draw shadow mesh */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 41188c2412f..5e015544dc9 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -898,6 +898,10 @@ typedef struct SpaceImage { char dt_uvstretch; char around; + /* Filter settings when editor shows other object's UVs. */ + int other_uv_filter; + int pad2; + MaskSpaceInfo mask_info; } SpaceImage; @@ -976,6 +980,12 @@ typedef enum eSpaceImage_Flag { SI_SHOW_B = (1 << 29), } eSpaceImage_Flag; +/* SpaceImage->other_uv_filter */ +typedef enum eSpaceImage_OtherUVFilter { + SI_FILTER_SAME_IMAGE = 0, + SI_FILTER_ALL = 1, +} eSpaceImage_OtherUVFilter; + /* Text Editor ============================================ */ /* Text Editor */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 8fb99703e9b..ffcf12edb2d 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1977,6 +1977,13 @@ static void rna_def_space_image_uv(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem other_uv_filter_items[] = { + {SI_FILTER_ALL, "ALL", 0, "All", "No filter, show all islands from other objects"}, + {SI_FILTER_SAME_IMAGE, "SAME_IMAGE", ICON_IMAGE_DATA, "Same Image", + "Only show others' UV islads who's active image matches image of the active face"}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "SpaceUVEditor", NULL); RNA_def_struct_sdna(srna, "SpaceImage"); RNA_def_struct_nested(brna, srna, "SpaceImageEditor"); @@ -2064,6 +2071,13 @@ static void rna_def_space_image_uv(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Live Unwrap", "Continuously unwrap the selected UV island while transforming pinned vertices"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); + + /* Other UV filtering */ + prop = RNA_def_property(srna, "other_uv_filter", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, other_uv_filter_items); + RNA_def_property_ui_text(prop, "Other UV filter", + "Filter applied on the other object's UV to limit displayed"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); } static void rna_def_space_outliner(BlenderRNA *brna) |