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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-08-22 21:22:04 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-08-22 21:22:04 +0400
commitb0dd030ba61fe81914d14e520f710684a2406900 (patch)
treef4f0027962b9aff73220bdeda00a974794875b1b /source/blender/blenkernel
parent1939baa47d6d6cd6cedb7440bc7b8e988fe6c702 (diff)
Fixed regression introduced in 50107
Shader preview job localizes material without referencing it as a user, so don't need to unreference itself as a user from this material. Added BKE_material_free_ex function which could skip user dereferencing. This also removed old hack with mtex users.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_material.h1
-rw-r--r--source/blender/blenkernel/intern/material.c10
2 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index 030af85ba84..dd1b1a7752b 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -48,6 +48,7 @@ struct Scene;
void init_def_material(void);
void BKE_material_free(struct Material *sc);
+void BKE_material_free_ex(struct Material *ma, int do_id_user);
void test_object_materials(struct ID *id);
void resize_object_material(struct Object *ob, const short totcol);
void init_material(struct Material *ma);
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 8a26a1b52c5..fd167c69e62 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -80,12 +80,18 @@ void init_def_material(void)
/* not material itself */
void BKE_material_free(Material *ma)
{
+ BKE_material_free_ex(ma, TRUE);
+}
+
+/* not material itself */
+void BKE_material_free_ex(Material *ma, int do_id_user)
+{
MTex *mtex;
int a;
for (a = 0; a < MAX_MTEX; a++) {
mtex = ma->mtex[a];
- if (mtex && mtex->tex) mtex->tex->id.us--;
+ if (do_id_user && mtex && mtex->tex) mtex->tex->id.us--;
if (mtex) MEM_freeN(mtex);
}
@@ -101,7 +107,7 @@ void BKE_material_free(Material *ma)
/* is no lib link block, but material extension */
if (ma->nodetree) {
- ntreeFreeTree(ma->nodetree);
+ ntreeFreeTree_ex(ma->nodetree, do_id_user);
MEM_freeN(ma->nodetree);
}