Cleanup: replace int with bool type

This commit is contained in:
Campbell Barton 2021-12-07 18:14:39 +11:00
parent ffc4c126f5
commit 6483dee141
6 changed files with 41 additions and 38 deletions

View File

@ -149,7 +149,7 @@ void BKE_curvemapping_table_RGBA(const struct CurveMapping *cumap, float **array
* Call when you do images etc, needs restore too. also verifies tables.
* non-const (these modify the curve).
*/
void BKE_curvemapping_premultiply(struct CurveMapping *cumap, int restore);
void BKE_curvemapping_premultiply(struct CurveMapping *cumap, bool restore);
void BKE_curvemapping_blend_write(struct BlendWriter *writer, const struct CurveMapping *cumap);
void BKE_curvemapping_curves_blend_write(struct BlendWriter *writer,

View File

@ -157,15 +157,15 @@ float effector_falloff(struct EffectorCache *eff,
struct EffectorData *efd,
struct EffectedPoint *point,
struct EffectorWeights *weights);
int closest_point_on_surface(struct SurfaceModifierData *surmd,
const float co[3],
float surface_co[3],
float surface_nor[3],
float surface_vel[3]);
int get_effector_data(struct EffectorCache *eff,
struct EffectorData *efd,
struct EffectedPoint *point,
int real_velocity);
bool closest_point_on_surface(struct SurfaceModifierData *surmd,
const float co[3],
float surface_co[3],
float surface_nor[3],
float surface_vel[3]);
bool get_effector_data(struct EffectorCache *eff,
struct EffectorData *efd,
struct EffectedPoint *point,
int real_velocity);
/* required for particle_system.c */
#if 0

View File

@ -441,12 +441,12 @@ void psys_get_particle_on_path(struct ParticleSimulationData *sim,
const bool vel);
/**
* Gets particle's state at a time.
* \return 1 if particle exists and can be seen and 0 if not.
* \return true if particle exists and can be seen and false if not.
*/
int psys_get_particle_state(struct ParticleSimulationData *sim,
int p,
struct ParticleKey *state,
int always);
bool psys_get_particle_state(struct ParticleSimulationData *sim,
int p,
struct ParticleKey *state,
const bool always);
/* Child paths. */

View File

@ -795,7 +795,7 @@ static void curvemap_make_table(const CurveMapping *cumap, CurveMap *cuma)
cuma->table = cmp;
}
void BKE_curvemapping_premultiply(CurveMapping *cumap, int restore)
void BKE_curvemapping_premultiply(CurveMapping *cumap, bool restore)
{
/* It uses a flag to prevent pre-multiply or free to happen twice. */

View File

@ -652,11 +652,11 @@ float effector_falloff(EffectorCache *eff,
return falloff;
}
int closest_point_on_surface(SurfaceModifierData *surmd,
const float co[3],
float surface_co[3],
float surface_nor[3],
float surface_vel[3])
bool closest_point_on_surface(SurfaceModifierData *surmd,
const float co[3],
float surface_co[3],
float surface_nor[3],
float surface_vel[3])
{
BVHTreeNearest nearest;
@ -683,18 +683,18 @@ int closest_point_on_surface(SurfaceModifierData *surmd,
mul_v3_fl(surface_vel, (1.0f / 3.0f));
}
return 1;
return true;
}
return 0;
return false;
}
int get_effector_data(EffectorCache *eff,
EffectorData *efd,
EffectedPoint *point,
int real_velocity)
bool get_effector_data(EffectorCache *eff,
EffectorData *efd,
EffectedPoint *point,
int real_velocity)
{
float cfra = DEG_get_ctime(eff->depsgraph);
int ret = 0;
bool ret = false;
/* In case surface object is in Edit mode when loading the .blend,
* surface modifier is never executed and bvhtree never built, see T48415. */
@ -726,7 +726,7 @@ int get_effector_data(EffectorCache *eff,
efd->size = 0.0f;
ret = 1;
ret = true;
}
}
else if (eff->psys) {
@ -794,7 +794,7 @@ int get_effector_data(EffectorCache *eff,
zero_v3(efd->vel);
efd->size = 0.0f;
ret = 1;
ret = true;
}
if (ret) {

View File

@ -4848,7 +4848,10 @@ void psys_get_particle_on_path(ParticleSimulationData *sim,
}
}
}
int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *state, int always)
bool psys_get_particle_state(ParticleSimulationData *sim,
int p,
ParticleKey *state,
const bool always)
{
ParticleSystem *psys = sim->psys;
ParticleSettings *part = psys->part;
@ -4863,12 +4866,12 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
if (p >= totpart) {
if (!psys->totchild) {
return 0;
return false;
}
if (part->childtype == PART_CHILD_FACES) {
if (!(psys->flag & PSYS_KEYED)) {
return 0;
return false;
}
cpa = psys->child + p - totpart;
@ -4878,7 +4881,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
if (!always) {
if ((state->time < 0.0f && !(part->flag & PART_UNBORN)) ||
(state->time > 1.0f && !(part->flag & PART_DIED))) {
return 0;
return false;
}
}
@ -4886,7 +4889,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
(part->lifetime * psys_frand(psys, p + 24));
psys_get_particle_on_path(sim, p, state, 1);
return 1;
return true;
}
cpa = sim->psys->child + p - totpart;
@ -4900,7 +4903,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
if (!always) {
if ((cfra < pa->time && (part->flag & PART_UNBORN) == 0) ||
(cfra >= pa->dietime && (part->flag & PART_DIED) == 0)) {
return 0;
return false;
}
}
@ -4910,7 +4913,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
if (sim->psys->flag & PSYS_KEYED) {
state->time = -cfra;
psys_get_particle_on_path(sim, p, state, 1);
return 1;
return true;
}
if (cpa) {
@ -5010,7 +5013,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
}
}
return 1;
return true;
}
void psys_get_dupli_texture(ParticleSystem *psys,