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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-01-05 16:15:29 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-01-05 16:15:29 +0300
commit8e29c7b76f23028e679e7dc97c90eba795604b5d (patch)
treeaa8d37591f94490107bba80e398ba2f099830c5c /source/blender/blenkernel/intern/material.c
parent0daebd0ed6e77ef5fd8d4c788d6e73572d9e98b8 (diff)
Material slots: on adding a new one, the material datablock is now copied again
like in 2.4x. This can result in material datablocks you don't need, but not doing it seems to cause too much confusion.
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r--source/blender/blenkernel/intern/material.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 3f18e7f3723..2d123302c3d 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -786,6 +786,13 @@ int object_add_material_slot(Object *ob)
ma= give_current_material(ob, ob->actcol);
+ if(ma == NULL)
+ ma= add_material("Material");
+ else
+ ma= copy_material(ma);
+
+ id_us_min(&ma->id);
+
assign_material(ob, ma, ob->totcol+1);
ob->actcol= ob->totcol;
return TRUE;