UI: Operator Props Dialog Changes #117528
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#117528
Loading…
Reference in New Issue
No description provided.
Delete Branch "Harley/blender:OpPropertyDialog"
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?
Changes to WM_operator_props_dialog_popup to allow configuration,
including via python, and with look consistent with new confirms.
Existing
wmOpPopUp
extended to include the many ways that all of these related functions could be configured.In the WM API, properties added to
invoke_props_dialog
for "title", "confirm_text", "cancel_default." Newrna_Operator_props_dialog_popup
added that calls existingWM_operator_props_dialog_popup
that is extended with default arguments so that existing uses are not changed.WM_operator_props_dialog_popup
creates the same dialog as now, withwm_block_dialog_create
, but passes along largerwmOpPopUp
with more options and set defaults.The dialog itself is altered to have optional mousemove_quit behavior, a cancel button (in OS order), and with either button set as default. Positioning is also configurable. Padding is changed. The title is bold.
a
dialog_cancel_cb
added to handle the action of the Cancel button.An example of a current dialog:
Note that the above shows grey-out text showing the operator name, and a single "OK" button. This PR, by default, creates the following:
It shows the operator description as title in bold. There is a confirm button using the operator name, and a Cancel button to back out. And of course the title, the button text, and which button is configurable in Python, with more configuration possible in C++.
Note that is borrows code and inspiration from Guillermo Venegas' #117143
Looking forward for this.
Some details
@ -221,0 +229,4 @@
{
title = RNA_translate_ui_text(title, text_ctxt, nullptr, nullptr, translate);
confirm_text = RNA_translate_ui_text(confirm_text, text_ctxt, nullptr, nullptr, translate);
return WM_operator_props_dialog_popup(C, op, width, title, confirm_text, cancel_default);
Misses
nullptr
checks inWM_operator_props_dialog_popup
string params@ -1675,0 +1684,4 @@
/* Only invoked by Cancel button in popups created with wm_block_dialog_create() */
static void dialog_cancel_cb(bContext *C, void *arg1, void *arg2)
{
wmOpPopUp *data = static_cast<wmOpPopUp *>(arg1);
this few lines (1687-1700) duplicates
wm_operator_ui_popup_cancel
Thanks! Can you double-check these to make sure I fixed them as you expected?
Works as expected!
@ -867,2 +881,4 @@
rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN);
parm = RNA_def_property(func, "title", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(parm, "Title", "Optional text to show as title of the title.");
title of the tile -> title of the popup
@ -869,0 +887,4 @@
parm,
"Confirm Text",
"Optional text to show instead to the default \"OK\" confirmation button text.");
parm = RNA_def_property(func, "cancel_default", PROP_BOOLEAN, PROP_NONE);
I'm not sure it makes sense to have
cancel_default
without also being able to change the text of the cancel button. Or if we want to have popups that do this at all actually.Can we leave this out of the Python API until it's more clear if this is something we actually want to recommend people use? I don't mind having it in C++.
@ -869,0 +900,4 @@
"Override automatic translation context of the given text");
RNA_def_property_clear_flag(parm, PROP_NEVER_NULL);
RNA_def_boolean(
func, "translate", true, "", "Translate the given text, when UI translation is enabled");
To deduplicate code, I suggest to add a
api_ui_item_common_text_translation
with these two properties, that is then also called byapi_ui_item_common_text
.You are right. It makes sense that we might want to have the Cancel be default for confirmations, but these dialogs are always the result of deliberate actions.
At first I thought there might be need for this in some places, but have not found any examples where we'd want the "do nothing" path to have a different button text. If you can think of any that would be really appreciated. The obvious "Yes" and "No" dialogs are problematic in that they can require careful parsing of a question in the content to know you are taking the right path, while Action/Cancel is much clearer. And I cringe at the idea of a clever addon maker using a cancel synonym like "Outa Here!." LOL
Looks good to me now.
I think we should ensure the available arguments and styling is consistent for other popups in 4.1. I guess the plan would be to follow up this change with further PR(s) for the other popups?
The one potentially controversial change is
invoke_confirm
I think. We could add acompact
argument there which defaults toTrue
for the existing behavior. Though it may also be reasonable to just have the new layout, or at least switch the default of such an option toFalse
; but that is a decision to be agreed in the UI module.Almost immediately after this I was going to propose what I think is a nice way to do the custom confirmations without that "confirm" callback.
Early on with the confirmations I did have a
compact
size for the default confirm but proposing any changes to that was tough, mostly with mouse move quit behavior making it hard to find a consensus. We can talk it through in the upcoming module meeting.@blender-bot build
I missed that this is making the description the title everywhere. That just doesn't work, the description is not meant for this. It is often much too long and contains too many details that make no sense as a title. It also often uses alternative wording than the operator name intentionally to help clarify, but it's not a good title.
I will revert that part of the change in main now, because it breaks a lot of popups.
That makes sense. using
WM_operatortype_name
is perfect. Thanks!