Edit Mesh: Move Edit Mesh display settings to overlay's

This makes the Edit Mesh display settings common to all objects. They can
also be set differently per viewport.

Modifying extra data (seams, sharp edges etc...) will no longer set them
automaticaly visible.

Bumping version because we need to force set all extra draw options for
older files.
This commit is contained in:
Clément Foucault 2018-09-24 23:18:02 +02:00
parent 7cc9998809
commit a3bb385ca0
Notes: blender-bot 2024-05-02 21:33:31 +02:00
Referenced by issue #68449, UV/Image editor: Remove Display Edges
22 changed files with 193 additions and 237 deletions

View File

@ -754,7 +754,10 @@ class IMAGE_PT_view_display_uv_edit_overlays(Panel):
col = layout.column()
col.prop(uvedit, "edge_display_type", text="Edges")
split = col.split(factor=0.6)
split.prop(uvedit, "show_edges", text="Edges")
split.prop(uvedit, "edge_display_type", text="")
col.prop(uvedit, "show_faces", text="Faces")
col = layout.column()

View File

@ -4349,7 +4349,6 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
overlay = view.overlay
shading = view.shading
display_all = overlay.show_overlays
data = context.active_object.data
col = layout.column()
col.active = display_all
@ -4357,18 +4356,18 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
split = col.split()
sub = split.column()
sub.prop(data, "show_edges", text="Edges")
sub.prop(overlay, "show_edges", text="Edges")
sub = split.column()
sub.prop(data, "show_faces", text="Faces")
sub.prop(overlay, "show_faces", text="Faces")
sub = split.column()
sub.active = shading.show_xray
sub.prop(data, "show_face_center", text="Center")
sub.prop(overlay, "show_face_center", text="Center")
row = col.row(align=True)
row.prop(data, "show_edge_crease", text="Creases", toggle=True)
row.prop(data, "show_edge_sharp", text="Sharp", text_ctxt=i18n_contexts.plural, toggle=True)
row.prop(data, "show_edge_bevel_weight", text="Bevel", toggle=True)
row.prop(data, "show_edge_seams", text="Seams", toggle=True)
row.prop(overlay, "show_edge_crease", text="Creases", toggle=True)
row.prop(overlay, "show_edge_sharp", text="Sharp", text_ctxt=i18n_contexts.plural, toggle=True)
row.prop(overlay, "show_edge_bevel_weight", text="Bevel", toggle=True)
row.prop(overlay, "show_edge_seams", text="Seams", toggle=True)
class VIEW3D_PT_overlay_edit_mesh_shading(Panel):
@ -4388,7 +4387,6 @@ class VIEW3D_PT_overlay_edit_mesh_shading(Panel):
overlay = view.overlay
tool_settings = context.tool_settings
display_all = overlay.show_overlays
data = context.active_object.data
statvis = tool_settings.statvis
col = layout.column()
@ -4402,12 +4400,12 @@ class VIEW3D_PT_overlay_edit_mesh_shading(Panel):
row.label(text="Zero Weights")
row.prop(tool_settings, "vertex_group_user", text="")
col.prop(data, "show_statvis", text="Mesh Analysis")
if data.show_statvis:
col.prop(overlay, "show_statvis", text="Mesh Analysis")
if overlay.show_statvis:
col = col.column()
sub = col.split()
sub.active = data.show_statvis
sub.active = overlay.show_statvis
sub.label(text="Type")
sub.prop(statvis, "type", text="")
@ -4450,7 +4448,6 @@ class VIEW3D_PT_overlay_edit_mesh_measurement(Panel):
view = context.space_data
overlay = view.overlay
display_all = overlay.show_overlays
data = context.active_object.data
col = layout.column()
col.active = display_all
@ -4458,12 +4455,12 @@ class VIEW3D_PT_overlay_edit_mesh_measurement(Panel):
split = col.split()
sub = split.column()
sub.prop(data, "show_extra_edge_length", text="Edge Length")
sub.prop(data, "show_extra_edge_angle", text="Edge Angle")
sub.prop(overlay, "show_extra_edge_length", text="Edge Length")
sub.prop(overlay, "show_extra_edge_angle", text="Edge Angle")
sub = split.column()
sub.prop(data, "show_extra_face_area", text="Face Area")
sub.prop(data, "show_extra_face_angle", text="Face Angle")
sub.prop(overlay, "show_extra_face_area", text="Face Area")
sub.prop(overlay, "show_extra_face_angle", text="Face Angle")
class VIEW3D_PT_overlay_edit_mesh_normals(Panel):
@ -4512,14 +4509,13 @@ class VIEW3D_PT_overlay_edit_mesh_freestyle(Panel):
view = context.space_data
overlay = view.overlay
display_all = overlay.show_overlays
data = context.active_object.data
col = layout.column()
col.active = display_all
row = col.row()
row.prop(data, "show_freestyle_edge_marks", text="Edge Marks")
row.prop(data, "show_freestyle_face_marks", text="Face Marks")
row.prop(overlay, "show_freestyle_edge_marks", text="Edge Marks")
row.prop(overlay, "show_freestyle_face_marks", text="Face Marks")
class VIEW3D_PT_overlay_edit_mesh_developer(Panel):
@ -4538,12 +4534,11 @@ class VIEW3D_PT_overlay_edit_mesh_developer(Panel):
view = context.space_data
overlay = view.overlay
display_all = overlay.show_overlays
data = context.active_object.data
col = layout.column()
col.active = display_all
col.prop(data, "show_extra_indices", text="Indices")
col.prop(overlay, "show_extra_indices", text="Indices")
class VIEW3D_PT_overlay_edit_curve(Panel):

