IDManagement: Update the Purge operator to display an interactive popup. #117304
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#117304
Loading…
Reference in New Issue
No description provided.
Delete Branch "mont29/blender:tmp-purge-as-popup"
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?
Make the 'purge' operation show an interactive popup by default, with a preview of the type and amount of data-blocks to be deleted.
Idea and initial UI/UX design are from @Harley (see PR !117242).
Some changes were also needed in
BKE_lib_query_unused_ids_tag
, toaddress some new needs from this new feature, and already existing
issues:
them (existing issue, would leave dirty tagging behind in case of
operator cancelling).
NOTE: These changes should be split in two commits (BKE_lib_query, and the outliner operator).
One main TODO that should be worked on in this PR is to allow a single call to
BKE_lib_query_unused_ids_tag
to generate all needed statistics. This call is not exactly cheap, having to do it three times is... suboptimal to say the least.In my opinion, the design of the popup in #117242 is much better. I think generic "Ok" buttons should be avoided, and the layout and spacing of the UI elements is not that pleasant.
I think on a technical level an argument can be made that making this kind of dialog should not involve much code, and ideally either the existing mechanism should be made to have a better layout or creating custom dialogs should be simpler. But I do think the improved design is worth something.
Totally agree. This is why am saying that the
WM_operator_props_dialog_popup
high-level operator-aware code should be worked on first.@ -2217,0 +2279,4 @@
uiItemR(layout, ptr, "do_recursive", UI_ITEM_NONE, nullptr, ICON_NONE);
label = IFACE_("To be deleted");
I don't think this total count is needed.
If it's needed to show recursive IDs as well, I think those should be behind that option.
Now, these are just the sum of the local and linked numbers, so indeed not really that useful.
@ -2253,0 +2331,4 @@
* `linked_ids_num` is the expected amount of linked IDs to be deleted with current settings
* (result may vary depending on `do_recursive` and `do_local_ids` settings).
*/
PropertyRNA *prop = RNA_def_int_array(ot->srna,
I don't think RNA properties should be used as a cache like this. Any reason not to store them in
op->customdata
?If it's to use them in a Adjust Last Operation panel, I don't think this operator should show there.
Very good point.
I need to check, but I do hope this operator does not show there indeed.Otherwise, this will have to be fixed.
@blender-bot build
@Harley think the UI is now the same as the one in !117242?
Note that I did not port the new
Manage Unused Data
operation, this one can be committed separately.Also, I think these changes are worth having in 4.1 (including the new
Manage Unused Data
from !117242), do we all agree that even if they are not formally approved yet before BCon3, it can still be committed to the release branch, provided it is within a few days from now?@blender-bot build
I apologize that the following will be maddening, because I know you were trying hard to copy what I did in #117242 and I really do appreciate that.
But #117242 is flawed. In hindsight I think props dialogs should have not have that layout with icon. With #117242 I was purposely making a bespoke thing so added some flourishes like the icon and made it look pretty like the other custom confirmation dialogs. I had the freedom to do anything and so used that license. But I think that icon was incorrect.
For confirmations they make sense. There is an action poised to go, so the dialog is an "are you sure?" So a "caution" icon makes sense.
But for properties dialogs the action isn't poised to go, but being created by the user right then in the dialog itself. I don't think that needs a caution or any other icon. In the same way that "Adjust Last Operation" wouldn't need caution.
I think if you just take out the changes to
WM_operator_props_dialog_popup
so it would not have an icon, nor be WM_POPUP_SIZE_LARGE. It would then calm this down a bit and get narrower. I think it just needs a spacing label to give a gap between the title and the rest of the content. It would look a bit more utilitarian, but I think that is what we probably want for these?And the "Manage Unused Data" can just be a different menu item, rather than bundled in this like in mine.
I personally would make this a target for 4.2. Then it would a change introduced at the same time as other dialog changes planned for that version.
Using the regular props dialog is fine with me, it looks a little better than it did before too.
@ -695,0 +704,4 @@
std::array<int, INDEX_ID_MAX> *num_total;
std::array<int, INDEX_ID_MAX> *num_local;
std::array<int, INDEX_ID_MAX> *num_linked;
Maybe these 6 members could be moved into a struct that is defined in the BKE header? I don't feel particularly strongly about it, just would simplify argument passing a bit.
I was thinking you'd reference
LibQueryUnusedIDsData
in this struct directly.@ -695,0 +715,4 @@
std::array<int, INDEX_ID_MAX> &num_local,
std::array<int, INDEX_ID_MAX> &num_linked)
{
BKE_main_relations_tag_set(bmain, MAINIDRELATIONS_ENTRY_TAGS_PROCESSED, false);
I think it would be more clear to call
BKE_main_relations_tag_set
outside of this. To me it's more clear if this struct just does counting, it's a bit unexpected to me that reset does more.@ -2251,2 +2321,4 @@
"Recursively check for indirectly unused data-blocks, ensuring that no orphaned "
"data-blocks remain after execution");
/* 'Cached' computed values.
This code can be removed now?
@ -21,3 +21,3 @@
# define RNA_MAX_ARRAY_LENGTH 64
#else
# define RNA_MAX_ARRAY_LENGTH 32
# define RNA_MAX_ARRAY_LENGTH 64
This change would also no longer be needed.
@blender-bot build
@Harley no problem, this is trivial to undo. :)
I don't mind either waiting for 4.2 if you think it's more consistent with other UI changes.
WIP: Quick prototype for showing Purge operator in a popup.to Updated the Purge operator to display an interactive popup.Updated the Purge operator to display an interactive popup.to IDManagement: Update the Purge operator to display an interactive popup.@ -693,2 +694,4 @@
/* ***** IDs usages.checking/tagging. ***** */
struct UnusedIdsData {
Main *bmain;
This can be removed now.
No, this is internal data not exposed in the header/public functions, it serves a different purpose as the public
LibQueryUnusedIDsData
one.Will add a comment about it.
Looks good to me overall now.
I think the design could be improved, but not strictly a blocker and maybe @Harley can do it.
One thought is to measure the text here, so it can get wider as needed:
Moved it under, and made it darker (although the 'disabled' layout trick might make it too dark now?). Would rather avoid splitting in multiple lines if we can, this is not exactly trivial.
Done.
This is.... somewhat orthogonal, the 'plural' name of IDTypeInfo is currently not supposed to be used in UI at all. Will likely need an new set of strings. For now for this PR, would say either leaves as-is, or always use singular form.
Added something like that, now when there is nothing to delete the popup is as narrow as possible (limited by title width):
@ -2172,0 +2178,4 @@
max_messages_width,
BLF_width(style->widget.uifont_id, unused_message.c_str(), BLF_DRAW_STR_DUMMY_MAX));
return int(std::max(max_messages_width, 150.0f));
Use 300 like other dialogs, this looks too narrow.
@ -2217,0 +2292,4 @@
uiLayout *column = uiLayoutColumn(layout, true);
uiItemR(column, ptr, "do_local_ids", UI_ITEM_NONE, nullptr, ICON_NONE);
uiLayout *row = uiLayoutRow(column, true);
uiLayoutSetActive(row, false);
Actually testing, I don't think this is needed. The text is already darker than the checkbox text without this, so no need.
@ -2217,0 +2301,4 @@
column = uiLayoutColumn(layout, true);
uiItemR(column, ptr, "do_linked_ids", UI_ITEM_NONE, nullptr, ICON_NONE);
row = uiLayoutRow(column, true);
uiLayoutSetActive(row, false);
Same.
FWIW, here is a before and after comparison with the horizontal rule I was going to propose adding to props dialogs after #117310. To me it seems to do a good job of separating the title part from the rest. With confirmations it seems okay that the title and message text can be seen as a group, but for these I think it would be nice to separate these sections.
Mentioning here so you can weigh in with an example we are now very familiar with.
Yes, the separator helps here, and seems good to add for all dialogs that have both a title and properties.
@blender-bot build
I think this is great! It makes so much more sense to do this in this way, rather than my bespoke dialog.
Although I think if you guys are rushing to get this into 4.1 then I think I would push for that horizontal rule as well.
@brecht do you think this could go in 4.1? If yes, indeed I think the ruler under the title should also be done in 4.1.
Otherwise we can commit this to main, am fine with both solutions.
Maybe best to leave it for 4.2, in the general spirit of trying to respect the release scheduler better.
5286023150
to15024cd96f
@blender-bot build
Hey @mont29 I have some feedback on how this works in practice now:
Now that this functionality has been merged into a single operator it's important to choose sensible defaults. Imo when it comes to 'purging unused data' it's reasonable to do this recursively by default. The way it works right now, you'll probably be left with unused data after the operation. Personally, since the recursive functionality has been introduced, I hardly ever used the non-recursive version again.
So both for convenience and also for logical consistency with the name of the operator I'd change the default of the recursive toggle to be True.
CC @Mets
@SimonThommes I agree. It does not make any sense to have the same naming as in the Outliner, but with different default options. Will fix, thanks for the suggestion!
@SimonThommes done as
b56457aa5e
.I am confused. The improvement of purge operators is gravely needed, but I don't understand how the most crucial feature is omitted - actually knowing what I am about to delete?!
Original design by @Harley addressed this. User would be aware which exact datablocks are getting deleted. But this one doesn't do that.
It's frustrating that this is finally getting touched after being so needed for years, but the change fails to address the main concern about being able to know which data I am deleting before I delete it. If it just tells me "10 materials" I have absolutely no clue if those 10 materials contain some important ones I forgot to mark as fake user.
@Rawalanche the issue here is purely UI-related: How do you show potentially hundreds of different IDs to be deleted to the user in a useful way?
The immediately unused data can be found in details in the Outliner 'Orphaned' view. For the others, we do not have a solution (aka UI/UX design) currently afaik.
Either scrollable list or at the very least icon/button you can hover over to show popover with a text list. If you make a point that seeing large amount (potentially hundreds) of different IDs us not useful to the user, then you are making a point that Outliner 'Orphaned' view is pretty much useless and should not exist.
I'm not sure which original @Harley design this is referring to. Maybe the Managed Unused Data operator that landed separately in #118435?
@Rawalanche
I'm not seeing any difference between what I originally proposed and what we have now. My original dialog also only showed "10 Objects, 3 Materials, ..." etc.
In my original proposal the new "Purge" dialog also included a button on it, "Manage" that opened Outliner Orphan Data view in a new window. My thoughts at the time were that if you saw "10 materials" and were unsure you could click that button and delete things, or not, in a more detailed manner. I also liked that the one item could mean the removal of the File / Cleanup menu so bringing this up a level.
But we all decided that combining the two things on the one dialog was awkward and arbitrary. So now we have everything I proposed, but just in two different items in the Cleanup menu. And with the added bonus that the Purge dialog was coded in a far better way by Bastien.
Is there something else about this, or the way they are combined, that you don't like? I'm not sure that we'd want to put more details on the Purge dialog since this would remain a binary "delete or not" choice. If we had to list each item with a checkbox then you as well just use the "Manage Unused Data" instead.
Or am I missing something?