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>2009-10-08 13:22:39 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-10-08 13:22:39 +0400
commit8f154364f28d53c58b9a0022f8c36ab787477492 (patch)
treecb229f5ad2a28db173c8f11bdefd304d2d09201e /source/blender/blenkernel/intern/material.c
parent5a7db36b1d6a17d714ad0056d02095feab371e80 (diff)
separate material lost all materials for the new mesh
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 b44c59baaca..c1093c119dc 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -630,8 +630,7 @@ void assign_matarar(struct Object *ob, struct Material ***matar, int totcol)
{
int i, actcol_orig= ob->actcol;
- while(ob->totcol)
- object_remove_material_slot(ob);
+ while(object_remove_material_slot(ob)) {};
/* now we have the right number of slots */
for(i=0; i<totcol; i++)
@@ -664,17 +663,18 @@ int find_material_index(Object *ob, Material *ma)
return 0;
}
-void object_add_material_slot(Object *ob)
+int object_add_material_slot(Object *ob)
{
Material *ma;
- if(ob==0) return;
- if(ob->totcol>=MAXMAT) return;
+ if(ob==0) return FALSE;
+ if(ob->totcol>=MAXMAT) return FALSE;
ma= give_current_material(ob, ob->actcol);
assign_material(ob, ma, ob->totcol+1);
ob->actcol= ob->totcol;
+ return TRUE;
}
static void do_init_render_material(Material *ma, int r_mode, float *amb)
@@ -889,7 +889,7 @@ void automatname(Material *ma)
}
-void object_remove_material_slot(Object *ob)
+int object_remove_material_slot(Object *ob)
{
Material *mao, ***matarar;
Object *obt;
@@ -898,7 +898,7 @@ void object_remove_material_slot(Object *ob)
short *totcolp;
int a, actcol;
- if(ob==NULL || ob->totcol==0) return;
+ if(ob==NULL || ob->totcol==0) return FALSE;
/* take a mesh/curve/mball as starting point, remove 1 index,
* AND with all objects that share the ob->data
@@ -909,6 +909,8 @@ void object_remove_material_slot(Object *ob)
totcolp= give_totcolp(ob);
matarar= give_matarar(ob);
+ if(*matarar==NULL) return FALSE;
+
/* we delete the actcol */
if(ob->totcol) {
mao= (*matarar)[ob->actcol-1];
@@ -971,6 +973,8 @@ void object_remove_material_slot(Object *ob)
}
freedisplist(&ob->disp);
}
+
+ return TRUE;
}