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>2011-07-31 16:43:41 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-07-31 16:43:41 +0400
commitc74bb09584371520b9b557cbaa8ae13356bf5e1a (patch)
tree1ab1a63110148b10a4a2808e17078075f71eaf66 /source/blender/blenkernel/intern/material.c
parent5b3bb373432d5b0b9c4ab1135a6f344831cb83a9 (diff)
fix for material slot removal (r38879)
- The object ID was being passed to the data_delete_material_index_id() from object_remove_material_slot(), rather then the object data. (so the material slot fix wouldnt run in that case). - add support for fixing text object materials too.
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r--source/blender/blenkernel/intern/material.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 1f2544c9706..9c455e84109 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -517,31 +517,15 @@ short *give_totcolp_id(ID *id)
void data_delete_material_index_id(ID *id, int index)
{
- Mesh *me;
- Curve *cu;
- Nurb *nu;
- int curvetype;
-
switch(GS(id->name)) {
case ID_ME:
- me=(Mesh *)id;
- mesh_delete_material_index(me, index);
+ mesh_delete_material_index((Mesh *)id, index);
break;
case ID_CU:
- cu= (Curve *)id;
- nu= cu->nurb.first;
-
- curvetype=curve_type(cu);
- if (!ELEM(curvetype, OB_CURVE, OB_SURF))
- return;
-
- while (nu) {
- if(nu->mat_nr && nu->mat_nr>=index) {
- nu->mat_nr--;
- if (curvetype == OB_CURVE) nu->charidx--;
- }
- nu= nu->next;
- }
+ curve_delete_material_index((Curve *)id, index);
+ break;
+ case ID_MB:
+ /* meta-elems dont have materials atm */
break;
}
}
@@ -1124,8 +1108,8 @@ int object_remove_material_slot(Object *ob)
}
/* check indices from mesh */
- if (ELEM3(ob->type, OB_MESH, OB_CURVE, OB_SURF)) {
- data_delete_material_index_id(&ob->id, actcol-1);
+ if (ELEM4(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT)) {
+ data_delete_material_index_id((ID *)ob->data, actcol-1);
freedisplist(&ob->disp);
}