diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-17 13:39:23 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-17 13:39:23 +0300 |
commit | bda4a284d20164fec2433f7c40f49fc903319400 (patch) | |
tree | a30de806282458376a5beffa8d474af2debf9ff4 | |
parent | 4b62d989847b821f35443eb3704a5b8e78a5e3c2 (diff) |
Fluid: Fix particle settings type
-rw-r--r-- | source/blender/alembic/intern/abc_exporter.cc | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 29 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_particle_types.h | 18 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 8 |
5 files changed, 34 insertions, 29 deletions
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc index 5d9f92432d1..cacf0676481 100644 --- a/source/blender/alembic/intern/abc_exporter.cc +++ b/source/blender/alembic/intern/abc_exporter.cc @@ -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)); } } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 41ca44fbcd9..17195d8c6c3 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -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 { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 2c93f35e02a..71fa28640e0 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -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; } } diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 8bbbc9fc85d..5012fbeca91 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -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). */ diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 51df843947d..b65ef1bdda2 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -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) |