Fix T102365: Wireframe skips edges after recent cleanup

10131a6f62 replaced use of the `ME_EDGERENDER` flag with
`ME_EDGEDRAW`. However, left over from previous refactors, code
for leaving edit mode set that flag based on the edge angle. Edge angle
wireframe hiding is currently supposed to be adjustable with the
wireframe overlay settings. This patch restores the previous behavior
from before the cleanup commit.

Differential Revision: https://developer.blender.org/D16451
This commit is contained in:
Hans Goudey 2022-11-16 16:48:09 -06:00
parent cacfaaa9a5
commit 145839aa42
Notes: blender-bot 2023-02-14 09:36:46 +01:00
Referenced by commit 7ca651d182, Mesh: Remove unnecessary edge draw flag
Referenced by issue #102365, Regression: Wire frame display doesn't draw every edge in some cases
3 changed files with 11 additions and 28 deletions

View File

@ -25,7 +25,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 0
#define BLENDER_FILE_SUBVERSION 1
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file

View File

@ -58,6 +58,7 @@
#include "BKE_lib_override.h"
#include "BKE_main.h"
#include "BKE_main_namemap.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_screen.h"
@ -3690,6 +3691,15 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 305, 1)) {
/* Reset edge visibility flag, since the base is meant to be "true" for original meshes. */
LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
for (MEdge &edge : mesh->edges_for_write()) {
edge.flag |= ME_EDGEDRAW;
}
}
}
/**
* Versioning code until next subversion bump goes here.
*

View File

@ -826,23 +826,6 @@ static void bm_to_mesh_shape(BMesh *bm,
/** \} */
BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
{
/* This is a cheap way to set the edge draw, its not precise and will
* pick the first 2 faces an edge uses.
* The dot comparison is a little arbitrary, but set so that a 5 subdivisions
* ico-sphere won't vanish but 6 subdivisions will (as with pre-bmesh Blender). */
if (/* (med->flag & ME_EDGEDRAW) && */ /* Assume to be true. */
(e->l && (e->l != e->l->radial_next)) &&
(dot_v3v3(e->l->f->no, e->l->radial_next->f->no) > 0.9995f)) {
med->flag &= ~ME_EDGEDRAW;
}
else {
med->flag |= ME_EDGEDRAW;
}
}
template<typename T, typename GetFn>
static void write_fn_to_attribute(blender::bke::MutableAttributeAccessor attributes,
const StringRef attribute_name,
@ -1036,8 +1019,6 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
/* Copy over custom-data. */
CustomData_from_bmesh_block(&bm->edata, &me->edata, e->head.data, i);
bmesh_quick_edgedraw_flag(&medge[i], e);
i++;
BM_CHECK_ELEMENT(e);
}
@ -1309,14 +1290,6 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
select_edge_attribute.span[i] = true;
}
/* Handle this differently to editmode switching,
* only enable draw for single user edges rather than calculating angle. */
if ((med->flag & ME_EDGEDRAW) == 0) {
if (eed->l && eed->l == eed->l->radial_next) {
med->flag |= ME_EDGEDRAW;
}
}
CustomData_from_bmesh_block(&bm->edata, &me->edata, eed->head.data, i);
}
bm->elem_index_dirty &= ~BM_EDGE;