Proposed Custom Confirmation Dialogs #106691
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#106691
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
Although we try to avoid blocking operations there are times when we must pause in order to confirm with the user before proceeding with potentially harmful operations. For example when we load Defaults, Delete data, etc.
We currently have only two ways to allow an operator to have a user confirmation. One is using
WM_operator_confirm
which has no configurability. It simply opens a popup menu with "OK?" as the title and a single button that contains the operator name. It can contain no other information, like the operator description, and there is no obvious and visible way to cancel.The other way is to create a bespoke popup dialog block like we have done for the dialog we get when closing Blender with unsaved changes. But that requires a lot of work. That "close" dialog requires about 280 lines of code.
I am proposing a third option. One that allows us to create a complex dialog containing multiple buttons and improved information in just a few lines of code.
This would involve adding an optional
warning
callback for operators. If not set callingWM_operator_confirm
would result in behavior that is identical to today.But if you create such a callback you are passed the context, operator, and a structure containing dialog information. Make changes to that passed struct and you change the contents, look, and behavior of the confirmation.
For the example above it could look like this:
The code above changes the "confirm" button to say "Save", shows it at a larger size, and in the center of the window. The contents are not changed here so it will just just use the operator's description:
But you can change the title, the content, the icon, the size, the behavior (like closing by moving your mouse away), position, and even if the "confirm" button should be red.
There is a PR that you can apply to test this proposal: #104670
Harley Acheson referenced this issue2023-04-12 02:51:13 +02:00
Closing. Implemented in #104670, merged with commit
f40d4e0bda