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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-04 18:55:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-04 18:55:19 +0300
commit747534af0058ff7a719b99af68333753527ed747 (patch)
tree38554e0d18239976390f9a6c958c43c2d53d7c5d /source/blender/blenkernel
parent7277f8973b08f847685a39b9326fc1e2fb9e268b (diff)
Particle System: move data creation into RNA update
Relying on evaluation to initialize data causes issues w/ 2.8.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_particle.h1
-rw-r--r--source/blender/blenkernel/intern/particle_system.c24
2 files changed, 7 insertions, 18 deletions
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index f09aa17ea92..8eee749ef70 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -304,6 +304,7 @@ bool psys_check_edited(struct ParticleSystem *psys);
void psys_check_group_weights(struct ParticleSettings *part);
int psys_uses_gravity(struct ParticleSimulationData *sim);
+void BKE_particlesettings_fluid_default_settings(struct ParticleSettings *part);
/* free */
void BKE_particlesettings_free(struct ParticleSettings *part);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 47e0994bb83..9eaebc2c55c 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -4140,7 +4140,7 @@ void psys_check_boid_data(ParticleSystem *psys)
}
}
-static void fluid_default_settings(ParticleSettings *part)
+void BKE_particlesettings_fluid_default_settings(ParticleSettings *part)
{
SPHFluidSettings *fluid = part->fluid;
@@ -4172,24 +4172,12 @@ static void psys_prepare_physics(ParticleSimulationData *sim)
sim->psys->flag &= ~PSYS_KEYED;
}
- if (part->phystype == PART_PHYS_BOIDS && part->boids == NULL) {
- BoidState *state;
-
- part->boids = MEM_callocN(sizeof(BoidSettings), "Boid Settings");
- boid_default_settings(part->boids);
-
- state = boid_new_state(part->boids);
- BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Separate));
- BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Flock));
-
- ((BoidRule*)state->rules.first)->flag |= BOIDRULE_CURRENT;
-
- state->flag |= BOIDSTATE_CURRENT;
- BLI_addtail(&part->boids->states, state);
+ /* RNA Update must ensure this is true. */
+ if (part->phystype == PART_PHYS_BOIDS) {
+ BLI_assert(part->boids != NULL);
}
- else if (part->phystype == PART_PHYS_FLUID && part->fluid == NULL) {
- part->fluid = MEM_callocN(sizeof(SPHFluidSettings), "SPH Fluid Settings");
- fluid_default_settings(part);
+ else if (part->phystype == PART_PHYS_FLUID) {
+ BLI_assert(part->fluid != NULL);
}
psys_check_boid_data(sim->psys);