[Bf-blender-cvs] [7b6af843c2b] master: Cleanup: getting rid of G.main.

Bastien Montagne noreply at git.blender.org
Fri Jun 8 12:17:28 CEST 2018


Commit: 7b6af843c2bdef9c9ab6d00100d93192a8e769c0
Author: Bastien Montagne
Date:   Fri Jun 8 12:16:37 2018 +0200
Branches: master
https://developer.blender.org/rB7b6af843c2bdef9c9ab6d00100d93192a8e769c0

Cleanup: getting rid of G.main.

Sometimes one needs a *lot* of changes for a single G.main... :/

===================================================================

M	source/blender/blenkernel/BKE_sequencer.h
M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/editors/curve/editcurve_paint.c
M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/editors/include/ED_object.h
M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_eyedropper_depth.c
M	source/blender/editors/interface/interface_intern.h
M	source/blender/editors/interface/resources.c
M	source/blender/editors/render/render_opengl.c
M	source/blender/editors/sculpt_paint/paint_image_proj.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_edit.c
M	source/blender/editors/space_view3d/view3d_intern.h
M	source/blender/editors/space_view3d/view3d_select.c
M	source/blender/editors/space_view3d/view3d_utils.c
M	source/blender/editors/transform/transform_conversions.c
M	source/blender/editors/transform/transform_snap.c
M	source/blender/python/intern/gpu_offscreen.c
M	source/blender/windowmanager/intern/wm_files.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 6b0cf8f0913..8d11ae89233 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -434,7 +434,8 @@ enum {
 };
 
 typedef struct ImBuf *(*SequencerDrawView)(
-        struct Scene *scene, struct Object *camera, int width, int height,
+        struct Main *bmain, struct Scene *scene,
+        struct Object *camera, int width, int height,
         unsigned int flag, unsigned int draw_flags, int drawtype, int alpha_mode,
         int samples, const char *viewname,
         struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index f817ba7fc37..557b781c5d0 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3326,7 +3326,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
 		BKE_scene_update_for_newframe(context->eval_ctx, context->bmain, scene, scene->lay);
 		ibuf = sequencer_view3d_cb(
 		        /* set for OpenGL render (NULL when scrubbing) */
-		        scene, camera, width, height, IB_rect, draw_flags, context->scene->r.seq_prev_type,
+		        context->bmain, scene, camera, width, height, IB_rect, draw_flags, context->scene->r.seq_prev_type,
 		        scene->r.alphamode, context->gpu_samples, viewname,
 		        context->gpu_fx, context->gpu_offscreen, err_out);
 		if (ibuf == NULL) {
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index 964296df205..325c39d7f38 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -35,6 +35,7 @@
 #include "BKE_curve.h"
 #include "BKE_depsgraph.h"
 #include "BKE_fcurve.h"
+#include "BKE_main.h"
 #include "BKE_report.h"
 
 #include "WM_api.h"
@@ -589,6 +590,7 @@ static bool curve_draw_init(bContext *C, wmOperator *op, bool is_invoke)
 		}
 	}
 	else {
+		cdd->vc.bmain = CTX_data_main(C);
 		cdd->vc.scene = CTX_data_scene(C);
 		cdd->vc.obedit = CTX_data_edit_object(C);
 	}
@@ -1078,7 +1080,7 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 				/* needed or else the draw matrix can be incorrect */
 				view3d_operator_needs_opengl(C);
 
