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.
This commit is contained in:
@@ -3259,3 +3259,28 @@ void curve_translate(Curve *cu, float offset[3], int do_keys)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void curve_delete_material_index(Curve *cu, int index)
|
||||
{
|
||||
const int curvetype= curve_type(cu);
|
||||
|
||||
if(curvetype == OB_FONT) {
|
||||
struct CharInfo *info= cu->strinfo;
|
||||
int i;
|
||||
for(i= cu->len-1; i >= 0; i--, info++) {
|
||||
if (info->mat_nr && info->mat_nr>=index) {
|
||||
info->mat_nr--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Nurb *nu;
|
||||
|
||||
for (nu= cu->nurb.first; nu; nu= nu->next) {
|
||||
if(nu->mat_nr && nu->mat_nr>=index) {
|
||||
nu->mat_nr--;
|
||||
if (curvetype == OB_CURVE) nu->charidx--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user