diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-01 13:20:18 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-01 13:20:18 +0300 |
commit | 3bd057d47284d727dadb6fd826bf55143a00ad97 (patch) | |
tree | 81b2ec88c6b1dabf7a6482d19743c2071c6f0441 | |
parent | bfcd25b313998d5d62e927f80a837555c5113de7 (diff) |
Texture Paint: fix wireframe and hiding not working with subsurf.
The editflag field is only valid in the original mesh instance.
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 2 | ||||
-rw-r--r-- | source/blender/draw/modes/paint_texture_mode.c | 5 | ||||
-rw-r--r-- | source/blender/draw/modes/paint_weight_mode.c | 6 |
3 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 9d0fb690b5a..ba61f376ce9 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -192,7 +192,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 = ob->data; + const Mesh *me = DEG_get_original_object((Object*)ob)->data; switch (ob->mode) { case OB_MODE_TEXTURE_PAINT: diff --git a/source/blender/draw/modes/paint_texture_mode.c b/source/blender/draw/modes/paint_texture_mode.c index 10b42c76b14..3be44a425f7 100644 --- a/source/blender/draw/modes/paint_texture_mode.c +++ b/source/blender/draw/modes/paint_texture_mode.c @@ -38,6 +38,8 @@ #include "DNA_mesh_types.h" +#include "DEG_depsgraph_query.h" + extern char datatoc_common_globals_lib_glsl[]; extern char datatoc_paint_texture_vert_glsl[]; extern char datatoc_paint_texture_frag_glsl[]; @@ -288,10 +290,11 @@ static void PAINT_TEXTURE_cache_populate(void *vedata, Object *ob) if ((ob->type == OB_MESH) && (draw_ctx->obact == ob)) { /* Get geometry cache */ const Mesh *me = ob->data; + const Mesh *me_orig = DEG_get_original_object(ob)->data; Scene *scene = draw_ctx->scene; const bool use_surface = draw_ctx->v3d->overlay.texture_paint_mode_opacity != 0.0; //DRW_object_is_mode_shade(ob) == true; const bool use_material_slots = (scene->toolsettings->imapaint.mode == IMAGEPAINT_MODE_MATERIAL); - const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; + const bool use_face_sel = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; bool ok = false; if (use_surface) { diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c index 9060a97f412..935c236410e 100644 --- a/source/blender/draw/modes/paint_weight_mode.c +++ b/source/blender/draw/modes/paint_weight_mode.c @@ -184,11 +184,11 @@ static void PAINT_WEIGHT_cache_populate(void *vedata, Object *ob) const View3D *v3d = draw_ctx->v3d; if ((ob->type == OB_MESH) && (ob == draw_ctx->obact)) { - const Mesh *me = ob->data; + const Mesh *me_orig = DEG_get_original_object(ob)->data; const bool use_wire = (v3d->overlay.paint_flag & V3D_OVERLAY_PAINT_WIRE) != 0; const bool use_surface = v3d->overlay.weight_paint_mode_opacity != 0.0f; - const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; - const bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0; + const bool use_face_sel = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; + const bool use_vert_sel = (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) != 0; struct GPUBatch *geom; if (use_surface) { |