Toggle cyclic on when creating segment between first and last points of non-cyclic bezier

This commit is contained in:
2010-11-21 19:29:08 +00:00
parent 18d9f7cbbf
commit a2dc1fe4b0

View File

@@ -3712,7 +3712,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
BezTriple *bezt; BezTriple *bezt;
BPoint *bp; BPoint *bp;
float *fp, offset; float *fp, offset;
int a; int a, ok= 0;
/* first decide if this is a surface merge! */ /* first decide if this is a surface merge! */
if(obedit->type==OB_SURF) nu= nubase->first; if(obedit->type==OB_SURF) nu= nubase->first;
@@ -3854,16 +3854,27 @@ static int make_segment_exec(bContext *C, wmOperator *op)
} }
set_actNurb(obedit, NULL); /* for selected */ set_actNurb(obedit, NULL); /* for selected */
ok= 1;
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); } else if(nu1 && !nu2 && nu1->type == CU_BEZIER) {
DAG_id_flush_update(obedit->data, OB_RECALC_DATA); if(!(nu1->flagu & CU_NURB_CYCLIC)) {
if(BEZSELECTED_HIDDENHANDLES(cu, nu1->bezt) &&
return OPERATOR_FINISHED; BEZSELECTED_HIDDENHANDLES(cu, bezt+(nu1->pntsu-1))) {
nu1->flagu|= CU_NURB_CYCLIC;
calchandlesNurb(nu1);
ok= 1;
}
}
} }
else {
if(!ok) {
BKE_report(op->reports, RPT_ERROR, "Can't make segment"); BKE_report(op->reports, RPT_ERROR, "Can't make segment");
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
return OPERATOR_FINISHED;
} }
void CURVE_OT_make_segment(wmOperatorType *ot) void CURVE_OT_make_segment(wmOperatorType *ot)