Cleanup: use bool instead of int

This commit is contained in:
Jacques Lucke 2020-09-09 11:10:38 +02:00
parent 916497627c
commit 377a1e3d7b
9 changed files with 40 additions and 39 deletions

View File

@ -306,12 +306,12 @@ static Mesh *dynamicPaint_brush_mesh_get(DynamicPaintBrushSettings *brush)
/***************************** General Utils ******************************/
/* Set canvas error string to display at the bake report */
static int setError(DynamicPaintCanvasSettings *canvas, const char *string)
static bool setError(DynamicPaintCanvasSettings *canvas, const char *string)
{
/* Add error to canvas ui info label */
BLI_strncpy(canvas->error, string, sizeof(canvas->error));
CLOG_STR_ERROR(&LOG, string);
return 0;
return false;
}
/* Get number of surface points for cached types */

View File

@ -483,7 +483,7 @@ static void *seq_prefetch_frames(void *job)
pfjob->running = false;
pfjob->scene_eval->ed->prefetch_job = NULL;
return 0;
return NULL;
}
static PrefetchJob *seq_prefetch_start(const SeqRenderData *context, float cfra)

View File

@ -58,7 +58,7 @@
/* Loops over the gp-frames for a gp-layer, and applies the given callback */
bool ED_gpencil_layer_frames_looper(bGPDlayer *gpl,
Scene *scene,
short (*gpf_cb)(bGPDframe *, Scene *))
bool (*gpf_cb)(bGPDframe *, Scene *))
{
/* error checker */
if (gpl == NULL) {
@ -511,40 +511,40 @@ bool ED_gpencil_anim_copybuf_paste(bAnimContext *ac, const short offset_mode)
/* -------------------------------------- */
/* Snap Tools */
static short gpencil_frame_snap_nearest(bGPDframe *UNUSED(gpf), Scene *UNUSED(scene))
static bool gpencil_frame_snap_nearest(bGPDframe *UNUSED(gpf), Scene *UNUSED(scene))
{
#if 0 /* note: gpf->framenum is already an int! */
if (gpf->flag & GP_FRAME_SELECT) {
gpf->framenum = (int)(floor(gpf->framenum + 0.5));
}
#endif
return 0;
return false;
}
static short gpencil_frame_snap_nearestsec(bGPDframe *gpf, Scene *scene)
static bool gpencil_frame_snap_nearestsec(bGPDframe *gpf, Scene *scene)
{
float secf = (float)FPS;
if (gpf->flag & GP_FRAME_SELECT) {
gpf->framenum = (int)(floorf(gpf->framenum / secf + 0.5f) * secf);
}
return 0;
return false;
}
static short gpencil_frame_snap_cframe(bGPDframe *gpf, Scene *scene)
static bool gpencil_frame_snap_cframe(bGPDframe *gpf, Scene *scene)
{
if (gpf->flag & GP_FRAME_SELECT) {
gpf->framenum = (int)CFRA;
}
return 0;
return false;
}
static short gpencil_frame_snap_nearmarker(bGPDframe *gpf, Scene *scene)
static bool gpencil_frame_snap_nearmarker(bGPDframe *gpf, Scene *scene)
{
if (gpf->flag & GP_FRAME_SELECT) {
gpf->framenum = (int)ED_markers_find_nearest_marker_time(&scene->markers,
(float)gpf->framenum);
}
return 0;
return false;
}
/* snap selected frames to ... */
@ -571,7 +571,7 @@ void ED_gpencil_layer_snap_frames(bGPDlayer *gpl, Scene *scene, short mode)
/* -------------------------------------- */
/* Mirror Tools */
static short gpencil_frame_mirror_cframe(bGPDframe *gpf, Scene *scene)
static bool gpencil_frame_mirror_cframe(bGPDframe *gpf, Scene *scene)
{
int diff;
@ -580,10 +580,10 @@ static short gpencil_frame_mirror_cframe(bGPDframe *gpf, Scene *scene)
gpf->framenum = CFRA + diff;
}
return 0;
return false;
}
static short gpencil_frame_mirror_yaxis(bGPDframe *gpf, Scene *UNUSED(scene))
static bool gpencil_frame_mirror_yaxis(bGPDframe *gpf, Scene *UNUSED(scene))
{
int diff;
@ -592,10 +592,10 @@ static short gpencil_frame_mirror_yaxis(bGPDframe *gpf, Scene *UNUSED(scene))
gpf->framenum = diff;
}
return 0;
return false;
}
static short gpencil_frame_mirror_xaxis(bGPDframe *gpf, Scene *UNUSED(scene))
static bool gpencil_frame_mirror_xaxis(bGPDframe *gpf, Scene *UNUSED(scene))
{
int diff;
@ -605,10 +605,10 @@ static short gpencil_frame_mirror_xaxis(bGPDframe *gpf, Scene *UNUSED(scene))
gpf->framenum = diff;
}
return 0;
return false;
}
static short gpencil_frame_mirror_marker(bGPDframe *gpf, Scene *scene)
static bool gpencil_frame_mirror_marker(bGPDframe *gpf, Scene *scene)
{
static TimeMarker *marker;
static short initialized = 0;
@ -645,7 +645,7 @@ static short gpencil_frame_mirror_marker(bGPDframe *gpf, Scene *scene)
}
}
return 0;
return false;
}
/* mirror selected gp-frames on... */

View File

