Fix #107422: Mesh context menus do not open with the last used option #107427
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#107427
Loading…
Reference in New Issue
No description provided.
Delete Branch "lichtwerk/blender:107422"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Caused by
99e5024e97
Above commit changed behavior in that it only flagged the
uiBlock
withUI_BLOCK_POPUP_MEMORY
in case a Menu's title was provided toui_popup_menu_create_block
. Now when is the title provided? Thisdepends on the
bl_label
set in the menu class. But this is not alwaysthe case, there are some menus that have a blank
bl_label
(as seenwith
VIEW3D_MT_edit_mesh_context_menu
for example -- this specifies itsown label inside the draw function depending on vertex/edge/face mode).
Thus the provided title is not really reliable as source information to
do the flagging (also see for example
a38b98478a
), flagging should always bedone [and only check a title for actually inserting in the puphash].
Choosing an entry in a menu will still handle puphash later (see
button_activate_exit
) though multiple menus without a label might fight for thesame storage of the menu memory. Using idname instead (or in combination with
the label) for the hash could be looked at to solve this.
Hey that works quite well!
The comment has a typo ("alwas"), and it should probably reference "#107422". The following is just a suggestion:
Problem is that the block's
puphash
will always be 0 for menus without title. So if you have multiple menus without a label, they will fight for the same storage of the menu memory. Need to think about what's the best solution here. Maybe we shouldn't use the label, but an id-name for this (there's already a menu type id-name separate from the label). But it's a bit tricky to get this information at this level.Afaict, that situation is not new (was the same prior to
99e5024e97
-- and wasnt really a problem then), but yeah, theoretically, true...A few possibilities:
bl_label
for each. This would mean menus require a label to support memory.Note that there are more broken cases. For example I can see the Grease Pencil edit mode context menu has the same issue. So it's probably worth solving this properly, with
Passing around idname + label/title might be a better way, but there are a couple of places where an idname is hard to get to (e.g. since this is also used with PieMenus, we might only have PieMenuLevelData at hand -- which only has a title), in these cases, we could probably get away with reusing the title for "both" label & idname, but this is also not very clean.
My vote would be to not sink a lot of time at this moment (like I said, afaict the danger of "stealing" was there before and apparently never really caused too much breakage in practice), and note this in both the commit message and the comment [I can update that], but still just go forward with this patch.
Of course, this is a decision the UI module has to make though.
I'm fine with this for now, just note this clearly in code comments.
I did work on a patch to use the idname for hashing last week, don't remember if it's finished though, would have to test again.