[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42028] trunk/blender/source/blender: Yet another fix for crashes when drawing empty base mesh with constructive modifier .
Lukas Toenne
lukas.toenne at googlemail.com
Mon Nov 21 12:46:06 CET 2011
Revision: 42028
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42028
Author: lukastoenne
Date: 2011-11-21 11:46:05 +0000 (Mon, 21 Nov 2011)
Log Message:
-----------
Yet another fix for crashes when drawing empty base mesh with constructive modifier. This crashed with ocean modifier (#29241). The previous fix was to avoid drawing mapped faces altogether for empty edit mesh, but that also disables the actual derived mesh display (#29346).
The real reason for this crash is that ocean modifier (in generative setting) does not properly set the derived mesh face ORIGINDEX data to ORIGINDEX_NONE. With this the previous fixes are not necessary.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_view3d/drawobject.c
trunk/blender/source/blender/modifiers/intern/MOD_ocean.c
Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c 2011-11-21 11:27:43 UTC (rev 42027)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c 2011-11-21 11:46:05 UTC (rev 42028)
@@ -2735,35 +2735,29 @@
if(dt>OB_WIRE) {
if(CHECK_OB_DRAWTEXTURE(v3d, dt)) {
if(draw_glsl_material(scene, ob, v3d, dt)) {
- /* if em has no faces the drawMappedFaces callback will fail */
- if(em->faces.first) {
- glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
-
- finalDM->drawMappedFacesGLSL(finalDM, GPU_enable_material,
- draw_em_fancy__setGLSLFaceOpts, NULL);
- GPU_disable_material();
-
- glFrontFace(GL_CCW);
- }
+ glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
+
+ finalDM->drawMappedFacesGLSL(finalDM, GPU_enable_material,
+ draw_em_fancy__setGLSLFaceOpts, NULL);
+ GPU_disable_material();
+
+ glFrontFace(GL_CCW);
}
else {
draw_mesh_textured(scene, v3d, rv3d, ob, finalDM, 0);
}
}
else {
- /* if em has no faces the drawMappedFaces callback will fail */
- if(em->faces.first) {
- /* 3 floats for position, 3 for normal and times two because the faces may actually be quads instead of triangles */
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED);
-
- glEnable(GL_LIGHTING);
- glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
-
- finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, NULL, 0, GPU_enable_material, NULL);
-
- glFrontFace(GL_CCW);
- glDisable(GL_LIGHTING);
- }
+ /* 3 floats for position, 3 for normal and times two because the faces may actually be quads instead of triangles */
+ glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED);
+
+ glEnable(GL_LIGHTING);
+ glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
+
+ finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, NULL, 0, GPU_enable_material, NULL);
+
+ glFrontFace(GL_CCW);
+ glDisable(GL_LIGHTING);
}
// Setup for drawing wire over, disable zbuffer
Modified: trunk/blender/source/blender/modifiers/intern/MOD_ocean.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_ocean.c 2011-11-21 11:27:43 UTC (rev 42027)
+++ trunk/blender/source/blender/modifiers/intern/MOD_ocean.c 2011-11-21 11:46:05 UTC (rev 42028)
@@ -277,6 +277,7 @@
MVert *mv;
MFace *mf;
MTFace *tf;
+ int *origindex;
int cdlayer;
@@ -305,6 +306,7 @@
mv = CDDM_get_verts(result);
mf = CDDM_get_faces(result);
+ origindex= result->getFaceDataArray(result, CD_ORIGINDEX);
/* create vertices */
#pragma omp parallel for private(x, y) if (rx > OMP_MIN_RES)
@@ -329,6 +331,9 @@
mf[fi].v4 = vi + res_x+1;
mf[fi].flag |= ME_SMOOTH;
+
+ /* generated geometry does not map to original faces */
+ origindex[fi] = ORIGINDEX_NONE;
}
}
More information about the Bf-blender-cvs
mailing list