[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21524] branches/soc-2009-imbusy/source/ blender: object, vertex paint, weight paint and texture paint seem to be fully working with all solid, shaded and textured mode combinations.

Lukas Steiblys imbusy at imbusy.org
Sat Jul 11 15:45:03 CEST 2009


Revision: 21524
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21524
Author:   imbusy
Date:     2009-07-11 15:45:01 +0200 (Sat, 11 Jul 2009)

Log Message:
-----------
object, vertex paint, weight paint and texture paint seem to be fully working with all solid, shaded and textured mode combinations. Edit mode and Sculpt mode left

Modified Paths:
--------------
    branches/soc-2009-imbusy/source/blender/blenkernel/intern/cdderivedmesh.c
    branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawmesh.c
    branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2009-imbusy/source/blender/gpu/intern/gpu_buffers.c

Modified: branches/soc-2009-imbusy/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/soc-2009-imbusy/source/blender/blenkernel/intern/cdderivedmesh.c	2009-07-11 13:32:20 UTC (rev 21523)
+++ branches/soc-2009-imbusy/source/blender/blenkernel/intern/cdderivedmesh.c	2009-07-11 13:45:01 UTC (rev 21524)
@@ -428,12 +428,14 @@
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 	MVert *mv = cddm->mvert;
 	MFace *mf = DM_get_face_data_layer(dm, CD_MFACE);
-	MCol *mcol = dm->getFaceDataArray(dm, CD_MCOL);
 	MCol *realcol = dm->getFaceDataArray(dm, CD_TEXTURE_MCOL);
 	float *nors= dm->getFaceDataArray(dm, CD_NORMAL);
 	MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE);
 	int i, j, orig, *index = DM_get_face_data_layer(dm, CD_ORIGINDEX);
 	int startFace = 0, lastFlag = 0xdeadbeef;
+	MCol *mcol = dm->getFaceDataArray(dm, CD_WEIGHT_MCOL);
+	if(!mcol)
+		mcol = dm->getFaceDataArray(dm, CD_MCOL);
 
 	if( GPU_buffer_legacy(dm) ) {
 		DEBUG_VBO( "Using legacy code. cdDM_drawFacesTex_common\n" );

Modified: branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawmesh.c
===================================================================
--- branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawmesh.c	2009-07-11 13:32:20 UTC (rev 21523)
+++ branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawmesh.c	2009-07-11 13:45:01 UTC (rev 21524)
@@ -69,6 +69,7 @@
 #include "UI_resources.h"
 #include "UI_interface_icons.h"
 
+#include "gpu_buffers.h"
 #include "GPU_extensions.h"
 #include "GPU_draw.h"
 
@@ -437,9 +438,12 @@
 {
 	MTFace *tface = DM_get_face_data_layer(dm, CD_MTFACE);
 	MFace *mface = DM_get_face_data_layer(dm, CD_MFACE);
-	MCol *mcol = dm->getFaceDataArray(dm, CD_MCOL);
 	MCol *finalCol;
 	int i,j;
+	MCol *mcol = dm->getFaceDataArray(dm, CD_WEIGHT_MCOL);
+	if(!mcol)
+		mcol = dm->getFaceDataArray(dm, CD_MCOL);
+
 	finalCol = MEM_mallocN(sizeof(MCol)*4*dm->getNumFaces(dm),"add_tface_color_layer");
 	for(i=0;i<dm->getNumFaces(dm);i++) {
 		if (tface && (tface->mode&TF_INVISIBLE)) {
@@ -648,6 +652,7 @@
 		if( GPU_buffer_legacy(dm) )
 			dm->drawFacesTex(dm, draw_tface__set_draw_legacy);
 		else {
+			glColor3f(1.0f,1.0f,1.0f);
 			if( !CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL) )
 				add_tface_color_layer(dm);
 			dm->drawFacesTex(dm, draw_tface__set_draw);

Modified: branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawobject.c	2009-07-11 13:32:20 UTC (rev 21523)
+++ branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawobject.c	2009-07-11 13:45:01 UTC (rev 21524)
@@ -5574,10 +5574,16 @@
 	glColor3ub(0, 0, 0);
 		
 	if( !GPU_buffer_legacy(dm) ) {
+		int *index = DM_get_face_data_layer(dm, CD_ORIGINDEX);
+		int ind;
 		colors = MEM_mallocN(dm->getNumFaces(dm)*sizeof(MCol)*4,"bbs_mesh_solid");
 		for(i=0;i<dm->getNumFaces(dm);i++) {
-			if (!(me->mface[i].flag&ME_HIDE)) {
-				unsigned int fbindex = index_to_framebuffer(i+1);
+			if( index != 0 )
+				ind = index[i];
+			else
+				ind = i;
+			if (!(me->mface[ind].flag&ME_HIDE)) {
+				unsigned int fbindex = index_to_framebuffer(ind+1);
 				for(j=0;j<4;j++) {
 					colors[i*4+j].b = ((fbindex)&0xFF);
 					colors[i*4+j].g = (((fbindex)>>8)&0xFF);
@@ -5593,7 +5599,6 @@
 		GPU_buffer_free(dm->drawObject->colors,0);
 		dm->drawObject->colors = 0;
 		dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 1);
-		CustomData_free_layer( &dm->faceData, CD_ID_MCOL, dm->getNumFaces(dm), 0 );
 	}
 	else {
 		dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts_legacy, me, 0);

Modified: branches/soc-2009-imbusy/source/blender/gpu/intern/gpu_buffers.c
===================================================================
--- branches/soc-2009-imbusy/source/blender/gpu/intern/gpu_buffers.c	2009-07-11 13:32:20 UTC (rev 21523)
+++ branches/soc-2009-imbusy/source/blender/gpu/intern/gpu_buffers.c	2009-07-11 13:45:01 UTC (rev 21524)
@@ -241,7 +241,7 @@
 	DEBUG_VBO("GPU_drawobject_new\n");
 
 	object = MEM_callocN(sizeof(GPUDrawObject),"GPU_drawobject_new");
-	/*object->legacy = 1;*/
+	object->legacy = 1;
 	memset(numverts,0,sizeof(int)*256);
 
 	mvert = dm->getVertArray(dm);





More information about the Bf-blender-cvs mailing list