Page MenuHome

Disabled Menu Entries with layout.enabled = False can still be executed with generic inbuilt shortcuts
Closed, ResolvedPublic


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

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.

Related Objects

Event Timeline

Sergey Sharybin (sergey) closed this task as Archived.
Sergey Sharybin (sergey) claimed this task.

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.

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.

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.

Sergey Sharybin (sergey) reopened this task as Open.
Sergey Sharybin (sergey) triaged this task as Normal priority.

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.

@Bastien Montagne (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.

Brecht Van Lommel (brecht) claimed this task.

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.