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:
authorBastien Montagne <montagne29@wanadoo.fr>2016-03-29 18:45:56 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-03-29 18:45:56 +0300
commit201d393862243013cd23693794c55d80e62a424a (patch)
tree12b65e35fb331cbf437ebc79942bacfb38624ae0 /source/blender/blenkernel/intern/particle_distribute.c
parenta95977162687863763e7a26a18e9d91c31227c1e (diff)
Fix T47902: Particle grid not using modifier stack, Take II.
Now only fix correct handling of use_modifier_stack for grid distribution, fixing it globally breaks all existing edited hair systems. :/
Diffstat (limited to 'source/blender/blenkernel/intern/particle_distribute.c')
-rw-r--r--source/blender/blenkernel/intern/particle_distribute.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index 2527ff5e0da..a250a41730a 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -795,6 +795,11 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
return 0;
}
+ /* XXX This distribution code is totally broken in case from == PART_FROM_CHILD, it's always using finaldm
+ * even if use_modifier_stack is unset... But making things consistent here break all existing edited
+ * hair systems, so better wait for complete rewrite.
+ */
+
psys_thread_context_init(ctx, sim);
/* First handle special cases */
@@ -810,10 +815,20 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
/* Grid distribution */
if (part->distr==PART_DISTR_GRID && from != PART_FROM_VERT) {
BLI_srandom(31415926 + psys->seed);
- dm= CDDM_from_mesh((Mesh*)ob->data);
- DM_ensure_tessface(dm);
+
+ if (psys->part->use_modifier_stack) {
+ dm = finaldm;
+ }
+ else {
+ dm = CDDM_from_mesh((Mesh*)ob->data);
+ }
+
distribute_grid(dm,psys);
- dm->release(dm);
+
+ if (dm != finaldm) {
+ dm->release(dm);
+ }
+
return 0;
}
}