Merge branch 'master' into blender2.8

This commit is contained in:
Bastien Montagne 2018-06-20 14:16:22 +02:00
commit c6ab911744

@ -314,7 +314,9 @@ void ntreeTypeAdd(bNodeTreeType *nt)
{ {
BLI_ghash_insert(nodetreetypes_hash, nt->idname, nt); BLI_ghash_insert(nodetreetypes_hash, nt->idname, nt);
/* XXX pass Main to register function? */ /* 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 */ /* callback for hash value free function */
@ -322,7 +324,9 @@ static void ntree_free_type(void *treetype_v)
{ {
bNodeTreeType *treetype = treetype_v; bNodeTreeType *treetype = treetype_v;
/* XXX pass Main to unregister function? */ /* 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); MEM_freeN(treetype);
} }
@ -371,7 +375,9 @@ static void node_free_type(void *nodetype_v)
{ {
bNodeType *nodetype = nodetype_v; bNodeType *nodetype = nodetype_v;
/* XXX pass Main to unregister function? */ /* 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 */ /* XXX deprecated */
if (nodetype->type == NODE_DYNAMIC) if (nodetype->type == NODE_DYNAMIC)
@ -389,7 +395,9 @@ void nodeRegisterType(bNodeType *nt)
BLI_ghash_insert(nodetypes_hash, nt->idname, nt); BLI_ghash_insert(nodetypes_hash, nt->idname, nt);
/* XXX pass Main to register function? */ /* 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) void nodeUnregisterType(bNodeType *nt)
@ -425,7 +433,9 @@ static void node_free_socket_type(void *socktype_v)
{ {
bNodeSocketType *socktype = socktype_v; bNodeSocketType *socktype = socktype_v;
/* XXX pass Main to unregister function? */ /* 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); MEM_freeN(socktype);
} }
@ -434,7 +444,9 @@ void nodeRegisterSocketType(bNodeSocketType *st)
{ {
BLI_ghash_insert(nodesockettypes_hash, (void *)st->idname, st); BLI_ghash_insert(nodesockettypes_hash, (void *)st->idname, st);
/* XXX pass Main to register function? */ /* 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) 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). */ /** Free (or release) any data used by this nodetree (does not free the nodetree itself). */
void ntreeFreeTree(bNodeTree *ntree) void ntreeFreeTree(bNodeTree *ntree)
{ {
bNodeTree *tntree;
bNode *node, *next; bNode *node, *next;
bNodeSocket *sock, *nextsock; bNodeSocket *sock, *nextsock;
@ -1846,10 +1857,7 @@ void ntreeFreeTree(bNodeTree *ntree)
BLI_mutex_free(ntree->duplilock); BLI_mutex_free(ntree->duplilock);
/* if ntree is not part of library, free the libblock data explicitly */ /* if ntree is not part of library, free the libblock data explicitly */
for (tntree = G.main->nodetree.first; tntree; tntree = tntree->id.next) if (ntree->id.tag & LIB_TAG_NO_MAIN) {
if (tntree == ntree)
break;
if (tntree == NULL) {
BKE_libblock_free_data(&ntree->id, true); BKE_libblock_free_data(&ntree->id, true);
} }
} }
@ -2603,7 +2611,8 @@ bool BKE_node_clipboard_validate(void)
/* currently only validate the ID */ /* currently only validate the ID */
if (node->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); BLI_assert(lb != NULL);
if (BLI_findindex(lb, node_info->id) == -1) { if (BLI_findindex(lb, node_info->id) == -1) {