Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-10-17 15:28:16 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-10-17 15:28:16 +0300
commitc2d0832c6ee11e1575744ab18233e41a9e7c2730 (patch)
treebc7b3425f37c31938d14eb7d42afe9605185c1f5 /source/blender/editors/uvedit
parent7f19c4fdf920c47d288a279af64bcf151e021877 (diff)
UV Editor: Add filter option to control what is visible when Draw Other Objects is enabled
Previously the editor will always try to only show UV faces with the same exact active image or image texture, which is quite difficult to control on a production shaders, where each material can have multiple objects assigned. The idea of this commit is to bring option which allows to easily control what to display when "Draw Other Objects" is enabled, so currently we can have old behavior ("Same Image") or tell editor to show everything ("All"). In the future we can extend it with such filters as "Same Material" and things like that. Hopefully this will help @eyecandy's workflow of texturing.
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c44
1 files changed, 28 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 */