I was looking at the T62258 and as I am not 100% up to date with all the discussions I thought it was a good idea to discuss the approach.
My idea is to solve this issue with medium effort. With this I mean this approach will not implement the concept of floating panels or dockable panels. This is something that needs to be tackled in a much broader scale. The described approach is to let the user able to hide the redo/repeat panel.
I did some preminary research and came to the next functional design:
- Render a (X) in the header of the redo panel. So the header will look something like > Add Cube (X).
- When the user clicks on the (X) the redo panel will be closed.
- The next time that a operator with the UNDO option set is executed the redo panel will appear again.
In technical there are many ways to implement this, But as I am not 100% familiar with the UI code I came with the next solutions.
- Extend the panel type
- The redo panel is an C defined panel. It seems that in C defined panels we don't share the same freedom as in Python (We cannot add an operator to the layout during the draw header callback). For the collapse/expand operator is part of the Panel meta data and is drawn in the function ed_panel_draw.
- Add a HIDDEN flag to the PanelType struct in DNA_screen.h This state will only be available for C defined Panels. Making this option available for Python might lead to undefined behavior.
- Add a CLOSABLE flag to the PanelType
- Add a close_operation_idname flag to the PanelType.
- When the panel_type.flag is CLOSABLE and the close_operation_idname is set we render the close button in the header.
Add a redo close operation that will set the paneltype to not visible.
Update the poll functions of the hud and the panel to check the visible flag.
( Not that clean code) When an operation is executed the flag of the paneltype is reset. (remove hidden flag if closable and hidden).
- specific solution for redo panels in the area/region types
There are also options to add a hide_redo_panel flag to the area/region to make it more specific. and less tweaking the UI framework code. and the operation can be written generic.
there are many variants. but as the code needs to be production proof, but will be used until we might some day have proper floating/dockable panels...