diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-02 12:37:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-02 12:37:44 +0400 |
commit | 3986896500e83fbac09c2b377fd41961030d78a3 (patch) | |
tree | d06a13b814a394a7af51b43a2517cd0affbe5384 | |
parent | e9e9f89f1a3f968b3c3c32677e1b7ff2b72c2c0f (diff) |
copying/freeing node trees now adjusts grease pencil user count.
also NULL freed texture node socket data incase its used again by accident.
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 4b40c07b7a9..ba2434bba23 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1193,7 +1193,9 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree) newtree= MEM_dupallocN(ntree); copy_libblock_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */ } - + + id_us_plus((ID *)newtree->gpd); + /* in case a running nodetree is copied */ newtree->init &= ~(NTREE_EXEC_INIT); newtree->threadstack= NULL; @@ -1435,6 +1437,8 @@ void ntreeFreeTree(bNodeTree *ntree) BKE_free_animdata((ID *)ntree); + id_us_min((ID *)ntree->gpd); + BLI_freelistN(&ntree->links); /* do first, then unlink_node goes fast */ for(node= ntree->nodes.first; node; node= next) { @@ -2324,13 +2328,18 @@ static void tex_end_exec(bNodeTree *ntree) bNodeStack *ns; int th, a; - if(ntree->threadstack) - for(th=0; th<BLENDER_MAX_THREADS; th++) - for(nts=ntree->threadstack[th].first; nts; nts=nts->next) - for(ns= nts->stack, a=0; a<ntree->stacksize; a++, ns++) - if(ns->data) + if(ntree->threadstack) { + for(th=0; th<BLENDER_MAX_THREADS; th++) { + for(nts=ntree->threadstack[th].first; nts; nts=nts->next) { + for(ns= nts->stack, a=0; a<ntree->stacksize; a++, ns++) { + if(ns->data) { MEM_freeN(ns->data); - + ns->data= NULL; + } + } + } + } + } } void ntreeBeginExecTree(bNodeTree *ntree) |