diff options
26 files changed, 89 insertions, 66 deletions
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index 09e9b667369..6dd40b7a651 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -57,11 +57,12 @@ enum { /* prototypes */ -struct Scene; -struct Object; -struct ListBase; struct Depsgraph; struct DerivedMesh; +struct ListBase; +struct Main; +struct Object; +struct Scene; /* used for curves, nurbs, mball, importing */ typedef struct DispList { diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h index a0814fc9183..0a759629930 100644 --- a/source/blender/blenkernel/BKE_dynamicpaint.h +++ b/source/blender/blenkernel/BKE_dynamicpaint.h @@ -28,6 +28,7 @@ */ struct Depsgraph; +struct Main; struct Scene; struct ViewLayer; @@ -86,7 +87,9 @@ struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings /* image sequence baking */ int dynamicPaint_createUVSurface(struct Scene *scene, struct DynamicPaintSurface *surface, float *progress, short *do_update); -int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *cObject, int frame); +int dynamicPaint_calculateFrame( + struct DynamicPaintSurface *surface, struct Depsgraph *depsgraph, + struct Scene *scene, struct Object *cObject, int frame); void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface, char *filename, short output_layer); /* PaintPoint state */ diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index e184fd3796b..c5ad91c81fd 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -54,7 +54,7 @@ typedef struct Global { /* strings: lastsaved */ char ima[1024], lib[1024]; /* 1024 = FILE_MAX */ - /* when set: G.main->name contains valid relative base path */ + /* when set: G_MAIN->name contains valid relative base path */ bool relbase_valid; bool file_loaded; bool save_over; @@ -210,6 +210,11 @@ enum { /* Memory is allocated where? blender.c */ extern Global G; +/** + * Stupid macro to hide the few *valid* usages of G.main (from startup/exit code e.g.), helps with cleanup task. + */ +#define G_MAIN (G).main + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_mball_tessellate.h b/source/blender/blenkernel/BKE_mball_tessellate.h index df652df177d..363bfe09c75 100644 --- a/source/blender/blenkernel/BKE_mball_tessellate.h +++ b/source/blender/blenkernel/BKE_mball_tessellate.h @@ -24,6 +24,7 @@ * \ingroup bke */ struct Depsgraph; +struct Main; struct Object; struct Scene; diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 6172c9998af..482d39b5e68 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -258,12 +258,10 @@ void BKE_object_eval_flush_base_flags( struct Object *object, int base_index, const bool is_from_set); -void BKE_object_handle_data_update( - struct Depsgraph *depsgraph, +void BKE_object_handle_data_update(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); -void BKE_object_handle_update( - struct Depsgraph *depsgraph, +void BKE_object_handle_update(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void BKE_object_handle_update_ex( struct Depsgraph *depsgraph, diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 412cf45de2b..2ba6446c18f 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -121,7 +121,7 @@ void BKE_paint_curve_copy_data( struct PaintCurve *BKE_paint_curve_copy(struct Main *bmain, const struct PaintCurve *pc); void BKE_paint_curve_make_local(struct Main *bmain, struct PaintCurve *pc, const bool lib_local); -void BKE_paint_init(struct Scene *sce, ePaintMode mode, const char col[3]); +void BKE_paint_init(struct Main *bmain, struct Scene *sce, ePaintMode mode, const char col[3]); void BKE_paint_free(struct Paint *p); void BKE_paint_copy(struct Paint *src, struct Paint *tar, const int flag); diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index a591ab354f6..5e812d4e5d0 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -53,6 +53,7 @@ #include "BKE_cdderivedmesh.h" #include "BKE_object.h" #include "BKE_library.h" +#include "BKE_main.h" #include "BKE_mball.h" #include "BKE_mball_tessellate.h" #include "BKE_mesh.h" diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 36452e1d2cf..0b2c65a7b8d 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3645,7 +3645,7 @@ static void dynamic_paint_brush_velocity_compute_cb( } static void dynamicPaint_brushMeshCalculateVelocity( - struct Depsgraph *depsgraph, Scene *scene, + Depsgraph *depsgraph, Scene *scene, Object *ob, DynamicPaintBrushSettings *brush, Vec3f **brushVel, float timescale) { float prev_obmat[4][4]; @@ -3710,7 +3710,8 @@ static void dynamicPaint_brushMeshCalculateVelocity( } /* calculate velocity for object center point */ -static void dynamicPaint_brushObjectCalculateVelocity(struct Depsgraph *depsgraph, Scene *scene, Object *ob, Vec3f *brushVel, float timescale) +static void dynamicPaint_brushObjectCalculateVelocity( + Depsgraph *depsgraph, Scene *scene, Object *ob, Vec3f *brushVel, float timescale) { float prev_obmat[4][4]; float cur_loc[3] = {0.0f}, prev_loc[3] = {0.0f}; @@ -4096,7 +4097,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex( } } -static int dynamicPaint_paintMesh(struct Depsgraph *depsgraph, DynamicPaintSurface *surface, +static int dynamicPaint_paintMesh(Depsgraph *depsgraph, DynamicPaintSurface *surface, DynamicPaintBrushSettings *brush, Object *brushOb, Scene *scene, @@ -4584,7 +4585,7 @@ static void dynamic_paint_paint_single_point_cb_ex( } static int dynamicPaint_paintSinglePoint( - struct Depsgraph *depsgraph, DynamicPaintSurface *surface, float *pointCoord, DynamicPaintBrushSettings *brush, + Depsgraph *depsgraph, DynamicPaintSurface *surface, float *pointCoord, DynamicPaintBrushSettings *brush, Object *brushOb, Scene *scene, float timescale) { PaintSurfaceData *sData = surface->data; @@ -5882,7 +5883,9 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, const Vie /* * Do Dynamic Paint step. Paints scene brush objects of current state/frame to the surface. */ -static int dynamicPaint_doStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, DynamicPaintSurface *surface, float timescale, float subframe) +static int dynamicPaint_doStep( + Depsgraph *depsgraph, Scene *scene, + Object *ob, DynamicPaintSurface *surface, float timescale, float subframe) { PaintSurfaceData *sData = surface->data; PaintBakeData *bData = sData->bData; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 8dac716ab02..a885f22b739 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1746,13 +1746,13 @@ const char *BKE_main_blendfile_path(const Main *bmain) } /** - * Return filepath of global main (G.main). + * Return filepath of global main (G_MAIN). * - * \warning Usage is not recommended, you should always try to get a velid Main pointer from context... + * \warning Usage is not recommended, you should always try to get a valid Main pointer from context... */ const char *BKE_main_blendfile_path_from_global(void) { - return BKE_main_blendfile_path(G.main); + return BKE_main_blendfile_path(G_MAIN); } /* ***************** ID ************************ */ diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c index 0f13618c76a..7e26a0f7713 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.c +++ b/source/blender/blenkernel/intern/mball_tessellate.c @@ -48,9 +48,10 @@ #include "BKE_global.h" -#include "BKE_scene.h" #include "BKE_displist.h" +#include "BKE_main.h" #include "BKE_mball_tessellate.h" /* own include */ +#include "BKE_scene.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 324ad3a31dc..2d1c03cf883 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -98,7 +98,9 @@ typedef struct DupliGenerator { static const DupliGenerator *get_dupli_generator(const DupliContext *ctx); /* create initial context for root object */ -static void init_context(DupliContext *r_ctx, Depsgraph *depsgraph, Scene *scene, Object *ob, float space_mat[4][4]) +static void init_context( + DupliContext *r_ctx, Depsgraph *depsgraph, + Scene *scene, Object *ob, float space_mat[4][4]) { r_ctx->depsgraph = depsgraph; r_ctx->scene = scene; diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 3b684ebfd94..f0f31eebfbd 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -39,28 +39,29 @@ #include "BLI_utildefines.h" #include "BLI_math.h" -#include "BKE_global.h" +#include "BKE_animsys.h" #include "BKE_armature.h" #include "BKE_action.h" #include "BKE_constraint.h" #include "BKE_curve.h" #include "BKE_DerivedMesh.h" -#include "BKE_animsys.h" #include "BKE_displist.h" +#include "BKE_editmesh.h" #include "BKE_effect.h" +#include "BKE_global.h" +#include "BKE_image.h" #include "BKE_key.h" #include "BKE_lamp.h" #include "BKE_lattice.h" #include "BKE_library.h" -#include "BKE_editmesh.h" +#include "BKE_main.h" +#include "BKE_material.h" +#include "BKE_mball.h" +#include "BKE_mesh.h" #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_scene.h" -#include "BKE_material.h" -#include "BKE_mball.h" -#include "BKE_mesh.h" -#include "BKE_image.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index f03b46c8a07..20d68ee2a58 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -504,7 +504,7 @@ eObjectMode BKE_paint_object_mode_from_paint_mode(ePaintMode mode) } } -void BKE_paint_init(Scene *sce, ePaintMode mode, const char col[3]) +void BKE_paint_init(Main *bmain, Scene *sce, ePaintMode mode, const char col[3]) { UnifiedPaintSettings *ups = &sce->toolsettings->unified_paint_settings; Brush *brush; @@ -514,10 +514,10 @@ void BKE_paint_init(Scene *sce, ePaintMode mode, const char col[3]) brush = BKE_paint_brush(paint); if (brush == NULL) { eObjectMode ob_mode = BKE_paint_object_mode_from_paint_mode(mode); - brush = BKE_brush_first_search(G.main, ob_mode); + brush = BKE_brush_first_search(bmain, ob_mode); if (!brush) { - brush = BKE_brush_add(G.main, "Brush", ob_mode); + brush = BKE_brush_add(bmain, "Brush", ob_mode); id_us_min(&brush->id); /* fake user only */ } BKE_paint_brush_set(paint, brush); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 2916e5559c4..63d7942c623 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -954,8 +954,7 @@ Scene *BKE_scene_set_name(Main *bmain, const char *name) } /* Used by metaballs, return *all* objects (including duplis) existing in the scene (including scene's sets) */ -int BKE_scene_base_iter_next( - Depsgraph *depsgraph, SceneBaseIter *iter, +int BKE_scene_base_iter_next(Depsgraph *depsgraph, SceneBaseIter *iter, Scene **scene, int val, Base **base, Object **ob) { bool run_again = true; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 922f82a5e2e..738be9ded54 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -2108,7 +2108,8 @@ BLI_INLINE void apply_inflow_fields(SmokeFlowSettings *sfs, float emission_value } } -static void update_flowsfluids(struct Depsgraph *depsgraph, Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt) +static void update_flowsfluids( + struct Depsgraph *depsgraph, Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt) { Object **flowobjs = NULL; EmissionMap *emaps = NULL; @@ -2562,7 +2563,9 @@ static void update_effectors(struct Depsgraph *depsgraph, Scene *scene, Object * pdEndEffectors(&effectors); } -static void step(struct Depsgraph *depsgraph, Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *domain_dm, float fps) +static void step( + Depsgraph *depsgraph, + Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *domain_dm, float fps) { SmokeDomainSettings *sds = smd->domain; /* stability values copied from wturbulence.cpp */ diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index ce12c2fcd7a..c45bebd5779 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -60,8 +60,8 @@ void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *aspx, float *a void ED_space_image_scopes_update(const struct bContext *C, struct SpaceImage *sima, struct ImBuf *ibuf, bool use_view_settings); -void ED_space_image_paint_update(struct wmWindowManager *wm, struct Scene *scene); -void ED_space_image_uv_sculpt_update(struct wmWindowManager *wm, struct Scene *scene); +void ED_space_image_paint_update(struct Main *bmain, struct wmWindowManager *wm, struct Scene *scene); +void ED_space_image_uv_sculpt_update(struct Main *bmain, struct wmWindowManager *wm, struct Scene *scene); void ED_image_get_uv_aspect(struct Image *ima, struct ImageUser *iuser, float *aspx, float *aspy); void ED_image_mouse_pos(struct SpaceImage *sima, struct ARegion *ar, const int mval[2], float co[2]); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 71b713da0d0..f1311233f23 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -137,11 +137,11 @@ bool ED_object_editmode_calc_active_center(struct Object *obedit, const bool sel void ED_object_vpaintmode_enter_ex( - struct Depsgraph *depsgraph, struct wmWindowManager *wm, + struct Main *bmain, struct Depsgraph *depsgraph, struct wmWindowManager *wm, struct Scene *scene, struct Object *ob); void ED_object_vpaintmode_enter(struct bContext *C); void ED_object_wpaintmode_enter_ex( - struct Depsgraph *depsgraph, struct wmWindowManager *wm, + struct Main *bmain, struct Depsgraph *depsgraph, struct wmWindowManager *wm, struct Scene *scene, struct Object *ob); void ED_object_wpaintmode_enter(struct bContext *C); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index d47a2576a8a..b7f59285186 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -473,7 +473,7 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op) } } - ED_space_image_uv_sculpt_update(CTX_wm_manager(C), scene); + ED_space_image_uv_sculpt_update(bmain, CTX_wm_manager(C), scene); WM_msg_publish_rna_prop(mbus, &obact->id, obact, Object, mode); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 2921faf8a5a..61b673afc9f 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -739,7 +739,7 @@ static void toggle_paint_cursor(bContext *C, int enable) * purpose is to make sure the paint cursor is shown if paint * mode is enabled in the image editor. the paint poll will * ensure that the cursor is hidden when not in paint mode */ -void ED_space_image_paint_update(wmWindowManager *wm, Scene *scene) +void ED_space_image_paint_update(Main *bmain, wmWindowManager *wm, Scene *scene) { ToolSettings *settings = scene->toolsettings; ImagePaintSettings *imapaint = &settings->imapaint; @@ -758,7 +758,7 @@ void ED_space_image_paint_update(wmWindowManager *wm, Scene *scene) } if (enabled) { - BKE_paint_init(scene, ePaintTexture2D, PAINT_CURSOR_TEXTURE_PAINT); + BKE_paint_init(bmain, scene, ePaintTexture2D, PAINT_CURSOR_TEXTURE_PAINT); paint_cursor_start_explicit(&imapaint->paint, wm, image_paint_poll); } @@ -1119,7 +1119,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) ob->mode |= mode_flag; - BKE_paint_init(scene, ePaintTextureProjective, PAINT_CURSOR_TEXTURE_PAINT); + BKE_paint_init(bmain, scene, ePaintTextureProjective, PAINT_CURSOR_TEXTURE_PAINT); if (U.glreslimit != 0) GPU_free_images(); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 02dae51c594..ac6bfe019a1 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -55,7 +55,6 @@ #include "BKE_brush.h" #include "BKE_context.h" #include "BKE_deform.h" -#include "BKE_global.h" #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_mesh_mapping.h" @@ -1062,7 +1061,8 @@ static void vertex_paint_init_session_data(const ToolSettings *ts, Object *ob) * \{ */ static void ed_vwpaintmode_enter_generic( - Depsgraph *depsgraph, wmWindowManager *wm, Scene *scene, + Main *bmain, Depsgraph *depsgraph, + wmWindowManager *wm, Scene *scene, Object *ob, const eObjectMode mode_flag) { ob->mode |= mode_flag; @@ -1083,7 +1083,7 @@ static void ed_vwpaintmode_enter_generic( Paint *paint = BKE_paint_get_active_from_paintmode(scene, paint_mode); paint_cursor_start_explicit(paint, wm, vertex_paint_poll); - BKE_paint_init(scene, paint_mode, PAINT_CURSOR_VERTEX_PAINT); + BKE_paint_init(bmain, scene, paint_mode, PAINT_CURSOR_VERTEX_PAINT); } else if (mode_flag == OB_MODE_WEIGHT_PAINT) { const ePaintMode paint_mode = ePaintWeight; @@ -1094,7 +1094,7 @@ static void ed_vwpaintmode_enter_generic( Paint *paint = BKE_paint_get_active_from_paintmode(scene, paint_mode); paint_cursor_start_explicit(paint, wm, weight_paint_poll); - BKE_paint_init(scene, paint_mode, PAINT_CURSOR_WEIGHT_PAINT); + BKE_paint_init(bmain, scene, paint_mode, PAINT_CURSOR_WEIGHT_PAINT); /* weight paint specific */ ED_mesh_mirror_spatial_table(ob, NULL, NULL, NULL, 's'); @@ -1120,35 +1120,37 @@ static void ed_vwpaintmode_enter_generic( } void ED_object_vpaintmode_enter_ex( - Depsgraph *depsgraph, wmWindowManager *wm, + Main *bmain, Depsgraph *depsgraph, wmWindowManager *wm, Scene *scene, Object *ob) { ed_vwpaintmode_enter_generic( - depsgraph, wm, scene, ob, OB_MODE_VERTEX_PAINT); + bmain, depsgraph, wm, scene, ob, OB_MODE_VERTEX_PAINT); } void ED_object_vpaintmode_enter(struct bContext *C) { + Main *bmain = CTX_data_main(C); Depsgraph *depsgraph = CTX_data_depsgraph(C); wmWindowManager *wm = CTX_wm_manager(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); - ED_object_vpaintmode_enter_ex(depsgraph, wm, scene, ob); + ED_object_vpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob); } void ED_object_wpaintmode_enter_ex( - Depsgraph *depsgraph, wmWindowManager *wm, + Main *bmain, Depsgraph *depsgraph, wmWindowManager *wm, Scene *scene, Object *ob) { ed_vwpaintmode_enter_generic( - depsgraph, wm, scene, ob, OB_MODE_WEIGHT_PAINT); + bmain, depsgraph, wm, scene, ob, OB_MODE_WEIGHT_PAINT); } void ED_object_wpaintmode_enter(struct bContext *C) { + Main *bmain = CTX_data_main(C); Depsgraph *depsgraph = CTX_data_depsgraph(C); wmWindowManager *wm = CTX_wm_manager(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); - ED_object_wpaintmode_enter_ex(depsgraph, wm, scene, ob); + ED_object_wpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob); } /** \} */ @@ -1234,6 +1236,7 @@ void ED_object_wpaintmode_exit(struct bContext *C) */ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); struct wmMsgBus *mbus = CTX_wm_message_bus(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_WEIGHT_PAINT; @@ -1254,7 +1257,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) else { Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C); wmWindowManager *wm = CTX_wm_manager(C); - ED_object_wpaintmode_enter_ex(depsgraph, wm, scene, ob); + ED_object_wpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob); } /* Weightpaint works by overriding colors in mesh, @@ -2371,6 +2374,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot) */ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); struct wmMsgBus *mbus = CTX_wm_message_bus(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_VERTEX_PAINT; @@ -2392,7 +2396,7 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) else { Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C); wmWindowManager *wm = CTX_wm_manager(C); - ED_object_vpaintmode_enter_ex(depsgraph, wm, scene, ob); + ED_object_vpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob); } BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 3475aadd171..1c76f20d45c 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5687,7 +5687,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); + BKE_paint_init(bmain, scene, ePaintSculpt, PAINT_CURSOR_SCULPT); paint_cursor_start_explicit(paint, bmain->wm.first, sculpt_poll_view3d); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 46d704e8f74..cf9feae62b5 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -43,12 +43,13 @@ #include "DNA_meshdata_types.h" #include "BKE_brush.h" -#include "BKE_paint.h" #include "BKE_colortools.h" #include "BKE_context.h" -#include "BKE_mesh_mapping.h" #include "BKE_customdata.h" #include "BKE_editmesh.h" +#include "BKE_main.h" +#include "BKE_mesh_mapping.h" +#include "BKE_paint.h" #include "DEG_depsgraph.h" @@ -230,7 +231,7 @@ static void brush_drawcursor_uvsculpt(bContext *C, int x, int y, void *UNUSED(cu } -void ED_space_image_uv_sculpt_update(wmWindowManager *wm, Scene *scene) +void ED_space_image_uv_sculpt_update(Main *bmain, wmWindowManager *wm, Scene *scene) { ToolSettings *settings = scene->toolsettings; if (settings->use_uv_sculpt) { @@ -243,7 +244,7 @@ void ED_space_image_uv_sculpt_update(wmWindowManager *wm, Scene *scene) settings->uvsculpt->paint.flags |= PAINT_SHOW_BRUSH; } - BKE_paint_init(scene, ePaintSculptUV, PAINT_CURSOR_SCULPT); + BKE_paint_init(bmain, scene, ePaintSculptUV, PAINT_CURSOR_SCULPT); settings->uvsculpt->paint.paint_cursor = WM_paint_cursor_activate(wm, uv_sculpt_brush_poll, brush_drawcursor_uvsculpt, NULL); diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 447cff065b7..a829f8c1144 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -129,7 +129,7 @@ void ED_editors_init(bContext *C) { Scene *sce = CTX_data_scene(C); if (sce) { - ED_space_image_paint_update(wm, sce); + ED_space_image_paint_update(bmain, wm, sce); } } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index bec70cd6cf3..af92f25d401 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -642,7 +642,7 @@ static void rna_GPencilBrush_name_set(PointerRNA *ptr, const char *value) static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) { - ED_space_image_uv_sculpt_update(bmain->wm.first, scene); + ED_space_image_uv_sculpt_update(bmain, bmain->wm.first, scene); } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index fca8e3ab9f9..eb576692224 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -857,7 +857,7 @@ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) { - ED_space_image_paint_update(bmain->wm.first, scene); + ED_space_image_paint_update(bmain, bmain->wm.first, scene); } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 8675ffec313..8105f94cb31 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -2184,7 +2184,7 @@ static void init_render_mball(Render *re, ObjectRen *obr) int a, need_orco, vlakindex, *index, negative_scale; ListBase dispbase= {NULL, NULL}; - if (ob!=BKE_mball_basis_find(re->eval_ctx, re->scene, ob)) + if (ob!=BKE_mball_basis_find(re->main, re->eval_ctx, re->scene, ob)) return; mul_m4_m4m4(mat, re->viewmat, ob->obmat); @@ -2199,7 +2199,7 @@ static void init_render_mball(Render *re, ObjectRen *obr) need_orco= 1; } - BKE_displist_make_mball_forRender(re->eval_ctx, re->scene, ob, &dispbase); + BKE_displist_make_mball_forRender(re->main, re->eval_ctx, re->scene, ob, &dispbase); dl= dispbase.first; if (dl == NULL) return; @@ -4862,7 +4862,7 @@ static int allow_render_object(Render *re, Object *ob, int nolamps, int onlysele } /* don't add non-basic meta objects, ends up having renderobjects with no geometry */ - if (ob->type == OB_MBALL && ob!=BKE_mball_basis_find(re->eval_ctx, re->scene, ob)) + if (ob->type == OB_MBALL && ob != BKE_mball_basis_find(re->main, re->eval_ctx, re->scene, ob)) return 0; if (nolamps && (ob->type==OB_LAMP)) @@ -5049,7 +5049,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp /* create list of duplis generated by this object, particle * system need to have render settings set for dupli particles */ dupli_render_particle_set(re, ob, timeoffset, 0, 1); - duplilist = object_duplilist(re->eval_ctx, re->scene, ob); + duplilist = object_duplilist(re->main, re->eval_ctx, re->scene, ob); duplilist_apply_data = duplilist_apply(ob, NULL, duplilist); /* postpone 'dupli_render_particle_set', since RE_addRenderInstance reads * index values from 'dob->persistent_id[0]', referencing 'psys->child' which |