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.
This commit is contained in:
Bastien Montagne 2016-01-09 12:31:45 +01:00
parent 08869e41f1
commit 43cc8d0be2
Notes: blender-bot 2023-02-14 09:44:56 +01:00
Referenced by issue #47060, Uv form dupli not working with Cycles when the hair/particles mesh has more than one uv sets
2 changed files with 11 additions and 3 deletions

View File

@ -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;

View File

@ -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)