diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-20 15:16:22 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-20 15:16:22 +0300 |
commit | c6ab9117447ab65159d2a77f4be734624929c8ef (patch) | |
tree | a9521d75544f10b93fb6ec5a48f6472ff29a92eb | |
parent | 984a78e76385a3dc02a956ea903754fdb177bd97 (diff) | |
parent | fd48e685c3077b781d8b81b8d5048c49d2ad5091 (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 6695d145a9a..9de31205504 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -314,7 +314,9 @@ void ntreeTypeAdd(bNodeTreeType *nt) { BLI_ghash_insert(nodetreetypes_hash, nt->idname, nt); /* XXX pass Main to register function? */ - update_typeinfo(G.main, NULL, nt, NULL, NULL, false); + /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all* + * active Mains, which we cannot do anyway currently. */ + update_typeinfo(G_MAIN, NULL, nt, NULL, NULL, false); } /* callback for hash value free function */ @@ -322,7 +324,9 @@ static void ntree_free_type(void *treetype_v) { bNodeTreeType *treetype = treetype_v; /* XXX pass Main to unregister function? */ - update_typeinfo(G.main, NULL, treetype, NULL, NULL, true); + /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all* + * active Mains, which we cannot do anyway currently. */ + update_typeinfo(G_MAIN, NULL, treetype, NULL, NULL, true); MEM_freeN(treetype); } @@ -371,7 +375,9 @@ static void node_free_type(void *nodetype_v) { bNodeType *nodetype = nodetype_v; /* XXX pass Main to unregister function? */ - update_typeinfo(G.main, NULL, NULL, nodetype, NULL, true); + /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all* + * active Mains, which we cannot do anyway currently. */ + update_typeinfo(G_MAIN, NULL, NULL, nodetype, NULL, true); /* XXX deprecated */ if (nodetype->type == NODE_DYNAMIC) @@ -389,7 +395,9 @@ void nodeRegisterType(bNodeType *nt) BLI_ghash_insert(nodetypes_hash, nt->idname, nt); /* XXX pass Main to register function? */ - update_typeinfo(G.main, NULL, NULL, nt, NULL, false); + /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all* + * active Mains, which we cannot do anyway currently. */ + update_typeinfo(G_MAIN, NULL, NULL, nt, NULL, false); } void nodeUnregisterType(bNodeType *nt) @@ -425,7 +433,9 @@ static void node_free_socket_type(void *socktype_v) { bNodeSocketType *socktype = socktype_v; /* XXX pass Main to unregister function? */ - update_typeinfo(G.main, NULL, NULL, NULL, socktype, true); + /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all* + * active Mains, which we cannot do anyway currently. */ + update_typeinfo(G_MAIN, NULL, NULL, NULL, socktype, true); MEM_freeN(socktype); } @@ -434,7 +444,9 @@ void nodeRegisterSocketType(bNodeSocketType *st) { BLI_ghash_insert(nodesockettypes_hash, (void *)st->idname, st); /* XXX pass Main to register function? */ - update_typeinfo(G.main, NULL, NULL, NULL, st, false); + /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all* + * active Mains, which we cannot do anyway currently. */ + update_typeinfo(G_MAIN, NULL, NULL, NULL, st, false); } void nodeUnregisterSocketType(bNodeSocketType *st) @@ -1789,7 +1801,6 @@ static void free_localized_node_groups(bNodeTree *ntree) /** Free (or release) any data used by this nodetree (does not free the nodetree itself). */ void ntreeFreeTree(bNodeTree *ntree) { - bNodeTree *tntree; bNode *node, *next; bNodeSocket *sock, *nextsock; @@ -1846,10 +1857,7 @@ void ntreeFreeTree(bNodeTree *ntree) BLI_mutex_free(ntree->duplilock); /* if ntree is not part of library, free the libblock data explicitly */ - for (tntree = G.main->nodetree.first; tntree; tntree = tntree->id.next) - if (tntree == ntree) - break; - if (tntree == NULL) { + if (ntree->id.tag & LIB_TAG_NO_MAIN) { BKE_libblock_free_data(&ntree->id, true); } } @@ -2603,7 +2611,8 @@ bool BKE_node_clipboard_validate(void) /* currently only validate the ID */ if (node->id) { - ListBase *lb = which_libbase(G.main, GS(node_info->id_name)); + /* We want to search into current blend file, so using G_MAIN is valid here too. */ + ListBase *lb = which_libbase(G_MAIN, GS(node_info->id_name)); BLI_assert(lb != NULL); if (BLI_findindex(lb, node_info->id) == -1) { |