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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-07-07 22:18:04 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-07-07 22:21:33 +0300
commit3fb2c1e4a2f99d5de2326ab593c1d900e164e5bd (patch)
treee4a924569c109d99e6f8c3bc92447058b6a8baa0 /source
parente2d469f8786530488ea3afc257b3ff33c07990fc (diff)
Make use of new 'idtype can use idtype' check (in ID usages code, and ID remapping one too).
Reduces calls to BKE_library_foreach_ID_link() from 312 to 105 when relocating a library in a rather simple lib reload test...
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/library_query.c14
-rw-r--r--source/blender/blenkernel/intern/library_remap.c4
2 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index afee80d5206..d068a394089 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -960,14 +960,19 @@ static bool library_ID_is_used(Main *bmain, void *idv, const bool check_linked)
{
IDUsersIter iter;
ListBase *lb_array[MAX_LIBARRAY];
+ ID *id = idv;
int i = set_listbasepointers(bmain, lb_array);
bool is_defined = false;
- iter.id = idv;
+ iter.id = id;
iter.count = 0;
while (i-- && !is_defined) {
ID *id_curr = lb_array[i]->first;
+ if (!id_curr || !BKE_library_idtype_can_use_idtype(GS(id->name), GS(id_curr->name))) {
+ continue;
+ }
+
for (; id_curr && !is_defined; id_curr = id_curr->next) {
if (check_linked != ID_IS_LINKED_DATABLOCK(id_curr)) {
continue;
@@ -1007,14 +1012,19 @@ void BKE_library_ID_test_usages(Main *bmain, void *idv, bool *is_used_local, boo
{
IDUsersIter iter_local, iter_linked;
ListBase *lb_array[MAX_LIBARRAY];
+ ID *id = idv;
int i = set_listbasepointers(bmain, lb_array);
bool is_defined = false;
- iter_local.id = iter_linked.id = idv;
+ iter_local.id = iter_linked.id = id;
iter_local.count = iter_linked.count = 0;
while (i-- && !is_defined) {
ID *id_curr = lb_array[i]->first;
+ if (!id_curr || !BKE_library_idtype_can_use_idtype(GS(id->name), GS(id_curr->name))) {
+ continue;
+ }
+
for (; id_curr && !is_defined; id_curr = id_curr->next) {
IDUsersIter *iter = (ID_IS_LINKED_DATABLOCK(id_curr)) ? &iter_linked : &iter_local;
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index a290c1c8cf5..491994a9555 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -283,6 +283,10 @@ static void libblock_remap_data(
while (i--) {
ID *id_curr = lb_array[i]->first;
+ if (!id_curr || !BKE_library_idtype_can_use_idtype(GS(id_curr->name), GS(old_id->name))) {
+ continue;
+ }
+
for (; id_curr; id_curr = id_curr->next) {
/* Note that we cannot skip indirect usages of old_id here (if requested), we still need to check it for
* the user count handling...