Design: Closable Redo/Repeat panel (WIP) #62995

Closed
opened 2019-03-27 08:47:14 +01:00 by Jeroen Bakker · 10 comments
Member

Hi,

I was looking at the #62258 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
  • 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).

  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.

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

Hi, I was looking at the #62258 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 * 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). 2) 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. 3) ... 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...
Jeroen Bakker self-assigned this 2019-03-27 08:47:14 +01:00
Author
Member

Added subscribers: @Jeroen-Bakker, @sebastian_k, @fsiddi

Added subscribers: @Jeroen-Bakker, @sebastian_k, @fsiddi
Jeroen Bakker changed title from Design: Repeat panel on hud should not block the interface (WIP) to Design: Closable Redo/Repeat panel 2019-03-27 08:48:31 +01:00
Author
Member

Added subscribers: @brecht, @ideasman42, @WilliamReynish
Removed subscribers: @fsiddi, @sebastian_k

Added subscribers: @brecht, @ideasman42, @WilliamReynish Removed subscribers: @fsiddi, @sebastian_k

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.
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 changed title from Design: Closable Redo/Repeat panel to Design: Closable Redo/Repeat panel (WIP) 2019-03-27 09:30:05 +01:00
Author
Member

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

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

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.

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.

Added subscriber: @zeauro

Added subscriber: @zeauro

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

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

This overlaps quite a lot w/ #57727#661048

This overlaps quite a lot w/ #57727#661048
Author
Member

Changed status from 'Open' to: 'Archived'

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