Revision: 30792 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30792 Author: nicholasbishop Date: 2010-07-27 07:38:26 +0200 (Tue, 27 Jul 2010)
Log Message: ----------- == VPaint == * Enabled fast navigate option for vpaint * Moved fast navigate UI button back to options panel for now * Fixed vpaint partial redraw, wasn't actually passing the redraw planes in Modified Paths: -------------- branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_modifier.py branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_DerivedMesh.h branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/DerivedMesh.c branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/cdderivedmesh.c branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/subsurf_ccg.c branches/soc-2010-nicolasbishop/source/blender/editors/space_view3d/drawmesh.c branches/soc-2010-nicolasbishop/source/blender/editors/space_view3d/drawobject.c Modified: branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_modifier.py =================================================================== --- branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_modifier.py 2010-07-27 04:56:24 UTC (rev 30791) +++ branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_modifier.py 2010-07-27 05:38:26 UTC (rev 30792) @@ -437,7 +437,6 @@ col.prop(md, "levels", text="Preview") col.prop(md, "edit_levels", text="Edit") col.prop(md, "render_levels", text="Render") - col.prop(bpy.context.tool_settings.sculpt, "fast_navigate") if wide_ui: col = split.column() Modified: branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py =================================================================== --- branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py 2010-07-27 04:56:24 UTC (rev 30791) +++ branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py 2010-07-27 05:38:26 UTC (rev 30792) @@ -1042,6 +1042,8 @@ col = split.column() + col.prop(tool_settings.sculpt, "fast_navigate") + col.label(text="Unified Settings:") col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size") col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength") @@ -1201,6 +1203,8 @@ col.prop(vpaint, "normals") col.prop(vpaint, "spray") + col.prop(vpaint, "fast_navigate") + col.label(text="Unified Settings:") col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size") col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength") Modified: branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_DerivedMesh.h =================================================================== --- branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_DerivedMesh.h 2010-07-27 04:56:24 UTC (rev 30791) +++ branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_DerivedMesh.h 2010-07-27 05:38:26 UTC (rev 30792) @@ -276,9 +276,10 @@ * smooth shaded. */ void (*drawMappedFaces)(DerivedMesh *dm, - int (*setDrawOptions)(void *userData, int index, - int *drawSmooth_r), - void *userData, int useColors); + float (*partial_redraw_planes)[4], int fast, + int (*setDrawOptions)(void *userData, int index, + int *drawSmooth_r), + void *userData, int useColors); /* Draw mapped faces using MTFace * o Drawing options too complicated to enumerate, look at code. Modified: branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/DerivedMesh.c =================================================================== --- branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/DerivedMesh.c 2010-07-27 04:56:24 UTC (rev 30791) +++ branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/DerivedMesh.c 2010-07-27 05:38:26 UTC (rev 30792) @@ -617,7 +617,7 @@ func(userData, i, cent, emdm->vertexCos?emdm->faceNos[i]:efa->n); } } -static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) +static void emDM_drawMappedFaces(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast_navigate, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) { EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm; EditFace *efa; Modified: branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/cdderivedmesh.c =================================================================== --- branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/cdderivedmesh.c 2010-07-27 04:56:24 UTC (rev 30791) +++ branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/cdderivedmesh.c 2010-07-27 05:38:26 UTC (rev 30792) @@ -797,7 +797,7 @@ cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); } -static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) +static void cdDM_drawMappedFaces(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast_navigate, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) { CDDerivedMesh *cddm = (CDDerivedMesh*) dm; MVert *mv = cddm->mvert; @@ -806,7 +806,7 @@ float *nors= dm->getFaceDataArray(dm, CD_NORMAL); int i, orig, *index = DM_get_face_data_layer(dm, CD_ORIGINDEX); - if(cddm_draw_pbvh(dm, NULL, NULL, + if(cddm_draw_pbvh(dm, partial_redraw_planes, NULL, useColors ? GPU_DRAW_ACTIVE_MCOL : 0)) return; Modified: branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/subsurf_ccg.c =================================================================== --- branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/subsurf_ccg.c 2010-07-27 04:56:24 UTC (rev 30791) +++ branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/subsurf_ccg.c 2010-07-27 05:38:26 UTC (rev 30792) @@ -1864,7 +1864,24 @@ } } -static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) { +/* TODO: unify with gpu_buffers.c */ +static void gl_color_from_grid(DMGridData *elem, GridKey *gridkey) +{ + float v[3] = {1, 1, 1}; + int i; + + for(i = 0; i < gridkey->color; ++i) { + float *col = GRIDELEM_COLOR(elem, gridkey)[i]; + interp_v3_v3v3(v, v, col, col[3]); + } + glColor3fv(v); +} + +static void ccgDM_drawMappedFaces(DerivedMesh *dm, + float (*partial_redraw_planes)[4], + int fast_navigate, + int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), + void *userData, int useColors) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; MCol *mcol= NULL; @@ -1872,15 +1889,22 @@ GridKey *gridkey = ccgSubSurf_getGridKey(ss); char *faceFlags = ccgdm->faceFlags; int gridFaces = gridSize - 1, totface; + int step = (fast_navigate)? gridSize-1: 1; - if(ccgdm_draw_pbvh(dm, NULL, NULL, 0, /* TODO, fast nav. */ + if(ccgdm_draw_pbvh(dm, partial_redraw_planes, NULL, fast_navigate, useColors ? GPU_DRAW_ACTIVE_MCOL : 0)) return; if(useColors) { - mcol = dm->getFaceDataArray(dm, CD_WEIGHT_MCOL); - if(!mcol) - mcol = dm->getFaceDataArray(dm, CD_MCOL); + if(fast_navigate) { + glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); + glEnable(GL_COLOR_MATERIAL); + } + else { + mcol = dm->getFaceDataArray(dm, CD_WEIGHT_MCOL); + if(!mcol) + mcol = dm->getFaceDataArray(dm, CD_MCOL); + } } totface = ccgSubSurf_getNumFaces(ss); @@ -1913,19 +1937,22 @@ for (S=0; S<numVerts; S++) { DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); + DMGridData *a, *b, *c, *d; + if (drawSmooth) { glShadeModel(GL_SMOOTH); - for (y=0; y<gridFaces; y++) { - DMGridData *a, *b; + for (y=0; y<gridFaces; y+=step) { glBegin(GL_QUAD_STRIP); - for (x=0; x<gridFaces; x++) { + for (x=0; x<gridFaces; x+=step) { a = GRIDELEM_AT(faceGridData, (y+0)*gridSize + x, gridkey); - b = GRIDELEM_AT(faceGridData, (y+1)*gridSize + x, gridkey); + b = GRIDELEM_AT(faceGridData, (y+step)*gridSize + x, gridkey); if(cp) glColor3ub(cp[3], cp[2], cp[1]); + else gl_color_from_grid(a, gridkey); glNormal3fv(GRIDELEM_NO(a, gridkey)); glVertex3fv(GRIDELEM_CO(a, gridkey)); if(cp) glColor3ub(cp[7], cp[6], cp[5]); + else gl_color_from_grid(b, gridkey); glNormal3fv(GRIDELEM_NO(b, gridkey)); glVertex3fv(GRIDELEM_CO(b, gridkey)); @@ -1935,12 +1962,14 @@ } a = GRIDELEM_AT(faceGridData, (y+0)*gridSize + x, gridkey); - b = GRIDELEM_AT(faceGridData, (y+1)*gridSize + x, gridkey); + b = GRIDELEM_AT(faceGridData, (y+step)*gridSize + x, gridkey); if(cp) glColor3ub(cp[15], cp[14], cp[13]); + else gl_color_from_grid(a, gridkey); glNormal3fv(GRIDELEM_NO(a, gridkey)); glVertex3fv(GRIDELEM_CO(a, gridkey)); if(cp) glColor3ub(cp[11], cp[10], cp[9]); + else gl_color_from_grid(b, gridkey); glNormal3fv(GRIDELEM_NO(b, gridkey)); glVertex3fv(GRIDELEM_CO(b, gridkey)); @@ -1951,23 +1980,37 @@ } else { glShadeModel(GL_FLAT); glBegin(GL_QUADS); - for (y=0; y<gridFaces; y++) { - for (x=0; x<gridFaces; x++) { - float *a = GRIDELEM_CO_AT(faceGridData, (y+0)*gridSize + x, gridkey); - float *b = GRIDELEM_CO_AT(faceGridData, (y+0)*gridSize + x + 1, gridkey); - float *c = GRIDELEM_CO_AT(faceGridData, (y+1)*gridSize + x + 1, gridkey); - float *d = GRIDELEM_CO_AT(faceGridData, (y+1)*gridSize + x, gridkey); + for (y=0; y<gridFaces; y+=step) { + for (x=0; x<gridFaces; x+=step) { + float *a_co, *b_co, *c_co, *d_co; - ccgDM_glNormalFast(a, b, c, d); + a = GRIDELEM_AT(faceGridData, (y+0)*gridSize + x, gridkey); + b = GRIDELEM_AT(faceGridData, (y+0)*gridSize + x + step, gridkey); + c = GRIDELEM_AT(faceGridData, (y+step)*gridSize + x + step, gridkey); + d = GRIDELEM_AT(faceGridData, (y+step)*gridSize + x, gridkey); + + a_co = GRIDELEM_CO(a, gridkey); + b_co = GRIDELEM_CO(b, gridkey); + c_co = GRIDELEM_CO(c, gridkey); + d_co = GRIDELEM_CO(d, gridkey); + + ccgDM_glNormalFast(a_co, b_co, c_co, d_co); if(cp) glColor3ub(cp[7], cp[6], cp[5]); - glVertex3fv(d); + else gl_color_from_grid(d, gridkey); + glVertex3fv(a_co); + if(cp) glColor3ub(cp[11], cp[10], cp[9]); - glVertex3fv(c); + else gl_color_from_grid(c, gridkey); + glVertex3fv(b_co); + if(cp) glColor3ub(cp[15], cp[14], cp[13]); - glVertex3fv(b); + else gl_color_from_grid(b, gridkey); + glVertex3fv(c_co); + if(cp) glColor3ub(cp[3], cp[2], cp[1]); - glVertex3fv(a); + else gl_color_from_grid(a, gridkey); + glVertex3fv(d_co); if(cp) cp += 16; } @@ -1980,6 +2023,9 @@ } } } + + if(fast_navigate) + glDisable(GL_COLOR_MATERIAL); } @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs