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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-04-20 21:25:22 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-04-24 13:44:27 +0300
commitd730e512ac56bd68c75f8c44ff186b51010db4c7 (patch)
treedddf69daf78ac1627db7069ef3012b8ecb54017f /source/blender/blenloader
parent62421470ee09fb70f343eb9fd48b093316c8eea1 (diff)
Nodes: avoid slow and unecessary node group updates on file read
On file read we need to update group nodes in case the group they refer to has changed its inputs and outputs. This had O(n^2) time complexity and was updating all datablocks even if they did not change.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 26a14c12229..f8f43f1fa86 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3454,26 +3454,6 @@ static void lib_link_nodetree(FileData *fd, Main *main)
}
}
-/* Verify group nodes have sockets matching their node groups. All data has
- * to be read and versioned at this point, since this accesses data across
- * files. */
-static void lib_verify_nodetree(Main *main)
-{
- /* verify all group user nodes */
- for (bNodeTree *ntree = main->nodetrees.first; ntree; ntree = ntree->id.next) {
- ntreeVerifyNodes(main, &ntree->id);
- }
-
- /* make update calls where necessary */
- {
- FOREACH_NODETREE_BEGIN (main, ntree, id) {
- /* make an update call for the tree */
- ntreeUpdateTree(main, ntree);
- }
- FOREACH_NODETREE_END;
- }
-}
-
static void direct_link_node_socket(FileData *fd, bNodeSocket *sock)
{
sock->prop = newdataadr(fd, sock->prop);
@@ -9734,13 +9714,13 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
do_versions_after_linking(mainvar);
}
blo_join_main(&mainlist);
+
+ /* After all data has been read and versioned, uses LIB_TAG_NEW. */
+ ntreeUpdateAllNew(bfd->main);
}
BKE_main_id_tag_all(bfd->main, LIB_TAG_NEW, false);
- /* After all data has been read and versioned. */
- lib_verify_nodetree(bfd->main);
-
/* Now that all our data-blocks are loaded, we can re-generate overrides from their references. */
if (fd->memfile == NULL) {
/* Do not apply in undo case! */
@@ -11508,9 +11488,11 @@ static void library_link_end(Main *mainl,
mainvar = (*fd)->mainlist->first;
MEM_freeN((*fd)->mainlist);
+ /* After all data has been read and versioned, uses LIB_TAG_NEW. */
+ ntreeUpdateAllNew(mainvar);
+
BKE_main_id_tag_all(mainvar, LIB_TAG_NEW, false);
- lib_verify_nodetree(mainvar);
fix_relpaths_library(BKE_main_blendfile_path(mainvar),
mainvar); /* make all relative paths, relative to the open blend file */