all areas of blender now do node tree id user count management, except for some excep...
[blender.git] / source / blender / blenkernel / intern / material.c
index a1288b8af08c58c47ae5ef26106812f0f6c31f88..8a26a1b52c5c9805af3c1ca2b461f18a776dd1be 100644 (file)
@@ -101,7 +101,7 @@ void BKE_material_free(Material *ma)
        
        /* is no lib link block, but material extension */
        if (ma->nodetree) {
-               ntreeFreeTree_ex(ma->nodetree, FALSE); /* TODO: do_id_user arg needs checking */
+               ntreeFreeTree(ma->nodetree);
                MEM_freeN(ma->nodetree);
        }
 
@@ -235,7 +235,7 @@ Material *BKE_material_copy(Material *ma)
        if (ma->preview) man->preview = BKE_previewimg_copy(ma->preview);
 
        if (ma->nodetree) {
-               man->nodetree = ntreeCopyTree_ex(ma->nodetree, FALSE); /* TODO: do_id_user arg needs checking */
+               man->nodetree = ntreeCopyTree(ma->nodetree);
        }
 
        man->gpumaterial.first = man->gpumaterial.last = NULL;
@@ -1483,7 +1483,11 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
        }
 }
 
-/* copy/paste buffer, if we had a propper py api that would be better */
+/**
+ * \brief copy/paste buffer, if we had a propper py api that would be better
+ * \note matcopybuf.nodetree does _NOT_ use ID's
+ * \todo matcopybuf.nodetree's  node->id's are NOT validated, this will crash!
+ */
 static Material matcopybuf;
 static short matcopied = 0;
 
@@ -1511,7 +1515,7 @@ void free_matcopybuf(void)
        matcopybuf.ramp_spec = NULL;
 
        if (matcopybuf.nodetree) {
-               ntreeFreeTree_ex(matcopybuf.nodetree, FALSE); /* TODO: do_id_user arg needs checking */
+               ntreeFreeTree_ex(matcopybuf.nodetree, FALSE);
                MEM_freeN(matcopybuf.nodetree);
                matcopybuf.nodetree = NULL;
        }
@@ -1537,7 +1541,7 @@ void copy_matcopybuf(Material *ma)
                        matcopybuf.mtex[a] = MEM_dupallocN(mtex);
                }
        }
-       matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, FALSE); /* TODO: do_id_user arg needs checking */
+       matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, FALSE);
        matcopybuf.preview = NULL;
        matcopybuf.gpumaterial.first = matcopybuf.gpumaterial.last = NULL;
        matcopied = 1;
@@ -1561,7 +1565,7 @@ void paste_matcopybuf(Material *ma)
        }
 
        if (ma->nodetree) {
-               ntreeFreeTree_ex(ma->nodetree, FALSE); /* TODO: do_id_user arg needs checking */
+               ntreeFreeTree(ma->nodetree);
                MEM_freeN(ma->nodetree);
        }
 
@@ -1582,7 +1586,7 @@ void paste_matcopybuf(Material *ma)
                }
        }
 
-       ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, FALSE); /* TODO: do_id_user arg needs checking */
+       ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, FALSE);
 }