View File

@ -28,7 +28,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
#define BLENDER_SUBVERSION 23
#define BLENDER_SUBVERSION 24
/* Several breakages with 280, e.g. collections vs layers */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0

View File

@ -2536,10 +2536,13 @@ static void editbmesh_calc_modifiers(
#if 0 /* XXX Will re-enable this when we have global mod stack options. */
const bool do_final_wmcol = (scene->toolsettings->weights_preview == WP_WPREVIEW_FINAL) && do_wmcol;
#endif
#if 0 /* Obsolete by 2.8. */
const bool do_final_wmcol = false;
const bool do_init_wmcol = ((((Mesh *)ob->data)->drawflag & ME_DRAWEIGHT) && !do_final_wmcol);
const bool do_init_statvis = ((((Mesh *)ob->data)->drawflag & ME_DRAW_STATVIS) && !do_init_wmcol);
#endif
const bool do_init_wmcol = false;
const bool do_init_statvis = false;
const bool do_mod_wmcol = do_init_wmcol;
VirtualModifierData virtualModifierData;

View File

@ -262,8 +262,6 @@ void BKE_editmesh_lnorspace_update(BMEditMesh *em)
Mesh *me = em->ob->data;
if (me->flag & ME_AUTOSMOOTH) {
BM_edges_sharp_from_angle_set(bm, me->smoothresh);
me->drawflag |= ME_DRAWSHARP;
}
}

View File

@ -508,7 +508,7 @@ void BKE_mesh_init(Mesh *me)
#if 0
me->flag = ME_TWOSIDED;
#endif
me->drawflag = ME_DRAWEDGES | ME_DRAWFACES | ME_DRAWCREASES;
me->drawflag = 0;
CustomData_reset(&me->vdata);
CustomData_reset(&me->edata);

View File

