Fluid: Fix particle settings type

This commit is contained in:
Sebastián Barschkis 2019-12-17 11:39:23 +01:00
parent 4b62d98984
commit bda4a284d2
5 changed files with 34 additions and 29 deletions

View File

@ -556,9 +556,9 @@ void AbcExporter::createParticleSystemsWriters(Object *ob, AbcTransformWriter *x
m_shapes.push_back(new AbcHairWriter(ob, xform, m_shape_sampling_index, m_settings, psys));
}
else if (m_settings.export_particles &&
(psys->part->type & PART_EMITTER || psys->part->type & PART_FLUID_FLIP ||
psys->part->type & PART_FLUID_SPRAY || psys->part->type & PART_FLUID_BUBBLE ||
psys->part->type & PART_FLUID_FOAM || psys->part->type & PART_FLUID_TRACER)) {
(psys->part->type == PART_EMITTER || psys->part->type == PART_FLUID_FLIP ||
psys->part->type == PART_FLUID_SPRAY || psys->part->type == PART_FLUID_BUBBLE ||
psys->part->type == PART_FLUID_FOAM || psys->part->type == PART_FLUID_TRACER)) {
m_shapes.push_back(new AbcPointsWriter(ob, xform, m_shape_sampling_index, m_settings, psys));
}
}

View File

