Fix #121386: Property context menu shows bone collection operation #121387

Open
Pratik Borhade wants to merge 1 commits from PratikPB2123/blender:121386-ctx-extra-op into main

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

Check "clicked" button type to avoid adding tree-view item operations
in context menu.

Main PR
image image
Check "clicked" button type to avoid adding tree-view item operations in context menu. | Main | PR | | -- | -- | | ![image](https://projects.blender.org/attachments/01b3707d-3d7c-41e6-a186-202d5e374aa9) | ![image](/attachments/8aeb88e0-21e7-4ef1-b5d2-6dea07d54229) |
Pratik Borhade added 1 commit 2024-05-03 13:22:33 +02:00
4b82719ea5 Fix #121386: Property context menu shows bone collection operation
Check "clicked" button type to avoid adding tree-view item operations
in context menu.
Pratik Borhade requested review from Pablo Vazquez 2024-05-03 13:24:22 +02:00
Pratik Borhade requested review from Julian Eisel 2024-05-03 13:24:22 +02:00
Pablo Vazquez approved these changes 2024-05-03 14:58:07 +02:00
Pablo Vazquez left a comment
Member

Makes sense from the user point of view. Thanks!

Makes sense from the user point of view. Thanks!
Julian Eisel requested changes 2024-05-03 16:42:37 +02:00
Julian Eisel left a comment
Member

This is a bit problematic. At least with the way this is done here, the context menu for the asset shelf breaks. That's because it overlays the preview-tile button on top of the view-item. This is typical for view-item buttons which are usually overlapped by other buttons. I'd expect other cases to break too.

One thing we could try would be adding the view-item context menu when the overlapped button is non-interactive. But I don't think this would work either, since the preview tile may well have own interaction handling.

So I don't really see a way to do this well, except maybe explicitly tagging buttons that should include (or exclude) the view-item context menu.

Another option is moving the view-item context menu into a sub-menu, when the top-most button isn't the view-item button.

This is a bit problematic. At least with the way this is done here, the context menu for the asset shelf breaks. That's because it overlays the preview-tile button on top of the view-item. This is typical for view-item buttons which are usually overlapped by other buttons. I'd expect other cases to break too. One thing we could try would be adding the view-item context menu when the overlapped button is non-interactive. But I don't think this would work either, since the preview tile may well have own interaction handling. So I don't really see a way to do this well, except maybe explicitly tagging buttons that should include (or exclude) the view-item context menu. Another option is moving the view-item context menu into a sub-menu, when the top-most button isn't the view-item button.
Author
Member

Another option is moving the view-item context menu into a sub-menu, when the top-most button isn't the view-item button.

I think this will also move the asset shelf context menu operations in sub-menu.

> Another option is moving the view-item context menu into a sub-menu, when the top-most button isn't the view-item button. I think this will also move the asset shelf context menu operations in sub-menu.
Author
Member

Cheap fix would be:

diff --git a/source/blender/editors/interface/interface_context_menu.cc b/source/blender/editors/interface/interface_context_menu.cc
index e89443f67a9..1a4c2e04efb 100644
--- a/source/blender/editors/interface/interface_context_menu.cc
+++ b/source/blender/editors/interface/interface_context_menu.cc
@@ -1072,7 +1072,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev
     const ARegion *region = CTX_wm_menu(C) ? CTX_wm_menu(C) : CTX_wm_region(C);
     uiButViewItem *view_item_but = (uiButViewItem *)ui_view_item_find_mouse_over(region,
                                                                                  event->xy);
-    if (view_item_but) {
+    if (view_item_but && ELEM(but->type, UI_BTYPE_VIEW_ITEM, UI_BTYPE_PREVIEW_TILE)) {
       BLI_assert(view_item_but->type == UI_BTYPE_VIEW_ITEM);

       const bContextStore *prev_ctx = CTX_store_get(C);
Cheap fix would be: ```Diff diff --git a/source/blender/editors/interface/interface_context_menu.cc b/source/blender/editors/interface/interface_context_menu.cc index e89443f67a9..1a4c2e04efb 100644 --- a/source/blender/editors/interface/interface_context_menu.cc +++ b/source/blender/editors/interface/interface_context_menu.cc @@ -1072,7 +1072,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev const ARegion *region = CTX_wm_menu(C) ? CTX_wm_menu(C) : CTX_wm_region(C); uiButViewItem *view_item_but = (uiButViewItem *)ui_view_item_find_mouse_over(region, event->xy); - if (view_item_but) { + if (view_item_but && ELEM(but->type, UI_BTYPE_VIEW_ITEM, UI_BTYPE_PREVIEW_TILE)) { BLI_assert(view_item_but->type == UI_BTYPE_VIEW_ITEM); const bContextStore *prev_ctx = CTX_store_get(C); ```
Merge conflict checking is in progress. Try again in few moments.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 121386-ctx-extra-op:PratikPB2123-121386-ctx-extra-op
git checkout PratikPB2123-121386-ctx-extra-op
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
3 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#121387
No description provided.