Revision: 48234
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48234
Author:   nazgul
Date:     2012-06-24 11:27:28 +0000 (Sun, 24 Jun 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/curve/editcurve.c

Modified: trunk/blender/source/blender/editors/curve/editcurve.c
===================================================================
--- trunk/blender/source/blender/editors/curve/editcurve.c      2012-06-24 
10:49:22 UTC (rev 48233)
+++ trunk/blender/source/blender/editors/curve/editcurve.c      2012-06-24 
11:27:28 UTC (rev 48234)
@@ -3937,7 +3937,6 @@
        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 @@
 
                                /* 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;
                        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to