[Bf-blender-cvs] [97ee6ac8b9e] fluid-mantaflow: improved particle setup sanity checks and fixed object drawtype setup (when parts enabled switch to wireframe, otherwise solid)
Sebastián Barschkis
noreply at git.blender.org
Thu Jul 6 11:14:20 CEST 2017
Commit: 97ee6ac8b9ee4210ca3a43ec8ef7dc75160273f9
Author: Sebastián Barschkis
Date: Thu Jul 6 11:14:00 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB97ee6ac8b9ee4210ca3a43ec8ef7dc75160273f9
improved particle setup sanity checks and fixed object drawtype setup (when parts enabled switch to wireframe, otherwise solid)
===================================================================
M source/blender/blenkernel/intern/particle_system.c
M source/blender/makesdna/DNA_smoke_types.h
M source/blender/makesrna/intern/rna_smoke.c
===================================================================
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 76c32273985..196df515b07 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3775,6 +3775,15 @@ static void particles_manta_step(ParticleSimulationData *sim, int UNUSED(cfra),
int flagActivePart, activeParts = 0, fileParts = 0;
float posX, posY, posZ, velX, velY, velZ;
int resX, resY, resZ;
+ char debugStrBuffer[256];
+
+ // Sanity check: parts also enabled in fluid domain?
+ if ((part->type == PART_MANTA_FLIP && !(sds->particle_type & MOD_SMOKE_PARTICLE_FLIP)) ||
+ (part->type == PART_MANTA_DROP && !(sds->particle_type & MOD_SMOKE_PARTICLE_DROP)))
+ {
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "particles_manta_step::error - found particle system that is not enabled in fluid domain\n");
+ return;
+ }
if (part->type == PART_MANTA_FLIP)
totpart = liquid_get_num_flip_particles(sds->fluid);
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index 43172078933..0acf17b404c 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -300,9 +300,8 @@ typedef struct SmokeDomainSettings {
#define MOD_SMOKE_FLOW_TEXTURE_MAP_UV 1
/* particle types */
-#define MOD_SMOKE_PARTICLE_NONE (1<<0)
-#define MOD_SMOKE_PARTICLE_FLIP (1<<1)
-#define MOD_SMOKE_PARTICLE_DROP (1<<2)
+#define MOD_SMOKE_PARTICLE_FLIP (1<<0)
+#define MOD_SMOKE_PARTICLE_DROP (1<<1)
/* flags */
#define MOD_SMOKE_FLOW_ABSOLUTE (1<<1) /*old style emission*/
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index d97ad6c5dff..0c82f4fecc1 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -140,7 +140,7 @@ static void rna_Smoke_parts_delete(PointerRNA *ptr, int ptype)
for (psys = ob->particlesystem.first; psys; psys = next_psys) {
next_psys = psys->next;
- if (psys && psys->part && psys->part->type == ptype) {
+ if (psys->part->type == ptype) {
/* clear modifier */
psmd = psys_get_modifier(ob, psys);
BLI_remlink(&ob->modifiers, psmd);
@@ -169,8 +169,8 @@ static void rna_Smoke_draw_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
Object *ob = (Object *)ptr->id.data;
SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
- /* Solid mode more convenient for meshes if no parts present */
- if (settings->particle_type & MOD_SMOKE_PARTICLE_NONE) {
+ /* Wire mode more convenient when particles present */
+ if ((settings->particle_type & (MOD_SMOKE_PARTICLE_FLIP | MOD_SMOKE_PARTICLE_DROP)) == 0) {
ob->dt = OB_SOLID;
} else {
ob->dt = OB_WIRE;
@@ -184,8 +184,9 @@ static void rna_Smoke_flip_parts_set(struct PointerRNA *ptr, int value)
smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
bool exists = rna_Smoke_parts_exists(ptr, PART_MANTA_FLIP);
- if (value && !exists) {
- rna_Smoke_parts_create(ptr, "FlipParticleSettings", "FLIP Particles", "FLIP Particle System", PART_MANTA_FLIP);
+ if (value) {
+ if (ob->type == OB_MESH && !exists)
+ rna_Smoke_parts_create(ptr, "FlipParticleSettings", "FLIP Particles", "FLIP Particle System", PART_MANTA_FLIP);
smd->domain->particle_type |= MOD_SMOKE_PARTICLE_FLIP;
}
else {
@@ -204,8 +205,9 @@ static void rna_Smoke_drop_parts_set(struct PointerRNA *ptr, int value)
smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
bool exists = rna_Smoke_parts_exists(ptr, PART_MANTA_DROP);
- if (value && !exists) {
- rna_Smoke_parts_create(ptr, "DropParticleSettings", "Drop Particles", "Drop Particle System", PART_MANTA_DROP);
+ if (value) {
+ if (ob->type == OB_MESH && !exists)
+ rna_Smoke_parts_create(ptr, "DropParticleSettings", "Drop Particles", "Drop Particle System", PART_MANTA_DROP);
smd->domain->particle_type |= MOD_SMOKE_PARTICLE_DROP;
}
else {
More information about the Bf-blender-cvs
mailing list