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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-06-24 15:27:28 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-24 15:27:28 +0400
commit7ed68ac4efb23186df7f7311b2957f4e61b131ac (patch)
treee5dfd90a60b65959e2d73b7760efa4c05d23d808 /source/blender/editors/curve
parent785a5c3aab0c92fa1286118df87db8e99b5769b4 (diff)
Fix #31909: "Make Segment" on path-curves gives wrong result
In fact fixed in easiest way -- always re-calculate knots array on topology changes. After some discussion with Ton we agreed on that having manually editable knots is not intuitive and user should only define cyclic/endpoints flags and knots would be re-calculated based on this flags. This means that it's unnecessary to have special logic for knots manipulating in some topology changing tools and they could just re-calculate knots for the whole nurb, without worrying that knots could have been manually edited.
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r--source/blender/editors/curve/editcurve.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 2fa7b4b2126..f5f013cb354 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -3937,7 +3937,6 @@ static int make_segment_exec(bContext *C, wmOperator *op)
ListBase *nubase = object_editcurve_get(obedit);
Nurb *nu, *nu1 = NULL, *nu2 = NULL;
BPoint *bp;
- float *fp, offset;
int a, ok = 0;
/* first decide if this is a surface merge! */
@@ -4053,25 +4052,12 @@ static int make_segment_exec(bContext *C, wmOperator *op)
/* now join the knots */
if (nu1->type == CU_NURBS) {
- if (nu1->knotsu == NULL) {
- BKE_nurb_knot_calc_u(nu1);
- }
- else {
- fp = MEM_mallocN(sizeof(float) * KNOTSU(nu1), "addsegment3");
- memcpy(fp, nu1->knotsu, sizeof(float) * a);
+ if (nu1->knotsu != NULL) {
MEM_freeN(nu1->knotsu);
- nu1->knotsu = fp;
-
-
- offset = nu1->knotsu[a - 1] + 1.0f;
- fp = nu1->knotsu + a;
- for (a = 0; a < nu2->pntsu; a++, fp++) {
- if (nu2->knotsu)
- *fp = offset + nu2->knotsu[a + 1];
- else
- *fp = offset;
- }
+ nu1->knotsu = NULL;
}
+
+ BKE_nurb_knot_calc_u(nu1);
}
BKE_nurb_free(nu2); nu2 = NULL;
}