diff options
author | Jacques Lucke <jacques@blender.org> | 2020-09-02 20:10:18 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-09-02 20:10:40 +0300 |
commit | f5e55c33378b96e614710006121860eb880e6820 (patch) | |
tree | 4f24b19e6b5e187d9b7b3d43f741c26f2c843fc8 /source/blender/blenkernel/intern | |
parent | f20f82ce3ee55c12adcec024e0133e71183e07b3 (diff) |
Cleanup: use bool instead of int in various places
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 48 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/colorband.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 30 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/customdata.c | 24 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/customdata_file.c | 62 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 48 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 22 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 6 |
12 files changed, 137 insertions, 143 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 263f63cb6da..681e46ed24e 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -407,7 +407,7 @@ void DM_from_template(DerivedMesh *dm, &CD_MASK_DERIVEDMESH); } -int DM_release(DerivedMesh *dm) +bool DM_release(DerivedMesh *dm) { if (dm->needsFree) { CustomData_free(&dm->vertData, dm->numVertData); @@ -420,7 +420,7 @@ int DM_release(DerivedMesh *dm) dm->looptris.num = 0; dm->looptris.num_alloc = 0; - return 1; + return true; } CustomData_free_temporary(&dm->vertData, dm->numVertData); @@ -429,7 +429,7 @@ int DM_release(DerivedMesh *dm) CustomData_free_temporary(&dm->loopData, dm->numLoopData); CustomData_free_temporary(&dm->polyData, dm->numPolyData); - return 0; + return false; } void DM_DupPolys(DerivedMesh *source, DerivedMesh *target) diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 24b4b85d0d4..62e2294345d 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -56,12 +56,12 @@ */ static void cloth_to_object(Object *ob, ClothModifierData *clmd, float (*vertexCos)[3]); static void cloth_from_mesh(ClothModifierData *clmd, Mesh *mesh); -static int cloth_from_object( +static bool cloth_from_object( Object *ob, ClothModifierData *clmd, Mesh *mesh, float framenr, int first); static void cloth_update_springs(ClothModifierData *clmd); static void cloth_update_verts(Object *ob, ClothModifierData *clmd, Mesh *mesh); static void cloth_update_spring_lengths(ClothModifierData *clmd, Mesh *mesh); -static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh); +static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh); static void cloth_apply_vgroup(ClothModifierData *clmd, Mesh *mesh); typedef struct BendSpringRef { @@ -324,7 +324,7 @@ void cloth_clear_cache(Object *ob, ClothModifierData *clmd, float framenr) BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_AFTER, framenr); } -static int do_init_cloth(Object *ob, ClothModifierData *clmd, Mesh *result, int framenr) +static bool do_init_cloth(Object *ob, ClothModifierData *clmd, Mesh *result, int framenr) { PointCache *cache; @@ -335,13 +335,13 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, Mesh *result, int if (!cloth_from_object(ob, clmd, result, framenr, 1)) { BKE_ptcache_invalidate(cache); BKE_modifier_set_error(&(clmd->modifier), "Can't initialize cloth"); - return 0; + return false; } if (clmd->clothObject == NULL) { BKE_ptcache_invalidate(cache); BKE_modifier_set_error(&(clmd->modifier), "Null cloth object"); - return 0; + return false; } SIM_cloth_solver_set_positions(clmd); @@ -356,7 +356,7 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, Mesh *result, int clmd->sim_parms->dt = 1.0f / clmd->sim_parms->stepsPerFrame; } - return 1; + return true; } static int do_step_cloth( @@ -818,7 +818,7 @@ static float cloth_shrink_factor(ClothModifierData *clmd, ClothVertex *verts, in return sqrtf(k1 * k2); } -static int cloth_from_object( +static bool cloth_from_object( Object *ob, ClothModifierData *clmd, Mesh *mesh, float UNUSED(framenr), int first) { int i = 0; @@ -843,12 +843,12 @@ static int cloth_from_object( } else { BKE_modifier_set_error(&(clmd->modifier), "Out of memory on allocating clmd->clothObject"); - return 0; + return false; } // mesh input objects need Mesh if (!mesh) { - return 0; + return false; } cloth_from_mesh(clmd, mesh); @@ -915,7 +915,7 @@ static int cloth_from_object( if (!cloth_build_springs(clmd, mesh)) { cloth_free_modifier(clmd); BKE_modifier_set_error(&(clmd->modifier), "Cannot build springs"); - return 0; + return false; } // init our solver @@ -928,7 +928,7 @@ static int cloth_from_object( clmd->clothObject->bvhtree = bvhtree_build_from_cloth(clmd, clmd->coll_parms->epsilon); clmd->clothObject->bvhselftree = bvhtree_build_from_cloth(clmd, clmd->coll_parms->selfepsilon); - return 1; + return true; } static void cloth_from_mesh(ClothModifierData *clmd, Mesh *mesh) @@ -1560,7 +1560,7 @@ static bool find_internal_spring_target_vertex(BVHTreeFromMesh *treedata, return false; } -static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) +static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) { Cloth *cloth = clmd->clothObject; ClothSpring *spring = NULL, *tspring = NULL, *tspring2 = NULL; @@ -1580,7 +1580,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) // error handling if (numedges == 0) { - return 0; + return false; } /* NOTE: handling ownership of springs and edgeset is quite sloppy @@ -1595,14 +1595,14 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) spring_ref = MEM_callocN(sizeof(*spring_ref) * numedges, "temp bend spring reference"); if (!spring_ref) { - return 0; + return false; } } else { edgelist = MEM_callocN(sizeof(*edgelist) * mvert_num, "cloth_edgelist_alloc"); if (!edgelist) { - return 0; + return false; } } @@ -1670,7 +1670,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) if (tmp_mesh) { BKE_mesh_free(tmp_mesh); } - return 0; + return false; } } } @@ -1736,7 +1736,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) } else { cloth_free_errorsprings(cloth, edgelist, spring_ref); - return 0; + return false; } } @@ -1770,7 +1770,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) } else { cloth_free_errorsprings(cloth, edgelist, spring_ref); - return 0; + return false; } } @@ -1784,7 +1784,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) } else { cloth_free_errorsprings(cloth, edgelist, spring_ref); - return 0; + return false; } } } @@ -1816,7 +1816,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) !cloth_bend_set_poly_vert_array( &spring->pb, spring->lb, &mloop[mpoly[i].loopstart])) { cloth_free_errorsprings(cloth, edgelist, spring_ref); - return 0; + return false; } spring->mn = ml->e; @@ -1874,7 +1874,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) if (!spring) { cloth_free_errorsprings(cloth, edgelist, spring_ref); - return 0; + return false; } spring_verts_ordered_set(spring, tspring2->ij, index2); @@ -1912,7 +1912,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) if (!spring) { cloth_free_errorsprings(cloth, edgelist, spring_ref); - return 0; + return false; } spring->ij = tspring2->ij; @@ -1952,7 +1952,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) if (!spring) { cloth_free_errorsprings(cloth, edgelist, spring_ref); - return 0; + return false; } spring->ij = tspring2->ij; @@ -2002,7 +2002,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) } #endif - return 1; + return true; } /** \} */ diff --git a/source/blender/blenkernel/intern/colorband.c b/source/blender/blenkernel/intern/colorband.c index 323a2f0cf53..cb30e4f1658 100644 --- a/source/blender/blenkernel/intern/colorband.c +++ b/source/blender/blenkernel/intern/colorband.c @@ -641,24 +641,22 @@ CBData *BKE_colorband_element_add(struct ColorBand *coba, float position) return coba->data + coba->cur; } -int BKE_colorband_element_remove(struct ColorBand *coba, int index) +bool BKE_colorband_element_remove(struct ColorBand *coba, int index) { - int a; - if (coba->tot < 2) { - return 0; + return false; } if (index < 0 || index >= coba->tot) { - return 0; + return false; } coba->tot--; - for (a = index; a < coba->tot; a++) { + for (int a = index; a < coba->tot; a++) { coba->data[a] = coba->data[a + 1]; } if (coba->cur) { coba->cur--; } - return 1; + return true; } diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 116d8b1a82f..6fb2df04b3c 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1151,50 +1151,48 @@ void BKE_curvemapping_evaluate_premulRGB(const CurveMapping *cumap, vecout_byte[2] = unit_float_to_uchar_clamp(vecout[2]); } -int BKE_curvemapping_RGBA_does_something(const CurveMapping *cumap) +bool BKE_curvemapping_RGBA_does_something(const CurveMapping *cumap) { - int a; - if (cumap->black[0] != 0.0f) { - return 1; + return true; } if (cumap->black[1] != 0.0f) { - return 1; + return true; } if (cumap->black[2] != 0.0f) { - return 1; + return true; } if (cumap->white[0] != 1.0f) { - return 1; + return true; } if (cumap->white[1] != 1.0f) { - return 1; + return true; } if (cumap->white[2] != 1.0f) { - return 1; + return true; } - for (a = 0; a < CM_TOT; a++) { + for (int a = 0; a < CM_TOT; a++) { if (cumap->cm[a].curve) { if (cumap->cm[a].totpoint != 2) { - return 1; + return true; } if (cumap->cm[a].curve[0].x != 0.0f) { - return 1; + return true; } if (cumap->cm[a].curve[0].y != 0.0f) { - return 1; + return true; } if (cumap->cm[a].curve[1].x != 1.0f) { - return 1; + return true; } if (cumap->cm[a].curve[1].y != 1.0f) { - return 1; + return true; } } } - return 0; + return false; } void BKE_curvemapping_init(CurveMapping *cumap) diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index b75efb6cdf1..909a4d42f0a 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -162,10 +162,10 @@ typedef struct LayerTypeInfo { void (*copyvalue)(const void *source, void *dest, const int mixmode, const float mixfactor); /** a function to read data from a cdf file */ - int (*read)(CDataFile *cdf, void *data, int count); + bool (*read)(CDataFile *cdf, void *data, int count); /** a function to write data to a cdf file */ - int (*write)(CDataFile *cdf, const void *data, int count); + bool (*write)(CDataFile *cdf, const void *data, int count); /** a function to determine file size */ size_t (*filesize)(CDataFile *cdf, const void *data, int count); @@ -659,12 +659,11 @@ static void layerFree_mdisps(void *data, int count, int UNUSED(size)) } } -static int layerRead_mdisps(CDataFile *cdf, void *data, int count) +static bool layerRead_mdisps(CDataFile *cdf, void *data, int count) { MDisps *d = data; - int i; - for (i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { if (!d[i].disps) { d[i].disps = MEM_calloc_arrayN(d[i].totdisp, sizeof(float[3]), "mdisps read"); } @@ -675,22 +674,21 @@ static int layerRead_mdisps(CDataFile *cdf, void *data, int count) } } - return 1; + return true; } -static int layerWrite_mdisps(CDataFile *cdf, const void *data, int count) +static bool layerWrite_mdisps(CDataFile *cdf, const void *data, int count) { const MDisps *d = data; - int i; - for (i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { if (!cdf_write_data(cdf, sizeof(float[3]) * d[i].totdisp, d[i].disps)) { CLOG_ERROR(&LOG, "failed to write multires displacement %d/%d %d", i, count, d[i].totdisp); return 0; } } - return 1; + return true; } static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), const void *data, int count) @@ -2594,12 +2592,12 @@ void CustomData_clear_layer_flag(struct CustomData *data, int type, int flag) } } -static int customData_resize(CustomData *data, int amount) +static bool customData_resize(CustomData *data, int amount) { CustomDataLayer *tmp = MEM_calloc_arrayN( (data->maxlayer + amount), sizeof(*tmp), "CustomData->layers"); if (!tmp) { - return 0; + return false; } data->maxlayer += amount; @@ -2609,7 +2607,7 @@ static int customData_resize(CustomData *data, int amount) } data->layers = tmp; - return 1; + return true; } static CustomDataLayer *customData_add_layer__internal(CustomData *data, diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c index 4fa232a368b..470c2f2d246 100644 --- a/source/blender/blenkernel/intern/customdata_file.c +++ b/source/blender/blenkernel/intern/customdata_file.c @@ -128,7 +128,7 @@ void cdf_free(CDataFile *cdf) /********************************* Read/Write ********************************/ -static int cdf_read_header(CDataFile *cdf) +static bool cdf_read_header(CDataFile *cdf) { CDataFileHeader *header; CDataFileImageHeader *image; @@ -141,14 +141,14 @@ static int cdf_read_header(CDataFile *cdf) header = &cdf->header; if (!fread(header, sizeof(CDataFileHeader), 1, cdf->readf)) { - return 0; + return false; } if (memcmp(header->ID, "BCDF", sizeof(header->ID)) != 0) { - return 0; + return false; } if (header->version > CDF_VERSION) { - return 0; + return false; } cdf->switchendian = header->endian != cdf_endian(); @@ -161,20 +161,20 @@ static int cdf_read_header(CDataFile *cdf) } if (!ELEM(header->type, CDF_TYPE_IMAGE, CDF_TYPE_MESH)) { - return 0; + return false; } offset += header->structbytes; header->structbytes = sizeof(CDataFileHeader); if (fseek(f, offset, SEEK_SET) != 0) { - return 0; + return false; } if (header->type == CDF_TYPE_IMAGE) { image = &cdf->btype.image; if (!fread(image, sizeof(CDataFileImageHeader), 1, f)) { - return 0; + return false; } if (cdf->switchendian) { @@ -190,7 +190,7 @@ static int cdf_read_header(CDataFile *cdf) else if (header->type == CDF_TYPE_MESH) { mesh = &cdf->btype.mesh; if (!fread(mesh, sizeof(CDataFileMeshHeader), 1, f)) { - return 0; + return false; } if (cdf->switchendian) { @@ -202,21 +202,21 @@ static int cdf_read_header(CDataFile *cdf) } if (fseek(f, offset, SEEK_SET) != 0) { - return 0; + return false; } cdf->layer = MEM_calloc_arrayN(header->totlayer, sizeof(CDataFileLayer), "CDataFileLayer"); cdf->totlayer = header->totlayer; if (!cdf->layer) { - return 0; + return false; } for (a = 0; a < header->totlayer; a++) { layer = &cdf->layer[a]; if (!fread(layer, sizeof(CDataFileLayer), 1, f)) { - return 0; + return false; } if (cdf->switchendian) { @@ -227,23 +227,23 @@ static int cdf_read_header(CDataFile *cdf) } if (layer->datatype != CDF_DATA_FLOAT) { - return 0; + return false; } offset += layer->structbytes; layer->structbytes = sizeof(CDataFileLayer); if (fseek(f, offset, SEEK_SET) != 0) { - return 0; + return false; } } cdf->dataoffset = offset; - return 1; + return true; } -static int cdf_write_header(CDataFile *cdf) +static bool cdf_write_header(CDataFile *cdf) { CDataFileHeader *header; CDataFileImageHeader *image; @@ -255,19 +255,19 @@ static int cdf_write_header(CDataFile *cdf) header = &cdf->header; if (!fwrite(header, sizeof(CDataFileHeader), 1, f)) { - return 0; + return false; } if (header->type == CDF_TYPE_IMAGE) { image = &cdf->btype.image; if (!fwrite(image, sizeof(CDataFileImageHeader), 1, f)) { - return 0; + return false; } } else if (header->type == CDF_TYPE_MESH) { mesh = &cdf->btype.mesh; if (!fwrite(mesh, sizeof(CDataFileMeshHeader), 1, f)) { - return 0; + return false; } } @@ -275,11 +275,11 @@ static int cdf_write_header(CDataFile *cdf) layer = &cdf->layer[a]; if (!fwrite(layer, sizeof(CDataFileLayer), 1, f)) { - return 0; + return false; } } - return 1; + return true; } bool cdf_read_open(CDataFile *cdf, const char *filename) @@ -288,22 +288,22 @@ bool cdf_read_open(CDataFile *cdf, const char *filename) f = BLI_fopen(filename, "rb"); if (!f) { - return 0; + return false; } cdf->readf = f; if (!cdf_read_header(cdf)) { cdf_read_close(cdf); - return 0; + return false; } if (cdf->header.type != cdf->type) { cdf_read_close(cdf); - return 0; + return false; } - return 1; + return true; } bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay) @@ -328,7 +328,7 @@ bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data) { /* read data */ if (!fread(data, size, 1, cdf->readf)) { - return 0; + return false; } /* switch endian if necessary */ @@ -336,7 +336,7 @@ bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data) BLI_endian_switch_float_array(data, size / sizeof(float)); } - return 1; + return true; } void cdf_read_close(CDataFile *cdf) @@ -356,7 +356,7 @@ bool cdf_write_open(CDataFile *cdf, const char *filename) f = BLI_fopen(filename, "wb"); if (!f) { - return 0; + return false; } cdf->writef = f; @@ -390,22 +390,22 @@ bool cdf_write_open(CDataFile *cdf, const char *filename) cdf_write_header(cdf); - return 1; + return true; } bool cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay)) { - return 1; + return true; } bool cdf_write_data(CDataFile *cdf, unsigned int size, void *data) { /* write data */ if (!fwrite(data, size, 1, cdf->writef)) { - return 0; + return false; } - return 1; + return true; } void cdf_write_close(CDataFile *cdf) diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 1c61afe5e5a..dff7dca4d76 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -4276,12 +4276,12 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex( } } -static int dynamicPaint_paintMesh(Depsgraph *depsgraph, - DynamicPaintSurface *surface, - DynamicPaintBrushSettings *brush, - Object *brushOb, - Scene *scene, - float timescale) +static bool dynamicPaint_paintMesh(Depsgraph *depsgraph, + DynamicPaintSurface *surface, + DynamicPaintBrushSettings *brush, + Object *brushOb, + Scene *scene, + float timescale) { PaintSurfaceData *sData = surface->data; PaintBakeData *bData = sData->bData; @@ -4298,7 +4298,7 @@ static int dynamicPaint_paintMesh(Depsgraph *depsgraph, Mesh *brush_mesh = dynamicPaint_brush_mesh_get(brush); if (brush_mesh == NULL) { - return 0; + return false; } { @@ -4395,7 +4395,7 @@ static int dynamicPaint_paintMesh(Depsgraph *depsgraph, MEM_freeN(brushVelocity); } - return 1; + return true; } /* @@ -4576,10 +4576,10 @@ static void dynamic_paint_paint_particle_cell_point_cb_ex( } } -static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, - ParticleSystem *psys, - DynamicPaintBrushSettings *brush, - float timescale) +static bool dynamicPaint_paintParticles(DynamicPaintSurface *surface, + ParticleSystem *psys, + DynamicPaintBrushSettings *brush, + float timescale) { ParticleSettings *part = psys->part; PaintSurfaceData *sData = surface->data; @@ -4601,7 +4601,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, Bounds3D part_bb = {{0}}; if (psys->totpart < 1) { - return 1; + return true; } /* @@ -4644,7 +4644,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, /* If no suitable particles were found, exit */ if (particlesAdded < 1) { BLI_kdtree_3d_free(tree); - return 1; + return true; } /* only continue if particle bb is close enough to canvas bb */ @@ -4684,7 +4684,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, } BLI_kdtree_3d_free(tree); - return 1; + return true; } /* paint a single point of defined proximity radius to the surface */ @@ -4780,7 +4780,7 @@ static void dynamic_paint_paint_single_point_cb_ex(void *__restrict userdata, } } -static int dynamicPaint_paintSinglePoint( +static bool dynamicPaint_paintSinglePoint( Depsgraph *depsgraph, DynamicPaintSurface *surface, /* Cannot be const, because it is assigned to non-const variable. @@ -4822,7 +4822,7 @@ static int dynamicPaint_paintSinglePoint( BLI_task_parallel_range( 0, sData->total_points, &data, dynamic_paint_paint_single_point_cb_ex, &settings); - return 1; + return true; } /***************************** Dynamic Paint Step / Baking ******************************/ @@ -6057,9 +6057,9 @@ static void dynamic_paint_generate_bake_data_cb(void *__restrict userdata, } } -static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, - Depsgraph *depsgraph, - Object *ob) +static bool dynamicPaint_generateBakeData(DynamicPaintSurface *surface, + Depsgraph *depsgraph, + Object *ob) { PaintSurfaceData *sData = surface->data; PaintBakeData *bData = sData->bData; @@ -6090,14 +6090,14 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, /* if previous data exists and mesh hasn't moved, no need to recalc */ if (!surface_moved) { - return 1; + return true; } } canvas_verts = (struct Vec3f *)MEM_mallocN(canvasNumOfVerts * sizeof(struct Vec3f), "Dynamic Paint transformed canvas verts"); if (!canvas_verts) { - return 0; + return false; } /* allocate memory if required */ @@ -6108,7 +6108,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, if (canvas_verts) { MEM_freeN(canvas_verts); } - return 0; + return false; } /* Init bdata */ @@ -6200,7 +6200,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, bData->clear = 0; - return 1; + return true; } /* diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 97f9cebf58b..1c5c74379f8 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -1207,9 +1207,9 @@ static bool debug_element_compare(const void *a, const void *b) const SimDebugElement *elem2 = b; if (elem1->hash == elem2->hash) { - return 0; + return false; } - return 1; + return true; } static void debug_element_free(void *val) diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 294e6f8c8a0..5d227ec2f9b 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1267,13 +1267,13 @@ void sort_time_fcurve(FCurve *fcu) } /* This function tests if any BezTriples are out of order, thus requiring a sort */ -short test_time_fcurve(FCurve *fcu) +bool test_time_fcurve(FCurve *fcu) { unsigned int a; /* sanity checks */ if (fcu == NULL) { - return 0; + return false; } /* currently, only need to test beztriples */ @@ -1283,7 +1283,7 @@ short test_time_fcurve(FCurve *fcu) /* loop through all BezTriples, stopping when one exceeds the one after it */ for (a = 0, bezt = fcu->bezt; a < (fcu->totvert - 1); a++, bezt++) { if (bezt->vec[1][0] > (bezt + 1)->vec[1][0]) { - return 1; + return true; } } } @@ -1293,13 +1293,13 @@ short test_time_fcurve(FCurve *fcu) /* loop through all FPoints, stopping when one exceeds the one after it */ for (a = 0, fpt = fcu->fpt; a < (fcu->totvert - 1); a++, fpt++) { if (fpt->vec[0] > (fpt + 1)->vec[0]) { - return 1; + return true; } } } /* none need any swapping */ - return 0; + return false; } /** \} */ diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 0f694a26b45..aeb2634b4da 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1327,37 +1327,37 @@ bool BKE_imtype_is_movie(const char imtype) return false; } -int BKE_imtype_supports_zbuf(const char imtype) +bool BKE_imtype_supports_zbuf(const char imtype) { switch (imtype) { case R_IMF_IMTYPE_IRIZ: case R_IMF_IMTYPE_OPENEXR: /* but not R_IMF_IMTYPE_MULTILAYER */ - return 1; + return true; } - return 0; + return false; } -int BKE_imtype_supports_compress(const char imtype) +bool BKE_imtype_supports_compress(const char imtype) { switch (imtype) { case R_IMF_IMTYPE_PNG: - return 1; + return true; } - return 0; + return false; } -int BKE_imtype_supports_quality(const char imtype) +bool BKE_imtype_supports_quality(const char imtype) { switch (imtype) { case R_IMF_IMTYPE_JPEG90: case R_IMF_IMTYPE_JP2: case R_IMF_IMTYPE_AVIJPEG: - return 1; + return true; } - return 0; + return false; } -int BKE_imtype_requires_linear_float(const char imtype) +bool BKE_imtype_requires_linear_float(const char imtype) { switch (imtype) { case R_IMF_IMTYPE_CINEON: @@ -1367,7 +1367,7 @@ int BKE_imtype_requires_linear_float(const char imtype) case R_IMF_IMTYPE_MULTILAYER: return true; } - return 0; + return false; } char BKE_imtype_valid_channels(const char imtype, bool write_file) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index e2bed85399b..b7694afb55b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3520,11 +3520,11 @@ void BKE_object_sculpt_data_create(Object *ob) ob->sculpt->mode_type = ob->mode; } -int BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc, float **r_size) +bool BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc, float **r_size) { if (ob->data == NULL) { - return 0; + return false; } switch (GS(((ID *)ob->data)->name)) { @@ -3560,9 +3560,9 @@ int BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc, break; } default: - return 0; + return false; } - return 1; + return true; } /** Get evaluated mesh for given object. */ diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 4d3e8b55404..1ebbc1e2d77 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -3209,16 +3209,16 @@ void sbObjectToSoftbody(Object *ob) free_softbody_intern(ob->soft); } -static int object_has_edges(Object *ob) +static bool object_has_edges(Object *ob) { if (ob->type == OB_MESH) { return ((Mesh *)ob->data)->totedge; } if (ob->type == OB_LATTICE) { - return 1; + return true; } - return 0; + return false; } /* SB global visible functions */ |