diff options
Diffstat (limited to 'source/blender/blenkernel/intern/object_dupli.c')
-rw-r--r-- | source/blender/blenkernel/intern/object_dupli.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 7983fe54be5..6b6c68b197e 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -93,8 +93,11 @@ typedef struct DupliGenerator { static const DupliGenerator *get_dupli_generator(const DupliContext *ctx); /* create initial context for root object */ -static void init_context( - DupliContext *r_ctx, Depsgraph *depsgraph, Scene *scene, Object *ob, float space_mat[4][4]) +static void init_context(DupliContext *r_ctx, + Depsgraph *depsgraph, + Scene *scene, + Object *ob, + const float space_mat[4][4]) { r_ctx->depsgraph = depsgraph; r_ctx->scene = scene; @@ -118,7 +121,7 @@ static void init_context( /* create sub-context for recursive duplis */ static void copy_dupli_context( - DupliContext *r_ctx, const DupliContext *ctx, Object *ob, float mat[4][4], int index) + DupliContext *r_ctx, const DupliContext *ctx, Object *ob, const float mat[4][4], int index) { *r_ctx = *ctx; @@ -204,7 +207,7 @@ static DupliObject *make_dupli(const DupliContext *ctx, Object *ob, float mat[4] */ static void make_recursive_duplis(const DupliContext *ctx, Object *ob, - float space_mat[4][4], + const float space_mat[4][4], int index) { /* simple preventing of too deep nested collections with MAX_DUPLI_RECUR */ @@ -398,12 +401,8 @@ static void make_child_duplis_verts(const DupliContext *ctx, void *userdata, Obj mul_m4_m4m4(vdd->child_imat, child->imat, ctx->object->obmat); const MVert *mvert = me_eval->mvert; - const int *origindex = CustomData_get_layer(&me_eval->vdata, CD_ORIGINDEX); - - for (int i = 0, j = 0; i < me_eval->totvert; i++) { - if (origindex == NULL || origindex[i] != ORIGINDEX_NONE) { - vertex_dupli(vdd, j++, mvert[i].co, mvert[i].no); - } + for (int i = 0; i < me_eval->totvert; i++) { + vertex_dupli(vdd, i, mvert[i].co, mvert[i].no); } } @@ -822,8 +821,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 +849,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 +917,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 { |