Cleanup: use bool
This commit is contained in:
@@ -1390,7 +1390,9 @@ void CURVE_OT_split(wmOperatorType *ot)
|
||||
|
||||
/* ******************* FLAGS ********************* */
|
||||
|
||||
static short isNurbselUV(Nurb *nu, int *u, int *v, int flag)
|
||||
static bool isNurbselUV(
|
||||
const Nurb *nu, int flag,
|
||||
int *r_u, int *r_v)
|
||||
{
|
||||
/* return (u != -1): 1 row in u-direction selected. U has value between 0-pntsv
|
||||
* return (v != -1): 1 column in v-direction selected. V has value between 0-pntsu
|
||||
@@ -1398,7 +1400,7 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag)
|
||||
BPoint *bp;
|
||||
int a, b, sel;
|
||||
|
||||
*u = *v = -1;
|
||||
*r_u = *r_v = -1;
|
||||
|
||||
bp = nu->bp;
|
||||
for (b = 0; b < nu->pntsv; b++) {
|
||||
@@ -1407,7 +1409,7 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag)
|
||||
if (bp->f1 & flag) sel++;
|
||||
}
|
||||
if (sel == nu->pntsu) {
|
||||
if (*u == -1) *u = b;
|
||||
if (*r_u == -1) *r_u = b;
|
||||
else return 0;
|
||||
}
|
||||
else if (sel > 1) {
|
||||
@@ -1422,7 +1424,7 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag)
|
||||
if (bp->f1 & flag) sel++;
|
||||
}
|
||||
if (sel == nu->pntsv) {
|
||||
if (*v == -1) *v = a;
|
||||
if (*r_v == -1) *r_v = a;
|
||||
else return 0;
|
||||
}
|
||||
else if (sel > 1) {
|
||||
@@ -1430,8 +1432,8 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag)
|
||||
}
|
||||
}
|
||||
|
||||
if (*u == -1 && *v > -1) return 1;
|
||||
if (*v == -1 && *u > -1) return 1;
|
||||
if (*r_u == -1 && *r_v > -1) return 1;
|
||||
if (*r_v == -1 && *r_u > -1) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1851,7 +1853,7 @@ bool ed_editnurb_extrude_flag(EditNurb *editnurb, const short flag)
|
||||
else {
|
||||
/* which row or column is selected */
|
||||
|
||||
if (isNurbselUV(nu, &u, &v, flag)) {
|
||||
if (isNurbselUV(nu, flag, &u, &v)) {
|
||||
|
||||
/* deselect all */
|
||||
bp = nu->bp;
|
||||
|
||||
@@ -2979,7 +2979,7 @@ typedef struct DMGradient_userData {
|
||||
const float *sco_end; /* [2] */
|
||||
float sco_line_div; /* store (1.0f / len_v2v2(sco_start, sco_end)) */
|
||||
int def_nr;
|
||||
short is_init;
|
||||
bool is_init;
|
||||
DMGradient_vertStore *vert_cache;
|
||||
/* only for init */
|
||||
BLI_bitmap *vert_visit;
|
||||
|
||||
@@ -63,12 +63,12 @@ enum {
|
||||
DCP_CINEMA4K = 4,
|
||||
};
|
||||
|
||||
static int check_jp2(const unsigned char *mem) /* J2K_CFMT */
|
||||
static bool check_jp2(const unsigned char *mem) /* J2K_CFMT */
|
||||
{
|
||||
return memcmp(JP2_HEAD, mem, sizeof(JP2_HEAD)) ? 0 : 1;
|
||||
}
|
||||
|
||||
static int check_j2k(const unsigned char *mem) /* J2K_CFMT */
|
||||
static bool check_j2k(const unsigned char *mem) /* J2K_CFMT */
|
||||
{
|
||||
return memcmp(J2K_HEAD, mem, sizeof(J2K_HEAD)) ? 0 : 1;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ struct ImBuf *imb_jp2_decode(const unsigned char *mem, size_t size, int flags, c
|
||||
unsigned int i, i_next, w, h, planes;
|
||||
unsigned int y;
|
||||
int *r, *g, *b, *a; /* matching 'opj_image_comp.data' type */
|
||||
int is_jp2, is_j2k;
|
||||
bool is_jp2, is_j2k;
|
||||
|
||||
opj_dparameters_t parameters; /* decompression parameters */
|
||||
|
||||
|
||||
@@ -532,7 +532,7 @@ static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int typ
|
||||
static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, PointerRNA *con_ptr)
|
||||
{
|
||||
bConstraint *con = con_ptr->data;
|
||||
const short is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
|
||||
const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
|
||||
Object *ob = (Object *)id;
|
||||
|
||||
if (BLI_findindex(&pchan->constraints, con) == -1) {
|
||||
|
||||
@@ -860,7 +860,7 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
ImageFormatData *imf = (ImageFormatData *)ptr->data;
|
||||
ID *id = ptr->id.data;
|
||||
const char is_render = (id && GS(id->name) == ID_SCE);
|
||||
const bool is_render = (id && GS(id->name) == ID_SCE);
|
||||
/* see note below on why this is */
|
||||
const char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) | (is_render ? IMA_CHAN_FLAG_BW : 0);
|
||||
|
||||
@@ -927,7 +927,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(
|
||||
{
|
||||
ImageFormatData *imf = (ImageFormatData *)ptr->data;
|
||||
ID *id = ptr->id.data;
|
||||
const char is_render = (id && GS(id->name) == ID_SCE);
|
||||
const bool is_render = (id && GS(id->name) == ID_SCE);
|
||||
|
||||
/* note, we need to act differently for render
|
||||
* where 'BW' will force grayscale even if the output format writes
|
||||
|
||||
@@ -1314,7 +1314,7 @@ static int icon_id_from_name(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const short is_enum_flag)
|
||||
static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const bool is_enum_flag)
|
||||
{
|
||||
EnumPropertyItem *items;
|
||||
PyObject *item;
|
||||
|
||||
@@ -7363,12 +7363,8 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
|
||||
PointerRNA funcptr;
|
||||
int err = 0, i, ret_len = 0, arg_count;
|
||||
int flag = RNA_function_flag(func);
|
||||
const char is_staticmethod = (flag & FUNC_NO_SELF) && !(flag & FUNC_USE_SELF_TYPE);
|
||||
const char is_classmethod = (flag & FUNC_NO_SELF) && (flag & FUNC_USE_SELF_TYPE);
|
||||
|
||||
/* annoying!, need to check if the screen gets set to NULL which is a
|
||||
* hint that the file was actually re-loaded. */
|
||||
char is_valid_wm;
|
||||
const bool is_staticmethod = (flag & FUNC_NO_SELF) && !(flag & FUNC_USE_SELF_TYPE);
|
||||
const bool is_classmethod = (flag & FUNC_NO_SELF) && (flag & FUNC_USE_SELF_TYPE);
|
||||
|
||||
PropertyRNA *pret_single = NULL;
|
||||
void *retdata_single = NULL;
|
||||
@@ -7395,7 +7391,9 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
|
||||
if (C == NULL)
|
||||
C = BPy_GetContext();
|
||||
|
||||
is_valid_wm = (CTX_wm_manager(C) != NULL);
|
||||
/* annoying!, need to check if the screen gets set to NULL which is a
|
||||
* hint that the file was actually re-loaded. */
|
||||
const bool is_valid_wm = (CTX_wm_manager(C) != NULL);
|
||||
|
||||
bpy_context_set(C, &gilstate);
|
||||
|
||||
|
||||
@@ -926,7 +926,7 @@ static void *do_bake_thread(void *bs_v)
|
||||
void RE_bake_ibuf_filter(ImBuf *ibuf, char *mask, const int filter)
|
||||
{
|
||||
/* must check before filtering */
|
||||
const short is_new_alpha = (ibuf->planes != R_IMF_PLANES_RGBA) && BKE_imbuf_alpha_test(ibuf);
|
||||
const bool is_new_alpha = (ibuf->planes != R_IMF_PLANES_RGBA) && BKE_imbuf_alpha_test(ibuf);
|
||||
|
||||
/* Margin */
|
||||
if (filter) {
|
||||
|
||||
@@ -184,7 +184,7 @@ void freeraytree(Render *re)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int is_raytraceable_vlr(Render *re, VlakRen *vlr)
|
||||
static bool is_raytraceable_vlr(Render *re, VlakRen *vlr)
|
||||
{
|
||||
/* note: volumetric must be tracable, wire must not */
|
||||
if ((re->flag & R_BAKE_TRACE) || (vlr->flag & R_TRACEBLE) || (vlr->mat->material_type == MA_TYPE_VOLUME))
|
||||
@@ -193,7 +193,7 @@ static int is_raytraceable_vlr(Render *re, VlakRen *vlr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_raytraceable(Render *re, ObjectInstanceRen *obi)
|
||||
static bool is_raytraceable(Render *re, ObjectInstanceRen *obi)
|
||||
{
|
||||
int v;
|
||||
ObjectRen *obr = obi->obr;
|
||||
|
||||
Reference in New Issue
Block a user