Consolidation of Operator Dialogs #117489
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#117489
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
I am quite happy with our new ability to customize confirmation dialogs. It allows a lot of configurability that seems to address all the different ways we might want to use those. So I'd like to consider extending that configurability into other operator dialogs, making them more customizable, and remove some redundancy.
At the core these things are quite similar. If the Confirmation dialog is given the (optional) ability to include operator properties we can - if we want - get things like this:
And if we use the confirmation dialog in place of the Operator Properties Dialog we get things like this:
To consolidate these things I propose the following:
The Confirmation dialog needs to able work nicely without an icon. Simple enough.
Non-confirmation operator popups currently pass around a
wmOpPopUp
which contains only the following:We can just add these four items to the larger
wmConfirmDetails
(with width becoming min_width) and then renamewmConfirmDetails
towmOpPopUp
. And then also add aninclude_properties
bool.We should eventually end up with all dialogs that are much more configurable and sharing more common code.
@brecht
This does include your comment to "change the new wm_block_confirm_create to call ot->ui between the message and the buttons, so that these new confirmation popups support showing operator properties" but makes this optional.
@mont29 - I think this is closer to what you are wanting, where I can use existing "ui" and op popup code for things like that "manage orphans" dialog. Make more sense to use dialog code rather than pretend it is a confirmation.
@Harley I think trying to reduce the amount of options here, and completely different codepaths doing seemingly (almost) the same thing, is definitely a good target.
On a high level, your proposal makes sense to me. I would even say we could entirely remove the
WM_operator_props_dialog_popup
once theWM_operator_confirm
API is able to show the settings of an operator.On a lower, technical level, I cannot say without deeper analysis of the existing code, whether the 'confirm' codepath should be merged into the 'props_dialog_popup' one, or vice-versa:
WM_operator_confirm
family usesUI_popup_block_invoke
to create and manage the popup window.WM_operator_props_dialog_popup
usesUI_popup_block
to create and manage the popup window.Maybe @ideasman42 or @JulianEisel know what are the differences between these, and which one should be used for operator popups?
Might be obvious, but technically, I don't think this code should ever directly call
ot->ui
, it should useuiTemplateOperatorPropoertyButs
(as done inwm_block_dialog_create
).In the Python API we currently have:
invoke_props_popup
: show operator properties and execute it automatically on changesinvoke_props_dialog
: show operator properties and only execute it on click of OK buttoninvoke_confirm
: only to let user confirm the execution, no operator properties showninvoke_popup
: only shows operator's properties, without executing itinvoke_search_popup
: searches values of an enum property of the operatorThis set of API function seems quite sensible and corresponding to different use cases we need. And we should not break compatibility. But it is missing control over title, icon, message and buttons, as well using inconsistent styling.
I think it would make sense to extend those API functions to cover what we need. And then use the same mechanism and naming in C++ and Python. So all those functions would have the same name in C++, but with a
WM_operator_
prefix. The newconfirm
callback mechanism that is only in C++ doesn't seem like a great fit and I would remove that in favor of an extendedinvoke_confirm
.I think title, icon and message could be added as optional arguments to these existing API functions.
I'd also probably just add optional text label for the confirmation and cancel buttons as well, along with a choice for which one should be the default. It does make the argument list relatively long. But introducing an intermediate struct doesn't see so convenient at least for the Python API. For C++ I don't mind a struct passed to these API functions if that makes the code cleaner.
A limitation is if you want to show e.g. 3 different buttons that correspond to different actions. Maybe that is best handled by
invoke_popup
which wouldn't automatically add any buttons. Then for thedraw
callback, there could be a new API function to add a dialog button with the right styling and callbacks.For
invoke_confirm
, a design question is if we want to change to the new layout by default. The easiest incremental step would be to add acompact
argument that defaults toTrue
and keeps the existing behavior. Then it would be up to the UI module to decide if they want to turn that option off by default or not.I imagine it's just for demonstration purposes, but I don't think that "Apply Object Transformations" popup should show the properties. If it wasn't going to show them when all the meshes were single user, it shouldn't show them if they aren't either. It should be purely a confirmation to make sure that is the main thing the users sees.
I'll try to treat anything in the props_dialog_popup version as correct over mine.
Yes, I noticed that. I made a test implementation - #117493 - to see if it would work, and it uses that. Although don't look at that, I just wanted something to refer to later.
Yes, it was just handy - but useless.
Agreed. I think we can later add python access later, similar to shown here: #117143
I think the first steps are simple and non-contentious:
I'm going to remove some unneeded options from wmConfirmDetails. Some things were put in there just to see if the idea worked but are unnecessary. This would include the overwriting of the string of the "cancel" button. Not used now, but having it could lead to inconsistencies later where we get things like "yes/no" dialogs which are a bit evil.
I'll refactor wmConfirmDetails to use std::string instead of char arrays.
Then I'll make something for this consolidation that we can then look at.