Mesh: Remove unnecessary edge draw flag #104417
@ -229,10 +229,6 @@ void BKE_mesh_material_remap(struct Mesh *me, const unsigned int *remap, unsigne
|
||||
void BKE_mesh_smooth_flag_set(struct Mesh *me, bool use_smooth);
|
||||
void BKE_mesh_auto_smooth_flag_set(struct Mesh *me, bool use_auto_smooth, float auto_smooth_angle);
|
||||
|
||||
/**
|
||||
* Needed after converting a mesh with subsurf optimal display to mesh.
|
||||
*/
|
||||
void BKE_mesh_edges_set_draw_render(struct Mesh *me);
|
||||
|
||||
/**
|
||||
* Used for unit testing; compares two meshes, checking only
|
||||
|
@ -145,10 +145,7 @@ void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh);
|
||||
*/
|
||||
void BKE_mesh_do_versions_convert_mfaces_to_mpolys(struct Mesh *mesh);
|
||||
|
||||
/**
|
||||
* Convert legacy #MFace.edcode to edge #ME_EDGEDRAW.
|
||||
*/
|
||||
void BKE_mesh_calc_edges_legacy(struct Mesh *me, bool use_old);
|
||||
void BKE_mesh_calc_edges_legacy(struct Mesh *me);
|
||||
|
||||
void BKE_mesh_do_versions_cd_flag_init(struct Mesh *mesh);
|
||||
|
||||
|
@ -174,6 +174,13 @@ struct MeshRuntime {
|
||||
*/
|
||||
BitVector<> subsurf_face_dot_tags;
|
||||
|
||||
/**
|
||||
* A bit vector the size of the number of edges, set to true for edges that should be drawn in
|
||||
* the viewport. Created by the "Optimimal Display" feature of the subdivision surface modifier.
|
||||
* Otherwise it will be empty.
|
||||
*/
|
||||
BitVector<> subsurf_optimal_display_edges;
|
||||
|
||||
MeshRuntime() = default;
|
||||
~MeshRuntime();
|
||||
|
||||
|
@ -62,7 +62,6 @@ static void fill_mesh_topology(const int vert_offset,
|
||||
MEdge &edge = edges[profile_edge_offset + i_ring];
|
||||
edge.v1 = ring_vert_offset + i_profile;
|
||||
edge.v2 = next_ring_vert_offset + i_profile;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +77,6 @@ static void fill_mesh_topology(const int vert_offset,
|
||||
MEdge &edge = edges[ring_edge_offset + i_profile];
|
||||
edge.v1 = ring_vert_offset + i_profile;
|
||||
edge.v2 = ring_vert_offset + i_next_profile;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,10 +107,12 @@ static void mesh_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
|
||||
mesh_dst->runtime->wrapper_type_finalize = mesh_src->runtime->wrapper_type_finalize;
|
||||
mesh_dst->runtime->subsurf_runtime_data = mesh_src->runtime->subsurf_runtime_data;
|
||||
mesh_dst->runtime->cd_mask_extra = mesh_src->runtime->cd_mask_extra;
|
||||
/* Copy face dot tags, since meshes may be duplicated after a subsurf modifier or node, but we
|
||||
* still need to be able to draw face center vertices. The tags may be cleared explicitly when
|
||||
* the topology is changed. */
|
||||
/* Copy face dot tags and edge tags, since meshes may be duplicated after a subsurf modifier or
|
||||
* node, but we still need to be able to draw face center vertices and "optimal edges"
|
||||
* differently. The tags may be cleared explicitly when the topology is changed. */
|
||||
mesh_dst->runtime->subsurf_face_dot_tags = mesh_src->runtime->subsurf_face_dot_tags;
|
||||
mesh_dst->runtime->subsurf_optimal_display_edges =
|
||||
mesh_src->runtime->subsurf_optimal_display_edges;
|
||||
if ((mesh_src->id.tag & LIB_TAG_NO_MAIN) == 0) {
|
||||
/* This is a direct copy of a main mesh, so for now it has the same topology. */
|
||||
mesh_dst->runtime->deformed_only = true;
|
||||
|
@ -146,7 +146,6 @@ static void serialize_and_initialize_deduplicated_edges(MutableSpan<EdgeMap> edg
|
||||
/* Initialize new edge. */
|
||||
new_edge.v1 = item.key.v_low;
|
||||
new_edge.v2 = item.key.v_high;
|
||||
new_edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
item.value.index = new_edge_index;
|
||||
new_edge_index++;
|
||||
|
@ -121,7 +121,7 @@ static void make_edges_mdata_extend(Mesh &mesh)
|
||||
BLI_edgehashIterator_getKey(ehi, &medge->v1, &medge->v2);
|
||||
BLI_edgehashIterator_setValue(ehi, POINTER_FROM_UINT(e_index));
|
||||
|
||||
medge->flag = ME_EDGEDRAW;
|
||||
medge->flag = 0;
|
||||
|
||||
}
|
||||
BLI_edgehashIterator_free(ehi);
|
||||
|
||||
@ -223,7 +223,6 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
|
||||
for (b = 1; b < dl->nr; b++) {
|
||||
edges[dst_edge].v1 = startvert + ofs + b - 1;
|
||||
edges[dst_edge].v2 = startvert + ofs + b;
|
||||
edges[dst_edge].flag = ME_EDGEDRAW;
|
||||
|
||||
dst_edge++;
|
||||
}
|
||||
@ -250,7 +249,6 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
|
||||
else {
|
||||
edges[dst_edge].v2 = startvert + ofs + b + 1;
|
||||
}
|
||||
edges[dst_edge].flag = ME_EDGEDRAW;
|
||||
dst_edge++;
|
||||
}
|
||||
}
|
||||
@ -662,14 +660,6 @@ void BKE_mesh_from_pointcloud(const PointCloud *pointcloud, Mesh *me)
|
||||
&pointcloud->pdata, &me->vdata, CD_MASK_PROP_ALL, CD_DUPLICATE, pointcloud->totpoint);
|
||||
}
|
||||
|
||||
void BKE_mesh_edges_set_draw_render(Mesh *mesh)
|
||||
{
|
||||
MutableSpan<MEdge> edges = mesh->edges_for_write();
|
||||
for (int i = 0; i < mesh->totedge; i++) {
|
||||
edges[i].flag |= ME_EDGEDRAW;
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_pointcloud_to_mesh(Main *bmain, Depsgraph *depsgraph, Scene * /*scene*/, Object *ob)
|
||||
{
|
||||
BLI_assert(ob->type == OB_POINTCLOUD);
|
||||
|
@ -89,7 +89,6 @@ static void mesh_calc_edges_mdata(const MVert * /*allvert*/,
|
||||
int totface,
|
||||
int /*totloop*/,
|
||||
int totpoly,
|
||||
const bool use_old,
|
||||
MEdge **r_medge,
|
||||
int *r_totedge)
|
||||
{
|
||||
@ -156,9 +155,6 @@ static void mesh_calc_edges_mdata(const MVert * /*allvert*/,
|
||||
if (ed->v1 != (ed + 1)->v1 || ed->v2 != (ed + 1)->v2) {
|
||||
med->v1 = ed->v1;
|
||||
med->v2 = ed->v2;
|
||||
if (use_old == false || ed->is_draw) {
|
||||
med->flag = ME_EDGEDRAW;
|
||||
}
|
||||
|
||||
/* order is swapped so extruding this edge as a surface won't flip face normals
|
||||
* with cyclic curves */
|
||||
@ -175,7 +171,6 @@ static void mesh_calc_edges_mdata(const MVert * /*allvert*/,
|
||||
/* last edge */
|
||||
med->v1 = ed->v1;
|
||||
med->v2 = ed->v2;
|
||||
med->flag = ME_EDGEDRAW;
|
||||
|
||||
MEM_freeN(edsort);
|
||||
|
||||
@ -206,7 +201,7 @@ static void mesh_calc_edges_mdata(const MVert * /*allvert*/,
|
||||
*r_totedge = totedge_final;
|
||||
}
|
||||
|
||||
void BKE_mesh_calc_edges_legacy(Mesh *me, const bool use_old)
|
||||
void BKE_mesh_calc_edges_legacy(Mesh *me)
|
||||
{
|
||||
using namespace blender;
|
||||
MEdge *medge;
|
||||
@ -224,7 +219,6 @@ void BKE_mesh_calc_edges_legacy(Mesh *me, const bool use_old)
|
||||
me->totface,
|
||||
loops.size(),
|
||||
polys.size(),
|
||||
use_old,
|
||||
&medge,
|
||||
&totedge);
|
||||
|
||||
|
@ -230,6 +230,7 @@ void BKE_mesh_runtime_clear_geometry(Mesh *mesh)
|
||||
mesh->runtime->loose_edges_cache.tag_dirty();
|
||||
mesh->runtime->looptris_cache.tag_dirty();
|
||||
mesh->runtime->subsurf_face_dot_tags.clear_and_shrink();
|
||||
mesh->runtime->subsurf_optimal_display_edges.clear_and_shrink();
|
||||
if (mesh->runtime->shrinkwrap_data) {
|
||||
BKE_shrinkwrap_boundary_data_free(mesh->runtime->shrinkwrap_data);
|
||||
}
|
||||
@ -245,6 +246,7 @@ void BKE_mesh_tag_edges_split(struct Mesh *mesh)
|
||||
free_subdiv_ccg(*mesh->runtime);
|
||||
mesh->runtime->loose_edges_cache.tag_dirty();
|
||||
mesh->runtime->subsurf_face_dot_tags.clear_and_shrink();
|
||||
mesh->runtime->subsurf_optimal_display_edges.clear_and_shrink();
|
||||
if (mesh->runtime->shrinkwrap_data) {
|
||||
BKE_shrinkwrap_boundary_data_free(mesh->runtime->shrinkwrap_data);
|
||||
}
|
||||
|
@ -1356,8 +1356,6 @@ void BKE_mesh_calc_edges_tessface(Mesh *mesh)
|
||||
for (int i = 0; BLI_edgesetIterator_isDone(ehi) == false;
|
||||
BLI_edgesetIterator_step(ehi), i++, med++, index++) {
|
||||
BLI_edgesetIterator_getKey(ehi, &med->v1, &med->v2);
|
||||
|
||||
med->flag = ME_EDGEDRAW;
|
||||
*index = ORIGINDEX_NONE;
|
||||
}
|
||||
BLI_edgesetIterator_free(ehi);
|
||||
|
@ -536,6 +536,10 @@ static bool subdiv_mesh_topology_info(const SubdivForeachContext *foreach_contex
|
||||
subdiv_mesh_prepare_accumulator(subdiv_context, num_vertices);
|
||||
subdiv_context->subdiv_mesh->runtime->subsurf_face_dot_tags.clear();
|
||||
subdiv_context->subdiv_mesh->runtime->subsurf_face_dot_tags.resize(num_vertices);
|
||||
if (subdiv_context->settings->use_optimal_display) {
|
||||
subdiv_context->subdiv_mesh->runtime->subsurf_optimal_display_edges.clear();
|
||||
subdiv_context->subdiv_mesh->runtime->subsurf_optimal_display_edges.resize(num_edges);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -784,15 +788,10 @@ static void subdiv_mesh_vertex_inner(const SubdivForeachContext *foreach_context
|
||||
* \{ */
|
||||
|
||||
static void subdiv_copy_edge_data(SubdivMeshContext *ctx,
|
||||
MEdge *subdiv_edge,
|
||||
const int subdiv_edge_index,
|
||||
const int coarse_edge_index)
|
||||
{
|
||||
const int subdiv_edge_index = subdiv_edge - ctx->subdiv_edges;
|
||||
if (coarse_edge_index == ORIGINDEX_NONE) {
|
||||
subdiv_edge->flag = 0;
|
||||
if (!ctx->settings->use_optimal_display) {
|
||||
subdiv_edge->flag |= ME_EDGEDRAW;
|
||||
}
|
||||
if (ctx->edge_origindex != nullptr) {
|
||||
ctx->edge_origindex[subdiv_edge_index] = ORIGINDEX_NONE;
|
||||
}
|
||||
@ -800,7 +799,9 @@ static void subdiv_copy_edge_data(SubdivMeshContext *ctx,
|
||||
}
|
||||
CustomData_copy_data(
|
||||
&ctx->coarse_mesh->edata, &ctx->subdiv_mesh->edata, coarse_edge_index, subdiv_edge_index, 1);
|
||||
subdiv_edge->flag |= ME_EDGEDRAW;
|
||||
if (ctx->settings->use_optimal_display) {
|
||||
ctx->subdiv_mesh->runtime->subsurf_optimal_display_edges[subdiv_edge_index].set();
|
||||
}
|
||||
}
|
||||
|
||||
static void subdiv_mesh_edge(const SubdivForeachContext *foreach_context,
|
||||
@ -814,7 +815,7 @@ static void subdiv_mesh_edge(const SubdivForeachContext *foreach_context,
|
||||
SubdivMeshContext *ctx = static_cast<SubdivMeshContext *>(foreach_context->user_data);
|
||||
MEdge *subdiv_medge = ctx->subdiv_edges;
|
||||
MEdge *subdiv_edge = &subdiv_medge[subdiv_edge_index];
|
||||
subdiv_copy_edge_data(ctx, subdiv_edge, coarse_edge_index);
|
||||
subdiv_copy_edge_data(ctx, subdiv_edge_index, coarse_edge_index);
|
||||
subdiv_edge->v1 = subdiv_v1;
|
||||
subdiv_edge->v2 = subdiv_v2;
|
||||
}
|
||||
|
@ -928,7 +928,6 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
|
||||
int edgeSize = ccgSubSurf_getEdgeSize(ss);
|
||||
uint i = 0;
|
||||
short *edgeFlags = ccgdm->edgeFlags;
|
||||
const short ed_interior_flag = ccgdm->drawInteriorEdges ? ME_EDGEDRAW : 0;
|
||||
|
||||
totface = ccgSubSurf_getNumFaces(ss);
|
||||
for (index = 0; index < totface; index++) {
|
||||
@ -940,7 +939,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
|
||||
ccgDM_to_MEdge(&medge[i++],
|
||||
getFaceIndex(ss, f, S, x, 0, edgeSize, gridSize),
|
||||
getFaceIndex(ss, f, S, x + 1, 0, edgeSize, gridSize),
|
||||
ed_interior_flag);
|
||||
0);
|
||||
}
|
||||
|
||||
for (x = 1; x < gridSize - 1; x++) {
|
||||
@ -948,11 +947,11 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
|
||||
ccgDM_to_MEdge(&medge[i++],
|
||||
getFaceIndex(ss, f, S, x, y, edgeSize, gridSize),
|
||||
getFaceIndex(ss, f, S, x, y + 1, edgeSize, gridSize),
|
||||
ed_interior_flag);
|
||||
0);
|
||||
ccgDM_to_MEdge(&medge[i++],
|
||||
getFaceIndex(ss, f, S, y, x, edgeSize, gridSize),
|
||||
getFaceIndex(ss, f, S, y + 1, x, edgeSize, gridSize),
|
||||
ed_interior_flag);
|
||||
0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -967,12 +966,9 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
|
||||
|
||||
if (edgeFlags) {
|
||||
if (edgeIdx != -1) {
|
||||
ed_flag |= ((edgeFlags[index] & ME_SEAM) | ME_EDGEDRAW);
|
||||
ed_flag |= (edgeFlags[index] & ME_SEAM);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ed_flag |= ME_EDGEDRAW;
|
||||
}
|
||||
|
||||
for (x = 0; x < edgeSize - 1; x++) {
|
||||
ccgDM_to_MEdge(&medge[i++],
|
||||
|
@ -3779,15 +3779,6 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 305, 2)) {
|
||||
LISTBASE_FOREACH (MovieClip *, clip, &bmain->movieclips) {
|
||||
MovieTracking *tracking = &clip->tracking;
|
||||
|
@ -1467,7 +1467,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
||||
|
||||
for (me = bmain->meshes.first; me; me = me->id.next) {
|
||||
if (!me->medge) {
|
||||
BKE_mesh_calc_edges_legacy(me, true); /* true = use #MFace.edcode. */
|
||||
BKE_mesh_calc_edges_legacy(me);
|
||||
}
|
||||
else {
|
||||
BKE_mesh_strip_loose_faces(me);
|
||||
|
@ -113,7 +113,7 @@ using blender::StringRef;
|
||||
|
||||
static char bm_edge_flag_from_mflag(const short mflag)
|
||||
{
|
||||
return ((mflag & ME_SEAM) ? BM_ELEM_SEAM : 0) | ((mflag & ME_EDGEDRAW) ? BM_ELEM_DRAW : 0);
|
||||
return ((mflag & ME_SEAM) ? BM_ELEM_SEAM : 0) | BM_ELEM_DRAW;
|
||||
}
|
||||
static char bm_face_flag_from_mflag(const char mflag)
|
||||
{
|
||||
@ -124,7 +124,7 @@ static short bm_edge_flag_to_mflag(const BMEdge *e)
|
||||
{
|
||||
const char hflag = e->head.hflag;
|
||||
|
||||
return ((hflag & BM_ELEM_SEAM) ? ME_SEAM : 0) | ((hflag & BM_ELEM_DRAW) ? ME_EDGEDRAW : 0);
|
||||
return (hflag & BM_ELEM_SEAM) ? ME_SEAM : 0;
|
||||
Jeroen Bakker
commented
Outer level of () can be removed. Outer level of () can be removed.
|
||||
}
|
||||
static char bm_face_flag_to_mflag(const BMFace *f)
|
||||
{
|
||||
@ -1420,15 +1420,6 @@ static void bm_to_mesh_edges(const BMesh &bm,
|
||||
dst_edge.v1 = BM_elem_index_get(src_edge.v1);
|
||||
dst_edge.v2 = BM_elem_index_get(src_edge.v2);
|
||||
dst_edge.flag = bm_edge_flag_to_mflag(&src_edge);
|
||||
|
||||
/* Handle this differently to editmode switching; only enable draw for single user
|
||||
* edges rather than calculating angle. */
|
||||
if ((dst_edge.flag & ME_EDGEDRAW) == 0) {
|
||||
if (src_edge.l && src_edge.l == src_edge.l->radial_next) {
|
||||
dst_edge.flag |= ME_EDGEDRAW;
|
||||
}
|
||||
}
|
||||
|
||||
CustomData_from_bmesh_block(&bm.edata, &mesh.edata, src_edge.head.data, edge_i);
|
||||
}
|
||||
if (!select_edge.is_empty()) {
|
||||
|
@ -82,7 +82,6 @@ void BM_mesh_bm_to_me(struct Main *bmain,
|
||||
* - Ignore shape-keys.
|
||||
* - Ignore vertex-parents.
|
||||
* - Ignore selection history.
|
||||
* - Uses simpler method to calculate #ME_EDGEDRAW
|
||||
* - Uses #CD_MASK_DERIVEDMESH instead of #CD_MASK_MESH.
|
||||
*
|
||||
* \note Was `cddm_from_bmesh_ex` in 2.7x, removed `MFace` support.
|
||||
|
@ -60,15 +60,8 @@ static void extract_edge_fac_init(const MeshRenderData *mr,
|
||||
|
||||
if (mr->extract_type == MR_EXTRACT_MESH) {
|
||||
data->edge_loop_count = MEM_cnew_array<uint8_t>(mr->edge_len, __func__);
|
||||
|
||||
/* HACK(@fclem): Detecting the need for edge render.
|
||||
* We could have a flag in the mesh instead or check the modifier stack. */
|
||||
const MEdge *med = mr->medge;
|
||||
for (int e_index = 0; e_index < mr->edge_len; e_index++, med++) {
|
||||
if ((med->flag & ME_EDGEDRAW) == 0) {
|
||||
data->use_edge_render = true;
|
||||
break;
|
||||
}
|
||||
if (!mr->me->runtime->subsurf_optimal_display_edges.is_empty()) {
|
||||
data->use_edge_render = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -109,6 +102,7 @@ static void extract_edge_fac_iter_poly_mesh(const MeshRenderData *mr,
|
||||
void *_data)
|
||||
{
|
||||
MeshExtract_EdgeFac_Data *data = static_cast<MeshExtract_EdgeFac_Data *>(_data);
|
||||
const BitVector<> &optimal_display_edges = mr->me->runtime->subsurf_optimal_display_edges;
|
||||
|
||||
const MLoop *mloop = mr->mloop;
|
||||
const int ml_index_end = mp->loopstart + mp->totloop;
|
||||
@ -116,8 +110,7 @@ static void extract_edge_fac_iter_poly_mesh(const MeshRenderData *mr,
|
||||
const MLoop *ml = &mloop[ml_index];
|
||||
|
||||
if (data->use_edge_render) {
|
||||
const MEdge *med = &mr->medge[ml->e];
|
||||
data->vbo_data[ml_index] = (med->flag & ME_EDGEDRAW) ? 255 : 0;
|
||||
data->vbo_data[ml_index] = optimal_display_edges[ml->e] ? 255 : 0;
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -1260,11 +1260,6 @@ static void mesh_add_edges(Mesh *mesh, int len)
|
||||
|
||||
mesh->totedge = totedge;
|
||||
|
||||
MutableSpan<MEdge> edges = mesh->edges_for_write();
|
||||
for (MEdge &edge : edges.take_back(len)) {
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
|
||||
bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> select_edge = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_edge", ATTR_DOMAIN_EDGE);
|
||||
|
@ -3154,8 +3154,6 @@ static int object_convert_exec(bContext *C, wmOperator *op)
|
||||
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_MESH);
|
||||
me_eval = BKE_mesh_copy_for_eval(me_eval, false);
|
||||
/* Full (edge-angle based) draw calculation should ideally be performed. */
|
||||
BKE_mesh_edges_set_draw_render(me_eval);
|
||||
BKE_object_material_from_eval_data(bmain, newob, &me_eval->id);
|
||||
Mesh *new_mesh = (Mesh *)newob->data;
|
||||
BKE_mesh_nomain_to_mesh(me_eval, new_mesh, newob);
|
||||
|
@ -675,7 +675,6 @@ bool ED_object_modifier_convert_psys_to_mesh(ReportList * /*reports*/,
|
||||
if (k) {
|
||||
medge->v1 = cvert - 1;
|
||||
medge->v2 = cvert;
|
||||
medge->flag = ME_EDGEDRAW;
|
||||
medge++;
|
||||
}
|
||||
else {
|
||||
@ -694,7 +693,6 @@ bool ED_object_modifier_convert_psys_to_mesh(ReportList * /*reports*/,
|
||||
if (k) {
|
||||
medge->v1 = cvert - 1;
|
||||
medge->v2 = cvert;
|
||||
medge->flag = ME_EDGEDRAW;
|
||||
medge++;
|
||||
}
|
||||
else {
|
||||
|
@ -562,15 +562,6 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len)
|
||||
|
||||
CustomData_free(&mesh->edata, mesh->totedge);
|
||||
mesh->edata = edata;
|
||||
|
||||
MutableSpan<MEdge> edges = mesh->edges_for_write();
|
||||
|
||||
/* set default flags */
|
||||
medge = &edges[mesh->totedge];
|
||||
for (int i = 0; i < len; i++, medge++) {
|
||||
medge->flag = ME_EDGEDRAW;
|
||||
}
|
||||
|
||||
mesh->totedge = totedge;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@ typedef struct MEdge {
|
||||
enum {
|
||||
/** Deprecated selection status. Now stored in ".select_edge" attribute. */
|
||||
/* SELECT = (1 << 0), */
|
||||
ME_EDGEDRAW = (1 << 1),
|
||||
ME_SEAM = (1 << 2),
|
||||
/** Deprecated hide status. Now stored in ".hide_edge" attribute. */
|
||||
/* ME_HIDE = (1 << 4), */
|
||||
|
@ -588,7 +588,7 @@ static void add_interpolated_polys_to_new_mesh(const Mesh &src_mesh,
|
||||
cut_edge.v1 = dst_loops[mp_dst.loopstart].v;
|
||||
cut_edge.v2 = cut_dst_loop.v;
|
||||
BLI_assert(cut_edge.v1 != cut_edge.v2);
|
||||
cut_edge.flag = ME_EDGEDRAW;
|
||||
cut_edge.flag = 0;
|
||||
edge_index++;
|
||||
|
||||
/* Only handle one of the cuts per iteration. */
|
||||
|
@ -786,7 +786,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
/* add the new edge */
|
||||
med_new->v1 = varray_stride + j;
|
||||
med_new->v2 = med_new->v1 - totvert;
|
||||
med_new->flag = ME_EDGEDRAW;
|
||||
med_new->flag = 0;
|
||||
med_new++;
|
||||
}
|
||||
}
|
||||
@ -804,7 +804,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
for (i = 0; i < totvert; i++) {
|
||||
med_new->v1 = i;
|
||||
med_new->v2 = varray_stride + i;
|
||||
med_new->flag = ME_EDGEDRAW;
|
||||
med_new->flag = 0;
|
||||
med_new++;
|
||||
}
|
||||
}
|
||||
|
@ -1054,7 +1054,6 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
|
||||
for (i = 0; i < rimVerts; i++, ed++) {
|
||||
ed->v1 = new_vert_arr[i];
|
||||
ed->v2 = (do_shell ? new_vert_arr[i] : i) + verts_num;
|
||||
ed->flag |= ME_EDGEDRAW;
|
||||
|
||||
if (orig_ed) {
|
||||
*orig_ed = ORIGINDEX_NONE;
|
||||
|
@ -2073,7 +2073,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
|
||||
BLI_assert(v2 != MOD_SOLIDIFY_EMPTY_TAG);
|
||||
medge[insert].v1 = v1;
|
||||
medge[insert].v2 = v2;
|
||||
medge[insert].flag = orig_medge[(*l)->old_edge].flag | ME_EDGEDRAW;
|
||||
medge[insert].flag = orig_medge[(*l)->old_edge].flag;
|
||||
if (result_edge_crease) {
|
||||
result_edge_crease[insert] = orig_edge_crease ? orig_edge_crease[(*l)->old_edge] :
|
||||
0.0f;
|
||||
@ -2236,7 +2236,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
|
||||
}
|
||||
medge[edge_index].v1 = last_g->new_vert;
|
||||
medge[edge_index].v2 = g->new_vert;
|
||||
medge[edge_index].flag = ME_EDGEDRAW | ((last_flag | flag) & ME_SEAM);
|
||||
medge[edge_index].flag = ((last_flag | flag) & ME_SEAM);
|
||||
if (result_edge_crease) {
|
||||
result_edge_crease[edge_index] = max_ff(mv_crease,
|
||||
min_ff(last_max_crease, max_crease));
|
||||
@ -2269,7 +2269,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
|
||||
last_g->open_face_edge = edge_index;
|
||||
medge[edge_index].v1 = last_g->new_vert;
|
||||
medge[edge_index].v2 = first_g->new_vert;
|
||||
medge[edge_index].flag = ME_EDGEDRAW | ((last_flag | first_flag) & ME_SEAM);
|
||||
medge[edge_index].flag = ((last_flag | first_flag) & ME_SEAM);
|
||||
if (result_edge_crease) {
|
||||
result_edge_crease[edge_index] = max_ff(mv_crease,
|
||||
min_ff(last_max_crease, first_max_crease));
|
||||
|
@ -43,8 +43,6 @@ static Mesh *triangulate_mesh(Mesh *mesh,
|
||||
{
|
||||
Mesh *result;
|
||||
BMesh *bm;
|
||||
int edges_num, i;
|
||||
MEdge *me;
|
||||
CustomData_MeshMasks cd_mask_extra{};
|
||||
cd_mask_extra.vmask = CD_MASK_ORIGINDEX;
|
||||
cd_mask_extra.emask = CD_MASK_ORIGINDEX;
|
||||
@ -85,14 +83,6 @@ static Mesh *triangulate_mesh(Mesh *mesh,
|
||||
CustomData_set_layer_flag(&result->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
|
||||
}
|
||||
|
||||
edges_num = result->totedge;
|
||||
me = BKE_mesh_edges_for_write(result);
|
||||
|
||||
/* force drawing of all edges (seems to be omitted in CDDM_from_bmesh) */
|
||||
for (i = 0; i < edges_num; i++, me++) {
|
||||
me->flag |= ME_EDGEDRAW;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,6 @@ static Mesh *hull_from_bullet(const Mesh *mesh, Span<float3> coords)
|
||||
MEdge &edge = edges[edge_index];
|
||||
edge.v1 = v_from;
|
||||
edge.v2 = v_to;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
|
||||
/* Write edge index into both loops that have it. */
|
||||
int reverse_index = plConvexHullGetReversedLoopIndex(hull, i);
|
||||
@ -98,7 +97,6 @@ static Mesh *hull_from_bullet(const Mesh *mesh, Span<float3> coords)
|
||||
MEdge &edge = edges[0];
|
||||
edge.v1 = 0;
|
||||
edge.v2 = 1;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
edge_index++;
|
||||
}
|
||||
BLI_assert(edge_index == edges_num);
|
||||
|
@ -91,7 +91,6 @@ static Mesh *cdt_to_mesh(const meshintersect::CDT_result<double> &result)
|
||||
for (const int i : IndexRange(result.edge.size())) {
|
||||
edges[i].v1 = result.edge[i].first;
|
||||
edges[i].v2 = result.edge[i].second;
|
||||
edges[i].flag = ME_EDGEDRAW;
|
||||
}
|
||||
int i_loop = 0;
|
||||
for (const int i : IndexRange(result.face.size())) {
|
||||
|
@ -151,7 +151,7 @@ static MEdge new_edge(const int v1, const int v2)
|
||||
MEdge edge;
|
||||
edge.v1 = v1;
|
||||
edge.v2 = v2;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
edge.flag = 0;
|
||||
return edge;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,6 @@ static Mesh *create_circle_mesh(const float radius,
|
||||
MEdge &edge = edges[i];
|
||||
edge.v1 = i;
|
||||
edge.v2 = (i + 1) % verts_num;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
|
||||
/* Create triangle fan edges. */
|
||||
@ -138,7 +137,6 @@ static Mesh *create_circle_mesh(const float radius,
|
||||
MEdge &edge = edges[verts_num + i];
|
||||
edge.v1 = verts_num;
|
||||
edge.v2 = i;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,6 @@ static void calculate_cone_edges(const ConeConfig &config, MutableSpan<MEdge> ed
|
||||
MEdge &edge = edges[edge_index++];
|
||||
edge.v1 = config.first_vert;
|
||||
edge.v2 = config.first_ring_verts_start + i;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
}
|
||||
|
||||
@ -342,7 +341,6 @@ static void calculate_cone_edges(const ConeConfig &config, MutableSpan<MEdge> ed
|
||||
MEdge &edge = edges[edge_index++];
|
||||
edge.v1 = this_ring_vert_start + j;
|
||||
edge.v2 = this_ring_vert_start + ((j + 1) % config.circle_segments);
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
if (i == config.tot_edge_rings - 1) {
|
||||
/* There is one fewer ring of connecting edges. */
|
||||
@ -353,7 +351,6 @@ static void calculate_cone_edges(const ConeConfig &config, MutableSpan<MEdge> ed
|
||||
MEdge &edge = edges[edge_index++];
|
||||
edge.v1 = this_ring_vert_start + j;
|
||||
edge.v2 = next_ring_vert_start + j;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,7 +360,6 @@ static void calculate_cone_edges(const ConeConfig &config, MutableSpan<MEdge> ed
|
||||
MEdge &edge = edges[edge_index++];
|
||||
edge.v1 = config.last_ring_verts_start + i;
|
||||
edge.v2 = config.last_vert;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,6 @@ Mesh *create_grid_mesh(const int verts_x,
|
||||
MEdge &edge = edges[y_edge_offset + y];
|
||||
edge.v1 = vert_index;
|
||||
edge.v2 = vert_index + 1;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -109,7 +108,6 @@ Mesh *create_grid_mesh(const int verts_x,
|
||||
MEdge &edge = edges[x_edge_offset + x];
|
||||
edge.v1 = vert_index;
|
||||
edge.v2 = vert_index + verts_y;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -117,7 +117,6 @@ BLI_NOINLINE static void calculate_sphere_edge_indices(MutableSpan<MEdge> edges,
|
||||
MEdge &edge = edges[edge_index++];
|
||||
edge.v1 = 0;
|
||||
edge.v2 = first_vert_ring_index_start + segment;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
|
||||
int ring_vert_index_start = 1;
|
||||
@ -129,7 +128,6 @@ BLI_NOINLINE static void calculate_sphere_edge_indices(MutableSpan<MEdge> edges,
|
||||
MEdge &edge = edges[edge_index++];
|
||||
edge.v1 = ring_vert_index_start + segment;
|
||||
edge.v2 = ring_vert_index_start + ((segment + 1) % segments);
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
|
||||
/* Add the edges connecting to the next ring. */
|
||||
@ -138,7 +136,6 @@ BLI_NOINLINE static void calculate_sphere_edge_indices(MutableSpan<MEdge> edges,
|
||||
MEdge &edge = edges[edge_index++];
|
||||
edge.v1 = ring_vert_index_start + segment;
|
||||
edge.v2 = next_ring_vert_index_start + segment;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
}
|
||||
ring_vert_index_start += segments;
|
||||
@ -151,7 +148,6 @@ BLI_NOINLINE static void calculate_sphere_edge_indices(MutableSpan<MEdge> edges,
|
||||
MEdge &edge = edges[edge_index++];
|
||||
edge.v1 = last_vert_index;
|
||||
edge.v2 = last_vert_ring_start + segment;
|
||||
edge.flag = ME_EDGEDRAW;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user
Just pattern checking. In other places you remove the assignment of flag, but here it is explicitly unset.
Yes, here I'm not totally sure that the new edges are initialized so it should be cleared to be sure.