diff options
author | Daniel Dunbar <daniel@zuster.org> | 2005-08-24 00:04:10 +0400 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2005-08-24 00:04:10 +0400 |
commit | 7396075ef1a23d63e0659010b7d86e55f4c6ebce (patch) | |
tree | 0df9991d19ce87e423383abd9943906a97b34796 /source/blender/src/vpaint.c | |
parent | e12e2469c8e2e0f0229af5bbc611ea76238d6d34 (diff) |
- add option to drawMappedFaces to draw with colors (from tface or mcol)
- convert weightpaint/vertexpaint to draw using drawMappedFaces, slightly
hacky because during weightpaint mcol's get overridden in order to
have them propogate through modifiers. should work fine.
- add NULL check in shaded draw, prevents crash w/ dupliframe
Diffstat (limited to 'source/blender/src/vpaint.c')
-rw-r--r-- | source/blender/src/vpaint.c | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c index 4551642a928..60d602e1e8a 100644 --- a/source/blender/src/vpaint.c +++ b/source/blender/src/vpaint.c @@ -440,35 +440,6 @@ void sample_vpaint() /* frontbuf */ addqueue(curarea->win, REDRAW, 1); // needed for when panel is open... } -/* only used in drawobject.c now... */ -void weight_to_rgb(float input, float *fr, float *fg, float *fb) -{ - float blend; - - blend= ((input/2.0f)+0.5f); - - if (input<=0.25f){ // blue->cyan - *fr= 0.0f; - *fg= blend*input*4.0f; - *fb= blend; - } - else if (input<=0.50f){ // cyan->green - *fr= 0.0f; - *fg= blend; - *fb= blend*(1.0f-((input-0.25f)*4.0f)); - } - else if (input<=0.75){ // green->yellow - *fr= blend * ((input-0.50f)*4.0f); - *fg= blend; - *fb= 0.0f; - } - else if (input<=1.0){ // yellow->red - *fr= blend; - *fg= blend * (1.0f-((input-0.75f)*4.0f)); - *fb= 0.0f; - } -} - void init_vertexpaint() { @@ -1352,14 +1323,20 @@ void set_wpaint(void) /* toggle */ allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWBUTSEDIT, 0); + /* Weightpaint works by overriding colors in mesh, + * so need to make sure we recalc on enter and + * exit (exit needs doing regardless because we + * should redeform). + */ + if (me) { + DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); + } + if(G.f & G_WEIGHTPAINT) { setcursor_space(SPACE_VIEW3D, CURSOR_VPAINT); } else { freefastshade(); /* to be sure */ - if (me) { - DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); - } if(!(G.f & G_FACESELECT)) setcursor_space(SPACE_VIEW3D, CURSOR_STD); } |