diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-03-05 17:24:54 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-03-05 17:24:54 +0300 |
commit | 7a6b46aac56b2a529370129bbedcd20f408c6352 (patch) | |
tree | 284f6c4d6b990d5acfebf3bb72c1df4bfcbd7ade /source/blender/blenkernel/intern/particle_system.c | |
parent | 302bba1665154edc81addfa18d7b8bc8bff6a18d (diff) |
Fix T62163: Duplicating particle system results in crash
There were two problems:
1. `mesh_get_eval_final` has to be called with the evaluated object.
2. Particle systems have to have unique names within an object.
The depsgraph seems to use the particle system name as identifier.
This issue is actually independent of duplication.
The old code used a small hack to create unique names.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D4451
Diffstat (limited to 'source/blender/blenkernel/intern/particle_system.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 7c6ebe79b58..2975eaaf5fc 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -56,6 +56,7 @@ #include "BLI_task.h" #include "BLI_threads.h" #include "BLI_linklist.h" +#include "BLI_string_utils.h" #include "BKE_animsys.h" #include "BKE_boids.h" @@ -186,6 +187,12 @@ void psys_reset(ParticleSystem *psys, int mode) psys->tot_fluidsprings = psys->alloc_fluidsprings = 0; } +void psys_unique_name(Object *object, ParticleSystem *psys, const char *defname) +{ + BLI_uniquename(&object->particlesystem, psys, defname, '.', + offsetof(ParticleSystem, name), sizeof(psys->name)); +} + static void realloc_particles(ParticleSimulationData *sim, int new_totpart) { ParticleSystem *psys = sim->psys; |