forked from bartvdbraak/blender
Bugfix #20173: Crash with Weight Paint on polygons with no faces
This commit is contained in:
parent
170c464920
commit
4d16275c03
@ -1438,22 +1438,35 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
|
||||
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 @@ static void wpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
|
||||
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 @@ static void wpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
|
||||
}
|
||||
}
|
||||
|
||||
DAG_id_flush_update(ob->data, OB_RECALC_DATA);
|
||||
|
||||
MEM_freeN(wpd);
|
||||
DAG_id_flush_update(ob->data, OB_RECALC_DATA);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user