Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-08-22 13:35:46 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-22 13:35:46 +0400
commit2b9fd376e1d0aa9491d8b842b7b45cc5beac5fbe (patch)
tree77aba0bee2e60d05fe87a738d1fb9124515cffd0 /source/blender/blenkernel/intern/material.c
parenta4fd9f827b5792538da664d1a5eaea2db9472b90 (diff)
all areas of blender now do node tree id user count management, except for some exceptions like making a node tree local and material clipboard.
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r--source/blender/blenkernel/intern/material.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index a1288b8af08..8a26a1b52c5 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -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);
}