diff options
author | Ton Roosendaal <ton@blender.org> | 2005-05-19 00:32:32 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-05-19 00:32:32 +0400 |
commit | 803d440871f79a9f19cffc71e0f570d677db78c2 (patch) | |
tree | 6be44dabfb7468689421638419914df39e2b0563 | |
parent | 95ad5ce1a8cf1871356fa421dd344de883edb0a5 (diff) |
On start vertexpaint of subsurf, the initialized vertex colors were wrong.
It tries to use the shaded colors, but these are from the subsurfed mesh.
Didn't feel like hacking here, so for this case colors are initialized
as black.
-rw-r--r-- | source/blender/src/vpaint.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c index 6acf0e0fcc5..8f08ababb9b 100644 --- a/source/blender/src/vpaint.c +++ b/source/blender/src/vpaint.c @@ -244,27 +244,34 @@ void make_vertexcol() /* single ob */ me->flag &= ~ME_TWOSIDED; } - dl= ob->disp.first; - - if(dl==0 || dl->col1==NULL) { - shadeDispList(ob); - dl= find_displist(&ob->disp, DL_VERTCOL); - } - if(dl && dl->col1) { - int i; - + /* but subsurf vertex colors are wrong */ + if (me->flag & ME_SUBSURF) { if(me->mcol) MEM_freeN(me->mcol); + me->mcol= MEM_callocN(4*me->totface*sizeof(MCol), "mcol"); + } + else { + dl= ob->disp.first; - me->mcol= MEM_dupallocN(dl->col1); - if (me->mcol) { - for (i=0; i<me->totface*4; i++) { - MCol *mcol= &me->mcol[i]; - mcol->a= 255; - } + if(dl==NULL || dl->col1==NULL) { + shadeDispList(ob); + dl= find_displist(&ob->disp, DL_VERTCOL); + } + if(dl && dl->col1) { + if(me->mcol) MEM_freeN(me->mcol); + me->mcol= MEM_dupallocN(dl->col1); + } + } + + if(me->mcol) { + int i; + for (i=0; i<me->totface*4; i++) { + MCol *mcol= &me->mcol[i]; + mcol->a= 255; } if(me->tface) mcol_to_tface(me, 1); } + freedisplist(&(ob->disp)); |