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.
This commit is contained in:
Brecht Van Lommel 2019-06-13 19:56:25 +02:00
parent 15dd289992
commit 45145e746d
4 changed files with 8 additions and 21 deletions

View File

@ -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 */
}

View File

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

View File

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

View File

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