From 740ca1b85880eda3b9e64462686ce2334557da8c Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 5 Dec 2023 09:33:03 +0100 Subject: [PATCH] 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 295bc1249a85, a listener for `NC_GEOM` > `ND_DATA` was added to the Outliner in order to update when renaming bones (c4622c405e40). 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 was notifiying XXX). This case was added separately now. --- source/blender/editors/armature/armature_naming.cc | 4 ++-- .../editors/space_outliner/space_outliner.cc | 13 ++++++++++++- source/blender/makesrna/intern/rna_armature.cc | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/armature/armature_naming.cc b/source/blender/editors/armature/armature_naming.cc index ca28c2e78a6..bcaab8c2803 100644 --- a/source/blender/editors/armature/armature_naming.cc +++ b/source/blender/editors/armature/armature_naming.cc @@ -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); diff --git a/source/blender/editors/space_outliner/space_outliner.cc b/source/blender/editors/space_outliner/space_outliner.cc index 381eb0321ab..bd4eb172b11 100644 --- a/source/blender/editors/space_outliner/space_outliner.cc +++ b/source/blender/editors/space_outliner/space_outliner.cc @@ -211,9 +211,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: @@ -269,6 +273,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; } } diff --git a/source/blender/makesrna/intern/rna_armature.cc b/source/blender/makesrna/intern/rna_armature.cc index f4c8a6a1eb9..e1f61cdec78 100644 --- a/source/blender/makesrna/intern/rna_armature.cc +++ b/source/blender/makesrna/intern/rna_armature.cc @@ -517,8 +517,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); -- 2.30.2