Image/UV Editor: Remove show other option

This is no longer useful now that we have multi-object editing support.
This commit is contained in:
Dalai Felinto 2018-09-10 10:41:36 -03:00
parent 0ee212682e
commit 58622eb3a6
4 changed files with 6 additions and 149 deletions

View File

@ -89,7 +89,6 @@ class IMAGE_MT_view(Menu):
if show_uvedit:
layout.prop(toolsettings, "show_uv_local_view")
layout.prop(uv, "show_other_objects")
layout.prop(uv, "show_metadata")
if paint.brush and (context.image_paint_object or sima.mode == 'PAINT'):
@ -782,15 +781,6 @@ class IMAGE_PT_view_display_uv_edit_overlays_advanced(Panel):
sima = context.space_data
uvedit = sima.uv_editor
col = layout.column()
col.prop(uvedit, "show_other_objects", text="Other Objects")
sub = col.column()
sub.active = uvedit.show_other_objects
sub.prop(uvedit, "other_uv_filter", text="Filter")
col.separator()
col = layout.column()
col.prop(uvedit, "show_stretch", text="Stretch")

View File

@ -424,110 +424,11 @@ static void draw_uvs_lineloop_bmfaces(BMesh *bm, const int cd_loop_uv_offset, co
GPU_batch_discard(loop_batch);
}
static void draw_uvs_lineloop_mpoly(Mesh *me, MPoly *mpoly, unsigned int pos)
static void draw_uvs_texpaint(Scene *scene, Object *ob)
{
MLoopUV *mloopuv;
int i;
immBegin(GPU_PRIM_LINE_LOOP, mpoly->totloop);
mloopuv = &me->mloopuv[mpoly->loopstart];
for (i = mpoly->totloop; i != 0; i--, mloopuv++) {
immVertex2fv(pos, mloopuv->uv);
}
immEnd();
}
static void draw_uvs_other_mesh(Object *ob, const Image *curimage,
const int other_uv_filter, unsigned int pos)
{
Mesh *me = ob->data;
MPoly *mpoly = me->mpoly;
int a;
BLI_bitmap *mat_test_array;
bool ok = false;
int totcol = 0;
if (me->mloopuv == NULL) {
return;
}
if (curimage && ob->totcol == 0) {
return;
}
totcol = max_ii(ob->totcol, 1);
mat_test_array = BLI_BITMAP_NEW_ALLOCA(totcol);
for (a = 0; a < totcol; a++) {
Image *image;
/* if no materials, assume a default material with no image */
if (ob->totcol)
ED_object_get_active_image(ob, a + 1, &image, NULL, NULL, NULL);
else
image = NULL;
if (image == curimage) {
BLI_BITMAP_ENABLE(mat_test_array, a);
ok = true;
}
}
if (ok == false) {
return;
}
for (a = me->totpoly; a != 0; a--, mpoly++) {
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, pos);
}
}
static void draw_uvs_other(ViewLayer *view_layer, Object *obedit, const Image *curimage,
const int other_uv_filter)
{
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_UV_OTHERS);
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
if (((base->flag & BASE_SELECTED) != 0) &&
((base->flag & BASE_VISIBLE) != 0))
{
Object *ob = base->object;
if ((ob->type == OB_MESH) && (ob != obedit) && ((Mesh *)ob->data)->mloopuv) {
draw_uvs_other_mesh(ob, curimage, other_uv_filter, pos);
}
}
}
immUnbindProgram();
}
static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Object *ob)
{
Image *curimage = ED_space_image(sima);
Mesh *me = ob->data;
Material *ma;
if (sima->flag & SI_DRAW_OTHER) {
draw_uvs_other(view_layer, ob, curimage, sima->other_uv_filter);
}
ma = give_current_material(ob, ob->actcol);
if (me->mloopuv) {
@ -582,7 +483,7 @@ static void draw_uvs_looptri(BMEditMesh *em, unsigned int *r_loop_index, const i
}
/* draws uv's in the image space */
static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Object *obedit, Depsgraph *depsgraph)
static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *depsgraph)
{
ToolSettings *ts;
Mesh *me = obedit->data;
@ -610,20 +511,6 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
else
interpedges = (ts->uv_selectmode == UV_SELECT_VERTEX);
/* draw other uvs */
if (sima->flag & SI_DRAW_OTHER) {
Image *curimage;
if (efa_act) {
ED_object_get_active_image(obedit, efa_act->mat_nr + 1, &curimage, NULL, NULL, NULL);
}
else {
curimage = ima;
}
draw_uvs_other(view_layer, obedit, curimage, sima->other_uv_filter);
}
/* 1. draw shadow mesh */
if (sima->flag & SI_DRAWSHADOW) {
@ -1070,12 +957,12 @@ void ED_uvedit_draw_main(
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob_iter = objects[ob_index];
draw_uvs(sima, scene, view_layer, ob_iter, depsgraph);
draw_uvs(sima, scene, ob_iter, depsgraph);
}
MEM_freeN(objects);
}
else {
draw_uvs_texpaint(sima, scene, view_layer, obact);
draw_uvs_texpaint(scene, obact);
}
if (show_uvedit && !(toolsettings->use_uv_sculpt))

View File

@ -917,8 +917,7 @@ typedef struct SpaceImage {
char dt_uvstretch;
char around;
/* Filter settings when editor shows other object's UVs. */
int other_uv_filter;
int pad2;
int flag;
@ -988,7 +987,7 @@ typedef enum eSpaceImage_Flag {
SI_SMOOTH_UV = (1 << 20),
SI_DRAW_STRETCH = (1 << 21),
SI_SHOW_GPENCIL = (1 << 22),
SI_DRAW_OTHER = (1 << 23),
/* SI_DEPRECATED6 = (1 << 23), */ /* deprecated */
SI_COLOR_CORRECTION = (1 << 24),

View File

@ -2190,13 +2190,6 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
static const 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 islands whose 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");
@ -2240,11 +2233,6 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Display Modified Edges", "Display edges after modifiers are applied");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
prop = RNA_def_property(srna, "show_other_objects", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_OTHER);
RNA_def_property_ui_text(prop, "Display Other Objects", "Display other selected objects that share the same image");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_METADATA);
RNA_def_property_ui_text(prop, "Show Metadata", "Display metadata properties of the image");
@ -2284,13 +2272,6 @@ 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)