Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 11 Jun 2018 12:39:38 +0000 (14:39 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 11 Jun 2018 12:39:38 +0000 (14:39 +0200)
Conflicts:
intern/cycles/blender/blender_object.cpp
source/blender/alembic/intern/abc_exporter.cc
source/blender/alembic/intern/abc_mball.cc
source/blender/alembic/intern/abc_mball.h
source/blender/blenkernel/BKE_anim.h
source/blender/blenkernel/BKE_displist.h
source/blender/blenkernel/BKE_dynamicpaint.h
source/blender/blenkernel/BKE_group.h
source/blender/blenkernel/BKE_mball.h
source/blender/blenkernel/BKE_mball_tessellate.h
source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/BKE_scene.h
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/group.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/mball_tessellate.c
source/blender/blenkernel/intern/mesh_convert.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/object_dupli.c
source/blender/blenkernel/intern/object_update.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/smoke.c
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/editors/include/ED_object.h
source/blender/editors/object/object_add.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_modifier.c
source/blender/editors/physics/dynamicpaint_ops.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt_uv.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_snap_object.c
source/blender/editors/util/ed_util.c
source/blender/gpu/intern/gpu_material.c
source/blender/makesrna/intern/rna_meta.c
source/blender/makesrna/intern/rna_object_api.c
source/blender/modifiers/intern/MOD_dynamicpaint.c
source/blenderplayer/bad_level_call_stubs/stubs.c

26 files changed:
source/blender/blenkernel/BKE_displist.h
source/blender/blenkernel/BKE_dynamicpaint.h
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/BKE_mball_tessellate.h
source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/BKE_paint.h
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/mball_tessellate.c
source/blender/blenkernel/intern/object_dupli.c
source/blender/blenkernel/intern/object_update.c
source/blender/blenkernel/intern/paint.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/smoke.c
source/blender/editors/include/ED_image.h
source/blender/editors/include/ED_object.h
source/blender/editors/object/object_edit.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/sculpt_paint/sculpt_uv.c
source/blender/editors/util/ed_util.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_space.c
source/blender/render/intern/source/convertblender.c

index 09e9b66..6dd40b7 100644 (file)
@@ -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 {
index a0814fc..0a75962 100644 (file)
@@ -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 */
index e184fd3..c5ad91c 100644 (file)
@@ -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
index df652df..363bfe0 100644 (file)
@@ -24,6 +24,7 @@
  *  \ingroup bke
  */
 struct Depsgraph;
+struct Main;
 struct Object;
 struct Scene;
 
index 6172c99..482d39b 100644 (file)
@@ -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,
index 412cf45..2ba6446 100644 (file)
@@ -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);
 
index a591ab3..5e812d4 100644 (file)
@@ -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"
index 36452e1..0b2c65a 100644 (file)
@@ -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;
index 8dac716..a885f22 100644 (file)
@@ -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 ************************ */
index 0f13618..7e26a0f 100644 (file)
 
 #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"
index 324ad3a..2d1c03c 100644 (file)
@@ -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;
index 3b684eb..f0f31ee 100644 (file)
 #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"
 
index f03b46c..20d68ee 100644 (file)
@@ -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);
index 2916e55..63d7942 100644 (file)
@@ -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;
index 922f82a..738be9d 100644 (file)
@@ -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 */
index ce12c2f..c45bebd 100644 (file)
@@ -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]);
index 71b713d..f131123 100644 (file)
@@ -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);
 
index d47a257..b7f5928 100644 (file)
@@ -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);
 
index 2921faf..61b673a 100644 (file)
@@ -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();
index 02dae51..ac6bfe0 100644 (file)
@@ -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);
index 3475aad..1c76f20 100644 (file)
@@ -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);
 
index 46d704e..cf9feae 100644 (file)
 #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);
index 447cff0..a829f8c 100644 (file)
@@ -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);
                }
        }
 
index bec70cd..af92f25 100644 (file)
@@ -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);
 }
 
 
index fca8e3a..eb57669 100644 (file)
@@ -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);
 }
 
 
index 8675ffe..8105f94 100644 (file)
@@ -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