[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36471] trunk/blender/source/blender/ editors/sculpt_paint: fix for crash executing sculpt via python.
Campbell Barton
ideasman42 at gmail.com
Wed May 4 05:34:56 CEST 2011
Revision: 36471
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36471
Author: campbellbarton
Date: 2011-05-04 03:34:55 +0000 (Wed, 04 May 2011)
Log Message:
-----------
fix for crash executing sculpt via python.
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c 2011-05-04 01:50:17 UTC (rev 36470)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c 2011-05-04 03:34:55 UTC (rev 36471)
@@ -896,11 +896,20 @@
{
PaintStroke *stroke = op->customdata;
+ /* only when executed for the first time */
+ if(stroke->stroke_started == 0) {
+ /* XXX stroke->last_mouse_position is unset, this may cause problems */
+ stroke->test_start(C, op, NULL);
+ stroke->stroke_started= 1;
+ }
+
RNA_BEGIN(op->ptr, itemptr, "stroke") {
stroke->update_step(C, stroke, &itemptr);
}
RNA_END;
+ stroke->done(C, stroke);
+
MEM_freeN(stroke);
op->customdata = NULL;
Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-05-04 01:50:17 UTC (rev 36470)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-05-04 03:34:55 UTC (rev 36471)
@@ -3462,8 +3462,9 @@
static int sculpt_stroke_test_start(bContext *C, struct wmOperator *op,
wmEvent *event)
{
- /* Don't start the stroke until mouse goes over the mesh */
- if(over_mesh(C, op, event->x, event->y)) {
+ /* Don't start the stroke until mouse goes over the mesh.
+ * note: event will only be null when re-executing the saved stroke. */
+ if(event==NULL || over_mesh(C, op, event->x, event->y)) {
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
@@ -3604,22 +3605,15 @@
static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op)
{
- Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
- SculptSession *ss = CTX_data_active_object(C)->sculpt;
-
if(!sculpt_brush_stroke_init(C, op->reports))
return OPERATOR_CANCELLED;
op->customdata = paint_stroke_new(C, sculpt_stroke_get_location, sculpt_stroke_test_start,
sculpt_stroke_update_step, sculpt_stroke_done, 0);
- sculpt_update_cache_invariants(C, sd, ss, op, NULL);
-
+ /* frees op->customdata */
paint_stroke_exec(C, op);
- sculpt_flush_update(C);
- sculpt_cache_free(ss->cache);
-
return OPERATOR_FINISHED;
}
More information about the Bf-blender-cvs
mailing list