[Bf-blender-cvs] [43cc8d0] master: Fix T47060: Uv form dupli not working with Cycles when the hair/particles mesh has more than one uv sets.

Bastien Montagne noreply at git.blender.org
Sat Jan 9 12:33:51 CET 2016


Commit: 43cc8d0be2f4e06b2862f735b6a8c06dda45c373
Author: Bastien Montagne
Date:   Sat Jan 9 12:31:45 2016 +0100
Branches: master
https://developer.blender.org/rB43cc8d0be2f4e06b2862f735b6a8c06dda45c373

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.

===================================================================

M	source/blender/blenkernel/intern/object_dupli.c
M	source/blender/blenkernel/intern/particle.c

===================================================================

diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 5da9fcb..7f742de 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 03c99b7..e8fcb5c 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)




More information about the Bf-blender-cvs mailing list