diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2016-08-07 13:48:25 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2016-08-07 13:48:25 +0300 |
commit | e1cdde5d147cb8928141441c102f3bbbd9e34cc7 (patch) | |
tree | 7bddc1c9a4745af374f621128db16e9d98b46d08 | |
parent | 912f46d309b3c1c2ec581a44ec77fed38cbe6aad (diff) |
Particles: don't output nonsense UV data for Grid distribution particles.
As reported in T48928, From Dupli UV is not supported for grid
distribution, and running the normal code as usual simply produces
nonsense data, because fuv is used to hold orco instead of
interpolation factors for uv, and num is zero.
Since support won't be added in 2.78, just stop outputting nonsense.
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 42b818b35a5..4fb302c71ea 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -4050,13 +4050,16 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, uv[0] = uv[1] = 0.f; + /* Grid distribution doesn't support UV or emit from vertex mode */ + bool is_grid = (part->distr == PART_DISTR_GRID && part->from != PART_FROM_VERT); + if (cpa) { if ((part->childtype == PART_CHILD_FACES) && (psmd->dm_final != NULL)) { CustomData *mtf_data = psmd->dm_final->getTessFaceDataLayout(psmd->dm_final); const int uv_idx = CustomData_get_render_layer(mtf_data, CD_MTFACE); mtface = CustomData_get_layer_n(mtf_data, CD_MTFACE, uv_idx); - if (mtface) { + if (mtface && !is_grid) { mface = psmd->dm_final->getTessFaceData(psmd->dm_final, cpa->num, CD_MFACE); mtface += cpa->num; psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, uv); @@ -4070,7 +4073,7 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, } } - if ((part->from == PART_FROM_FACE) && (psmd->dm_final != NULL)) { + if ((part->from == PART_FROM_FACE) && (psmd->dm_final != NULL) && !is_grid) { CustomData *mtf_data = psmd->dm_final->getTessFaceDataLayout(psmd->dm_final); const int uv_idx = CustomData_get_render_layer(mtf_data, CD_MTFACE); mtface = CustomData_get_layer_n(mtf_data, CD_MTFACE, uv_idx); |