copy animdata and id-props when copying material node tree's to avoid double memory...
[blender.git] / source / blender / blenkernel / intern / node.c
index 0f3dc4b1a5a54f51cb4e0858675f5f88e6cb2f8e..1601697bbdb6ee4d037ac79e31d2ede28062958e 100644 (file)
@@ -1105,10 +1105,12 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree, int internal_select)
                /* is ntree part of library? */
                for(newtree=G.main->nodetree.first; newtree; newtree= newtree->id.next)
                        if(newtree==ntree) break;
-               if(newtree)
+               if(newtree) {
                        newtree= copy_libblock(ntree);
-               else
+               } else {
                        newtree= MEM_dupallocN(ntree);
+                       copy_libblock_data(&newtree->id, &ntree->id); /* copy animdata and ID props */
+               }
                newtree->nodes.first= newtree->nodes.last= NULL;
                newtree->links.first= newtree->links.last= NULL;
        }