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:
authorBastien Montagne <bastien@blender.org>2020-06-19 17:55:24 +0300
committerBastien Montagne <bastien@blender.org>2020-06-19 18:01:20 +0300
commitf6b23c63e1d7aae45ac97b92d4b57d550c6051bc (patch)
treeeb5dd0f5fce1f505bfadcc828bba0bd3f1182832
parent9905f5725c366b6ee8b159a7293e8bd273922dfa (diff)
LibOverride: Parallelize diffing of Main database.
This will not give any noticeable improvements in common editing tasks, since then usually only a very few IDs are changed and checked for override updates. However, it makes full override diffing process several times faster (happens usually when saving a .blend file, but could also help e.g. when multi-editing several override objects at the same time...).
-rw-r--r--source/blender/blenkernel/intern/lib_override.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 64ed41e3a08..28d8b5932a1 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -40,6 +40,7 @@
#include "BLI_ghash.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
+#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "RNA_access.h"
@@ -796,6 +797,14 @@ bool BKE_lib_override_library_operations_create(Main *bmain,
return ret;
}
+static void lib_override_library_operations_create_cb(TaskPool *__restrict pool, void *taskdata)
+{
+ Main *bmain = BLI_task_pool_user_data(pool);
+ ID *id = taskdata;
+
+ BKE_lib_override_library_operations_create(bmain, id, false);
+}
+
/** Check all overrides from given \a bmain and create/update overriding operations as needed. */
void BKE_lib_override_library_main_operations_create(Main *bmain, const bool force_auto)
{
@@ -811,15 +820,21 @@ void BKE_lib_override_library_main_operations_create(Main *bmain, const bool for
BKE_lib_override_library_main_tag(bmain, IDOVERRIDE_LIBRARY_TAG_UNUSED, true);
}
+ TaskPool *task_pool = BLI_task_pool_create(bmain, TASK_PRIORITY_HIGH);
+
FOREACH_MAIN_ID_BEGIN (bmain, id) {
if ((ID_IS_OVERRIDE_LIBRARY(id) && force_auto) ||
(id->tag & LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH)) {
- BKE_lib_override_library_operations_create(bmain, id, force_auto);
+ BLI_task_pool_push(task_pool, lib_override_library_operations_create_cb, id, false, NULL);
id->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH;
}
}
FOREACH_MAIN_ID_END;
+ BLI_task_pool_work_and_wait(task_pool);
+
+ BLI_task_pool_free(task_pool);
+
if (force_auto) {
BKE_lib_override_library_main_unused_cleanup(bmain);
}