diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-07-31 16:43:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-07-31 16:43:41 +0400 |
commit | c74bb09584371520b9b557cbaa8ae13356bf5e1a (patch) | |
tree | 1ab1a63110148b10a4a2808e17078075f71eaf66 /source/blender/blenkernel/intern/curve.c | |
parent | 5b3bb373432d5b0b9c4ab1135a6f344831cb83a9 (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/curve.c')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 202a3f28d9a..66ab11938f3 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -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--; + } + } + } +} |