Fix #115662: Outliner slows down many geometry operations in big scenes

This was reported for UV editing but also e.g. some modeling operations
were affected.

In 295bc1249a, a listener for `NC_GEOM` > `ND_DATA` was added to the
Outliner in order to update when renaming bones (c4622c405e).
Since we are only interested in the naming part (no need to update the
Outliner otherwise), the notifier/listener combo was made more specific
by including the `NA_RENAME` action here.

Since this was a very general thing to listen to, other operations might
have relied on this to properly update, but having checked many things,
I could spot only one case where an Outliner update was missing after
the initial change and that was adding images.
This case was added separately now.

Pull Request: https://projects.blender.org/blender/blender/pulls/115799
This commit is contained in:
Philipp Oeser
2023-12-06 10:22:54 +01:00
committed by Philipp Oeser
parent 3d0731e66c
commit 94defad5f1
3 changed files with 16 additions and 5 deletions
@@ -477,8 +477,8 @@ static int armature_flip_names_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
/* copied from #rna_Bone_update_renamed */
/* redraw view */
WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
/* Redraw Outliner / Dopesheet. */
WM_event_add_notifier(C, NC_GEOM | ND_DATA | NA_RENAME, ob->data);
/* update animation channels */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, ob->data);
@@ -214,9 +214,13 @@ static void outliner_main_region_listener(const wmRegionListenerParams *params)
case NC_GEOM:
switch (wmn->data) {
case ND_VERTEX_GROUP:
case ND_DATA:
ED_region_tag_redraw(region);
break;
case ND_DATA:
if (wmn->action == NA_RENAME) {
ED_region_tag_redraw(region);
}
break;
}
break;
case NC_ANIMATION:
@@ -272,6 +276,13 @@ static void outliner_main_region_listener(const wmRegionListenerParams *params)
ED_region_tag_redraw(region);
}
break;
case NC_IMAGE:
if (ELEM(wmn->action, NA_ADDED, NA_REMOVED) &&
ELEM(space_outliner->outlinevis, SO_LIBRARIES, SO_DATA_API))
{
ED_region_tag_redraw(region);
}
break;
}
}
@@ -534,8 +534,8 @@ static void rna_Bone_update_renamed(Main * /*bmain*/, Scene * /*scene*/, Pointer
{
ID *id = ptr->owner_id;
/* redraw view */
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
/* Redraw Outliner / Dopesheet. */
WM_main_add_notifier(NC_GEOM | ND_DATA | NA_RENAME, id);
/* update animation channels */
WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN, id);