Page MenuHome

Non-single-column layouts are not displayed correctly in menus
Closed, ResolvedPublic


System Information
Operating system: Windows 7 (64 bit)
Graphics card: Radeon HD 8670D

Blender Version
Broken: 2.80, 69b2f5268114, blender2.7, 2019-02-10, as found on the splash screen

Short description of error
If any non-single-column layout (box(), row() with 2 or more items, etc.) is used in a menu's draw() function, all subsequent widgets will be shifted to the right.

Exact steps for others to reproduce the error
Open the attached file and run the script. In the text editor's left-side shelf a "Test Panel" will appear, which would contain a test menu and a bunch of labels in a test layout. If you open the menu, the labels in it will be shifted.



Event Timeline

(Added extra test case - properties with non-empty labels also cause shifts)

Jacques Lucke (JacquesLucke) lowered the priority of this task from Needs Triage by Developer to Confirmed, Medium.Feb 12 2019, 11:04 AM

Can confirm that.

Menus are a bit limited in regards to layout.
I dont have an exact list of these limitations (I just remeber I had an issue in D4215 as well).

Could this be made a popover instead? These basically can contain a whole panel, layout works as expected...

@William Reynish (billreynish) : Is this [use popover instead] something we should offer as a workaround to the limited layout drawing in menus?
(also not sure if we should close this as "not-a-bug")

I don't think it's a bug. I think this is just a limitation of the menu system. For more custom layouts, use a popover.

Philipp Oeser (lichtwerk) claimed this task.

Oki, closing then

@dima glib (dairin0d) : feel free to comment again if there are issues converting this to a popover...

Thanks! layout.popover() seems like exactly what I need.

Just one question: what is the recommended way to register an "invisible" panel (i.e. which is guaranteed to not show in any editor/tab on its own)?
Right now, I can do this by using a bl_space_type which doesn't contain any panels (e.g. bl_space_type = 'CONSOLE', bl_region_type = 'WINDOW'), but it seems a bit hacky and not future-proof.

Not sure if this is the recommended way, but picking a region type for your spacetype that doesnt draw panels automatically seems fine, I guess...
So for space TEXT_EDITOR, you could use bl_region_type = 'HEADER', bl_region_type = 'WINDOW'?