[Bf-blender-cvs] [b519af6] temp-derivedmesh-looptri: Update DM_vertex_attributes_from_gpu to use loop-data

Campbell Barton noreply at git.blender.org
Sat Jul 11 23:42:28 CEST 2015


Commit: b519af617c762b8044e0c64b9f12e2a7608b7318
Author: Campbell Barton
Date:   Sun Jul 12 07:35:56 2015 +1000
Branches: temp-derivedmesh-looptri
https://developer.blender.org/rBb519af617c762b8044e0c64b9f12e2a7608b7318

Update DM_vertex_attributes_from_gpu to use loop-data

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

M	source/blender/blenkernel/intern/DerivedMesh.c

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

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 68c3080..a75442e 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -3227,17 +3227,20 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
 				attribs->tface[a].gl_texco = gattribs->layer[b].gltexco;
 			}
 			else {
+				/* exception .. */
+				CustomData *ldata = dm->getLoopDataLayout(dm);
+
 				if (gattribs->layer[b].name[0])
-					layer = CustomData_get_named_layer_index(tfdata, CD_MTFACE,
+					layer = CustomData_get_named_layer_index(ldata, CD_MLOOPUV,
 					                                         gattribs->layer[b].name);
 				else
-					layer = CustomData_get_active_layer_index(tfdata, CD_MTFACE);
+					layer = CustomData_get_active_layer_index(ldata, CD_MLOOPUV);
 
 				a = attribs->tottface++;
 
 				if (layer != -1) {
-					attribs->tface[a].array = tfdata->layers[layer].data;
-					attribs->tface[a].em_offset = tfdata->layers[layer].offset;
+					attribs->tface[a].array = ldata->layers[layer].data;
+					attribs->tface[a].em_offset = ldata->layers[layer].offset;
 				}
 				else {
 					attribs->tface[a].array = NULL;
@@ -3274,19 +3277,22 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
 				attribs->mcol[a].gl_index = gattribs->layer[b].glindex;
 			}
 			else {
+				/* exception .. */
+				CustomData *ldata = dm->getLoopDataLayout(dm);
+
 				/* vertex colors */
 				if (gattribs->layer[b].name[0])
-					layer = CustomData_get_named_layer_index(tfdata, CD_MCOL,
+					layer = CustomData_get_named_layer_index(ldata, CD_MLOOPCOL,
 					                                         gattribs->layer[b].name);
 				else
-					layer = CustomData_get_active_layer_index(tfdata, CD_MCOL);
+					layer = CustomData_get_active_layer_index(ldata, CD_MLOOPCOL);
 
 				a = attribs->totmcol++;
 
 				if (layer != -1) {
-					attribs->mcol[a].array = tfdata->layers[layer].data;
+					attribs->mcol[a].array = ldata->layers[layer].data;
 					/* odd, store the offset for a different layer type here, but editmode draw code expects it */
-					attribs->mcol[a].em_offset = tfdata->layers[layer].offset;
+					attribs->mcol[a].em_offset = ldata->layers[layer].offset;
 				}
 				else {
 					attribs->mcol[a].array = NULL;




More information about the Bf-blender-cvs mailing list