diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-08 13:16:37 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-08 13:17:22 +0300 |
commit | 7b6af843c2bdef9c9ab6d00100d93192a8e769c0 (patch) | |
tree | 1dae0407c639733739a2e281547f54d8e8a93614 /source/blender/editors/sculpt_paint | |
parent | 55606dbdbcd33fb8ba2ee41284fc1c5c35977815 (diff) |
Cleanup: getting rid of G.main.
Sometimes one needs a *lot* of changes for a single G.main... :/
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 6 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 10 |
2 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 8e1d47db61a..96aa4b17788 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5025,6 +5025,7 @@ void paint_proj_stroke( /* clone gets special treatment here to avoid going through image initialization */ if (ps_handle->is_clone_cursor_pick) { + Main *bmain = CTX_data_main(C); Scene *scene = ps_handle->scene; View3D *v3d = CTX_wm_view3d(C); ARegion *ar = CTX_wm_region(C); @@ -5033,7 +5034,7 @@ void paint_proj_stroke( view3d_operator_needs_opengl(C); - if (!ED_view3d_autodist(scene, ar, v3d, mval_i, cursor, false, NULL)) + if (!ED_view3d_autodist(bmain, scene, ar, v3d, mval_i, cursor, false, NULL)) return; ED_region_tag_redraw(ar); @@ -5445,6 +5446,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) ImBuf *ibuf; char filename[FILE_MAX]; + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); ToolSettings *settings = scene->toolsettings; int w = settings->imapaint.screen_grab_size[0]; @@ -5460,7 +5462,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) if (h > maxsize) h = maxsize; ibuf = ED_view3d_draw_offscreen_imbuf( - scene, CTX_wm_view3d(C), CTX_wm_region(C), + bmain, scene, CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect, V3D_OFSDRAW_NONE, R_ALPHAPREMUL, 0, NULL, NULL, NULL, err_out); if (!ibuf) { diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 40d11e0197b..d5bdd4c8b98 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5630,7 +5630,7 @@ static int ed_object_sculptmode_flush_recalc_flag(Scene *scene, Object *ob, Mult } void ED_object_sculptmode_enter_ex( - Scene *scene, Object *ob, + Main *bmain, Scene *scene, Object *ob, ReportList *reports) { const int mode_flag = OB_MODE_SCULPT; @@ -5674,7 +5674,7 @@ void ED_object_sculptmode_enter_ex( Paint *paint = BKE_paint_get_active_from_paintmode(scene, ePaintSculpt); BKE_paint_init(scene, ePaintSculpt, PAINT_CURSOR_SCULPT); - paint_cursor_start_explicit(paint, G.main->wm.first, sculpt_poll_view3d); + paint_cursor_start_explicit(paint, bmain->wm.first, sculpt_poll_view3d); /* Check dynamic-topology flag; re-enter dynamic-topology mode when changing modes, * As long as no data was added that is not supported. */ @@ -5730,9 +5730,10 @@ void ED_object_sculptmode_enter_ex( void ED_object_sculptmode_enter(struct bContext *C, ReportList *reports) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); - ED_object_sculptmode_enter_ex(scene, ob, reports); + ED_object_sculptmode_enter_ex(bmain, scene, ob, reports); } void ED_object_sculptmode_exit_ex( @@ -5790,6 +5791,7 @@ void ED_object_sculptmode_exit(bContext *C) static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_SCULPT; @@ -5805,7 +5807,7 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) ED_object_sculptmode_exit_ex(scene, ob); } else { - ED_object_sculptmode_enter_ex(scene, ob, op->reports); + ED_object_sculptmode_enter_ex(bmain, scene, ob, op->reports); } WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); |