diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-01-16 17:04:06 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-01-16 17:56:45 +0300 |
commit | 32f0bb052308a31313ba2abc15e59f5a5e668bbe (patch) | |
tree | 14bfe0c453d3befb88ffe5fa5c809f9e84dca600 /source/blender/blenkernel | |
parent | 216291ddb39e3460361b8bd7350878a30e34945b (diff) |
Fix T70766 EEVEE: Performance drop with node tree in 2.81
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 14 |
2 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 11f151af44d..b599e1e1b2c 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -545,7 +545,8 @@ void nodeRemoveNode(struct Main *bmain, struct bNode *BKE_node_copy_ex(struct bNodeTree *ntree, const struct bNode *node_src, - const int flag); + const int flag, + const bool unique_name); /* Same as BKE_node_copy_ex() but stores pointers to a new node and its sockets in the source * node. diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 13169d9ace8..75e0d044c7c 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1089,7 +1089,11 @@ static void node_socket_copy(bNodeSocket *sock_dst, const bNodeSocket *sock_src, /* keep socket listorder identical, for copying links */ /* ntree is the target tree */ -bNode *BKE_node_copy_ex(bNodeTree *ntree, const bNode *node_src, const int flag) +/* unique_name needs to be true. It's only disabled for speed when doing GPUnodetrees. */ +bNode *BKE_node_copy_ex(bNodeTree *ntree, + const bNode *node_src, + const int flag, + const bool unique_name) { bNode *node_dst = MEM_callocN(sizeof(bNode), "dupli node"); bNodeSocket *sock_dst, *sock_src; @@ -1098,7 +1102,9 @@ bNode *BKE_node_copy_ex(bNodeTree *ntree, const bNode *node_src, const int flag) *node_dst = *node_src; /* can be called for nodes outside a node tree (e.g. clipboard) */ if (ntree) { - nodeUniqueName(ntree, node_dst); + if (unique_name) { + nodeUniqueName(ntree, node_dst); + } BLI_addtail(&ntree->nodes, node_dst); } @@ -1186,7 +1192,7 @@ static void node_set_new_pointers(bNode *node_src, bNode *new_node) bNode *BKE_node_copy_store_new_pointers(bNodeTree *ntree, bNode *node_src, const int flag) { - bNode *new_node = BKE_node_copy_ex(ntree, node_src, flag); + bNode *new_node = BKE_node_copy_ex(ntree, node_src, flag, true); node_set_new_pointers(node_src, new_node); return new_node; } @@ -1516,7 +1522,7 @@ void BKE_node_tree_copy_data(Main *UNUSED(bmain), GHash *new_pointers = BLI_ghash_ptr_new("BKE_node_tree_copy_data"); for (const bNode *node_src = ntree_src->nodes.first; node_src; node_src = node_src->next) { - bNode *new_node = BKE_node_copy_ex(ntree_dst, node_src, flag_subdata); + bNode *new_node = BKE_node_copy_ex(ntree_dst, node_src, flag_subdata, true); BLI_ghash_insert(new_pointers, (void *)node_src, new_node); /* Store mapping to inputs. */ bNodeSocket *new_input_sock = new_node->inputs.first; |