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:
authorJacques Lucke <jacques@blender.org>2020-07-20 16:30:12 +0300
committerJacques Lucke <jacques@blender.org>2020-07-20 16:31:05 +0300
commit4f4af0cbe17fe9781aeaefb7e0d2f554bdb9c1a5 (patch)
treee8765dd53aee71b6a84420d692526b33157e5896 /source/blender/simulation/intern/simulation_collect_influences.cc
parent9016a29f194194085acfd937f31b80be0f1b0c8e (diff)
Particles: support removing particles during the simulation
This still cannot be controlled by the user. Currently, all particles are killed after two seconds
Diffstat (limited to 'source/blender/simulation/intern/simulation_collect_influences.cc')
-rw-r--r--source/blender/simulation/intern/simulation_collect_influences.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/simulation/intern/simulation_collect_influences.cc b/source/blender/simulation/intern/simulation_collect_influences.cc
index c1b936d9aa3..d4161b06a00 100644
--- a/source/blender/simulation/intern/simulation_collect_influences.cc
+++ b/source/blender/simulation/intern/simulation_collect_influences.cc
@@ -278,10 +278,12 @@ class MyBasicEmitter : public ParticleEmitter {
MutableSpan<float3> positions = attributes.get<float3>("Position");
MutableSpan<float3> velocities = attributes.get<float3>("Velocity");
+ MutableSpan<float> birth_times = attributes.get<float>("Birth Time");
for (int i : IndexRange(attributes.size())) {
positions[i] = rng.get_unit_float3();
velocities[i] = rng.get_unit_float3();
+ birth_times[i] = context.simulation_time_interval().start();
}
}
};
@@ -307,6 +309,9 @@ static void prepare_particle_attribute_builders(nodes::MFNetworkTreeMap &network
builder.add<float3>("Position", {0, 0, 0});
builder.add<float3>("Velocity", {0, 0, 0});
builder.add<int>("ID", 0);
+ /* TODO: Use bool property, but need to add CD_PROP_BOOL first. */
+ builder.add<int>("Dead", 0);
+ builder.add<float>("Birth Time", 0.0f);
r_influences.particle_attributes_builder.add_new(std::move(name), &builder);
}
}