Fix T62449: Subsurf+hidden faces

When using subsurf (and other modifiers) the edit flags are not
propagated correctly. Currently we assume to read the edit flags
from the original object which is kind off hinding the real issue.

Modifiers use `mesh_new_nomain_from_template_ex` to create a copy
from an existing mesh. this method is only used by modifiers. So
by placing this we will make sure that editmesh is propagated.

Reviewed By: fclem, sergey

Maniphest Tasks: T62449

Differential Revision: https://developer.blender.org/D4666
This commit is contained in:
Jeroen Bakker
2019-04-10 09:49:02 +02:00
parent 1a12c9edab
commit a1a8578d5c
3 changed files with 4 additions and 2 deletions

View File

@@ -634,6 +634,7 @@ static Mesh *mesh_new_nomain_from_template_ex(
me_dst->totpoly = polys_len;
me_dst->cd_flag = me_src->cd_flag;
me_dst->editflag = me_src->editflag;
CustomData_copy(&me_src->vdata, &me_dst->vdata, mask.vmask, CD_CALLOC, verts_len);
CustomData_copy(&me_src->edata, &me_dst->edata, mask.emask, CD_CALLOC, edges_len);

View File

@@ -3808,10 +3808,11 @@ void drw_batch_cache_generate_requested(Object *ob)
const enum eContextObjectMode mode = CTX_data_mode_enum_ex(
draw_ctx->object_edit, draw_ctx->obact, draw_ctx->object_mode);
const bool is_paint_mode = ELEM(mode, CTX_MODE_PAINT_TEXTURE, CTX_MODE_PAINT_VERTEX, CTX_MODE_PAINT_WEIGHT);
const bool use_hide = (
(ob->type == OB_MESH) &&
((is_paint_mode && (ob == draw_ctx->obact) &&
(BKE_paint_select_face_test(ob) || BKE_paint_select_vert_test(ob))) ||
DRW_object_use_hide_faces(ob)) ||
((mode == CTX_MODE_EDIT_MESH) && BKE_object_is_in_editmode(ob))));
struct Mesh *mesh_eval = ob->runtime.mesh_eval;

View File

@@ -200,7 +200,7 @@ bool DRW_object_is_flat_normal(const Object *ob)
bool DRW_object_use_hide_faces(const struct Object *ob)
{
if (ob->type == OB_MESH) {
const Mesh *me = DEG_get_original_object((Object *)ob)->data;
const Mesh *me = ob->data;
switch (ob->mode) {
case OB_MODE_TEXTURE_PAINT: