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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-03-25 15:55:03 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-03-25 16:28:29 +0300
commit489c015e706cf3bcfd246a2a081664d290ec7096 (patch)
tree2fc1ad494d7172419c60a8d16c9f8f103fa53651 /source/blender/blenkernel/intern/particle_distribute.c
parenta6f9e0d6441c3741280bda998e179f2a2da8efe2 (diff)
Fix T62891: particle even distribution is not even.
CD_ORCO coordinates are stored normalized by convention, this code path did not store them correctly.
Diffstat (limited to 'source/blender/blenkernel/intern/particle_distribute.c')
-rw-r--r--source/blender/blenkernel/intern/particle_distribute.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index dd0a4a24d7b..fc3c998ca1c 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -909,8 +909,12 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
BKE_mesh_tessface_ensure(mesh);
/* we need orco for consistent distributions */
- if (!CustomData_has_layer(&mesh->vdata, CD_ORCO))
- CustomData_add_layer(&mesh->vdata, CD_ORCO, CD_ASSIGN, BKE_mesh_orco_verts_get(ob), mesh->totvert);
+ if (!CustomData_has_layer(&mesh->vdata, CD_ORCO)) {
+ /* Orcos are stored in normalized 0..1 range by convention. */
+ float (*orcodata)[3] = BKE_mesh_orco_verts_get(ob);
+ BKE_mesh_orco_verts_transform(mesh, orcodata, mesh->totvert, false);
+ CustomData_add_layer(&mesh->vdata, CD_ORCO, CD_ASSIGN, orcodata, mesh->totvert);
+ }
if (from == PART_FROM_VERT) {
MVert *mv = mesh->mvert;
@@ -966,6 +970,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
MFace *mf = &mesh->mface[i];
if (orcodata) {
+ /* Transform orcos from normalized 0..1 to object space. */
copy_v3_v3(co1, orcodata[mf->v1]);
copy_v3_v3(co2, orcodata[mf->v2]);
copy_v3_v3(co3, orcodata[mf->v3]);