- more fixes for wpaint mode, need to patch mesh modifier as well

- change wpaint to flush changes during painting... can see this
   is going to be a problem because will also redeform. what to
   do, what to do...
This commit is contained in:
Daniel Dunbar 2005-08-23 21:04:17 +00:00
parent 81f995b741
commit 9759296483
2 changed files with 15 additions and 3 deletions

@ -77,6 +77,7 @@ typedef struct {
Mesh *me; Mesh *me;
MVert *verts; MVert *verts;
float *nors; float *nors;
MCol *wpaintMCol;
int freeNors, freeVerts; int freeNors, freeVerts;
} MeshDerivedMesh; } MeshDerivedMesh;
@ -382,7 +383,9 @@ static void meshDM_drawFacesTex(DerivedMesh *dm, int (*setDrawParams)(TFace *tf,
if (flag==0) { if (flag==0) {
continue; continue;
} else if (flag==1) { } else if (flag==1) {
if (tf) { if (mdm->wpaintMCol) {
cp= (unsigned char*) &mdm->wpaintMCol[i*4];
} else if (tf) {
cp= (unsigned char*) tf->col; cp= (unsigned char*) tf->col;
} else if (me->mcol) { } else if (me->mcol) {
cp= (unsigned char*) &me->mcol[i*4]; cp= (unsigned char*) &me->mcol[i*4];
@ -435,7 +438,9 @@ static void meshDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *
unsigned char *cp = NULL; unsigned char *cp = NULL;
if (useColors) { if (useColors) {
if (me->tface) { if (mdm->wpaintMCol) {
cp= (unsigned char*) &mdm->wpaintMCol[i*4];
} else if (me->tface) {
cp= (unsigned char*) me->tface[i].col; cp= (unsigned char*) me->tface[i].col;
} else if (me->mcol) { } else if (me->mcol) {
cp= (unsigned char*) &me->mcol[i*4]; cp= (unsigned char*) &me->mcol[i*4];
@ -498,6 +503,7 @@ static void meshDM_release(DerivedMesh *dm)
{ {
MeshDerivedMesh *mdm = (MeshDerivedMesh*) dm; MeshDerivedMesh *mdm = (MeshDerivedMesh*) dm;
if (mdm->wpaintMCol) MEM_freeN(mdm->wpaintMCol);
if (mdm->freeNors) MEM_freeN(mdm->nors); if (mdm->freeNors) MEM_freeN(mdm->nors);
if (mdm->freeVerts) MEM_freeN(mdm->verts); if (mdm->freeVerts) MEM_freeN(mdm->verts);
MEM_freeN(mdm); MEM_freeN(mdm);
@ -531,7 +537,12 @@ static DerivedMesh *getMeshDerivedMesh(Mesh *me, Object *ob, float (*vertCos)[3]
mdm->dm.drawMappedFaces = meshDM_drawMappedFaces; mdm->dm.drawMappedFaces = meshDM_drawMappedFaces;
mdm->dm.release = meshDM_release; mdm->dm.release = meshDM_release;
/* Works in conjunction with hack during modifier calc */
if (G.f & G_WEIGHTPAINT) {
mdm->wpaintMCol = MEM_dupallocN(me->mcol);
}
mdm->ob = ob; mdm->ob = ob;
mdm->me = me; mdm->me = me;
mdm->verts = me->mvert; mdm->verts = me->mvert;

@ -1101,6 +1101,7 @@ void weight_paint(void)
if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) { if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
scrarea_do_windraw(curarea); scrarea_do_windraw(curarea);
if(Gwp.flag & (VP_AREA|VP_SOFT)) { if(Gwp.flag & (VP_AREA|VP_SOFT)) {