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>2014-05-26 03:11:42 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-05-26 03:35:32 +0400
commiteaf815f14a928f7d99db93013c9ad8daae539094 (patch)
tree39dbe47367aa37c83ef0f9455e4ea8f707e1acca /source/blender/blenkernel/intern/curve.c
parentf574b1ca3cda82b2cffa992bd4288c44e99cc643 (diff)
Fix for curve having invalid active vertex after setting type
also allow passing NULL vertex to BKE_curve_nurb_vert_active_set
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r--source/blender/blenkernel/intern/curve.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index fa5e3dc24c3..a61a15f4566 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -3830,6 +3830,9 @@ bool BKE_nurb_order_clamp_v(struct Nurb *nu)
return changed;
}
+/**
+ * \note caller must ensure active vertex remains valid.
+ */
bool BKE_nurb_type_convert(Nurb *nu, const short type, const bool use_handles)
{
BezTriple *bezt;
@@ -4011,13 +4014,18 @@ void BKE_curve_nurb_vert_active_set(Curve *cu, Nurb *nu, void *vert)
if (nu) {
BKE_curve_nurb_active_set(cu, nu);
- if (nu->type == CU_BEZIER) {
- BLI_assert(ARRAY_HAS_ITEM((BezTriple *)vert, nu->bezt, nu->pntsu));
- cu->actvert = (BezTriple *)vert - nu->bezt;
+ if (vert) {
+ if (nu->type == CU_BEZIER) {
+ BLI_assert(ARRAY_HAS_ITEM((BezTriple *)vert, nu->bezt, nu->pntsu));
+ cu->actvert = (BezTriple *)vert - nu->bezt;
+ }
+ else {
+ BLI_assert(ARRAY_HAS_ITEM((BPoint *)vert, nu->bp, nu->pntsu * nu->pntsv));
+ cu->actvert = (BPoint *)vert - nu->bp;
+ }
}
else {
- BLI_assert(ARRAY_HAS_ITEM((BPoint *)vert, nu->bp, nu->pntsu * nu->pntsv));
- cu->actvert = (BPoint *)vert - nu->bp;
+ cu->actvert = CU_ACT_NONE;
}
}
else {