diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-01-20 01:44:25 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-01-20 01:44:57 +0300 |
commit | 81b7f8efaf7a0dfec7a17a11ff2f2c8af661bbd2 (patch) | |
tree | 42935b35fb5acca019cbe72bec5e2dbbe6000692 /source/blender/makesrna | |
parent | c7596cd820e32747372378a511cd95894c4829e3 (diff) |
Fixed secondary particle combined export functionality
The combined export was using the old flag format.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_fluid.c | 204 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 6 |
2 files changed, 115 insertions, 95 deletions
diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c index 386aa89ea5c..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); } @@ -1542,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); @@ -1827,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 d1cb7ad0604..536691b074d 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) |