use booleans in BKE_nurb_handles_autocalc and BMO_op_vinitf
This commit is contained in:
@@ -3176,7 +3176,7 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag)
|
|||||||
const float eps_sq = eps * eps;
|
const float eps_sq = eps * eps;
|
||||||
|
|
||||||
BezTriple *bezt2, *bezt1, *bezt0;
|
BezTriple *bezt2, *bezt1, *bezt0;
|
||||||
int i, align, leftsmall, rightsmall;
|
int i;
|
||||||
|
|
||||||
if (nu == NULL || nu->bezt == NULL)
|
if (nu == NULL || nu->bezt == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -3187,7 +3187,7 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag)
|
|||||||
i = nu->pntsu;
|
i = nu->pntsu;
|
||||||
|
|
||||||
while (i--) {
|
while (i--) {
|
||||||
align = leftsmall = rightsmall = 0;
|
bool align = false, leftsmall = false, rightsmall = false;
|
||||||
|
|
||||||
/* left handle: */
|
/* left handle: */
|
||||||
if (flag == 0 || (bezt1->f1 & flag) ) {
|
if (flag == 0 || (bezt1->f1 & flag) ) {
|
||||||
@@ -3195,12 +3195,12 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag)
|
|||||||
/* distance too short: vectorhandle */
|
/* distance too short: vectorhandle */
|
||||||
if (len_squared_v3v3(bezt1->vec[1], bezt0->vec[1]) < eps_sq) {
|
if (len_squared_v3v3(bezt1->vec[1], bezt0->vec[1]) < eps_sq) {
|
||||||
bezt1->h1 = HD_VECT;
|
bezt1->h1 = HD_VECT;
|
||||||
leftsmall = 1;
|
leftsmall = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* aligned handle? */
|
/* aligned handle? */
|
||||||
if (dist_to_line_v2(bezt1->vec[1], bezt1->vec[0], bezt1->vec[2]) < eps) {
|
if (dist_to_line_v2(bezt1->vec[1], bezt1->vec[0], bezt1->vec[2]) < eps) {
|
||||||
align = 1;
|
align = true;
|
||||||
bezt1->h1 = HD_ALIGN;
|
bezt1->h1 = HD_ALIGN;
|
||||||
}
|
}
|
||||||
/* or vector handle? */
|
/* or vector handle? */
|
||||||
@@ -3214,7 +3214,7 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag)
|
|||||||
/* distance too short: vectorhandle */
|
/* distance too short: vectorhandle */
|
||||||
if (len_squared_v3v3(bezt1->vec[1], bezt2->vec[1]) < eps_sq) {
|
if (len_squared_v3v3(bezt1->vec[1], bezt2->vec[1]) < eps_sq) {
|
||||||
bezt1->h2 = HD_VECT;
|
bezt1->h2 = HD_VECT;
|
||||||
rightsmall = 1;
|
rightsmall = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* aligned handle? */
|
/* aligned handle? */
|
||||||
|
@@ -1639,9 +1639,9 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
|
|||||||
// BMOpDefine *def;
|
// BMOpDefine *def;
|
||||||
char *opname, *ofmt, *fmt;
|
char *opname, *ofmt, *fmt;
|
||||||
char slot_name[64] = {0};
|
char slot_name[64] = {0};
|
||||||
int i /*, n = strlen(fmt) */, stop /*, slot_code = -1 */, type, state;
|
int i, type;
|
||||||
|
bool noslot, state;
|
||||||
char htype;
|
char htype;
|
||||||
int noslot = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/* basic useful info to help find where bmop formatting strings fail */
|
/* basic useful info to help find where bmop formatting strings fail */
|
||||||
@@ -1662,7 +1662,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
|
|||||||
i = strcspn(fmt, " ");
|
i = strcspn(fmt, " ");
|
||||||
|
|
||||||
opname = fmt;
|
opname = fmt;
|
||||||
if (!opname[i]) noslot = 1;
|
noslot = (opname[i] == '\0');
|
||||||
opname[i] = '\0';
|
opname[i] = '\0';
|
||||||
|
|
||||||
fmt += i + (noslot ? 0 : 1);
|
fmt += i + (noslot ? 0 : 1);
|
||||||
@@ -1679,7 +1679,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
|
|||||||
// def = bmo_opdefines[i];
|
// def = bmo_opdefines[i];
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
state = 1; /* 0: not inside slot_code name, 1: inside slot_code name */
|
state = true; /* false: not inside slot_code name, true: inside slot_code name */
|
||||||
|
|
||||||
while (*fmt) {
|
while (*fmt) {
|
||||||
if (state) {
|
if (state) {
|
||||||
@@ -1705,7 +1705,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
|
|||||||
|
|
||||||
BLI_strncpy(slot_name, fmt, sizeof(slot_name));
|
BLI_strncpy(slot_name, fmt, sizeof(slot_name));
|
||||||
|
|
||||||
state = 0;
|
state = false;
|
||||||
fmt += i;
|
fmt += i;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1726,13 +1726,13 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
|
|||||||
else GOTO_ERROR("matrix size was not 3 or 4");
|
else GOTO_ERROR("matrix size was not 3 or 4");
|
||||||
|
|
||||||
BMO_slot_mat_set(op, op->slots_in, slot_name, va_arg(vlist, void *), size);
|
BMO_slot_mat_set(op, op->slots_in, slot_name, va_arg(vlist, void *), size);
|
||||||
state = 1;
|
state = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'v':
|
case 'v':
|
||||||
{
|
{
|
||||||
BMO_slot_vec_set(op->slots_in, slot_name, va_arg(vlist, float *));
|
BMO_slot_vec_set(op->slots_in, slot_name, va_arg(vlist, float *));
|
||||||
state = 1;
|
state = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'e': /* single vert/edge/face */
|
case 'e': /* single vert/edge/face */
|
||||||
@@ -1742,7 +1742,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
|
|||||||
|
|
||||||
BMO_slot_buffer_from_single(op, slot, ele);
|
BMO_slot_buffer_from_single(op, slot, ele);
|
||||||
|
|
||||||
state = 1;
|
state = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 's':
|
case 's':
|
||||||
@@ -1761,20 +1761,20 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
|
|||||||
BMO_slot_copy(op_other, slots_out, slot_name_other,
|
BMO_slot_copy(op_other, slots_out, slot_name_other,
|
||||||
op, slots_in, slot_name);
|
op, slots_in, slot_name);
|
||||||
}
|
}
|
||||||
state = 1;
|
state = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'i':
|
case 'i':
|
||||||
BMO_slot_int_set(op->slots_in, slot_name, va_arg(vlist, int));
|
BMO_slot_int_set(op->slots_in, slot_name, va_arg(vlist, int));
|
||||||
state = 1;
|
state = true;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
BMO_slot_bool_set(op->slots_in, slot_name, va_arg(vlist, int));
|
BMO_slot_bool_set(op->slots_in, slot_name, va_arg(vlist, int));
|
||||||
state = 1;
|
state = true;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
BMO_slot_ptr_set(op->slots_in, slot_name, va_arg(vlist, void *));
|
BMO_slot_ptr_set(op->slots_in, slot_name, va_arg(vlist, void *));
|
||||||
state = 1;
|
state = true;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
case 'F':
|
case 'F':
|
||||||
@@ -1787,15 +1787,16 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
|
|||||||
BMO_slot_float_set(op->slots_in, slot_name, va_arg(vlist, double));
|
BMO_slot_float_set(op->slots_in, slot_name, va_arg(vlist, double));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
bool stop = false;
|
||||||
|
|
||||||
htype = 0;
|
htype = 0;
|
||||||
stop = 0;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
switch (NEXT_CHAR(fmt)) {
|
switch (NEXT_CHAR(fmt)) {
|
||||||
case 'f': htype |= BM_FACE; break;
|
case 'f': htype |= BM_FACE; break;
|
||||||
case 'e': htype |= BM_EDGE; break;
|
case 'e': htype |= BM_EDGE; break;
|
||||||
case 'v': htype |= BM_VERT; break;
|
case 'v': htype |= BM_VERT; break;
|
||||||
default:
|
default:
|
||||||
stop = 1;
|
stop = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (stop) {
|
if (stop) {
|
||||||
@@ -1822,7 +1823,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state = 1;
|
state = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
Reference in New Issue
Block a user