[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52659] trunk/blender/source/blender/ editors/sculpt_paint/sculpt.c: Fix #33345: Crash when using bpy.ops.sculpt. brush_stroke

Sergey Sharybin sergey.vfx at gmail.com
Thu Nov 29 14:24:02 CET 2012


Revision: 52659
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52659
Author:   nazgul
Date:     2012-11-29 13:24:02 +0000 (Thu, 29 Nov 2012)
Log Message:
-----------
Fix #33345: Crash when using bpy.ops.sculpt.brush_stroke

It was kind of a regression in behavior in svn rev46862 which made it so
blender crashes if stroke is done from the script.

It should bring back the behavior back and made it so blender doesn't crash,
however it's probably not full fix and some further work is needed to make
call of stroke operator usable from the addon.

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46862

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2012-11-29 13:07:45 UTC (rev 52658)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2012-11-29 13:24:02 UTC (rev 52659)
@@ -3356,7 +3356,10 @@
 	sculpt_init_mirror_clipping(ob, ss);
 
 	/* Initial mouse location */
-	copy_v2_v2(ss->cache->initial_mouse, mouse);
+	if (mouse)
+		copy_v2_v2(ss->cache->initial_mouse, mouse);
+	else
+		zero_v2(ss->cache->initial_mouse);
 
 	mode = RNA_enum_get(op->ptr, "mode");
 	cache->invert = mode == BRUSH_STROKE_INVERT;
@@ -3890,8 +3893,8 @@
                                     const float mouse[2])
 {
 	/* Don't start the stroke until mouse goes over the mesh.
-	 * note: event will only be null when re-executing the saved stroke. */
-	if (over_mesh(C, op, mouse[0], mouse[1])) {
+	 * note: mouse will only be null when re-executing the saved stroke. */
+	if (!mouse || over_mesh(C, op, mouse[0], mouse[1])) {
 		Object *ob = CTX_data_active_object(C);
 		SculptSession *ss = ob->sculpt;
 		Sculpt *sd = CTX_data_tool_settings(C)->sculpt;




More information about the Bf-blender-cvs mailing list