Disabled Menu Entries with layout.enabled = False can still be executed with generic inbuilt shortcuts #52998

Closed
opened 2017-10-05 02:14:40 +02:00 by Vuk Gardašević · 14 comments

System Information
Win 7 AMD X3 455, R7 360

Blender Version
5c6e3ff, 2.67b

Short description of error
Inbuilt quick access shortcuts for menus can execute the associated entries no matter the UI state of them (disabled by using layout.enabled = False)

Exact steps for others to reproduce the error

test_menu_shortcuts_error.py

Run script the provided modified template script in the Text editor > Access the Custom Menu in the Info header > Press 1 (One) or T (underscored letter).
Even though the entry is disabled in the menu layout, it still can be accessed with these inbuilt generic Menu shortcuts.
It's not that a big of an issue in case of operators behind a poll but it can lead to crashes if something was disabled in the UI for a reason.

**System Information** Win 7 AMD X3 455, R7 360 **Blender Version** `5c6e3ff`, 2.67b **Short description of error** Inbuilt quick access shortcuts for menus can execute the associated entries no matter the UI state of them (disabled by using `layout.enabled = False`) **Exact steps for others to reproduce the error** [test_menu_shortcuts_error.py](https://archive.blender.org/developer/F952940/test_menu_shortcuts_error.py) Run script the provided modified template script in the Text editor > Access the Custom Menu in the Info header > Press 1 (One) or T (underscored letter). Even though the entry is disabled in the menu layout, it still can be accessed with these inbuilt generic Menu shortcuts. It's not that a big of an issue in case of operators behind a poll but it can lead to crashes if something was disabled in the UI for a reason.
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @VukGardasevic

Added subscriber: @VukGardasevic

Added subscriber: @Sergey

Added subscriber: @Sergey

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sergey Sharybin self-assigned this 2017-10-05 12:20:45 +02:00

Everything is working according to a design here. Enabled only makes widgets greyed-out, but still allows to tweak values and such. For example, you can do necessary tweaks to shutter duration even while Motion Blur is disabled in render settings.

What you should be doing in this particular case is to declare operator's poll() function which will check whether operator can or can not be run within the current context. If operator is forbidden to run in current context, poll() should return False and it will make corresponding entry in menu to be greyed out and will also exclude the operator from running via shortcuts.

Thanks for the report, but it is how Blender works.

Everything is working according to a design here. `Enabled` only makes widgets greyed-out, but still allows to tweak values and such. For example, you can do necessary tweaks to shutter duration even while Motion Blur is disabled in render settings. What you should be doing in this particular case is to declare operator's `poll()` function which will check whether operator can or can not be run within the current context. If operator is forbidden to run in current context, `poll()` should return `False` and it will make corresponding entry in menu to be greyed out and will also exclude the operator from running via shortcuts. Thanks for the report, but it is how Blender works.
Author
Member

Maybe i wasn't being clear enough with the example, so I apologize.
For Menu entries, both enabled and active set to False will not allow tweaking of properties. Otherwise can be true for panels, but menus are specific.

test_menu_shortcuts_properties.py

Also accessing properties like scene ones with number shorticuts in menus (like 2, 3 depending on their order in the menu) will reset the value to the defined minimum one.

Maybe i wasn't being clear enough with the example, so I apologize. For Menu entries, both `enabled` and `active` set to False will not allow tweaking of properties. Otherwise can be true for panels, but menus are specific. [test_menu_shortcuts_properties.py](https://archive.blender.org/developer/F960131/test_menu_shortcuts_properties.py) Also accessing properties like scene ones with number shorticuts in menus (like 2, 3 depending on their order in the menu) will reset the value to the defined minimum one.

Changed status from 'Archived' to: 'Open'

Changed status from 'Archived' to: 'Open'
Sergey Sharybin removed their assignment 2017-10-05 14:46:46 +02:00
Bastien Montagne was assigned by Sergey Sharybin 2017-10-05 14:46:46 +02:00

Added subscriber: @mont29

Added subscriber: @mont29

Well, technically you shouldn't be adding props to menus, this is highly discouraged by interface guidelines. But maybe we should make those behave same for both menus and panels.

@mont29, can i assign it to you and have your opinion here? :)

Well, technically you shouldn't be adding props to menus, this is highly discouraged by interface guidelines. But maybe we should make those behave same for both menus and panels. @mont29, can i assign it to you and have your opinion here? :)

Am pretty sure it’s not worth spending time to fix/hack/workaround this unsupported, unrecommended "feature"… Properties are for panels, if this is really to be solved, I’d simply forbid props in menu layouts, done. Because I suspect getting all different 'keyboard users' here (menu entry selection/'shortcut', widget itself…) to play nice and sound together won’t be easy.

Am pretty sure it’s not worth spending time to fix/hack/workaround this unsupported, unrecommended "feature"… Properties are for panels, if this is really to be solved, I’d simply forbid props in menu layouts, done. Because I suspect getting all different 'keyboard users' here (menu entry selection/'shortcut', widget itself…) to play nice and sound together won’t be easy.

Added subscriber: @brecht

Added subscriber: @brecht
Bastien Montagne was unassigned by Brecht Van Lommel 2017-10-05 16:34:30 +02:00
Brecht Van Lommel self-assigned this 2017-10-05 16:34:30 +02:00

I'll fix this bug.

Properties in menus are used in various places, like the Render menu or graph editor View menu, we can't simply remove that.

I'll fix this bug. Properties in menus are used in various places, like the Render menu or graph editor View menu, we can't simply remove that.

This issue was referenced by 64f8cc3e7d

This issue was referenced by 64f8cc3e7d5d13c60845cef8c7a0e0cd6f3f58d2

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
Asset Browser Project
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
5 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#52998
No description provided.