[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25481] trunk/blender/source/blender/ editors/sculpt_paint/paint_vertex.c: Bugfix #20173: Crash with Weight Paint on polygons with no faces
Joshua Leung
aligorith at gmail.com
Sun Dec 20 11:50:40 CET 2009
Revision: 25481
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25481
Author: aligorith
Date: 2009-12-20 11:50:40 +0100 (Sun, 20 Dec 2009)
Log Message:
-----------
Bugfix #20173: Crash with Weight Paint on polygons with no faces
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c 2009-12-20 10:33:03 UTC (rev 25480)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c 2009-12-20 10:50:40 UTC (rev 25481)
@@ -1438,22 +1438,35 @@
VPaint *wp= ts->wpaint;
Brush *brush = paint_brush(&wp->paint);
struct WPaintData *wpd= paint_stroke_mode_data(stroke);
- ViewContext *vc= &wpd->vc;
- Object *ob= vc->obact;
- Mesh *me= ob->data;
+ ViewContext *vc;
+ Object *ob;
+ Mesh *me;
float mat[4][4];
float paintweight= ts->vgroup_weight;
- int *indexar= wpd->indexar;
+ int *indexar;
int totindex, index, totw, flip;
float alpha;
float mval[2], pressure;
-
+
+ /* cannot paint if there is no stroke data */
+ if (wpd == NULL) {
+ // XXX: force a redraw here, since even though we can't paint,
+ // at least view won't freeze until stroke ends
+ ED_region_tag_redraw(CTX_wm_region(C));
+ return;
+ }
+
+ vc= &wpd->vc;
+ ob= vc->obact;
+ me= ob->data;
+ indexar= wpd->indexar;
+
view3d_operator_needs_opengl(C);
-
+
/* load projection matrix */
wmMultMatrix(ob->obmat);
wmGetSingleMatrix(mat);
- wmLoadMatrix(wpd->vc.rv3d->viewmat);
+ wmLoadMatrix(vc->rv3d->viewmat);
flip = RNA_boolean_get(itemptr, "flip");
pressure = RNA_float_get(itemptr, "pressure");
@@ -1598,13 +1611,17 @@
Object *ob= CTX_data_active_object(C);
struct WPaintData *wpd= paint_stroke_mode_data(stroke);
- if(wpd->vertexcosnos)
- MEM_freeN(wpd->vertexcosnos);
- MEM_freeN(wpd->indexar);
+ if(wpd) {
+ if(wpd->vertexcosnos)
+ MEM_freeN(wpd->vertexcosnos);
+ MEM_freeN(wpd->indexar);
+
+ if (wpd->vgroup_validmap)
+ MEM_freeN(wpd->vgroup_validmap);
+
+ MEM_freeN(wpd);
+ }
- if (wpd->vgroup_validmap)
- MEM_freeN(wpd->vgroup_validmap);
-
/* frees prev buffer */
copy_wpaint_prev(ts->wpaint, NULL, 0);
@@ -1623,9 +1640,7 @@
}
}
- DAG_id_flush_update(ob->data, OB_RECALC_DATA);
-
- MEM_freeN(wpd);
+ DAG_id_flush_update(ob->data, OB_RECALC_DATA);
}
More information about the Bf-blender-cvs
mailing list