Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2022-01-25 17:31:46 +0300
committerJeroen Bakker <jeroen@blender.org>2022-01-25 17:31:46 +0300
commit460e0a1347e50d33f5d42235ee2d9cb7208cdc4f (patch)
tree76f51516a6865d42315f9f6f5b30147d75082dcb /source/blender/editors/space_outliner
parent33ba298b5db24b002d936e135c3c84aa2300e6db (diff)
Revert "Performance: Remap multiple items in UI"
This reverts commit 948211679f2a0681421160be0d3b90f507bc0be7. This commit introduced some regressions in the test suite. As this change is a core part of blender Bastien and I decided to revert it as the solution isn't clear and needs more investigation. The following tests FAILED: 62 - blendfile_liblink (SEGFAULT) 63 - blendfile_library_overrides (SEGFAULT) It fails in (id_us_ensure_real)
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/space_outliner.cc65
1 files changed, 30 insertions, 35 deletions
diff --git a/source/blender/editors/space_outliner/space_outliner.cc b/source/blender/editors/space_outliner/space_outliner.cc
index 0fb17fa3f47..bb4e57a79da 100644
--- a/source/blender/editors/space_outliner/space_outliner.cc
+++ b/source/blender/editors/space_outliner/space_outliner.cc
@@ -31,7 +31,6 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
-#include "BKE_lib_remap.h"
#include "BKE_outliner_treehash.h"
#include "BKE_screen.h"
@@ -406,49 +405,45 @@ static SpaceLink *outliner_duplicate(SpaceLink *sl)
return (SpaceLink *)space_outliner_new;
}
-static void outliner_id_remap(ScrArea *area, SpaceLink *slink, const struct IDRemapper *mappings)
+static void outliner_id_remap(ScrArea *area, SpaceLink *slink, ID *old_id, ID *new_id)
{
SpaceOutliner *space_outliner = (SpaceOutliner *)slink;
- BKE_id_remapper_apply(mappings, (ID **)&space_outliner->search_tse.id, ID_REMAP_APPLY_DEFAULT);
-
- if (!space_outliner->treestore) {
- return;
+ /* Some early out checks. */
+ if (!TREESTORE_ID_TYPE(old_id)) {
+ return; /* ID type is not used by outliner. */
}
- TreeStoreElem *tselem;
- BLI_mempool_iter iter;
- bool changed = false;
- bool unassigned = false;
+ if (space_outliner->search_tse.id == old_id) {
+ space_outliner->search_tse.id = new_id;
+ }
- BLI_mempool_iternew(space_outliner->treestore, &iter);
- while ((tselem = static_cast<TreeStoreElem *>(BLI_mempool_iterstep(&iter)))) {
- switch (BKE_id_remapper_apply(mappings, &tselem->id, ID_REMAP_APPLY_DEFAULT)) {
- case ID_REMAP_RESULT_SOURCE_REMAPPED:
- changed = true;
- break;
- case ID_REMAP_RESULT_SOURCE_UNASSIGNED:
+ if (space_outliner->treestore) {
+ TreeStoreElem *tselem;
+ BLI_mempool_iter iter;
+ bool changed = false;
+
+ BLI_mempool_iternew(space_outliner->treestore, &iter);
+ while ((tselem = static_cast<TreeStoreElem *>(BLI_mempool_iterstep(&iter)))) {
+ if (tselem->id == old_id) {
+ tselem->id = new_id;
changed = true;
- unassigned = true;
- break;
- case ID_REMAP_RESULT_SOURCE_UNAVAILABLE:
- case ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE:
- break;
+ }
}
- }
- /* Note that the Outliner may not be the active editor of the area, and hence not initialized.
- * So runtime data might not have been created yet. */
- if (space_outliner->runtime && space_outliner->runtime->treehash && changed) {
- /* rebuild hash table, because it depends on ids too */
- /* postpone a full rebuild because this can be called many times on-free */
- space_outliner->storeflag |= SO_TREESTORE_REBUILD;
-
- if (unassigned) {
- /* Redraw is needed when removing data for multiple outlines show the same data.
- * without this, the stale data won't get fully flushed when this outliner
- * is not the active outliner the user is interacting with. See T85976. */
- ED_area_tag_redraw(area);
+ /* Note that the Outliner may not be the active editor of the area, and hence not initialized.
+ * So runtime data might not have been created yet. */
+ if (space_outliner->runtime && space_outliner->runtime->treehash && changed) {
+ /* rebuild hash table, because it depends on ids too */
+ /* postpone a full rebuild because this can be called many times on-free */
+ space_outliner->storeflag |= SO_TREESTORE_REBUILD;
+
+ if (new_id == nullptr) {
+ /* Redraw is needed when removing data for multiple outlines show the same data.
+ * without this, the stale data won't get fully flushed when this outliner
+ * is not the active outliner the user is interacting with. See T85976. */
+ ED_area_tag_redraw(area);
+ }
}
}
}