diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-01-09 14:31:45 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-01-09 14:31:45 +0300 |
commit | 43cc8d0be2f4e06b2862f735b6a8c06dda45c373 (patch) | |
tree | f621c9bc68d76a46ada01853e9a1c646cc0961ec /source | |
parent | 08869e41f15a3cd0df6ff4dbd436bfaaca0954c5 (diff) |
Fix T47060: Uv form dupli not working with Cycles when the hair/particles mesh has more than one uv sets.
In fact, it was not working with BI either - 'UV from dupli' would always take active UVLayer,
not render_active one.
Fixed now for both Cycles and BI, and for both particles and 'simple' dupli_face.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/object_dupli.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 5da9fcbb4fe..7f742dee73c 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -792,8 +792,10 @@ static void make_duplis_faces(const DupliContext *ctx) fdd.dm = mesh_get_derived_final(scene, parent, dm_mask); if (use_texcoords) { + CustomData *ml_data = fdd.dm->getLoopDataLayout(fdd.dm); + const int uv_idx = CustomData_get_render_layer(ml_data, CD_MLOOPUV); fdd.orco = fdd.dm->getVertDataArray(fdd.dm, CD_ORCO); - fdd.mloopuv = fdd.dm->getLoopDataArray(fdd.dm, CD_MLOOPUV); + fdd.mloopuv = CustomData_get_layer_n(ml_data, CD_MLOOPUV, uv_idx); } else { fdd.orco = NULL; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 03c99b7ad45..e8fcb5c50b1 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -4078,7 +4078,10 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, if (cpa) { if ((part->childtype == PART_CHILD_FACES) && (psmd->dm_final != NULL)) { - mtface = CustomData_get_layer(&psmd->dm_final->faceData, CD_MTFACE); + 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) { mface = psmd->dm_final->getTessFaceData(psmd->dm_final, cpa->num, CD_MFACE); mtface += cpa->num; @@ -4094,7 +4097,10 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, } if ((part->from == PART_FROM_FACE) && (psmd->dm_final != NULL)) { - mtface = CustomData_get_layer(&psmd->dm_final->faceData, CD_MTFACE); + 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); + num = pa->num_dmcache; if (num == DMCACHE_NOTFOUND) |