UI: Support layout panels in dialog popups #119519
No reviewers
Labels
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#119519
Loading…
Reference in New Issue
No description provided.
Delete Branch "guishe/blender:dialog-layout-panels"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Enables operators that uses
WM_operator_props_dialog_popup
or
redo
popup to use layout panels.Other popups would likely also support layout panels, only
they need to set its dummy panel with
UI_popup_dummy_panel_set
Python test example
WIP: UI: Support layout panels in dialog popupsto UI: Support layout panels in dialog popupsThere is a odd alignment in sub panel backdrops, but i would prefer to solve that in a different patch that also add the sub panel color as user pref
Does clicking and dragging to open/close multiple panels work for you?
Fixed now, i noticed this other issue that happens with layout panels in general #119639
The code generally seems fine, I only have one major comment: Do we really need two kinds of function pointers for creating popup blocks (
uiBlockCreateFunc
anduiBlockCreateWithPanelFunc
)?Having two methods to do this creates potentially unnecessary complexity.
I can think of the following alternatives for now:
region->runtime.popup_block_panel
. Maybe we could also get rid ofUI_block_set_root_panel
in this case.UI_panel_begin
in the popup which also initializesblock->panel
.@ -765,13 +776,26 @@ uiLayout *UI_pie_menu_layout(uiPieMenu *pie);
* Functions used to create popup blocks. These are like popup menus
* but allow using all button types and creating their own layout. */
using uiBlockCreateFunc = uiBlock *(*)(bContext *C, ARegion *region, void *arg1);
/** Function used to create popup blocks, with a given dummy `panel` so popups can support creating
Comment style (newline after
/**
).@ -2096,6 +2096,15 @@ void UI_block_draw(const bContext *C, uiBlock *block)
UI_panel_should_show_background(region, block->panel->type),
region->flag & RGN_FLAG_SEARCH_FILTER_ACTIVE);
}
/** Shared layout panel backdrop style between redo region and popups. */
Comment style, same below.
@ -834,2 +834,4 @@
struct uiPopupBlockCreate {
uiBlockCreateFunc create_func;
uiBlockCreateWithPanelFunc create_with_panel_func;
/** Dummy panel used in popups created with #create_with_panel_func so they can support layout
Comment style.
@ -753,7 +773,14 @@ uiBlock *ui_popup_block_refresh(bContext *C,
region->winrct.ymax = block->rect.ymax + UI_POPUP_MENU_TOP;
UI_block_translate(block, -region->winrct.xmin, -region->winrct.ymin);
/** Popups can change size, fix scroll ofsset if a panel was closed. */
typo and comment style (use
/* ... */
for comments that are not for functions/data members)@ -821,0 +851,4 @@
handle->popup_create_vars.panel = nullptr;
if (std::holds_alternative<uiBlockCreateWithPanelFunc>(create_func) &&
std::get<uiBlockCreateWithPanelFunc>(create_func))
Looks like you're checking the same thing twice here.
@ -1376,0 +1385,4 @@
return type;
}();
bool open;
panel = UI_panel_begin(region, ®ion->panels, block, &panel_type, panel, &open);
Hm, seems tricky to call
UI_panel_begin
without ever callingUI_panel_end
. I think, given the approach used now,UI_panel_begin
shouldn't be called and what you did before to create the dummy panel was better.@ -712,6 +712,17 @@ int UI_popup_menu_invoke(bContext *C, const char *idname, ReportList *reports) A
* E.g. WM might need to do this for exiting files correctly.
*/
void UI_popup_menu_retval_set(const uiBlock *block, int retval, bool enable);
void UI_popup_dummy_panel_set(ARegion *region, uiBlock *block);
Add comment to this function.
@ -579,0 +605,4 @@
}
panel->runtime->layout_panels.clear();
block->panel = panel;
panel->runtime->block=block;
Use
make format
(even better, configure clang format to run on every save)@ -878,2 +919,4 @@
ui_popup_block_remove(C, handle);
if (handle->region->runtime.popup_block_panel) {
BKE_panel_free(handle->region->runtime.popup_block_panel);
I get a crash when closing the splash screen here.
This code might have to come before
ui_popup_block_remove
above.@ -2098,1 +2098,4 @@
}
/* Shared layout panel backdrop style between redo region and popups. */
if (block->panel && ELEM(region->regiontype, RGN_TYPE_HUD, RGN_TYPE_TEMPORARY)) {
/** TODO: Add as theme color. */
Comment style.
Can you update the release notes?
i will check