Nodes: Hide the node preview button when the overlays are disabled #110949

Merged
Brecht Van Lommel merged 3 commits from Kdaf/blender:GSOC-hide-preview-button into main 2023-08-09 14:04:17 +02:00
Member

When the overlays are hidden or the previews overlays are hidden, it is more consistent to have the preview toggle button hidden than shown.

This patch also removes the preview rendering when the previews are hidden.

When the overlays are hidden or the previews overlays are hidden, it is more consistent to have the preview toggle button hidden than shown. This patch also removes the preview rendering when the previews are hidden.
Colin Marmond added 1 commit 2023-08-09 12:22:26 +02:00
Colin Marmond requested review from Brecht Van Lommel 2023-08-09 12:24:34 +02:00
Brecht Van Lommel approved these changes 2023-08-09 13:28:13 +02:00
Brecht Van Lommel requested changes 2023-08-09 13:30:57 +02:00
@ -1127,2 +1127,3 @@
bool node_is_previewable(const bNodeTree &ntree, const bNode &node)
bool node_is_previewable(const SpaceNode &snode, const bNodeTree &ntree, const bNode &node)
{
if (!(snode.overlay.flag & SN_OVERLAY_SHOW_OVERLAYS) ||

Actually, I think this should be && instead of ||?

But look at node_draw_basis, it doesn't check SN_OVERLAY_SHOW_OVERLAYS for show_preview which I guess is a mistake?

Actually, I think this should be && instead of ||? But look at `node_draw_basis`, it doesn't check `SN_OVERLAY_SHOW_OVERLAYS` for `show_preview` which I guess is a mistake?
Author
Member

(!(snode.overlay.flag & SN_OVERLAY_SHOW_OVERLAYS) || !(snode.overlay.flag & SN_OVERLAY_SHOW_PREVIEWS))
<=>
!(snode.overlay.flag & SN_OVERLAY_SHOW_OVERLAYS && snode.overlay.flag & SN_OVERLAY_SHOW_PREVIEWS)

It is a mistake, but not a problem, because the extra info panel is hidden with the SN_OVERLAY_SHOW_OVERLAYS flag. I'll correct that to be more consistent and maybe avoid getting previews for nothing.

> (!(snode.overlay.flag & SN_OVERLAY_SHOW_OVERLAYS) || !(snode.overlay.flag & SN_OVERLAY_SHOW_PREVIEWS)) <=> !(snode.overlay.flag & SN_OVERLAY_SHOW_OVERLAYS && snode.overlay.flag & SN_OVERLAY_SHOW_PREVIEWS) It is a mistake, but not a problem, because the extra info panel is hidden with the `SN_OVERLAY_SHOW_OVERLAYS` flag. I'll correct that to be more consistent and maybe avoid getting previews for nothing.
Author
Member

I wonder if the preview acquisition could be moved inside the node_draw_extra_info_panel function. It would make it more consistent and avoid some double checks of the flags and redundancy.

I wonder if the preview acquisition could be moved inside the `node_draw_extra_info_panel` function. It would make it more consistent and avoid some double checks of the flags and redundancy.
Author
Member

After thinking longer, it is not possible to do, because we need to know the size of the node including its preview before drawing.

After thinking longer, it is not possible to do, because we need to know the size of the node including its preview before drawing.
Kdaf marked this conversation as resolved
Colin Marmond added 1 commit 2023-08-09 13:42:07 +02:00
8a4c09b8b8 Add overlays tag check to improve consistency
Also avoid getting the images if the overlays are hidden but not the previews.
Colin Marmond added 1 commit 2023-08-09 13:50:02 +02:00
Brecht Van Lommel approved these changes 2023-08-09 13:58:40 +02:00
Brecht Van Lommel merged commit c63bcbf906 into main 2023-08-09 14:04:17 +02:00
Brecht Van Lommel deleted branch GSOC-hide-preview-button 2023-08-09 14:04:19 +02:00
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 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#110949
No description provided.