Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-01-20 11:22:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-01-20 11:22:44 +0300
commitfb26d25405319191eed286a0f9bdd58b899c6009 (patch)
tree1b3e234257eaaf9ada8838dff39ce87ddb83cfe3 /source
parent3fb8191d1dbd5c50c8bd5b0821e7cf1bb9885736 (diff)
parent6395937b01f0f6ca8669d694edcf9e7d258a30a1 (diff)
Merge branch 'blender-v2.82-release'
Diffstat (limited to 'source')
-rw-r--r--source/blender/alembic/intern/abc_exporter.cc6
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c6
-rw-r--r--source/blender/blenkernel/intern/fluid.c74
-rw-r--r--source/blender/blenkernel/intern/particle_system.c68
-rw-r--r--source/blender/editors/interface/interface_templates.c4
-rw-r--r--source/blender/editors/mesh/editmesh_bisect.c7
-rw-r--r--source/blender/makesdna/DNA_particle_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_fluid.c215
-rw-r--r--source/blender/makesrna/intern/rna_particle.c6
9 files changed, 250 insertions, 140 deletions
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index cacf0676481..c2201c706bc 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -558,7 +558,11 @@ void AbcExporter::createParticleSystemsWriters(Object *ob, AbcTransformWriter *x
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_FLUID_FOAM || psys->part->type == PART_FLUID_TRACER ||
+ psys->part->type == PART_FLUID_SPRAYFOAM ||
+ psys->part->type == PART_FLUID_SPRAYBUBBLE ||
+ psys->part->type == PART_FLUID_FOAMBUBBLE ||
+ psys->part->type == PART_FLUID_SPRAYFOAMBUBBLE)) {
m_shapes.push_back(new AbcPointsWriter(ob, xform, m_shape_sampling_index, m_settings, psys));
}
}
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 74a523bfbdc..a70e5b67a15 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -6285,7 +6285,11 @@ static int dynamicPaint_doStep(Depsgraph *depsgraph,
PART_FLUID_SPRAY,
PART_FLUID_BUBBLE,
PART_FLUID_FOAM,
- PART_FLUID_TRACER) &&
+ PART_FLUID_TRACER,
+ PART_FLUID_SPRAYFOAM,
+ PART_FLUID_SPRAYBUBBLE,
+ PART_FLUID_FOAMBUBBLE,
+ PART_FLUID_SPRAYFOAMBUBBLE) &&
psys_check_enabled(brushObj, brush->psys, for_render)) {
/* Paint a particle system */
dynamicPaint_paintParticles(surface, brush->psys, brush, timescale);
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index 0213d10796a..106f1216d2a 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -3110,7 +3110,7 @@ static Mesh *create_liquid_geometry(FluidDomainSettings *mds, Mesh *orgmesh, Obj
// if reading raw data directly from manta, normalize now, otherwise omit this, ie when reading
// from files
- {
+ if (!manta_liquid_mesh_from_file(mds->fluid)) {
// normalize to unit cube around 0
mverts->co[0] -= ((float)mds->res[0] * mds->mesh_scale) * 0.5f;
mverts->co[1] -= ((float)mds->res[1] * mds->mesh_scale) * 0.5f;
@@ -3664,12 +3664,14 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
/* Read mesh cache. */
if (with_liquid && with_mesh) {
- has_mesh = manta_read_mesh(mds->fluid, mmd, mesh_frame);
+ /* Update mesh data from file is faster than via Python (manta_read_mesh()). */
+ has_mesh = manta_update_mesh_structures(mds->fluid, mmd, mesh_frame);
}
/* Read particles cache. */
if (with_liquid && with_particles) {
- has_particles = manta_read_particles(mds->fluid, mmd, particles_frame);
+ /* Update particle data from file is faster than via Python (manta_read_particles()). */
+ has_particles = manta_update_particle_structures(mds->fluid, mmd, particles_frame);
}
/* Read guide cache. */
@@ -3707,12 +3709,23 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
}
/* Read data cache only */
else {
- /* Read config and realloc fluid object if needed. */
- if (manta_read_config(mds->fluid, mmd, data_frame) && manta_needs_realloc(mds->fluid, mmd)) {
- BKE_fluid_reallocate_fluid(mds, mds->res, 1);
+ if (with_smoke) {
+ /* Read config and realloc fluid object if needed. */
+ if (manta_read_config(mds->fluid, mmd, data_frame) &&
+ manta_needs_realloc(mds->fluid, mmd)) {
+ BKE_fluid_reallocate_fluid(mds, mds->res, 1);
+ }
+ /* Read data cache */
+ has_data = manta_read_data(mds->fluid, mmd, data_frame);
+ }
+ if (with_liquid) {
+ if (!baking_data && !baking_particles && !baking_mesh) {
+ has_data = manta_update_liquid_structures(mds->fluid, mmd, data_frame);
+ }
+ else {
+ has_data = manta_read_data(mds->fluid, mmd, data_frame);
+ }
}
- /* Read data cache */
- has_data = manta_read_data(mds->fluid, mmd, data_frame);
}
}
@@ -3806,15 +3819,46 @@ struct Mesh *BKE_fluid_modifier_do(
BLI_rw_mutex_unlock(mmd->domain->fluid_mutex);
}
+ /* Optimization: Do not update viewport during bakes (except in replay mode)
+ * Reason: UI is locked and updated liquid / smoke geometry is not visible anyways. */
+ bool needs_viewport_update = false;
+ if (mmd->domain) {
+ FluidDomainSettings *mds = mmd->domain;
+
+ /* Always update viewport in cache replay mode. */
+ if (mds->cache_type == FLUID_DOMAIN_CACHE_REPLAY) {
+ needs_viewport_update = true;
+ }
+ /* In other cache modes, only update the viewport when no bake is going on. */
+ else {
+ bool with_mesh;
+ with_mesh = mds->flags & FLUID_DOMAIN_USE_MESH;
+ bool baking_data, baking_noise, baking_mesh, baking_particles, baking_guide;
+ baking_data = mds->cache_flag & FLUID_DOMAIN_BAKING_DATA;
+ baking_noise = mds->cache_flag & FLUID_DOMAIN_BAKING_NOISE;
+ baking_mesh = mds->cache_flag & FLUID_DOMAIN_BAKING_MESH;
+ baking_particles = mds->cache_flag & FLUID_DOMAIN_BAKING_PARTICLES;
+ baking_guide = mds->cache_flag & FLUID_DOMAIN_BAKING_GUIDE;
+
+ if (with_mesh && !baking_data && !baking_noise && !baking_mesh && !baking_particles &&
+ !baking_guide) {
+ needs_viewport_update = true;
+ }
+ }
+ }
+
Mesh *result = NULL;
if (mmd->type & MOD_FLUID_TYPE_DOMAIN && mmd->domain) {
- /* Return generated geometry depending on domain type. */
- if (mmd->domain->type == FLUID_DOMAIN_TYPE_LIQUID) {
- result = create_liquid_geometry(mmd->domain, me, ob);
- }
- if (mmd->domain->type == FLUID_DOMAIN_TYPE_GAS) {
- result = create_smoke_geometry(mmd->domain, me, ob);
+ if (needs_viewport_update) {
+ /* Return generated geometry depending on domain type. */
+ if (mmd->domain->type == FLUID_DOMAIN_TYPE_LIQUID) {
+ result = create_liquid_geometry(mmd->domain, me, ob);
+ }
+ if (mmd->domain->type == FLUID_DOMAIN_TYPE_GAS) {
+ result = create_smoke_geometry(mmd->domain, me, ob);
+ }
}
+
/* Clear flag outside of locked block (above). */
mmd->domain->cache_flag &= ~FLUID_DOMAIN_OUTDATED_DATA;
mmd->domain->cache_flag &= ~FLUID_DOMAIN_OUTDATED_NOISE;
@@ -4161,7 +4205,7 @@ void BKE_fluid_particle_system_destroy(struct Object *ob, const int particle_typ
for (psys = ob->particlesystem.first; psys; psys = next_psys) {
next_psys = psys->next;
- if (psys->part->type & particle_type) {
+ if (psys->part->type == particle_type) {
/* clear modifier */
pmmd = psys_get_modifier(ob, psys);
BLI_remlink(&ob->modifiers, pmmd);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 34f2aa73817..172940760f9 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -4137,6 +4137,34 @@ static void cached_step(ParticleSimulationData *sim, float cfra, const bool use_
}
}
+static bool particles_has_flip(short parttype)
+{
+ return (parttype == PART_FLUID_FLIP);
+}
+
+static bool particles_has_tracer(short parttype)
+{
+ return (parttype == PART_FLUID_TRACER);
+}
+
+static bool particles_has_spray(short parttype)
+{
+ return ((parttype == PART_FLUID_SPRAY) || (parttype == PART_FLUID_SPRAYFOAM) ||
+ (parttype == PART_FLUID_SPRAYFOAMBUBBLE));
+}
+
+static bool particles_has_bubble(short parttype)
+{
+ return ((parttype == PART_FLUID_BUBBLE) || (parttype == PART_FLUID_FOAMBUBBLE) ||
+ (parttype == PART_FLUID_SPRAYFOAMBUBBLE));
+}
+
+static bool particles_has_foam(short parttype)
+{
+ return ((parttype == PART_FLUID_FOAM) || (parttype == PART_FLUID_SPRAYFOAM) ||
+ (parttype == PART_FLUID_SPRAYFOAMBUBBLE));
+}
+
static void particles_fluid_step(ParticleSimulationData *sim,
int cfra,
const bool use_render_params)
@@ -4173,15 +4201,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 ((particles_has_flip(part->type) &&
(mds->particle_type & FLUID_DOMAIN_PARTICLE_FLIP) == 0) ||
- (part->type == PART_FLUID_SPRAY &&
+ (particles_has_spray(part->type) &&
(mds->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) == 0) ||
- (part->type == PART_FLUID_BUBBLE &&
+ (particles_has_bubble(part->type) &&
(mds->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE) == 0) ||
- (part->type == PART_FLUID_FOAM &&
+ (particles_has_foam(part->type) &&
(mds->particle_type & FLUID_DOMAIN_PARTICLE_FOAM) == 0) ||
- (part->type == PART_FLUID_TRACER &&
+ (particles_has_tracer(part->type) &&
(mds->particle_type & FLUID_DOMAIN_PARTICLE_TRACER) == 0)) {
BLI_snprintf(debugStrBuffer,
sizeof(debugStrBuffer),
@@ -4194,23 +4222,23 @@ static void particles_fluid_step(ParticleSimulationData *sim,
if (part->type == PART_FLUID_FLIP) {
tottypepart = totpart = manta_liquid_get_num_flip_particles(mds->fluid);
}
- if ((part->type == PART_FLUID_SPRAY) || (part->type == PART_FLUID_BUBBLE) ||
- (part->type == PART_FLUID_FOAM) || (part->type == PART_FLUID_TRACER)) {
+ if (particles_has_spray(part->type) || particles_has_bubble(part->type) ||
+ particles_has_foam(part->type) || particles_has_tracer(part->type)) {
totpart = manta_liquid_get_num_snd_particles(mds->fluid);
/* tottypepart is the amount of particles of a snd particle type. */
for (p = 0; p < totpart; p++) {
flagActivePart = manta_liquid_get_snd_particle_flag_at(mds->fluid, p);
- if ((part->type & PART_FLUID_SPRAY) && (flagActivePart & PARTICLE_TYPE_SPRAY)) {
+ if (particles_has_spray(part->type) && (flagActivePart & PARTICLE_TYPE_SPRAY)) {
tottypepart++;
}
- if ((part->type & PART_FLUID_BUBBLE) && (flagActivePart & PARTICLE_TYPE_BUBBLE)) {
+ if (particles_has_bubble(part->type) && (flagActivePart & PARTICLE_TYPE_BUBBLE)) {
tottypepart++;
}
- if ((part->type & PART_FLUID_FOAM) && (flagActivePart & PARTICLE_TYPE_FOAM)) {
+ if (particles_has_foam(part->type) && (flagActivePart & PARTICLE_TYPE_FOAM)) {
tottypepart++;
}
- if ((part->type & PART_FLUID_TRACER) && (flagActivePart & PARTICLE_TYPE_TRACER)) {
+ if (particles_has_tracer(part->type) && (flagActivePart & PARTICLE_TYPE_TRACER)) {
tottypepart++;
}
}
@@ -4261,8 +4289,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->type == PART_FLUID_BUBBLE) ||
- (part->type == PART_FLUID_FOAM) || (part->type == PART_FLUID_TRACER)) {
+ else if (particles_has_spray(part->type) || particles_has_bubble(part->type) ||
+ particles_has_foam(part->type) || particles_has_tracer(part->type)) {
flagActivePart = manta_liquid_get_snd_particle_flag_at(mds->fluid, p);
resX = (float)manta_liquid_get_particle_res_x(mds->fluid);
@@ -4292,16 +4320,16 @@ static void particles_fluid_step(ParticleSimulationData *sim,
/* Type of particle must match current particle system type
* (only important for snd particles). */
- if ((flagActivePart & PARTICLE_TYPE_SPRAY) && (part->type & PART_FLUID_SPRAY) == 0) {
+ if ((flagActivePart & PARTICLE_TYPE_SPRAY) && !particles_has_spray(part->type)) {
continue;
}
- if ((flagActivePart & PARTICLE_TYPE_BUBBLE) && (part->type & PART_FLUID_BUBBLE) == 0) {
+ if ((flagActivePart & PARTICLE_TYPE_BUBBLE) && !particles_has_bubble(part->type)) {
continue;
}
- if ((flagActivePart & PARTICLE_TYPE_FOAM) && (part->type & PART_FLUID_FOAM) == 0) {
+ if ((flagActivePart & PARTICLE_TYPE_FOAM) && !particles_has_foam(part->type)) {
continue;
}
- if ((flagActivePart & PARTICLE_TYPE_TRACER) && (part->type & PART_FLUID_TRACER) == 0) {
+ if ((flagActivePart & PARTICLE_TYPE_TRACER) && !particles_has_tracer(part->type)) {
continue;
}
# if 0
@@ -4844,9 +4872,9 @@ void particle_system_update(struct Depsgraph *depsgraph,
hair_step(&sim, cfra, use_render_params);
}
}
- 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)) {
+ else if (particles_has_flip(part->type) || particles_has_spray(part->type) ||
+ particles_has_bubble(part->type) || particles_has_foam(part->type) ||
+ particles_has_tracer(part->type)) {
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 4fcc8ba4112..c43b7385a36 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1822,7 +1822,9 @@ 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_TRACER) {
+ particle_type == PART_FLUID_BUBBLE || particle_type == PART_FLUID_TRACER ||
+ particle_type == PART_FLUID_SPRAYFOAM || particle_type == PART_FLUID_SPRAYBUBBLE ||
+ particle_type == PART_FLUID_FOAMBUBBLE || particle_type == PART_FLUID_SPRAYFOAMBUBBLE) {
return 0;
}
}
diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c
index 0bf9688888b..b2af58e47f2 100644
--- a/source/blender/editors/mesh/editmesh_bisect.c
+++ b/source/blender/editors/mesh/editmesh_bisect.c
@@ -346,10 +346,9 @@ static int mesh_bisect_exec(bContext *C, wmOperator *op)
BMOperator bmop_fill;
BMOperator bmop_attr;
+ /* The fill normal sign is ignored as the face-winding is defined by surrounding faces.
+ * The normal is passed so triangle fill wont have to calculate it. */
normalize_v3_v3(normal_fill, plane_no_local);
- if (clear_outer == true && clear_inner == false) {
- negate_v3(normal_fill);
- }
/* Fill */
BMO_op_initf(bm,
@@ -369,7 +368,7 @@ static int mesh_bisect_exec(bContext *C, wmOperator *op)
"face_attribute_fill faces=%S use_normals=%b use_data=%b",
&bmop_fill,
"geom.out",
- false,
+ true,
true);
BMO_op_exec(bm, &bmop_attr);
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 5012fbeca91..373c193b4ab 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -443,6 +443,10 @@ enum {
PART_FLUID_BUBBLE = 6,
PART_FLUID_FOAM = 7,
PART_FLUID_TRACER = 8,
+ PART_FLUID_SPRAYFOAM = 9,
+ PART_FLUID_SPRAYBUBBLE = 10,
+ PART_FLUID_FOAMBUBBLE = 11,
+ PART_FLUID_SPRAYFOAMBUBBLE = 12,
};
/* Mirroring Mantaflow particle types from particle.h (Mantaflow header). */
diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c
index b84da6a4ed9..0e819b555e8 100644
--- a/source/blender/makesrna/intern/rna_fluid.c
+++ b/source/blender/makesrna/intern/rna_fluid.c
@@ -192,15 +192,13 @@ static void rna_Fluid_flip_parts_update(Main *bmain, Scene *scene, PointerRNA *p
}
else {
rna_Fluid_parts_delete(ptr, PART_FLUID_FLIP);
- rna_Fluid_resetCache(bmain, scene, ptr);
-
mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_FLIP;
}
rna_Fluid_draw_type_update(NULL, NULL, ptr);
- rna_Fluid_reset(bmain, scene, ptr);
+ rna_Fluid_update(bmain, scene, ptr);
}
-static void rna_Fluid_spray_parts_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Fluid_spray_parts_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
FluidModifierData *mmd;
@@ -218,15 +216,12 @@ static void rna_Fluid_spray_parts_update(Main *bmain, Scene *scene, PointerRNA *
}
else {
rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAY);
- rna_Fluid_resetCache(bmain, scene, ptr);
-
mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_SPRAY;
}
rna_Fluid_draw_type_update(NULL, NULL, ptr);
- rna_Fluid_reset(bmain, scene, ptr);
}
-static void rna_Fluid_bubble_parts_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Fluid_bubble_parts_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
FluidModifierData *mmd;
@@ -244,15 +239,12 @@ static void rna_Fluid_bubble_parts_update(Main *bmain, Scene *scene, PointerRNA
}
else {
rna_Fluid_parts_delete(ptr, PART_FLUID_BUBBLE);
- rna_Fluid_resetCache(bmain, scene, ptr);
-
mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_BUBBLE;
}
rna_Fluid_draw_type_update(NULL, NULL, ptr);
- rna_Fluid_reset(bmain, scene, ptr);
}
-static void rna_Fluid_foam_parts_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Fluid_foam_parts_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
FluidModifierData *mmd;
@@ -270,15 +262,12 @@ static void rna_Fluid_foam_parts_update(Main *bmain, Scene *scene, PointerRNA *p
}
else {
rna_Fluid_parts_delete(ptr, PART_FLUID_FOAM);
- rna_Fluid_resetCache(bmain, scene, ptr);
-
mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_FOAM;
}
rna_Fluid_draw_type_update(NULL, NULL, ptr);
- rna_Fluid_reset(bmain, scene, ptr);
}
-static void rna_Fluid_tracer_parts_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Fluid_tracer_parts_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
FluidModifierData *mmd;
@@ -296,12 +285,9 @@ static void rna_Fluid_tracer_parts_update(Main *bmain, Scene *scene, PointerRNA
}
else {
rna_Fluid_parts_delete(ptr, PART_FLUID_TRACER);
- rna_Fluid_resetCache(bmain, scene, ptr);
-
mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_TRACER;
}
rna_Fluid_draw_type_update(NULL, NULL, ptr);
- rna_Fluid_reset(bmain, scene, ptr);
}
static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -311,101 +297,131 @@ static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerR
mmd = (FluidModifierData *)modifiers_findByType(ob, eModifierType_Fluid);
if (mmd->domain->sndparticle_combined_export == SNDPARTICLE_COMBINED_EXPORT_OFF) {
- rna_Fluid_parts_delete(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM | PART_FLUID_BUBBLE));
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYFOAM);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYBUBBLE);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_FOAMBUBBLE);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYFOAMBUBBLE);
- // re-add each particle type if enabled
- if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) != 0) {
+ bool exists_spray = rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAY);
+ bool exists_foam = rna_Fluid_parts_exists(ptr, PART_FLUID_FOAM);
+ bool exists_bubble = rna_Fluid_parts_exists(ptr, PART_FLUID_BUBBLE);
+
+ /* Re-add each particle type if enabled and no particle system exists for them anymore. */
+ if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) && !exists_spray) {
rna_Fluid_spray_parts_update(bmain, scene, ptr);
}
- if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FOAM) != 0) {
+ if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FOAM) && !exists_foam) {
rna_Fluid_foam_parts_update(bmain, scene, ptr);
}
- if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE) != 0) {
+ if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE) && !exists_bubble) {
rna_Fluid_bubble_parts_update(bmain, scene, ptr);
}
}
else if (mmd->domain->sndparticle_combined_export == SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM) {
- if (ob->type == OB_MESH &&
- !rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM))) {
- rna_Fluid_parts_delete(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM));
- }
- rna_Fluid_parts_create(bmain,
- ptr,
- "SprayFoamParticleSettings",
- "Spray + Foam Particles",
- "Spray + Foam Particle System",
- (PART_FLUID_SPRAY | PART_FLUID_FOAM));
-
- mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_SPRAY;
- mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_FOAM;
-
- // re-add bubbles if enabled
- if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE) != 0) {
- rna_Fluid_bubble_parts_update(bmain, scene, ptr);
+ if (ob->type == OB_MESH && !rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAYFOAM)) {
+
+ rna_Fluid_parts_create(bmain,
+ ptr,
+ "SprayFoamParticleSettings",
+ "Spray + Foam Particles",
+ "Spray + Foam Particle System",
+ PART_FLUID_SPRAYFOAM);
+
+ mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_SPRAY;
+ mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_FOAM;
+
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAY);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_FOAM);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYBUBBLE);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_FOAMBUBBLE);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYFOAMBUBBLE);
+
+ /* Re-add spray if enabled and no particle system exists for it anymore. */
+ bool exists_bubble = rna_Fluid_parts_exists(ptr, PART_FLUID_BUBBLE);
+ if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE) && !exists_bubble) {
+ rna_Fluid_bubble_parts_update(bmain, scene, ptr);
+ }
}
}
else if (mmd->domain->sndparticle_combined_export == SNDPARTICLE_COMBINED_EXPORT_SPRAY_BUBBLE) {
- if (ob->type == OB_MESH &&
- !rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_BUBBLE))) {
- rna_Fluid_parts_delete(ptr, (PART_FLUID_SPRAY | PART_FLUID_BUBBLE));
- }
- rna_Fluid_parts_create(bmain,
- ptr,
- "SprayBubbleParticleSettings",
- "Spray + Bubble Particles",
- "Spray + Bubble Particle System",
- (PART_FLUID_SPRAY | PART_FLUID_BUBBLE));
-
- mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_SPRAY;
- mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_BUBBLE;
-
- // re-add foam if enabled
- if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FOAM) != 0) {
- rna_Fluid_foam_parts_update(bmain, scene, ptr);
+ if (ob->type == OB_MESH && !rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAYBUBBLE)) {
+
+ rna_Fluid_parts_create(bmain,
+ ptr,
+ "SprayBubbleParticleSettings",
+ "Spray + Bubble Particles",
+ "Spray + Bubble Particle System",
+ PART_FLUID_SPRAYBUBBLE);
+
+ mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_SPRAY;
+ mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_BUBBLE;
+
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAY);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_BUBBLE);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYFOAM);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_FOAMBUBBLE);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYFOAMBUBBLE);
+
+ /* Re-add foam if enabled and no particle system exists for it anymore. */
+ bool exists_foam = rna_Fluid_parts_exists(ptr, PART_FLUID_FOAM);
+ if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FOAM) && !exists_foam) {
+ rna_Fluid_foam_parts_update(bmain, scene, ptr);
+ }
}
}
else if (mmd->domain->sndparticle_combined_export == SNDPARTICLE_COMBINED_EXPORT_FOAM_BUBBLE) {
- if (ob->type == OB_MESH &&
- !rna_Fluid_parts_exists(ptr, (PART_FLUID_FOAM | PART_FLUID_BUBBLE))) {
- rna_Fluid_parts_delete(ptr, (PART_FLUID_FOAM | PART_FLUID_BUBBLE));
- }
- rna_Fluid_parts_create(bmain,
- ptr,
- "FoamBubbleParticleSettings",
- "Foam + Bubble Particles",
- "Foam + Bubble Particle System",
- (PART_FLUID_FOAM | PART_FLUID_BUBBLE));
-
- mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_FOAM;
- mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_BUBBLE;
-
- // re-add spray if enabled
- if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) != 0) {
- rna_Fluid_spray_parts_update(bmain, scene, ptr);
+ if (ob->type == OB_MESH && !rna_Fluid_parts_exists(ptr, PART_FLUID_FOAMBUBBLE)) {
+
+ rna_Fluid_parts_create(bmain,
+ ptr,
+ "FoamBubbleParticleSettings",
+ "Foam + Bubble Particles",
+ "Foam + Bubble Particle System",
+ PART_FLUID_FOAMBUBBLE);
+
+ mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_FOAM;
+ mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_BUBBLE;
+
+ rna_Fluid_parts_delete(ptr, PART_FLUID_FOAM);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_BUBBLE);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYFOAM);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYBUBBLE);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYFOAMBUBBLE);
+
+ /* Re-add foam if enabled and no particle system exists for it anymore. */
+ bool exists_spray = rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAY);
+ if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) && !exists_spray) {
+ rna_Fluid_spray_parts_update(bmain, scene, ptr);
+ }
}
}
else if (mmd->domain->sndparticle_combined_export ==
SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM_BUBBLE) {
- if (ob->type == OB_MESH &&
- !rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM | PART_FLUID_BUBBLE))) {
- rna_Fluid_parts_delete(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM | PART_FLUID_BUBBLE));
+ if (ob->type == OB_MESH && !rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAYFOAMBUBBLE)) {
+
+ rna_Fluid_parts_create(bmain,
+ ptr,
+ "SprayFoamBubbleParticleSettings",
+ "Spray + Foam + Bubble Particles",
+ "Spray + Foam + Bubble Particle System",
+ PART_FLUID_SPRAYFOAMBUBBLE);
+
+ mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_SPRAY;
+ mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_FOAM;
+ mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_BUBBLE;
+
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAY);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_FOAM);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_BUBBLE);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYFOAM);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAYBUBBLE);
+ rna_Fluid_parts_delete(ptr, PART_FLUID_FOAMBUBBLE);
}
- rna_Fluid_parts_create(bmain,
- ptr,
- "SprayFoamBubbleParticleSettings",
- "Spray + Foam + Bubble Particles",
- "Spray + Foam + Bubble Particle System",
- (PART_FLUID_SPRAY | PART_FLUID_FOAM | PART_FLUID_BUBBLE));
-
- mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_SPRAY;
- mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_FOAM;
- mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_BUBBLE;
}
else {
// sanity check, should not occur
printf("ERROR: Unexpected combined export setting encountered!");
}
- rna_Fluid_resetCache(bmain, scene, ptr);
rna_Fluid_draw_type_update(NULL, NULL, ptr);
}
@@ -997,13 +1013,18 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
"REPLAY",
0,
"Replay",
- "Use the timeline to bake the scene. Pausing and resuming possible."},
+ "Use the timeline to bake the scene. Pausing and resuming possible"},
{FLUID_DOMAIN_CACHE_MODULAR,
"MODULAR",
0,
"Modular",
- "Bake every stage of the simulation on its own. Can pause and resume bake jobs."},
- {FLUID_DOMAIN_CACHE_FINAL, "FINAL", 0, "Final", "Bake the entire simulation at once."},
+ "Bake every stage of the simulation on its own. Pausing and resuming possible"},
+ {FLUID_DOMAIN_CACHE_FINAL,
+ "FINAL",
+ 0,
+ "Final",
+ "Bake the entire simulation at once. Only produces the most essential cache files. Pausing "
+ "and resuming not possible"},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem smoke_data_depth_items[] = {
@@ -1537,7 +1558,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "particle_type", FLUID_DOMAIN_PARTICLE_FLIP);
RNA_def_property_ui_text(prop, "FLIP", "Create FLIP particle system");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Fluid_flip_parts_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_flip_parts_update");
prop = RNA_def_property(srna, "use_fractions", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_FRACTIONS);
@@ -1822,25 +1843,25 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "particle_type", FLUID_DOMAIN_PARTICLE_SPRAY);
RNA_def_property_ui_text(prop, "Spray", "Create spray particle system");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Fluid_spray_parts_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_spray_parts_update");
prop = RNA_def_property(srna, "use_bubble_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "particle_type", FLUID_DOMAIN_PARTICLE_BUBBLE);
RNA_def_property_ui_text(prop, "Bubble", "Create bubble particle system");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Fluid_bubble_parts_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_bubble_parts_update");
prop = RNA_def_property(srna, "use_foam_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "particle_type", FLUID_DOMAIN_PARTICLE_FOAM);
RNA_def_property_ui_text(prop, "Foam", "Create foam particle system");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Fluid_foam_parts_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_foam_parts_update");
prop = RNA_def_property(srna, "use_tracer_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "particle_type", FLUID_DOMAIN_PARTICLE_TRACER);
RNA_def_property_ui_text(prop, "Tracer", "Create tracer particle system");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Fluid_tracer_parts_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_tracer_parts_update");
/* fluid guiding options */
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 9bc65de11e0..d914dc3b8dd 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -964,7 +964,11 @@ static int rna_PartSettings_is_fluid_get(PointerRNA *ptr)
PART_FLUID_FOAM,
PART_FLUID_SPRAY,
PART_FLUID_BUBBLE,
- PART_FLUID_TRACER));
+ PART_FLUID_TRACER,
+ PART_FLUID_SPRAYFOAM,
+ PART_FLUID_SPRAYBUBBLE,
+ PART_FLUID_FOAMBUBBLE,
+ PART_FLUID_SPRAYFOAMBUBBLE));
}
static void rna_ParticleSettings_use_clump_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)