diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-08-01 18:05:53 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-08-01 18:05:53 +0300 |
commit | 03bbd5f9dedf7b3dfea7119c172c61f0b50ae28c (patch) | |
tree | 79ab34e79af6a700c6f73f331e4ee4e253ab3751 /source/blender/blenkernel/intern/curve.c | |
parent | 2204bfcf9e1c3a38e60830bd97775dd72158f4d6 (diff) | |
parent | 49b2162309da6abf66764d41d9fc4c45ad01936c (diff) |
Merge branch 'master' into temp-gpencil-drw-engine
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 931c0ed73d3..efdfa2c19bb 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -5313,6 +5313,32 @@ void BKE_curve_material_index_remove(Curve *cu, int index) } } +bool BKE_curve_material_index_used(Curve *cu, int index) +{ + const int curvetype = BKE_curve_type_get(cu); + + if (curvetype == OB_FONT) { + struct CharInfo *info = cu->strinfo; + int i; + for (i = cu->len_wchar - 1; i >= 0; i--, info++) { + if (info->mat_nr == index) { + return true; + } + } + } + else { + Nurb *nu; + + for (nu = cu->nurb.first; nu; nu = nu->next) { + if (nu->mat_nr == index) { + return true; + } + } + } + + return false; +} + void BKE_curve_material_index_clear(Curve *cu) { const int curvetype = BKE_curve_type_get(cu); |