svn merge ^/trunk/blender -r41226:41227 .
[blender.git] / source / blender / blenkernel / intern / node.c
index 6a3e035..c450b46 100644 (file)
@@ -1039,7 +1039,6 @@ static void ntreeMakeLocal_LinkNew(void *calldata, ID *owner_id, bNodeTree *ntre
 
 void ntreeMakeLocal(bNodeTree *ntree)
 {
-       Main *bmain= G.main;
        bNodeTreeType *treetype= ntreeGetType(ntree->type);
        MakeLocalCallData cd;
        
@@ -1050,7 +1049,9 @@ void ntreeMakeLocal(bNodeTree *ntree)
        
        if(ntree->id.lib==NULL) return;
        if(ntree->id.us==1) {
-               id_clear_lib_data(&bmain->nodetree, (ID *)ntree);
+               ntree->id.lib= NULL;
+               ntree->id.flag= LIB_LOCAL;
+               new_id(NULL, (ID *)ntree, NULL);
                return;
        }
        
@@ -1064,7 +1065,9 @@ void ntreeMakeLocal(bNodeTree *ntree)
        
        /* if all users are local, we simply make tree local */
        if(cd.local && cd.lib==0) {
-               id_clear_lib_data(&bmain->nodetree, (ID *)ntree);
+               ntree->id.lib= NULL;
+               ntree->id.flag= LIB_LOCAL;
+               new_id(NULL, (ID *)ntree, NULL);
        }
        else if(cd.local && cd.lib) {
                /* this is the mixed case, we copy the tree and assign it to local users */