3D View: Do not recalculate the depth buffer for 'Auto Depth' #113026

Merged
Germano Cavalcante merged 2 commits from mano-wii/blender:zoom_optimize into main 2024-03-07 15:16:50 +01:00

This is a solution to avoid redrawing the depth buffer for each Zoom
with Auto Depth.

The solution is to move the ED_view3d_depth_override function out of
ED_view3d_autodist and only call ED_view3d_depth_override if the
depth buffer is not used by any current engine.

This is a solution to avoid redrawing the depth buffer for each Zoom with `Auto Depth`. The solution is to move the `ED_view3d_depth_override` function out of `ED_view3d_autodist` and only call `ED_view3d_depth_override` if the depth buffer is not used by any current engine.
Germano Cavalcante added 1 commit 2023-09-28 18:32:00 +02:00
d33eb78de3 3D View: Do not recalculate the depth buffer for 'Auto Depth'
This is a solution to avoid redrawing the depth buffer for each Zoom
with `Auto Depth`.

The solution is to move the `ED_view3d_depth_override` function out of
`ED_view3d_autodist`.

`ED_view3d_depth_override` is now only called for navigation operations
if it does not meet the following condition:

```
    bool has_depth_buffer = !(v3d->flag2 & V3D_HIDE_OVERLAYS) ||
                            ELEM(v3d->shading.type, OB_SOLID, OB_MATERIAL) ||
                            XRAY_FLAG_ENABLED(v3d) ||
                            v3d->shading.type == OB_RENDER &&
                                (strcmp(DEG_get_evaluated_scene(depsgraph)->r.engine,
                                        RE_engine_id_BLENDER_EEVEE) == 0 ||
                                 strcmp(DEG_get_evaluated_scene(depsgraph)->r.engine,
                                        RE_engine_id_BLENDER_WORKBENCH) == 0);
```
Germano Cavalcante requested review from Campbell Barton 2023-09-28 18:32:13 +02:00
Germano Cavalcante requested review from Clément Foucault 2023-09-28 18:32:14 +02:00
Germano Cavalcante added 1 commit 2023-09-29 14:12:39 +02:00
Clément Foucault requested changes 2023-09-29 20:55:48 +02:00
Dismissed
@ -223,3 +227,2 @@
const bool is_set = ED_view3d_autodist(
depsgraph, region, v3d, event->mval, r_pivot, true, fallback_depth_pt);
bool has_depth_buffer = !(v3d->flag2 & V3D_HIDE_OVERLAYS) ||

Break this in multiple descriptive bool assignement. This should also avoid mixing || and && without parenthesis which is quite hard to read the intent.

Break this in multiple descriptive `bool` assignement. This should also avoid mixing `||` and `&&` without parenthesis which is quite hard to read the intent.
fclem marked this conversation as resolved
Author
Member

I noticed an error. Overlay only draws the depth if the engine is external. Fixing....

I also noticed that in wireframe mode, the depth of each line is drawn and it works well for autodepth (in my opinion it looks better than overriding) but I decided to override it too so as not to change too much.

I noticed an error. Overlay only draws the depth if the engine is external. Fixing.... I also noticed that in wireframe mode, the depth of each line is drawn and it works well for autodepth (in my opinion it looks better than overriding) but I decided to override it too so as not to change too much.
Clément Foucault approved these changes 2024-03-07 10:38:48 +01:00
Dismissed
Germano Cavalcante force-pushed zoom_optimize from 7ef793c013 to 651ebc1c5e 2024-03-07 15:00:57 +01:00 Compare
Clément Foucault requested changes 2024-03-07 15:04:40 +01:00
Dismissed
@ -209,6 +211,8 @@ bool ED_view3d_depth_unproject_v3(const ARegion *region,
double depth,
float r_location_world[3]);
bool view3d_has_depth_buffer_being_used(const Depsgraph *depsgraph, const View3D *v3d);

Shouldn't it have the ED prefix since it's a public API function?

Shouldn't it have the `ED` prefix since it's a public API function?
Germano Cavalcante added 1 commit 2024-03-07 15:07:34 +01:00
Germano Cavalcante merged commit dd0e60fb51 into main 2024-03-07 15:16:50 +01:00
Germano Cavalcante deleted branch zoom_optimize 2024-03-07 15:16:53 +01:00
Clément Foucault approved these changes 2024-03-07 15:23:08 +01:00
Sign in to join this conversation.
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 project
No Assignees
2 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#113026
No description provided.