Merge branch 'blender-v2.82-release'

This commit is contained in:
Campbell Barton 2020-02-04 19:02:03 +11:00
commit 77702245b1
6 changed files with 39 additions and 11 deletions

View File

@ -179,7 +179,7 @@ BLI_INLINE OVERLAY_DupliData *OVERLAY_duplidata_get(Object *ob, void *vedata, bo
static bool overlay_object_is_edit_mode(const OVERLAY_PrivateData *pd, const Object *ob)
{
if ((ob->mode & OB_MODE_EDIT) && BKE_object_is_in_editmode(ob)) {
if (DRW_object_is_in_edit_mode(ob)) {
/* Also check for context mode as the object mode is not 100% reliable. (see T72490) */
switch (ob->type) {
case OB_MESH:

View File

@ -154,7 +154,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
}
}
const bool is_edit_mode = BKE_object_is_in_editmode(ob);
const bool is_edit_mode = DRW_object_is_in_edit_mode(ob);
bool has_edit_mesh_cage = false;
if (is_mesh && is_edit_mode) {
/* TODO: Should be its own function. */

View File

@ -617,6 +617,7 @@ void **DRW_duplidata_get(void *vedata);
/* Settings */
bool DRW_object_is_renderable(const struct Object *ob);
bool DRW_object_is_in_edit_mode(const struct Object *ob);
int DRW_object_visibility_in_active_context(const struct Object *ob);
bool DRW_object_is_flat_normal(const struct Object *ob);
bool DRW_object_use_hide_faces(const struct Object *ob);

View File

@ -3424,7 +3424,7 @@ void drw_batch_cache_generate_requested(Object *ob)
const bool use_hide = ((ob->type == OB_MESH) &&
((is_paint_mode && (ob == draw_ctx->obact) &&
DRW_object_use_hide_faces(ob)) ||
((mode == CTX_MODE_EDIT_MESH) && BKE_object_is_in_editmode(ob))));
((mode == CTX_MODE_EDIT_MESH) && DRW_object_is_in_edit_mode(ob))));
struct Mesh *mesh_eval = ob->runtime.mesh_eval;
switch (ob->type) {

View File

@ -996,13 +996,7 @@ void DRW_mesh_batch_cache_create_requested(
BLI_assert(me->edit_mesh->mesh_eval_final != NULL);
}
const bool is_editmode =
(me->edit_mesh != NULL) &&
(/* Simple case, the object is in edit-mode with an edit-mesh. */
(ob->mode & OB_MODE_EDIT) ||
/* This is needed so linked duplicates show updates while the user edits the mesh.
* While this is not essential, it's useful to see the edit-mode changes everywhere. */
(me->edit_mesh->mesh_eval_final != NULL));
const bool is_editmode = (me->edit_mesh != NULL) && DRW_object_is_in_edit_mode(ob);
DRWBatchFlag batch_requested = cache->batch_requested;
cache->batch_requested = 0;

View File

@ -167,7 +167,8 @@ bool DRW_object_is_renderable(const Object *ob)
BLI_assert((ob->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0);
if (ob->type == OB_MESH) {
if ((ob == DST.draw_ctx.object_edit) || BKE_object_is_in_editmode(ob)) {
if ((ob == DST.draw_ctx.object_edit) || DRW_object_is_in_edit_mode(ob)) {
View3D *v3d = DST.draw_ctx.v3d;
const int mask = (V3D_OVERLAY_EDIT_OCCLUDE_WIRE | V3D_OVERLAY_EDIT_WEIGHT);
@ -180,6 +181,38 @@ bool DRW_object_is_renderable(const Object *ob)
return true;
}
/* Does `ob` needs to be rendered in edit mode.
*
* When using duplicate linked meshes, objects that are not in edit-mode will be drawn as
* it is in edit mode, when another object with the same mesh is in edit mode.
* This will not be the case when one of the objects are influenced by modifiers. */
bool DRW_object_is_in_edit_mode(const Object *ob)
{
if (BKE_object_is_in_editmode(ob)) {
if (ob->type == OB_MESH) {
if ((ob->mode & OB_MODE_EDIT) == 0) {
Mesh *me = (Mesh *)ob->data;
BMEditMesh *embm = me->edit_mesh;
/* Sanity check when rendering in multiple windows. */
if (embm && embm->mesh_eval_final == NULL) {
return false;
}
/* Do not draw ob with edit overlay when edit data is present and is modified. */
if (embm && embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final)) {
return false;
}
/* Check if the object that we are drawing is modified. */
if (!DEG_is_original_id(&me->id)) {
return false;
}
return true;
}
}
return true;
}
return false;
}
/**
* Return whether this object is visible depending if
* we are rendering or drawing in the viewport.