[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18108] branches/nurbs/blender: Another fix from Laurynas for a bug with extruding surfaces/ adding a new control point to a curve.
Emmanuel Stone
emmanuel.stone at gmail.com
Sun Dec 28 02:49:42 CET 2008
Revision: 18108
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18108
Author: eman
Date: 2008-12-28 02:49:39 +0100 (Sun, 28 Dec 2008)
Log Message:
-----------
Another fix from Laurynas for a bug with extruding surfaces/adding a new control point to a curve.
Modified Paths:
--------------
branches/nurbs/blender/intern/nurbana/intern/Object_Primitives.cpp
branches/nurbs/blender/source/blender/src/editcurve.c
Modified: branches/nurbs/blender/intern/nurbana/intern/Object_Primitives.cpp
===================================================================
--- branches/nurbs/blender/intern/nurbana/intern/Object_Primitives.cpp 2008-12-28 01:28:31 UTC (rev 18107)
+++ branches/nurbs/blender/intern/nurbana/intern/Object_Primitives.cpp 2008-12-28 01:49:39 UTC (rev 18108)
@@ -16,6 +16,7 @@
no.Order(0, 4);
no.Order(1, 4);
no.setEndType(0, NURBS_KV_Open);
+ no.setEndType(1, NURBS_KV_Open);
no.SetLengthRef(lengthU, lengthV);
no.Length(0, lengthU);
@@ -100,8 +101,8 @@
const nbReal radius = 1;
Object_NURBS &no = *ptr;
no.setEndType(0, NURBS_KV_Periodic);
+ no.setEndType(1, NURBS_KV_Open);
no.Order(0, 4);
-// no.Cyclic(0, 1);
no.SetLengthRef(lengthU, lengthV);
Modified: branches/nurbs/blender/source/blender/src/editcurve.c
===================================================================
--- branches/nurbs/blender/source/blender/src/editcurve.c 2008-12-28 01:28:31 UTC (rev 18107)
+++ branches/nurbs/blender/source/blender/src/editcurve.c 2008-12-28 01:49:39 UTC (rev 18108)
@@ -750,7 +750,7 @@
{
Nurb *nu;
BPoint *bp, *bpn, *newbp;
- int ok= 0, a, u, v, len;
+ int ok= 0, a, u, v, len, shift;
if(G.obedit && G.obedit->type==OB_SURF);
else return 0;
@@ -769,27 +769,21 @@
}
if(a==0) {
ok= 1;
- newbp =
- (BPoint*)MEM_mallocN(2 * nu->pntsu * sizeof(BPoint), "extrudeNurb1");
- memcpy(newbp, nu->bp, nu->pntsu*sizeof(BPoint) );
- bp= newbp+ nu->pntsu;
- memcpy(bp, nu->bp, nu->pntsu*sizeof(BPoint) );
- MEM_freeN(nu->bp);
- nu->bp= newbp;
- a= nu->pntsu;
+ NRB_setLength(nu -> pntsu, nu -> pntsv + 1, 0, 0, 0, nu -> nurbanaPtr);
+ newbp = nu -> bp;
+ bp = newbp + nu -> pntsu;
+ memcpy(bp, nu -> bp, nu -> pntsu * sizeof(BPoint) );
+ nu -> bp = newbp;
+ a = nu -> pntsu;
while(a--) {
select_bpoint(bp, SELECT, flag, HIDDEN);
select_bpoint(newbp, DESELECT, flag, HIDDEN);
bp++;
newbp++;
}
-
- nu->pntsv= 2;
- nu->orderv= 2;
- NRB_setLength(nu -> pntsu, nu -> pntsv, 0, 0, 1, nu -> nurbanaPtr);
-
- makeknots(nu, 2, nu->flagv>>1);
- //NRB_SizeChanged(nu->nurbanaPtr,nu->pntsu,nu->pntsv);
+ nu -> pntsv = 2;
+ nu -> orderv = 2;
+ NRB_SizeChanged(nu -> nurbanaPtr, nu -> pntsu, nu -> pntsv);
}
}
else {
@@ -807,65 +801,50 @@
if(u==0 || u== nu->pntsv-1) { /* row in u-direction selected */
ok= 1;
- newbp =
- (BPoint*) MEM_mallocN(nu->pntsu*(nu->pntsv + 1)
- * sizeof(BPoint), "extrudeNurb1");
- if(u==0) {
- len= nu->pntsv*nu->pntsu;
- memcpy(newbp+nu->pntsu, nu->bp, len*sizeof(BPoint) );
- memcpy(newbp, nu->bp, nu->pntsu*sizeof(BPoint) );
- bp= newbp;
+ shift = u == 0? 1: 0;
+ NRB_setLength(nu -> pntsu, nu -> pntsv + 1, 0, shift, 0, nu -> nurbanaPtr);
+ bp = newbp = nu -> bp;
+
+ if(u == 0) {
+ memcpy(newbp, newbp + nu-> pntsu, nu -> pntsu * sizeof(BPoint));
+ } else {
+ len = nu -> pntsv * nu -> pntsu;
+ memcpy(newbp + len, nu -> bp + len - nu -> pntsu, nu -> pntsu * sizeof(BPoint));
+ bp += len;
}
- else {
- len= nu->pntsv*nu->pntsu;
- memcpy(newbp, nu->bp, len*sizeof(BPoint) );
- memcpy(newbp+len, nu->bp+len-nu->pntsu, nu->pntsu*sizeof(BPoint) );
- bp= newbp+len;
- }
- a= nu->pntsu;
- while(a--) {
+ a = nu -> pntsu;
+ while (a--) {
select_bpoint(bp, SELECT, flag, HIDDEN);
bp++;
}
-
- MEM_freeN(nu->bp);
- nu->bp= newbp;
- nu->pntsv++;
- //makeknots(nu, 2, nu->flagv>>1);
-
+ nu -> pntsv++;
// resize nurbana's buffers
NRB_SizeChanged(nu->nurbanaPtr,nu->pntsu,nu->pntsv);
}
else if(v==0 || v== nu->pntsu-1) { /* collumn in v-direction selected */
ok= 1;
- bpn = newbp =
- (BPoint*) MEM_mallocN((nu->pntsu + 1) * nu->pntsv * sizeof(BPoint), "extrudeNurb1");
- bp= nu->bp;
-
- for(a=0; a<nu->pntsv; a++) {
- if(v==0) {
- *bpn= *bp;
- bpn->f1 |= flag;
- bpn++;
- }
- memcpy(bpn, bp, nu->pntsu*sizeof(BPoint));
- bp+= nu->pntsu;
- bpn+= nu->pntsu;
- if(v== nu->pntsu-1) {
- *bpn= *(bp-1);
- bpn->f1 |= flag;
- bpn++;
- }
+ shift = v == 0? 1: 0;
+ NRB_setLength(nu -> pntsu + 1, nu -> pntsv, shift, 0, 0, nu -> nurbanaPtr);
+ if (v == 0) {
+ bpn = nu -> bp;
+ bp = bpn + shift;
+ } else {
+ bpn = nu -> bp + nu -> pntsu;
+ bp = bpn - 1;
}
- MEM_freeN(nu->bp);
- nu->bp= newbp;
nu->pntsu++;
- // makeknots(nu, 1, nu->flagu>>1);
+
+ for(a = 0; a < nu -> pntsv; a++) {
+ *bpn= *bp;
+ bpn -> f1 |= flag;
+ bp += nu -> pntsu;
+ bpn += nu -> pntsu;
+ }
// resize nurbana's buffers
- NRB_SizeChanged(nu->nurbanaPtr,nu->pntsu,nu->pntsv);
+ NRB_SizeChanged(nu->nurbanaPtr, nu->pntsu, nu->pntsv);
}
}
}
More information about the Bf-blender-cvs
mailing list