Texture Paint: fix wireframe and hiding not working with subsurf.

The editflag field is only valid in the original mesh instance.
This commit is contained in:
Alexander Gavrilov 2018-12-01 13:20:18 +03:00
parent bfcd25b313
commit 3bd057d472
3 changed files with 8 additions and 5 deletions

View File

@ -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:

View File

@ -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) {

View File

@ -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) {