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/cloth.c | |
parent | f20f82ce3ee55c12adcec024e0133e71183e07b3 (diff) |
Cleanup: use bool instead of int in various places
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 48 |
1 files changed, 24 insertions, 24 deletions
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; } /** \} */ |