[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50820] trunk/blender/source/blender/ editors/sculpt_paint: fix for some crashes running operators in background mode.
Campbell Barton
ideasman42 at gmail.com
Sun Sep 23 07:33:24 CEST 2012
Revision: 50820
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50820
Author: campbellbarton
Date: 2012-09-23 05:33:23 +0000 (Sun, 23 Sep 2012)
Log Message:
-----------
fix for some crashes running operators in background mode.
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/paint_hide.c
trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
trunk/blender/source/blender/editors/sculpt_paint/sculpt_intern.h
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_hide.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_hide.c 2012-09-23 05:02:06 UTC (rev 50819)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_hide.c 2012-09-23 05:33:23 UTC (rev 50820)
@@ -388,7 +388,7 @@
ot->modal = WM_border_select_modal;
ot->exec = hide_show_exec;
/* sculpt-only for now */
- ot->poll = sculpt_mode_poll;
+ ot->poll = sculpt_mode_poll_view3d;
ot->flag = OPTYPE_REGISTER;
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c 2012-09-23 05:02:06 UTC (rev 50819)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c 2012-09-23 05:33:23 UTC (rev 50820)
@@ -524,8 +524,10 @@
{
Paint *p = paint_get_active_from_context(C);
Object *ob = CTX_data_active_object(C);
+ ScrArea *sa = CTX_wm_area(C);
+ ARegion *ar = CTX_wm_region(C);
return p && ob && paint_brush(p) &&
- CTX_wm_area(C)->spacetype == SPACE_VIEW3D &&
- CTX_wm_region(C)->regiontype == RGN_TYPE_WINDOW;
+ (sa && sa->spacetype == SPACE_VIEW3D) &&
+ (ar && ar->regiontype == RGN_TYPE_WINDOW);
}
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c 2012-09-23 05:02:06 UTC (rev 50819)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c 2012-09-23 05:33:23 UTC (rev 50820)
@@ -134,7 +134,7 @@
paint_brush(&CTX_data_tool_settings(C)->vpaint->paint))
{
ScrArea *sa = CTX_wm_area(C);
- if (sa->spacetype == SPACE_VIEW3D) {
+ if (sa && sa->spacetype == SPACE_VIEW3D) {
ARegion *ar = CTX_wm_region(C);
if (ar->regiontype == RGN_TYPE_WINDOW)
return 1;
Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2012-09-23 05:02:06 UTC (rev 50819)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2012-09-23 05:33:23 UTC (rev 50820)
@@ -3139,6 +3139,11 @@
return ob && ob->mode & OB_MODE_SCULPT;
}
+int sculpt_mode_poll_view3d(bContext *C)
+{
+ return (sculpt_mode_poll(C) && CTX_wm_region_view3d(C));
+}
+
int sculpt_poll(bContext *C)
{
return sculpt_mode_poll(C) && paint_poll(C);
Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt_intern.h
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt_intern.h 2012-09-23 05:02:06 UTC (rev 50819)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt_intern.h 2012-09-23 05:33:23 UTC (rev 50820)
@@ -56,6 +56,7 @@
void sculpt(struct Sculpt *sd);
int sculpt_mode_poll(struct bContext *C);
+int sculpt_mode_poll_view3d(struct bContext *C);
int sculpt_poll(struct bContext *C);
void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob, int need_pmap);
More information about the Bf-blender-cvs
mailing list