@ -176,7 +176,7 @@ void ED_annotation_draw_ex(struct Scene *scene,
/* ----------- Grease-Pencil AnimEdit API ------------------ */
bool ED_gpencil_layer_frames_looper(struct bGPDlayer *gpl,
struct Scene *scene,
short (*gpf_cb)(struct bGPDframe *, struct Scene *));
bool (*gpf_cb)(struct bGPDframe *, struct Scene *));
void ED_gpencil_layer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, bool onlysel);
bool ED_gpencil_layer_frame_select_check(struct bGPDlayer *gpl);

View File

@ -91,8 +91,8 @@ bool ED_mask_layer_shape_auto_key_select(struct Mask *mask, const int frame);
/* ----------- Mask AnimEdit API ------------------ */
bool ED_masklayer_frames_looper(struct MaskLayer *mask_layer,
struct Scene *scene,
short (*mask_layer_shape_cb)(struct MaskLayerShape *,
struct Scene *));
bool (*mask_layer_shape_cb)(struct MaskLayerShape *,
struct Scene *));
void ED_masklayer_make_cfra_list(struct MaskLayer *mask_layer, ListBase *elems, bool onlysel);
bool ED_masklayer_frame_select_check(struct MaskLayer *mask_layer);

View File

@ -55,7 +55,7 @@
/* Loops over the mask-frames for a mask-layer, and applies the given callback */
bool ED_masklayer_frames_looper(MaskLayer *mask_layer,
Scene *scene,
short (*mask_layer_shape_cb)(MaskLayerShape *, Scene *))
bool (*mask_layer_shape_cb)(MaskLayerShape *, Scene *))
{
MaskLayerShape *mask_layer_shape;
@ -310,38 +310,38 @@ void ED_masklayer_frames_duplicate(MaskLayer *mask_layer)
/* -------------------------------------- */
/* Snap Tools */
static short snap_mask_layer_nearest(MaskLayerShape *mask_layer_shape, Scene *UNUSED(scene))
static bool snap_mask_layer_nearest(MaskLayerShape *mask_layer_shape, Scene *UNUSED(scene))
{
if (mask_layer_shape->flag & MASK_SHAPE_SELECT) {
mask_layer_shape->frame = (int)(floor(mask_layer_shape->frame + 0.5));
}
return 0;
return false;
}
static short snap_mask_layer_nearestsec(MaskLayerShape *mask_layer_shape, Scene *scene)
static bool snap_mask_layer_nearestsec(MaskLayerShape *mask_layer_shape, Scene *scene)
{
float secf = (float)FPS;
if (mask_layer_shape->flag & MASK_SHAPE_SELECT) {
mask_layer_shape->frame = (int)(floorf(mask_layer_shape->frame / secf + 0.5f) * secf);
}
return 0;
return false;
}
static short snap_mask_layer_cframe(MaskLayerShape *mask_layer_shape, Scene *scene)
static bool snap_mask_layer_cframe(MaskLayerShape *mask_layer_shape, Scene *scene)
{
if (mask_layer_shape->flag & MASK_SHAPE_SELECT) {
mask_layer_shape->frame = (int)CFRA;
}
return 0;
return false;
}
static short snap_mask_layer_nearmarker(MaskLayerShape *mask_layer_shape, Scene *scene)
static bool snap_mask_layer_nearmarker(MaskLayerShape *mask_layer_shape, Scene *scene)
{
if (mask_layer_shape->flag & MASK_SHAPE_SELECT) {
mask_layer_shape->frame = (int)ED_markers_find_nearest_marker_time(
&scene->markers, (float)mask_layer_shape->frame);
}
return 0;
return false;
}
/* snap selected frames to ... */

View File

@ -891,7 +891,8 @@ void ED_mesh_mirror_topo_table_end(Object *UNUSED(ob))
ED_mesh_mirrtopo_free(&mesh_topo_store);
}
static int ed_mesh_mirror_topo_table_update(Object *ob, Mesh *me_eval)
/* Returns true on success. */
static bool ed_mesh_mirror_topo_table_update(Object *ob, Mesh *me_eval)
{
Mesh *me_mirror;
BMEditMesh *em_mirror;
@ -900,7 +901,7 @@ static int ed_mesh_mirror_topo_table_update(Object *ob, Mesh *me_eval)
if (ED_mesh_mirrtopo_recalc_check(em_mirror, me_mirror, &mesh_topo_store)) {
ED_mesh_mirror_topo_table_begin(ob, me_eval);
}
return 0;
return true;
}
/** \} */
@ -921,7 +922,7 @@ static int mesh_get_x_mirror_vert_spatial(Object *ob, Mesh *me_eval, int index)
static int mesh_get_x_mirror_vert_topo(Object *ob, Mesh *mesh, int index)
{
if (ed_mesh_mirror_topo_table_update(ob, mesh) == -1) {
if (!ed_mesh_mirror_topo_table_update(ob, mesh)) {
return -1;
}
@ -963,7 +964,7 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob,
int index)
{
intptr_t poinval;
if (ed_mesh_mirror_topo_table_update(ob, NULL) == -1) {
if (!ed_mesh_mirror_topo_table_update(ob, NULL)) {
return NULL;
}

View File

@ -507,7 +507,7 @@ fail:
/** \} */
int BPY_rna_gizmo_module(PyObject *mod_par)
bool BPY_rna_gizmo_module(PyObject *mod_par)
{
static PyMethodDef method_def_array[] = {
/* Gizmo Target Property Define API */
@ -541,5 +541,5 @@ int BPY_rna_gizmo_module(PyObject *mod_par)
PyModule_AddObject(mod_par, name_prefix, func_inst);
}
return 0;
return false;
}

View File

@ -24,7 +24,7 @@
extern "C" {
#endif
int BPY_rna_gizmo_module(PyObject *);
bool BPY_rna_gizmo_module(PyObject *);
#ifdef __cplusplus
}