Page MenuHome

Design: Closable Redo/Repeat panel (WIP)
Closed, InvalidPublic

Description

Hi,

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.

  1. Extend the panel type
  2. 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.
  3. 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.
  4. Add a CLOSABLE flag to the PanelType
  5. Add a close_operation_idname flag to the PanelType.
  6. 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).

  1. 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.

  1. ...

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...

Details

Type
Design

Event Timeline

Jeroen Bakker (jbakker) triaged this task as Confirmed, High priority.
Jeroen Bakker (jbakker) renamed this task from Design: Repeat panel on hud should not block the interface (WIP) to Design: Closable Redo/Repeat panel.

This should be possible without large changes.

Panels drawing & event handling code can check when used in a floating region and show a close button in that case.

When the close button is pressed the region can be set to hidden using existing flag.


It could work this way.

  • add a new flag to Panel.runtime_flag to show a closed button, set it when drawing into a RGN_ALIGN_FLOAT region.
  • Check this when handling events ui_handle_panel_header & drawing ui_draw_aligned_panel.
  • Pressing it sets the RGN_FLAG_HIDDEN flag.
Jeroen Bakker (jbakker) renamed this task from Design: Closable Redo/Repeat panel to Design: Closable Redo/Repeat panel (WIP).Mar 27 2019, 9:30 AM
Jeroen Bakker (jbakker) raised the priority of this task from Confirmed, High to Needs Triage by Developer.

Thanks, that is really valid feedback! It will keep the code centralized and more general.

I think the main thing for this bug is that the panel should move up a bit automatically. Closing can be useful but the important thing is to avoid the overlap automatically.

I think that automatically avoiding overlap for example in case of modal operation is active and the mouse is near the panel might create a jumpy user interface.

I saw that there is a legacy close operation already, that is currently not used anywhere and not working panel->control |= UI_PNL_CLOSE trying to revamp this one.

Move Redo panel to a global Topbar. It will no more overlap anything.

Jeroen Bakker (jbakker) closed this task as Invalid.Wed, Apr 24, 2:06 PM