[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32321] trunk/blender/source/blender: bugfix [#23506] Bevel Modifier display problem
Campbell Barton
ideasman42 at gmail.com
Tue Oct 5 13:25:35 CEST 2010
Revision: 32321
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32321
Author: campbellbarton
Date: 2010-10-05 13:25:34 +0200 (Tue, 05 Oct 2010)
Log Message:
-----------
bugfix [#23506] Bevel Modifier display problem
This is a more general problem that drawing functions would skip faces when the original index could not be found, screw result for example wasnt visible in editmode too.
Fixed by adding a material set argument to DerivedMesh->drawMappedFaces(), this was already being done in some of the other drawing functions.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_DerivedMesh.h
trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c
trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c
trunk/blender/source/blender/editors/space_view3d/drawmesh.c
trunk/blender/source/blender/editors/space_view3d/drawobject.c
Modified: trunk/blender/source/blender/blenkernel/BKE_DerivedMesh.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_DerivedMesh.h 2010-10-05 11:16:07 UTC (rev 32320)
+++ trunk/blender/source/blender/blenkernel/BKE_DerivedMesh.h 2010-10-05 11:25:34 UTC (rev 32321)
@@ -280,7 +280,8 @@
void (*drawMappedFaces)(DerivedMesh *dm,
int (*setDrawOptions)(void *userData, int index,
int *drawSmooth_r),
- void *userData, int useColors);
+ void *userData, int useColors,
+ int (*setMaterial)(int, void *attribs));
/* Draw mapped faces using MTFace
* o Drawing options too complicated to enumerate, look at code.
Modified: trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c 2010-10-05 11:16:07 UTC (rev 32320)
+++ trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c 2010-10-05 11:25:34 UTC (rev 32321)
@@ -626,7 +626,9 @@
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)
+
+/* note, material function is ignored for now. */
+static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs))
{
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditFace *efa;
Modified: trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c 2010-10-05 11:16:07 UTC (rev 32320)
+++ trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c 2010-10-05 11:25:34 UTC (rev 32321)
@@ -777,7 +777,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, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs))
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
MVert *mv = cddm->mvert;
@@ -798,16 +798,16 @@
DEBUG_VBO( "Using legacy code. cdDM_drawMappedFaces\n" );
for(i = 0; i < dm->numFaceData; i++, mf++) {
int drawSmooth = (mf->flag & ME_SMOOTH);
+ int draw= 1;
- if(index) {
- orig = *index++;
- if(setDrawOptions && orig == ORIGINDEX_NONE)
- { if(nors) nors += 3; continue; }
- }
- else
- orig = i;
+ orig= (index==NULL) ? i : *index++;
+
+ if(orig == ORIGINDEX_NONE)
+ draw= setMaterial(mf->mat_nr + 1, NULL);
+ else if (setDrawOptions != NULL)
+ draw= setDrawOptions(userData, orig, &drawSmooth);
- if(!setDrawOptions || setDrawOptions(userData, orig, &drawSmooth)) {
+ if(draw) {
unsigned char *cp = NULL;
if(useColors && mc)
@@ -887,23 +887,20 @@
for( i = 0; i < tottri; i++ ) {
//int actualFace = dm->drawObject->faceRemap[i];
int actualFace = next_actualFace;
- int drawSmooth = (mf[actualFace].flag & ME_SMOOTH);
+ MFace *mface= mf + actualFace;
+ int drawSmooth= (mface->flag & ME_SMOOTH);
int draw = 1;
if(i != tottri-1)
next_actualFace= dm->drawObject->faceRemap[i+1];
-
- if(index) {
- orig = index[actualFace];
- if(orig == ORIGINDEX_NONE)
- draw = 0;
- }
- else
- orig = actualFace;
+
+ orig= (index==NULL) ? actualFace : index[actualFace];
+
+ if(orig == ORIGINDEX_NONE)
+ draw= setMaterial(mface->mat_nr + 1, NULL);
+ else if (setDrawOptions != NULL)
+ draw= setDrawOptions(userData, orig, &drawSmooth);
- if(draw && !setDrawOptions(userData, orig, &drawSmooth))
- draw = 0;
-
/* Goal is to draw as long of a contiguous triangle
array as possible, so draw when we hit either an
invisible triangle or at the end of the array */
@@ -974,8 +971,12 @@
else if(setDrawOptions) {
orig = (index)? index[a]: a;
- if(orig == ORIGINDEX_NONE)
- continue;
+ if(orig == ORIGINDEX_NONE) {
+ /* since the material is set by setMaterial(), faces with no
+ * origin can be assumed to be generated by a modifier */
+
+ /* continue */
+ }
else if(!setDrawOptions(userData, orig))
continue;
}
Modified: trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c 2010-10-05 11:16:07 UTC (rev 32320)
+++ trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c 2010-10-05 11:25:34 UTC (rev 32321)
@@ -1619,11 +1619,12 @@
if(drawParams)
flag = drawParams(tf, mcol, mat_nr);
- else if(index != ORIGINDEX_NONE)
+ else if (index != ORIGINDEX_NONE)
flag= (drawParamsMapped)? drawParamsMapped(userData, index): 1;
else
- flag= 1;
-
+ flag= GPU_enable_material(mat_nr, NULL) ? 1:0;
+
+
if (flag == 0) { /* flag 0 == the face is hidden or invisible */
if(tf) tf += gridFaces*gridFaces*numVerts;
if(mcol) mcol += gridFaces*gridFaces*numVerts*4;
@@ -1763,7 +1764,7 @@
}
}
-static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) {
+static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
MCol *mcol= NULL;
@@ -1795,10 +1796,14 @@
mcol += gridFaces*gridFaces*numVerts*4;
}
- if (index!=-1) {
- int draw;
- draw = setDrawOptions==NULL ? 1 : setDrawOptions(userData, index, &drawSmooth);
-
+ {
+ int draw= 1;
+
+ if(index == ORIGINDEX_NONE)
+ draw= setMaterial(faceFlags ? faceFlags[origIndex*2 + 1] + 1: 1, NULL); /* XXX, no faceFlags no material */
+ else if (setDrawOptions)
+ draw= setDrawOptions(userData, index, &drawSmooth);
+
if (draw) {
if (draw==2) {
glEnable(GL_POLYGON_STIPPLE);
Modified: trunk/blender/source/blender/editors/space_view3d/drawmesh.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawmesh.c 2010-10-05 11:16:07 UTC (rev 32320)
+++ trunk/blender/source/blender/editors/space_view3d/drawmesh.c 2010-10-05 11:25:34 UTC (rev 32321)
@@ -647,7 +647,7 @@
dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh);
} else if(faceselect) {
if(ob->mode & OB_MODE_WEIGHT_PAINT)
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1);
+ dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material);
else
dm->drawMappedFacesTex(dm, draw_tface_mapped__set_draw, me);
}
Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c 2010-10-05 11:16:07 UTC (rev 32320)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c 2010-10-05 11:25:34 UTC (rev 32321)
@@ -1867,7 +1867,7 @@
data.cols[2] = actCol;
data.efa_act = efa_act;
- dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0);
+ dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material);
}
static int draw_dm_creases__setDrawOptions(void *userData, int index)
@@ -2287,7 +2287,7 @@
glEnable(GL_LIGHTING);
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
- finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, 0, 0);
+ finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, 0, 0, GPU_enable_material);
glFrontFace(GL_CCW);
glDisable(GL_LIGHTING);
@@ -2517,7 +2517,7 @@
/* weight paint in solid mode, special case. focus on making the weights clear
* rather then the shading, this is also forced in wire view */
GPU_enable_material(0, NULL);
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1);
+ dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material);
bglPolygonOffset(rv3d->dist, 1.0);
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
@@ -2599,7 +2599,7 @@
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1);
+ dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
@@ -2607,10 +2607,10 @@
}
else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) {
if(me->mcol)
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1);
+ dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1, GPU_enable_material);
else {
glColor3f(1.0f, 1.0f, 1.0f);
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0);
+ dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material);
}
}
else do_draw= 1;
@@ -6328,7 +6328,7 @@
cpack(0);
if (facecol) {
- dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0);
+ dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0, GPU_enable_material);
if(check_ob_drawface_dot(scene, v3d, ob->dt)) {
glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE));
@@ -6339,7 +6339,7 @@
}
} else {
- dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, 0);
+ dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, 0, GPU_enable_material);
}
}
@@ -6369,8 +6369,8 @@
glColor3ub(0, 0, 0);
- if(face_sel_mode) dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, me, 0);
- else dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 0);
+ if(face_sel_mode) dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, me, 0, GPU_enable_material);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list