[Bf-blender-cvs] [881b90b9229] fluid-mantaflow: Mantaflow: Fixed issues raised in part 6 of the review (D3855)

Sebastián Barschkis noreply at git.blender.org
Tue Dec 10 22:02:24 CET 2019


Commit: 881b90b9229fa0e7b9f7eb4381a9590baa46f822
Author: Sebastián Barschkis
Date:   Tue Dec 10 22:02:13 2019 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rB881b90b9229fa0e7b9f7eb4381a9590baa46f822

Mantaflow: Fixed issues raised in part 6 of the review (D3855)

===================================================================

M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/makesdna/DNA_particle_types.h

===================================================================

diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 25702a757c1..ce34fea7981 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -4197,13 +4197,13 @@ static void particles_manta_step(ParticleSimulationData *sim,
         /* 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_MANTA_SPRAY) && (flagActivePart & PSPRAY))
+          if ((part->type & PART_MANTA_SPRAY) && (flagActivePart & PARTICLE_TYPE_SPRAY))
             tottypepart++;
-          if ((part->type & PART_MANTA_BUBBLE) && (flagActivePart & PBUBBLE))
+          if ((part->type & PART_MANTA_BUBBLE) && (flagActivePart & PARTICLE_TYPE_BUBBLE))
             tottypepart++;
-          if ((part->type & PART_MANTA_FOAM) && (flagActivePart & PFOAM))
+          if ((part->type & PART_MANTA_FOAM) && (flagActivePart & PARTICLE_TYPE_FOAM))
             tottypepart++;
-          if ((part->type & PART_MANTA_TRACER) && (flagActivePart & PTRACER))
+          if ((part->type & PART_MANTA_TRACER) && (flagActivePart & PARTICLE_TYPE_TRACER))
             tottypepart++;
         }
       }
@@ -4279,13 +4279,13 @@ static void particles_manta_step(ParticleSimulationData *sim,
 
         /* Type of particle must matche current particle system type (only important for snd
          * particles) */
-        if ((flagActivePart & PSPRAY) && (part->type & PART_MANTA_SPRAY) == 0)
+        if ((flagActivePart & PARTICLE_TYPE_SPRAY) && (part->type & PART_MANTA_SPRAY) == 0)
           continue;
-        if ((flagActivePart & PBUBBLE) && (part->type & PART_MANTA_BUBBLE) == 0)
+        if ((flagActivePart & PARTICLE_TYPE_BUBBLE) && (part->type & PART_MANTA_BUBBLE) == 0)
           continue;
-        if ((flagActivePart & PFOAM) && (part->type & PART_MANTA_FOAM) == 0)
+        if ((flagActivePart & PARTICLE_TYPE_FOAM) && (part->type & PART_MANTA_FOAM) == 0)
           continue;
-        if ((flagActivePart & PTRACER) && (part->type & PART_MANTA_TRACER) == 0)
+        if ((flagActivePart & PARTICLE_TYPE_TRACER) && (part->type & PART_MANTA_TRACER) == 0)
           continue;
 
         // printf("system type is %d and particle type is %d\n", part->type, flagActivePart);
@@ -4295,8 +4295,8 @@ static void particles_manta_step(ParticleSimulationData *sim,
           break;
 
         /* Only show active particles, i.e. filter out dead particles that just Mantaflow needs
-         * Mantaflow convention: PDELETE == inactive particle */
-        if ((flagActivePart & PDELETE) == 0) {
+         * Mantaflow convention: PARTICLE_TYPE_DELETE == inactive particle */
+        if ((flagActivePart & PARTICLE_TYPE_DELETE) == 0) {
           activeParts++;
 
           /* Use particle system settings for particle size */
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index b754051321c..674442f33df 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1819,16 +1819,16 @@ static int modifier_can_delete(ModifierData *md)
 {
   /* fluid particle modifier can't be deleted here */
   if (md->type == eModifierType_ParticleSystem) {
-    if (((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID ||
-        ((ParticleSystemModifierData *)md)->psys->part->type == PART_MANTA_FLIP ||
-        ((ParticleSystemModifierData *)md)->psys->part->type == PART_MANTA_FOAM ||
-        ((ParticleSystemModifierData *)md)->psys->part->type == PART_MANTA_SPRAY ||
-        ((ParticleSystemModifierData *)md)->psys->part->type == PART_MANTA_BUBBLE ||
-        ((ParticleSystemModifierData *)md)->psys->part->type == PART_MANTA_BUBBLE) {
+    short particle_type = ((ParticleSystemModifierData *)md)->psys->part->type;
+    if (particle_type == PART_FLUID ||
+        particle_type == PART_MANTA_FLIP ||
+        particle_type == PART_MANTA_FOAM ||
+        particle_type == PART_MANTA_SPRAY ||
+        particle_type == PART_MANTA_BUBBLE ||
+        particle_type == PART_MANTA_BUBBLE) {
       return 0;
     }
   }
-
   return 1;
 }
 
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 2c62ba72f39..da584a295f2 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -429,28 +429,33 @@ typedef enum eParticleDrawFlag {
   PART_DRAW_HAIR_GRID = (1 << 18),
 } eParticleDrawFlag;
 
-/* part->type */
-/* hair is always baked static in object/geometry space */
-/* other types (normal particles) are in global space and not static baked */
-#define PART_EMITTER (1 << 0)
-//#define PART_REACTOR                     (1<<0)
-#define PART_HAIR (1 << 2)
-#define PART_FLUID (1 << 3) /* deprecated (belonged to elbeem) */
-#define PART_MANTA_FLIP (1 << 4)
-#define PART_MANTA_SPRAY (1 << 5)
-#define PART_MANTA_BUBBLE (1 << 6)
-#define PART_MANTA_FOAM (1 << 7)
-#define PART_MANTA_TRACER (1 << 8)
-
-/* mirroring mantaflow particle types from particle.h */
-#define PNONE (0 << 0)
-#define PNEW (1 << 0)
-#define PSPRAY (1 << 1)
-#define PBUBBLE (1 << 2)
-#define PFOAM (1 << 3)
-#define PTRACER (1 << 4)
-#define PDELETE (1 << 10)
-#define PINVALID (1 << 30)
+/* part->type
+ * 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),
+  /* REACTOR type currently unused */
+  /* PART_REACTOR = (1 << 1), */
+  PART_HAIR = (1 << 2),
+  PART_FLUID = (1 << 3), /* deprecated (belonged to elbeem) */
+  PART_MANTA_FLIP = (1 << 4),
+  PART_MANTA_SPRAY = (1 << 5),
+  PART_MANTA_BUBBLE = (1 << 6),
+  PART_MANTA_FOAM = (1 << 7),
+  PART_MANTA_TRACER = (1 << 8),
+};
+
+/* Mirroring Mantaflow particle types from particle.h (Mantaflow header). */
+enum {
+  PARTICLE_TYPE_NONE = (0 << 0),
+  PARTICLE_TYPE_NEW = (1 << 0),
+  PARTICLE_TYPE_SPRAY = (1 << 1),
+  PARTICLE_TYPE_BUBBLE = (1 << 2),
+  PARTICLE_TYPE_FOAM = (1 << 3),
+  PARTICLE_TYPE_TRACER = (1 << 4),
+  PARTICLE_TYPE_DELETE = (1 << 10),
+  PARTICLE_TYPE_INVALID = (1 << 30),
+};
 
 /* part->flag */
 #define PART_REACT_STA_END 1



More information about the Bf-blender-cvs mailing list