@ -637,7 +637,6 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Base *base;
Material *ma;
Camera *cam;
Mesh *me;
Curve *cu;
Scene *sce;
Tex *tx;
@ -729,10 +728,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
}
#if 0 /* ME_DRAWEDGES and others was moved to viewport. */
/* copy standard draw flag to meshes(used to be global, is not available here) */
for (me = bmain->mesh.first; me; me = me->id.next) {
me->drawflag = ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
me->drawflag = ME_DRAWEDGES | ME_DRAWFACES | ME_DRAWCREASES;
}
#endif
/* particle draw and render types */
for (part = bmain->particle.first; part; part = part->id.next) {

View File

@ -2052,4 +2052,24 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 24)) {
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
v3d->overlay.edit_flag |= V3D_OVERLAY_EDIT_FACES |
V3D_OVERLAY_EDIT_SEAMS |
V3D_OVERLAY_EDIT_SHARP |
V3D_OVERLAY_EDIT_FREESTYLE_EDGE |
V3D_OVERLAY_EDIT_FREESTYLE_FACE |
V3D_OVERLAY_EDIT_EDGES |
V3D_OVERLAY_EDIT_CREASES |
V3D_OVERLAY_EDIT_BWEIGHTS;
}
}
}
}
}
}

View File

@ -405,33 +405,32 @@ static void EDIT_MESH_cache_init(void *vedata)
if (draw_ctx->object_edit->type == OB_MESH) {
if (BKE_object_is_in_editmode(draw_ctx->object_edit)) {
const Mesh *me = draw_ctx->object_edit->data;
if ((me->drawflag & ME_DRAW_FREESTYLE_FACE) == 0) {
if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FREESTYLE_EDGE) == 0) {
stl->g_data->data_mask[0] &= ~VFLAG_FACE_FREESTYLE;
}
if ((me->drawflag & ME_DRAWFACES) == 0) {
if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACES) == 0) {
stl->g_data->data_mask[0] &= ~(VFLAG_FACE_SELECTED & VFLAG_FACE_FREESTYLE);
stl->g_data->do_faces = false;
}
if ((me->drawflag & ME_DRAWSEAMS) == 0) {
if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_SEAMS) == 0) {
stl->g_data->data_mask[1] &= ~VFLAG_EDGE_SEAM;
}
if ((me->drawflag & ME_DRAWSHARP) == 0) {
if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_SHARP) == 0) {
stl->g_data->data_mask[1] &= ~VFLAG_EDGE_SHARP;
}
if ((me->drawflag & ME_DRAW_FREESTYLE_EDGE) == 0) {
if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FREESTYLE_FACE) == 0) {
stl->g_data->data_mask[1] &= ~VFLAG_EDGE_FREESTYLE;
}
if ((me->drawflag & ME_DRAWEDGES) == 0) {
if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGES) == 0) {
if ((tsettings->selectmode & SCE_SELECT_EDGE) == 0) {
stl->g_data->data_mask[1] &= ~(VFLAG_EDGE_ACTIVE & VFLAG_EDGE_SELECTED);
stl->g_data->do_edges = false;
}
}
if ((me->drawflag & ME_DRAWCREASES) == 0) {
if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CREASES) == 0) {
stl->g_data->data_mask[2] = 0x0;
}
if ((me->drawflag & ME_DRAWBWEIGHTS) == 0) {
if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_BWEIGHTS) == 0) {
stl->g_data->data_mask[3] = 0x0;
}
}
@ -565,14 +564,13 @@ static void EDIT_MESH_cache_populate(void *vedata, Object *ob)
if (ob->type == OB_MESH) {
if ((ob == draw_ctx->object_edit) || BKE_object_is_in_editmode(ob)) {
const Mesh *me = ob->data;
bool do_occlude_wire = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_OCCLUDE_WIRE) != 0;
bool do_show_weight = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_WEIGHT) != 0;
bool fnormals_do = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_NORMALS) != 0;
bool vnormals_do = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_VERT_NORMALS) != 0;
bool lnormals_do = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_LOOP_NORMALS) != 0;
bool show_face_dots = ((Mesh *)draw_ctx->object_edit->data)->drawflag & ME_DRAW_FACE_DOT;
bool show_face_dots = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) != 0;
if (stl->g_data->do_faces == false &&
stl->g_data->do_edges == false &&
@ -646,11 +644,11 @@ static void EDIT_MESH_cache_populate(void *vedata, Object *ob)
stl->g_data->edit_ob += 1;
/* 3D text overlay */
if (me->drawflag & (ME_DRAWEXTRA_EDGELEN |
ME_DRAWEXTRA_FACEAREA |
ME_DRAWEXTRA_FACEANG |
ME_DRAWEXTRA_EDGEANG |
ME_DRAWEXTRA_INDICES))
if (v3d->overlay.edit_flag & (V3D_OVERLAY_EDIT_EDGE_LEN |
V3D_OVERLAY_EDIT_FACE_AREA |
V3D_OVERLAY_EDIT_FACE_ANG |
V3D_OVERLAY_EDIT_EDGE_ANG |
V3D_OVERLAY_EDIT_INDICES))
{
if (DRW_state_show_text()) {
DRW_edit_mesh_mode_text_measure_stats(

View File

@ -70,7 +70,7 @@ void DRW_edit_mesh_mode_text_measure_stats(
const bool do_global = (v3d->flag & V3D_GLOBAL_STATS) != 0;
const bool do_moving = (G.moving & G_TRANSFORM_EDIT) != 0;
/* when 2 edge-info options are enabled, space apart */
const bool do_edge_textpair = (me->drawflag & ME_DRAWEXTRA_EDGELEN) && (me->drawflag & ME_DRAWEXTRA_EDGEANG);
const bool do_edge_textpair = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_LEN) && (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_ANG);
const short edge_texpair_sep = (short)(5.0f * U.ui_scale);
float clip_planes[4][4];
/* allow for displaying shape keys and deform mods */
@ -84,14 +84,14 @@ void DRW_edit_mesh_mode_text_measure_stats(
else if (grid <= 10.0f) conv_float = "%.3g";
else conv_float = "%.2g";
if (me->drawflag & (ME_DRAWEXTRA_EDGELEN | ME_DRAWEXTRA_EDGEANG | ME_DRAWEXTRA_INDICES)) {
if (v3d->overlay.edit_flag & (V3D_OVERLAY_EDIT_EDGE_LEN | V3D_OVERLAY_EDIT_EDGE_ANG | V3D_OVERLAY_EDIT_INDICES)) {
BoundBox bb;
const rcti rect = {0, ar->winx, 0, ar->winy};
ED_view3d_clipping_calc(&bb, clip_planes, ar, em->ob, &rect);
}
if (me->drawflag & ME_DRAWEXTRA_EDGELEN) {
if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_LEN) {
BMEdge *eed;
UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
@ -133,7 +133,7 @@ void DRW_edit_mesh_mode_text_measure_stats(
}
}
if (me->drawflag & ME_DRAWEXTRA_EDGEANG) {
if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_ANG) {
const bool is_rad = (unit->system_rotation == USER_UNIT_ROT_RADIANS);
BMEdge *eed;
@ -191,7 +191,7 @@ void DRW_edit_mesh_mode_text_measure_stats(
}
}
if (me->drawflag & ME_DRAWEXTRA_FACEAREA) {
if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_AREA) {
/* would be nice to use BM_face_calc_area, but that is for 2d faces
* so instead add up tessellation triangle areas */
@ -242,7 +242,7 @@ void DRW_edit_mesh_mode_text_measure_stats(
}
}
if (me->drawflag & ME_DRAWEXTRA_FACEANG) {
if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_ANG) {
BMFace *efa;
const bool is_rad = (unit->system_rotation == USER_UNIT_ROT_RADIANS);
@ -296,7 +296,7 @@ void DRW_edit_mesh_mode_text_measure_stats(
}
/* This option is for mesh ops and addons debugging; only available in UI if Blender starts with --debug */
if (me->drawflag & ME_DRAWEXTRA_INDICES) {
if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_INDICES) {
int i;
/* For now, reuse an appropriate theme color */

View File

@ -319,7 +319,7 @@ static void edgetag_ensure_cd_flag(Mesh *me, const char edge_mode)
/* since you want to create paths with multiple selects, it doesn't have extend option */
static void mouse_mesh_shortest_path_edge(
Scene *scene, Object *obedit, const struct PathSelectParams *op_params,
Scene *UNUSED(scene), Object *obedit, const struct PathSelectParams *op_params,
BMEdge *e_act, BMEdge *e_dst)
{
BMEditMesh *em = BKE_editmesh_from_object(obedit);
@ -327,7 +327,6 @@ static void mouse_mesh_shortest_path_edge(
struct UserData user_data = {bm, obedit->data, op_params};
LinkNode *path = NULL;
Mesh *me = obedit->data;
bool is_path_ordered = false;
edgetag_ensure_cd_flag(obedit->data, op_params->edge_mode);
@ -415,29 +414,6 @@ static void mouse_mesh_shortest_path_edge(
}
}
/* force drawmode for mesh */
switch (op_params->edge_mode) {
case EDGE_MODE_TAG_SEAM:
me->drawflag |= ME_DRAWSEAMS;
ED_uvedit_live_unwrap(scene, obedit);
break;
case EDGE_MODE_TAG_SHARP:
me->drawflag |= ME_DRAWSHARP;
break;
case EDGE_MODE_TAG_CREASE:
me->drawflag |= ME_DRAWCREASES;
break;
case EDGE_MODE_TAG_BEVEL:
me->drawflag |= ME_DRAWBWEIGHTS;
break;
#ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE:
me->drawflag |= ME_DRAW_FREESTYLE_EDGE;
break;
#endif
}
EDBM_update_generic(em, false, false);
}

View File

@ -988,13 +988,6 @@ static int edbm_mark_seam_exec(bContext *C, wmOperator *op)
continue;
}
Mesh *me = ((Mesh *)obedit->data);
/* auto-enable seams drawing */
if (clear == 0) {
me->drawflag |= ME_DRAWSEAMS;
}
if (clear) {
BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
@ -1063,17 +1056,11 @@ static int edbm_mark_sharp_exec(bContext *C, wmOperator *op)
Object *obedit = objects[ob_index];
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
Mesh *me = ((Mesh *)obedit->data);
if (bm->totedgesel == 0) {
continue;
}
/* auto-enable sharp edge drawing */
if (clear == 0) {
me->drawflag |= ME_DRAWSHARP;
}
BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
if (use_verts) {
if (!(BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) || BM_elem_flag_test(eed->v2, BM_ELEM_SELECT))) {
@ -6937,17 +6924,11 @@ static int edbm_mark_freestyle_edge_exec(bContext *C, wmOperator *op)
}
BMesh *bm = em->bm;
Mesh *me = ((Mesh *)obedit->data);
if (bm->totedgesel == 0) {
continue;
}
/* auto-enable Freestyle edge mark drawing */
if (clear == 0) {
me->drawflag |= ME_DRAW_FREESTYLE_EDGE;
}
if (!CustomData_has_layer(&em->bm->edata, CD_FREESTYLE_EDGE)) {
BM_data_layer_add(em->bm, &em->bm->edata, CD_FREESTYLE_EDGE);
}
@ -7015,7 +6996,6 @@ static int edbm_mark_freestyle_face_exec(bContext *C, wmOperator *op)
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
Mesh *me = (Mesh *)obedit->data;
BMEditMesh *em = BKE_editmesh_from_object(obedit);
if (em == NULL) {
@ -7026,11 +7006,6 @@ static int edbm_mark_freestyle_face_exec(bContext *C, wmOperator *op)
continue;
}
/* auto-enable Freestyle face mark drawing */
if (!clear) {
me->drawflag |= ME_DRAW_FREESTYLE_FACE;
}
if (!CustomData_has_layer(&em->bm->pdata, CD_FREESTYLE_FACE)) {
BM_data_layer_add(em->bm, &em->bm->pdata, CD_FREESTYLE_FACE);
}
@ -7715,10 +7690,6 @@ static int normals_split_merge(bContext *C, const bool do_merge)
BM_elem_flag_set(e, BM_ELEM_SMOOTH, do_merge);
}
}
if (do_merge == 0) {
Mesh *me = obedit->data;
me->drawflag |= ME_DRAWSHARP;
}
bm->spacearr_dirty |= BM_SPACEARR_DIRTY_ALL;
BKE_editmesh_lnorspace_update(em);

View File

@ -798,8 +798,6 @@ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator
/* Tag edges as sharp according to smooth threshold if needed, to preserve autosmooth shading. */
if (me->flag & ME_AUTOSMOOTH) {
BM_edges_sharp_from_angle_set(me->edit_btmesh->bm, me->smoothresh);
me->drawflag |= ME_DRAWSHARP;
}
BM_data_layer_add(me->edit_btmesh->bm, data, CD_CUSTOMLOOPNORMAL);
@ -823,8 +821,6 @@ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator
me->smoothresh);
MEM_freeN(polynors);
me->drawflag |= ME_DRAWSHARP;
}
CustomData_add_layer(data, CD_CUSTOMLOOPNORMAL, CD_DEFAULT, NULL, me->totloop);

View File

@ -330,6 +330,14 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
v3d->overlay.texture_paint_mode_opacity = 0.8;
v3d->overlay.weight_paint_mode_opacity = 0.8;
v3d->overlay.vertex_paint_mode_opacity = 0.8;
v3d->overlay.edit_flag = V3D_OVERLAY_EDIT_FACES |
V3D_OVERLAY_EDIT_SEAMS |
V3D_OVERLAY_EDIT_SHARP |
V3D_OVERLAY_EDIT_FREESTYLE_EDGE |
V3D_OVERLAY_EDIT_FREESTYLE_FACE |
V3D_OVERLAY_EDIT_EDGES |
V3D_OVERLAY_EDIT_CREASES |
V3D_OVERLAY_EDIT_BWEIGHTS;
v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR;

View File

@ -1017,27 +1017,6 @@ static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
Transform_Properties(ot, P_SNAP);
}
static int edge_bevelweight_exec(bContext *C, wmOperator *op)
{
Mesh *me = (Mesh *)CTX_data_edit_object(C)->data;
/* auto-enable bevel edge weight drawing, then chain to common transform code */
me->drawflag |= ME_DRAWBWEIGHTS;
return transform_exec(C, op);
}
static int edge_bevelweight_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
Mesh *me = (Mesh *)CTX_data_edit_object(C)->data;
/* auto-enable bevel edge weight drawing, then chain to common transform code */
me->drawflag |= ME_DRAWBWEIGHTS;
return transform_invoke(C, op, event);
}
static void TRANSFORM_OT_edge_bevelweight(struct wmOperatorType *ot)
{
/* identifiers */
@ -1047,8 +1026,8 @@ static void TRANSFORM_OT_edge_bevelweight(struct wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
/* api callbacks */
ot->invoke = edge_bevelweight_invoke;
ot->exec = edge_bevelweight_exec;
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
ot->poll = ED_operator_editmesh;

View File

@ -679,7 +679,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
GPU_line_width(1.0f);
UI_GetThemeColor4fv(TH_WIRE_EDIT, col2);
if (me->drawflag & ME_DRAWEDGES) {
if ((sima->flag & SI_NO_DRAWEDGES) == 0) {
int sel;
UI_GetThemeColor4fv(TH_EDGE_SELECT, col1);

View File

@ -4505,13 +4505,6 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
}
}
if (mark_seams) {
me->drawflag |= ME_DRAWSEAMS;
}
if (mark_sharp) {
me->drawflag |= ME_DRAWSHARP;
}
BM_uv_vert_map_free(vmap);
DEG_id_tag_update(&me->id, 0);
@ -4587,8 +4580,6 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *op)
}
if (changed) {
me->drawflag |= ME_DRAWSEAMS;
if (scene->toolsettings->edge_mode_live_unwrap) {
ED_unwrap_lscm(scene, ob, false, false);
}

View File

@ -238,6 +238,7 @@ enum {
ME_CDFLAG_EDGE_CREASE = 1 << 2,
};
#if 0 /* Was moved to overlay options for 2.8 */
/* me->drawflag, short */
enum {
ME_DRAWEDGES = 1 << 0,
@ -270,6 +271,7 @@ enum {
/* draw loop normals */
ME_DRAW_LNORMALS = 1 << 18,
};
#endif
/* Subsurf Type */
enum {

View File

@ -997,6 +997,8 @@ typedef enum eSpaceImage_Flag {
SI_SHOW_R = (1 << 27),
SI_SHOW_G = (1 << 28),
SI_SHOW_B = (1 << 29),
SI_NO_DRAWEDGES = (1 << 30),
} eSpaceImage_Flag;
/* SpaceImage.other_uv_filter */

View File

@ -429,6 +429,25 @@ enum {
V3D_OVERLAY_EDIT_OCCLUDE_WIRE = (1 << 3),
V3D_OVERLAY_EDIT_WEIGHT = (1 << 4),
V3D_OVERLAY_EDIT_EDGES = (1 << 5),
V3D_OVERLAY_EDIT_FACES = (1 << 6),
V3D_OVERLAY_EDIT_FACE_DOT = (1 << 7),
V3D_OVERLAY_EDIT_SEAMS = (1 << 8),
V3D_OVERLAY_EDIT_SHARP = (1 << 9),
V3D_OVERLAY_EDIT_CREASES = (1 << 10),
V3D_OVERLAY_EDIT_BWEIGHTS = (1 << 11),
V3D_OVERLAY_EDIT_FREESTYLE_EDGE = (1 << 12),
V3D_OVERLAY_EDIT_FREESTYLE_FACE = (1 << 13),
V3D_OVERLAY_EDIT_STATVIS = (1 << 14),
V3D_OVERLAY_EDIT_EDGE_LEN = (1 << 15),
V3D_OVERLAY_EDIT_EDGE_ANG = (1 << 16),
V3D_OVERLAY_EDIT_FACE_ANG = (1 << 17),
V3D_OVERLAY_EDIT_FACE_AREA = (1 << 18),
V3D_OVERLAY_EDIT_INDICES = (1 << 19),
};
/* View3DOverlay->arm_flag */

View File

@ -228,15 +228,6 @@ static void rna_Mesh_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), Poin
}
}
static void rna_Mesh_update_data_edit_color(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Mesh *me = rna_mesh(ptr);
rna_Mesh_update_data(bmain, scene, ptr);
if (me->edit_btmesh) {
BKE_editmesh_color_free(me->edit_btmesh);
}
}
static void rna_Mesh_update_data_edit_weight(Main *bmain, Scene *scene, PointerRNA *ptr)
{
BKE_mesh_batch_cache_dirty_tag(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_ALL);
@ -3510,90 +3501,6 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
#endif
/* Mesh Draw Options for Edit Mode*/
prop = RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEDGES);
RNA_def_property_ui_text(prop, "Draw Edges",
"Display selected edges using highlights in the 3D view and UV editor");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWFACES);
RNA_def_property_ui_text(prop, "Draw Faces", "Display all faces as shades in the 3D view and UV editor");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_face_center", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_FACE_DOT);
RNA_def_property_ui_text(prop, "Draw Face Center", "Display face center");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWCREASES);
RNA_def_property_ui_text(prop, "Draw Creases", "Display creases created for Subdivision Surface modifier");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_edge_bevel_weight", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWBWEIGHTS);
RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Display weights created for the Bevel modifier");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_edge_seams", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSEAMS);
RNA_def_property_ui_text(prop, "Draw Seams", "Display UV unwrapping seams");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_edge_sharp", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSHARP);
RNA_def_property_ui_text(prop, "Draw Sharp", "Display sharp edges, used with the Edge Split modifier");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_freestyle_edge_marks", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_FREESTYLE_EDGE);
RNA_def_property_ui_text(prop, "Draw Freestyle Edge Marks", "Display Freestyle edge marks, used with the Freestyle renderer");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_freestyle_face_marks", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_FREESTYLE_FACE);
RNA_def_property_ui_text(prop, "Draw Freestyle Face Marks", "Display Freestyle face marks, used with the Freestyle renderer");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_statvis", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_STATVIS);
RNA_def_property_ui_text(prop, "Stat Vis", "Display statistical information about the mesh");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_color");
prop = RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGELEN);
RNA_def_property_ui_text(prop, "Edge Length",
"Display selected edge lengths, using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_extra_edge_angle", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGEANG);
RNA_def_property_ui_text(prop, "Edge Angle",
"Display selected edge angle, using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_extra_face_angle", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEANG);
RNA_def_property_ui_text(prop, "Face Angles",
"Display the angles in the selected edges, "
"using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEAREA);
RNA_def_property_ui_text(prop, "Face Area",
"Display the area of selected faces, "
"using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop = RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_INDICES);
RNA_def_property_ui_text(prop, "Indices", "Display the index numbers of selected vertices, edges, and faces");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
/* editflag */
prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X);

View File

@ -2267,6 +2267,11 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Display Faces", "Display faces over the image");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
prop = RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAWEDGES);
RNA_def_property_ui_text(prop, "Display Edges", "Display edges in vertex select mode");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
/* todo: move edge and face drawing options here from G.f */
prop = RNA_def_property(srna, "use_snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
@ -2792,6 +2797,88 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Display Split Normals", "Display vertex-per-face normals as lines");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_EDGES);
RNA_def_property_ui_text(prop, "Draw Edges",
"Display selected edges using highlights in the 3D view and UV editor");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACES);
RNA_def_property_ui_text(prop, "Draw Faces", "Display all faces as shades in the 3D view and UV editor");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_face_center", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_DOT);
RNA_def_property_ui_text(prop, "Draw Face Center", "Display face center");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_CREASES);
RNA_def_property_ui_text(prop, "Draw Creases", "Display creases created for Subdivision Surface modifier");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_edge_bevel_weight", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_BWEIGHTS);
RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Display weights created for the Bevel modifier");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_edge_seams", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_SEAMS);
RNA_def_property_ui_text(prop, "Draw Seams", "Display UV unwrapping seams");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_edge_sharp", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_SHARP);
RNA_def_property_ui_text(prop, "Draw Sharp", "Display sharp edges, used with the Edge Split modifier");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_freestyle_edge_marks", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FREESTYLE_EDGE);
RNA_def_property_ui_text(prop, "Draw Freestyle Edge Marks", "Display Freestyle edge marks, used with the Freestyle renderer");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_freestyle_face_marks", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FREESTYLE_FACE);
RNA_def_property_ui_text(prop, "Draw Freestyle Face Marks", "Display Freestyle face marks, used with the Freestyle renderer");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_statvis", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_STATVIS);
RNA_def_property_ui_text(prop, "Stat Vis", "Display statistical information about the mesh");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_EDGE_LEN);
RNA_def_property_ui_text(prop, "Edge Length",
"Display selected edge lengths, using global values when set in the transform panel");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_extra_edge_angle", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_EDGE_ANG);
RNA_def_property_ui_text(prop, "Edge Angle",
"Display selected edge angle, using global values when set in the transform panel");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_extra_face_angle", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_ANG);
RNA_def_property_ui_text(prop, "Face Angles",
"Display the angles in the selected edges, "
"using global values when set in the transform panel");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_AREA);
RNA_def_property_ui_text(prop, "Face Area",
"Display the area of selected faces, "
"using global values when set in the transform panel");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_INDICES);
RNA_def_property_ui_text(prop, "Indices", "Display the index numbers of selected vertices, edges, and faces");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "normals_length", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "overlay.normals_length");
RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view");