diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-06-13 20:56:25 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-06-13 21:14:19 +0300 |
commit | 45145e746d0b414b0d9d2db6182e26f226950efa (patch) | |
tree | 9bf93a23db1e4fe7817b4fb248b38c695c5315f6 | |
parent | 15dd2899923093db6c070b4520e0678affe49d09 (diff) |
Fix part of T63595: generated texture coordinates don't stick to deforming mesh
Always compute CD_ORCO undeformed coordinates now for rendering, same as before.
There is still a refresh issue to be fixed, when switching from solid to textured
mode in the viewport.
Computing such undeformed coordinates can be expensive and is not actually needed
if the mesh is only using e.g. UV maps. This was the same in 2.79, at least now we
are skipping the computation when there are no deforming mdifiers on the mesh.
4 files changed, 8 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 84e46f1ef70..6a6adb82225 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -168,13 +168,16 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o CustomData_MeshMasks cddata_masks = scene->customdata_mask; CustomData_MeshMasks_update(&cddata_masks, &CD_MASK_BAREMESH); + if (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER) { + /* Make sure Freestyle edge/face marks appear in DM for render (see T40315). */ #ifdef WITH_FREESTYLE - /* make sure Freestyle edge/face marks appear in DM for render (see T40315) */ - if (DEG_get_mode(depsgraph) != DAG_EVAL_VIEWPORT) { cddata_masks.emask |= CD_MASK_FREESTYLE_EDGE; cddata_masks.pmask |= CD_MASK_FREESTYLE_FACE; - } #endif + /* Always compute UVs, vertex colors as orcos for render. */ + cddata_masks.lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL; + cddata_masks.vmask |= CD_MASK_ORCO; + } if (em) { makeDerivedMesh(depsgraph, scene, ob, em, &cddata_masks); /* was CD_MASK_BAREMESH */ } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index cc76c151a29..38e8d285c77 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -50,14 +50,6 @@ #include "view3d_intern.h" /* bad level include */ -int view3d_effective_drawtype(const struct View3D *v3d) -{ - if (v3d->shading.type == OB_RENDER) { - return v3d->shading.prev_type; - } - return v3d->shading.type; -} - /* OpenGL Circle Drawing - Tables for Optimized Drawing Speed */ /* 32 values of sin function (still same result!) */ #define CIRCLE_RESOL 32 diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 755852a2e18..dd97a023825 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -771,14 +771,9 @@ void ED_view3d_datamask(const bContext *C, const View3D *v3d, CustomData_MeshMasks *r_cddata_masks) { - const int drawtype = view3d_effective_drawtype(v3d); - - if (ELEM(drawtype, OB_TEXTURE, OB_MATERIAL)) { + if (ELEM(v3d->shading.type, OB_TEXTURE, OB_MATERIAL, OB_RENDER)) { r_cddata_masks->lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL; - - if (drawtype == OB_MATERIAL) { - r_cddata_masks->vmask |= CD_MASK_ORCO; - } + r_cddata_masks->vmask |= CD_MASK_ORCO; } if ((CTX_data_mode_enum(C) == CTX_MODE_EDIT_MESH) && diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index e499672acc1..3a6825aacb4 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -126,9 +126,6 @@ void VIEW3D_OT_fly(struct wmOperatorType *ot); /* view3d_walk.c */ void VIEW3D_OT_walk(struct wmOperatorType *ot); -/* drawobject.c */ -int view3d_effective_drawtype(const struct View3D *v3d); - /* view3d_draw.c */ void view3d_main_region_draw(const struct bContext *C, struct ARegion *ar); void view3d_draw_region_info(const struct bContext *C, struct ARegion *ar); |