@ -4171,15 +4171,15 @@ static void particles_fluid_step(ParticleSimulationData *sim,
float min[3], max[3], size[3], cell_size_scaled[3], max_size;
/* Sanity check: parts also enabled in fluid domain? */
if ((part->type & PART_FLUID_FLIP &&
if ((part->type == PART_FLUID_FLIP &&
(mds->particle_type & FLUID_DOMAIN_PARTICLE_FLIP) == 0) ||
(part->type & PART_FLUID_SPRAY &&
(part->type == PART_FLUID_SPRAY &&
(mds->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) == 0) ||
(part->type & PART_FLUID_BUBBLE &&
(part->type == PART_FLUID_BUBBLE &&
(mds->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE) == 0) ||
(part->type & PART_FLUID_FOAM &&
(part->type == PART_FLUID_FOAM &&
(mds->particle_type & FLUID_DOMAIN_PARTICLE_FOAM) == 0) ||
(part->type & PART_FLUID_TRACER &&
(part->type == PART_FLUID_TRACER &&
(mds->particle_type & FLUID_DOMAIN_PARTICLE_TRACER) == 0)) {
BLI_snprintf(debugStrBuffer,
sizeof(debugStrBuffer),
@ -4189,11 +4189,11 @@ static void particles_fluid_step(ParticleSimulationData *sim,
}
/* Count particle amount. tottypepart is only important for snd particles. */
if (part->type & PART_FLUID_FLIP) {
if (part->type == PART_FLUID_FLIP) {
tottypepart = totpart = manta_liquid_get_num_flip_particles(mds->fluid);
}
if (part->type &
(PART_FLUID_SPRAY | PART_FLUID_BUBBLE | PART_FLUID_FOAM | PART_FLUID_TRACER)) {
if ((part->type == PART_FLUID_SPRAY) || (part->type == PART_FLUID_BUBBLE) ||
(part->type == PART_FLUID_FOAM) || (part->type == PART_FLUID_TRACER)) {
totpart = manta_liquid_get_num_snd_particles(mds->fluid);
/* tottypepart is the amount of particles of a snd particle type. */
@ -4242,7 +4242,7 @@ static void particles_fluid_step(ParticleSimulationData *sim,
}
/* flag, res, upres, pos, vel for FLIP and snd particles have different getters. */
if (part->type & PART_FLUID_FLIP) {
if (part->type == PART_FLUID_FLIP) {
flagActivePart = manta_liquid_get_flip_particle_flag_at(mds->fluid, p);
resX = (float)manta_get_res_x(mds->fluid);
@ -4259,8 +4259,8 @@ static void particles_fluid_step(ParticleSimulationData *sim,
velY = manta_liquid_get_flip_particle_velocity_y_at(mds->fluid, p);
velZ = manta_liquid_get_flip_particle_velocity_z_at(mds->fluid, p);
}
else if (part->type &
(PART_FLUID_SPRAY | PART_FLUID_BUBBLE | PART_FLUID_FOAM | PART_FLUID_TRACER)) {
else if ((part->type == PART_FLUID_SPRAY) || (part->type == PART_FLUID_BUBBLE) ||
(part->type == PART_FLUID_FOAM) || (part->type == PART_FLUID_TRACER)) {
flagActivePart = manta_liquid_get_snd_particle_flag_at(mds->fluid, p);
resX = (float)manta_liquid_get_particle_res_x(mds->fluid);
@ -4787,7 +4787,7 @@ void particle_system_update(struct Depsgraph *depsgraph,
/* setup necessary physics type dependent additional data if it doesn't yet exist */
psys_prepare_physics(&sim);
if (part->type & PART_HAIR) {
if (part->type == PART_HAIR) {
/* nothing to do so bail out early */
if (psys->totpart == 0 && part->totpart == 0) {
psys_free_path_cache(psys, NULL);
@ -4844,8 +4844,9 @@ void particle_system_update(struct Depsgraph *depsgraph,
hair_step(&sim, cfra, use_render_params);
}
}
else if (part->type & (PART_FLUID_FLIP | PART_FLUID_BUBBLE | PART_FLUID_BUBBLE |
PART_FLUID_FOAM | PART_FLUID_TRACER)) {
else if ((part->type == PART_FLUID_FLIP) || (part->type == PART_FLUID_SPRAY) ||
(part->type == PART_FLUID_BUBBLE) || (part->type == PART_FLUID_FOAM) ||
(part->type == PART_FLUID_TRACER)) {
particles_fluid_step(&sim, (int)cfra, use_render_params);
}
else {

View File

@ -1822,7 +1822,7 @@ static int modifier_can_delete(ModifierData *md)
short particle_type = ((ParticleSystemModifierData *)md)->psys->part->type;
if (particle_type == PART_FLUID || particle_type == PART_FLUID_FLIP ||
particle_type == PART_FLUID_FOAM || particle_type == PART_FLUID_SPRAY ||
particle_type == PART_FLUID_BUBBLE || particle_type == PART_FLUID_BUBBLE) {
particle_type == PART_FLUID_BUBBLE || particle_type == PART_FLUID_TRACER) {
return 0;
}
}

View File

@ -433,16 +433,16 @@ typedef enum eParticleDrawFlag {
* Hair is always baked static in object/geometry space.
* Other types (normal particles) are in global space and not static baked. */
enum {
PART_EMITTER = (1 << 0),
PART_EMITTER = 0,
/* REACTOR type currently unused */
/* PART_REACTOR = (1 << 1), */
PART_HAIR = (1 << 2),
PART_FLUID = (1 << 3), /* deprecated (belonged to elbeem) */
PART_FLUID_FLIP = (1 << 4),
PART_FLUID_SPRAY = (1 << 5),
PART_FLUID_BUBBLE = (1 << 6),
PART_FLUID_FOAM = (1 << 7),
PART_FLUID_TRACER = (1 << 8),
/* PART_REACTOR = 1, */
PART_HAIR = 2,
PART_FLUID = 3, /* deprecated (belonged to elbeem) */
PART_FLUID_FLIP = 4,
PART_FLUID_SPRAY = 5,
PART_FLUID_BUBBLE = 6,
PART_FLUID_FOAM = 7,
PART_FLUID_TRACER = 8,
};
/* Mirroring Mantaflow particle types from particle.h (Mantaflow header). */

View File

@ -954,8 +954,12 @@ static int rna_PartSettings_is_fluid_get(PointerRNA *ptr)
{
ParticleSettings *part = (ParticleSettings *)ptr->data;
return (part->type & (PART_FLUID_FLIP | PART_FLUID_SPRAY | PART_FLUID_BUBBLE | PART_FLUID_FOAM |
PART_FLUID_TRACER));
if (part->type == PART_FLUID || part->type == PART_FLUID_FLIP || part->type == PART_FLUID_FOAM ||
part->type == PART_FLUID_SPRAY || part->type == PART_FLUID_BUBBLE ||
part->type == PART_FLUID_TRACER) {
return true;
}
return false;
}
static void rna_ParticleSettings_use_clump_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)