diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2019-09-10 15:14:52 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2019-09-10 16:39:38 +0300 |
commit | a13b1b18def05a2cc73ab05327412215da632389 (patch) | |
tree | b19d76d4b3fecfdcc912c69d68dfbad851903256 /source/blender/blenkernel/intern/object_dupli.c | |
parent | cfb3011e521499862aff55965479fcbebc1c44bd (diff) |
Fix T69702: crash using particles rendered as whole collection
This happened when the 'Whole Collection' option was enabled next to the
'Use Count' option. These two are exclusive but some code paths only
checked for 'Use Count'.
Reviewers: brecht
Maniphest Tasks: T69702
Differential Revision: https://developer.blender.org/D5741
Diffstat (limited to 'source/blender/blenkernel/intern/object_dupli.c')
-rw-r--r-- | source/blender/blenkernel/intern/object_dupli.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 7983fe54be5..8ffb99dd8ab 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -822,8 +822,10 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem /* gather list of objects or single object */ int totcollection = 0; + const bool use_whole_collection = part->draw & PART_DRAW_WHOLE_GR; + const bool use_collection_count = part->draw & PART_DRAW_COUNT_GR && !use_whole_collection; if (part->ren_as == PART_DRAW_GR) { - if (part->draw & PART_DRAW_COUNT_GR) { + if (use_collection_count) { psys_find_group_weights(part); for (dw = part->instance_weights.first; dw; dw = dw->next) { @@ -848,7 +850,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem oblist = MEM_callocN((size_t)totcollection * sizeof(Object *), "dupcollection object list"); - if (part->draw & PART_DRAW_COUNT_GR) { + if (use_collection_count) { a = 0; for (dw = part->instance_weights.first; dw; dw = dw->next) { FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN ( @@ -916,7 +918,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem } /* for collections, pick the object based on settings */ - if (part->draw & PART_DRAW_RAND_GR) { + if (part->draw & PART_DRAW_RAND_GR && !use_whole_collection) { b = BLI_rng_get_int(rng) % totcollection; } else { |