-				ED_view3d_autodist_init(cdd->vc.scene, cdd->vc.ar, cdd->vc.v3d, 0);
+				ED_view3d_autodist_init(cdd->vc.bmain, cdd->vc.scene, cdd->vc.ar, cdd->vc.v3d, 0);
 
 				if (cdd->vc.rv3d->depths) {
 					cdd->vc.rv3d->depths->damaged = true;
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index d48efd75746..cdd8d571400 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -57,6 +57,7 @@
 #include "BKE_context.h"
 #include "BKE_gpencil.h"
 #include "BKE_library.h"
+#include "BKE_main.h"
 #include "BKE_report.h"
 #include "BKE_screen.h"
 
@@ -2098,6 +2099,7 @@ static int gp_strokes_reproject_poll(bContext *C)
 
 static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
 {
+	Main *bmain = CTX_data_main(C);
 	Scene *scene = CTX_data_scene(C);
 	GP_SpaceConversion gsc = {NULL};
 	eGP_ReprojectModes mode = RNA_boolean_get(op->ptr, "type");
@@ -2108,7 +2110,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
 	/* init autodist for geometry projection */
 	if (mode == GP_REPROJECT_SURFACE) {
 		view3d_region_operator_needs_opengl(CTX_wm_window(C), gsc.ar);
-		ED_view3d_autodist_init(scene, gsc.ar, CTX_wm_view3d(C), 0);
+		ED_view3d_autodist_init(bmain, scene, gsc.ar, CTX_wm_view3d(C), 0);
 	}
 
 	// TODO: For deforming geometry workflow, create new frames?
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index ece1b74d8dd..0d4c8e383de 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -46,14 +46,15 @@
 
 #include "PIL_time.h"
 
-#include "BKE_paint.h"
-#include "BKE_gpencil.h"
+#include "BKE_colortools.h"
 #include "BKE_context.h"
 #include "BKE_global.h"
+#include "BKE_gpencil.h"
+#include "BKE_main.h"
+#include "BKE_paint.h"
 #include "BKE_report.h"
 #include "BKE_screen.h"
 #include "BKE_tracking.h"
-#include "BKE_colortools.h"
 
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
@@ -111,6 +112,7 @@ typedef enum eGPencil_PaintFlags {
  *   "p" = op->customdata
  */
 typedef struct tGPsdata {
+	Main *bmain;
 	Scene *scene;       /* current scene from context */
 
 	wmWindow *win;      /* window where painting originated */
@@ -638,7 +640,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure,
 				View3D *v3d = p->sa->spacedata.first;
 
 				view3d_region_operator_needs_opengl(p->win, p->ar);
-				ED_view3d_autodist_init(p->scene, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
+				ED_view3d_autodist_init(p->bmain, p->scene, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
 			}
 
 			/* convert screen-coordinates to appropriate coordinates (and store them) */
@@ -1240,7 +1242,7 @@ static void gp_stroke_doeraser(tGPsdata *p)
 			View3D *v3d = p->sa->spacedata.first;
 
 			view3d_region_operator_needs_opengl(p->win, p->ar);
-			ED_view3d_autodist_init(p->scene, p->ar, v3d, 0);
+			ED_view3d_autodist_init(p->bmain, p->scene, p->ar, v3d, 0);
 		}
 	}
 
@@ -1393,6 +1395,7 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
 	}
 
 	/* pass on current scene and window */
+	p->bmain = CTX_data_main(C);
 	p->scene = CTX_data_scene(C);
 	p->win = CTX_wm_window(C);
 
@@ -1805,7 +1808,7 @@ static void gp_paint_strokeend(tGPsdata *p)
 
 		/* need to restore the original projection settings before packing up */
 		view3d_region_operator_needs_opengl(p->win, p->ar);
-		ED_view3d_autodist_init(p->scene, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
+		ED_view3d_autodist_init(p->bmain, p->scene, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
 	}
 
 	/* check if doing eraser or not */
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 707afa72c6a..0a35dd90f02 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -47,10 +47,11 @@
 #include "DNA_space_types.h"
 #include "DNA_view3d_types.h"
 
+#include "BKE_action.h"
 #include "BKE_context.h"
 #include "BKE_gpencil.h"
+#include "BKE_main.h"
 #include "BKE_tracking.h"
-#include "BKE_action.h"
 
 #include "WM_api.h"
 
@@ -520,6 +521,7 @@ bGPDpalettecolor *ED_gpencil_stroke_getcolor(bGPdata *gpd, bGPDstroke *gps)
  */
 void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
 {
+	Main *bmain = CTX_data_main(C);
 	ScrArea *sa = CTX_wm_area(C);
 	ARegion *ar = CTX_wm_region(C);
 
@@ -543,7 +545,7 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
 		view3d_operator_needs_opengl(C);
 
 		view3d_region_operator_needs_opengl(win, ar);
-		ED_view3d_autodist_init(scene, ar, v3d, 0);
+		ED_view3d_autodist_init(bmain, scene, ar, v3d, 0);
 
 		/* for camera view set the subrect */
 		if (rv3d->persp == RV3D_CAMOB) {
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 31a03f336a9..ade68de6d24 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -140,7 +140,7 @@ void ED_object_wpaintmode_exit_ex(struct Object *ob);
 void ED_object_wpaintmode_exit(struct bContext *C);
 
 void ED_object_sculptmode_enter_ex(
-        struct Scene *scene, struct Object *ob,
+        struct Main *bmain, struct Scene *scene, struct Object *ob,
         struct ReportList *reports);
 void ED_object_sculptmode_enter(struct bContext *C, struct ReportList *reports);
 void ED_object_sculptmode_exit_ex(
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 5110dd1a3f6..b1b1c5d1612 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -70,6 +70,7 @@ enum eGPUFXFlags;
 
 /* for derivedmesh drawing callbacks, for view3d_select, .... */
 typedef struct ViewContext {
+	struct Main *bmain;
 	struct Scene *scene;
 	struct Object *obact;
 	struct Object *obedit;
@@ -298,12 +299,12 @@ int          ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float
 unsigned int ED_view3d_backbuf_sample(struct ViewContext *vc, int x, int y);
 
 bool ED_view3d_autodist(
-        struct Scene *scene, struct ARegion *ar, struct View3D *v3d,
+        struct Main *bmain, struct Scene *scene, struct ARegion *ar, struct View3D *v3d,
         const int mval[2], float mouse_worldloc[3],
         const bool alphaoverride, const float fallback_depth_pt[3]);
 
 /* only draw so ED_view3d_autodist_simple can be called many times after */
-void ED_view3d_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode);
+void ED_view3d_autodist_init(struct Main *bmain, struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode);
 bool ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth);
 bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
 bool ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
@@ -359,7 +360,7 @@ struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d);
 void                    ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat);
 
 bool ED_view3d_context_activate(struct bContext *C);
-void ED_view3d_draw_offscreen_init(struct Scene *scene, struct View3D *v3d);
+void ED_view3d_draw_offscreen_init(struct Main *bmain, struct Scene *scene, struct View3D *v3d);
 void ED_view3d_draw_offscreen(
         struct Scene *scene, struct View3D *v3d, struc

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list