Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2020-02-03 10:16:38 +0300
committerJeroen Bakker <jeroen@blender.org>2020-02-04 09:46:15 +0300
commitd09646a40b1928308025d8ceb2c2d505651fc9a4 (patch)
tree0974a71a1b6f049c0f21c9b437d32c60ee8209f3 /source/blender/draw/intern/draw_manager.c
parentfdb68e184714f480c87c13c3c34480e9adfe4620 (diff)
Fix T73095: Edit Mode Overlay Linked Mesh
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. The change reflects more how it was done in Blender 2.79. The current change introduces a draw manager method that checks in detail who is responsible for the drawing (render engine or overlay engine). If the edit mesh is not the original or the object that is drawn doesn't draw the original mesh the object will be drawn by the render engine. Known Limitation of this patch is that the rendering outside edit mode doesn't reflect the latest changes until the user switches between object and edit mode. When there are no modifiers in use, the updating is done immediately. IMO this would be sufficient for blender 2.82, it also fixes parts of T72733. The updating of the surface batches requires more development and is post-poned for now. Reviewed By: fclem, brecht Differential Revision: https://developer.blender.org/D6737
Diffstat (limited to 'source/blender/draw/intern/draw_manager.c')
-rw-r--r--source/blender/draw/intern/draw_manager.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 2fbb0a740cf..7397490d406 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -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.