Fix #107411: Non-visible objects in the viewport occlude selection #107449

Closed
Guillermo Venegas wants to merge 1 commits from guishe:local-view-selection into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Contributor

When using edit mode with a mesh, if you have retopology overlay active,
the selection of vertices, edges, or faces is occluded by the other objects.
However, if local view is on or collections with objects are hidden,
non-visible objects can occlude the selection.

This patch discards objects that are not visible in the viewport so they do not
occlude the selection anymore.

When using edit mode with a mesh, if you have retopology overlay active, the selection of vertices, edges, or faces is occluded by the other objects. However, if local view is on or collections with objects are hidden, non-visible objects can occlude the selection. This patch discards objects that are not visible in the viewport so they do not occlude the selection anymore.
Guillermo Venegas force-pushed local-view-selection from a6ef7f443a to 710e4a228a 2023-04-28 18:53:06 +02:00 Compare
Guillermo Venegas changed title from Fix #107411: Selection occlusion in local view to Fix #107411: Selection occlusion in local view view with retopology overlay 2023-04-28 18:53:07 +02:00
Guillermo Venegas changed title from Fix #107411: Selection occlusion in local view view with retopology overlay to Fix #107411: Selection occlusion in local view with retopology overlay 2023-04-28 18:53:15 +02:00
Iliya Katushenock added this to the EEVEE & Viewport project 2023-04-28 19:17:21 +02:00
Iliya Katushenock added the
Interest
Modeling
label 2023-04-28 19:17:25 +02:00
Contributor

I'd do a slightly different check:

if (!BKE_object_is_visible_in_viewport(v3d, ob)) {
    continue;
}

Perhaps before the other checks, to be consistent with other code in the same file.
And then I'd rename this to something like "Objects hidden by local mode or collection occlude selection", because it's not just local mode that's fixed.

I'd do a slightly different check: ```cpp if (!BKE_object_is_visible_in_viewport(v3d, ob)) { continue; } ``` Perhaps before the other checks, to be consistent with other code in the same file. And then I'd rename this to something like "Objects hidden by local mode or collection occlude selection", because it's not just local mode that's fixed.
Guillermo Venegas force-pushed local-view-selection from 710e4a228a to b9f9fc08b4 2023-05-15 18:15:24 +02:00 Compare
Guillermo Venegas force-pushed local-view-selection from b9f9fc08b4 to 44dfb9666e 2023-05-15 18:26:09 +02:00 Compare
Guillermo Venegas changed title from Fix #107411: Selection occlusion in local view with retopology overlay to Fix #107411: Non-visible objects in the viewport affect selection collusion 2023-05-15 18:26:38 +02:00
Guillermo Venegas changed title from Fix #107411: Non-visible objects in the viewport affect selection collusion to Fix #107411: Non-visible objects in the viewport occlude selection 2023-05-15 19:03:06 +02:00

@fclem @Jeroen-Bakker Hey, can you please take a look at this PR? Thanks in advance.

@fclem @Jeroen-Bakker Hey, can you please take a look at this PR? Thanks in advance.
Member

We have two PRs to fix the same issue #107833. Note that this should be solved in the engines and not in the draw manager itself. the draw manager should not have this logic if not needed.

We have two PRs to fix the same issue #107833. Note that this should be solved in the engines and not in the draw manager itself. the draw manager should not have this logic if not needed.
Contributor

This same check is done in 3 other depsgraph iterators in this same file, so I think it makes sense here.
But moving it to the select engine cache populate function is fine too I suppose.
Like so:

static void select_cache_populate(void *vedata, Object *ob)
{
  SELECTID_StorageList *stl = ((SELECTID_Data *)vedata)->stl;
  const DRWContextState *draw_ctx = DRW_context_state_get();

  const bool retopology_occlusion = RETOPOLOGY_ENABLED(draw_ctx->v3d) &&
                                    !XRAY_ENABLED(draw_ctx->v3d);
  if (retopology_occlusion && !DRW_object_is_in_edit_mode(ob)) {
-   if (ob->dt >= OB_SOLID) {
+   if (ob->dt >= OB_SOLID && BKE_object_is_visible_in_viewport(draw_ctx->v3d, ob)) {
      struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_surface(ob->data);
      DRW_shgroup_call_obmat(stl->g_data->shgrp_occlude, geom_faces, ob->object_to_world);
    }
    return;
  }

...
This same check is done in 3 other depsgraph iterators in this same file, so I think it makes sense here. But moving it to the select engine cache populate function is fine too I suppose. Like so: ```diff static void select_cache_populate(void *vedata, Object *ob) { SELECTID_StorageList *stl = ((SELECTID_Data *)vedata)->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); const bool retopology_occlusion = RETOPOLOGY_ENABLED(draw_ctx->v3d) && !XRAY_ENABLED(draw_ctx->v3d); if (retopology_occlusion && !DRW_object_is_in_edit_mode(ob)) { - if (ob->dt >= OB_SOLID) { + if (ob->dt >= OB_SOLID && BKE_object_is_visible_in_viewport(draw_ctx->v3d, ob)) { struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_surface(ob->data); DRW_shgroup_call_obmat(stl->g_data->shgrp_occlude, geom_faces, ob->object_to_world); } return; } ... ```
Guillermo Venegas force-pushed local-view-selection from 44dfb9666e to 93f43b5172 2023-05-16 04:04:17 +02:00 Compare
Guillermo Venegas force-pushed local-view-selection from 93f43b5172 to 75d72daba3 2023-05-16 04:13:18 +02:00 Compare
Member

Ah yes you're right. Sorry about that. Do you mind reverting it to the previous version. Than I can accept it

Ah yes you're right. Sorry about that. Do you mind reverting it to the previous version. Than I can accept it
Guillermo Venegas force-pushed local-view-selection from 75d72daba3 to e7c4544c84 2023-05-16 16:52:58 +02:00 Compare
Guillermo Venegas force-pushed local-view-selection from e7c4544c84 to 0d3914f646 2023-05-16 16:54:05 +02:00 Compare
Contributor

@Jeroen-Bakker He's reverted it like you asked 🙂

@Jeroen-Bakker He's reverted it like you asked 🙂
Jeroen Bakker approved these changes 2023-05-22 08:21:56 +02:00
Member

I manually commited this to blender-v3.6-release branch e83a2386b5

I manually commited this to blender-v3.6-release branch e83a2386b5f6dcdb60b9c57934b5642da37853b1
Jeroen Bakker closed this pull request 2023-05-22 08:28:25 +02:00
Guillermo Venegas deleted branch local-view-selection 2023-05-22 16:55:52 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#107449
No description provided.