Fix T81997: Subsurf Optimal Display sticks after object conversion
When using Optimal Display, some edges are not flagged `ME_EDGEDRAW` | `ME_EDGERENDER`. When the modifier is applied through the UI in the modifier stack this is not an issue because the `modifyMesh` callback is run with `MOD_APPLY_TO_BASE_MESH` (this will effectively turn of Optimal Display). When converting to mesh though, this will just get an evaluated mesh (where the edge flags are still the same as with the subdivision modifier). Now ensure every edge is flagged to draw after conversion. Maniphest Tasks: T81997 Differential Revision: https://developer.blender.org/D9331
This commit is contained in:
parent
1019df81ff
commit
42980abf8d
Notes:
blender-bot
2023-02-14 08:45:09 +01:00
Referenced by issue #82854, Bevel modifier custom profile handle type crash Referenced by issue #81997, Wireframe is not Updated When Converting to Mesh
|
@ -188,6 +188,9 @@ void BKE_mesh_material_index_clear(struct Mesh *me);
|
|||
void BKE_mesh_material_remap(struct Mesh *me, const unsigned int *remap, unsigned int remap_len);
|
||||
void BKE_mesh_smooth_flag_set(struct Mesh *me, const bool use_smooth);
|
||||
|
||||
/* Needed after converting a mesh with subsurf optimal display to mesh. */
|
||||
void BKE_mesh_edges_set_draw_render(struct Mesh *me);
|
||||
|
||||
const char *BKE_mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh);
|
||||
|
||||
struct BoundBox *BKE_mesh_boundbox_get(struct Object *ob);
|
||||
|
|
|
@ -980,6 +980,14 @@ void BKE_mesh_from_pointcloud(PointCloud *pointcloud, Mesh *me)
|
|||
CustomData_free_layer(&me->vdata, CD_PROP_FLOAT3, me->totvert, layer_idx);
|
||||
}
|
||||
|
||||
void BKE_mesh_edges_set_draw_render(Mesh *mesh)
|
||||
{
|
||||
MEdge *med = mesh->medge;
|
||||
for (int i = 0; i < mesh->totedge; i++, med++) {
|
||||
med->flag |= ME_EDGEDRAW | ME_EDGERENDER;
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_pointcloud_to_mesh(Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob)
|
||||
{
|
||||
BLI_assert(ob->type == OB_POINTCLOUD);
|
||||
|
|
|
@ -2686,6 +2686,8 @@ 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_mesh_nomain_to_mesh(me_eval, newob->data, newob, &CD_MASK_MESH, true);
|
||||
BKE_object_free_modifiers(newob, 0); /* after derivedmesh calls! */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue