Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-06-11 12:05:37 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-06-11 13:15:14 +0300
commit8055ed2741d1da48f2bf84c75ccb37b54cef1ab8 (patch)
treec9ec424a22afda1e40bc635280795b6d35d5f9e1
parent13d238729bed899a9a7e190ba38406846c485230 (diff)
Cleanup: remove some G.main usages...
-rw-r--r--source/blender/blenkernel/BKE_paint.h2
-rw-r--r--source/blender/blenkernel/intern/paint.c6
-rw-r--r--source/blender/editors/include/ED_image.h4
-rw-r--r--source/blender/editors/include/ED_object.h4
-rw-r--r--source/blender/editors/object/object_edit.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c26
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c11
-rw-r--r--source/blender/editors/util/ed_util.c2
-rw-r--r--source/blender/makesrna/intern/rna_scene.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c2
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c4
13 files changed, 41 insertions, 33 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 9dbd17bfaab..253a615712c 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -118,7 +118,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/paint.c b/source/blender/blenkernel/intern/paint.c
index 4ba9cbf7ea0..b55f9ad6f62 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -498,7 +498,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;
@@ -508,10 +508,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/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index aeace9d679a..845d61ec355 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 ade68de6d24..da39f558909 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -126,11 +126,11 @@ bool ED_object_editmode_calc_active_center(struct Object *obedit, const bool sel
void ED_object_vpaintmode_enter_ex(
- struct wmWindowManager *wm,
+ struct Main *bmain, struct wmWindowManager *wm,
struct Scene *scene, struct Object *ob);
void ED_object_vpaintmode_enter(struct bContext *C);
void ED_object_wpaintmode_enter_ex(
- struct wmWindowManager *wm,
+ struct Main *bmain, 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 2131c85ec82..68cdcd4fdeb 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -631,6 +631,7 @@ bool ED_object_editmode_enter(bContext *C, int flag)
static int editmode_toggle_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
const int mode_flag = OB_MODE_EDIT;
const bool is_mode_set = (CTX_data_edit_object(C) != NULL);
Scene *scene = CTX_data_scene(C);
@@ -648,7 +649,7 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op)
else {
ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
}
- ED_space_image_uv_sculpt_update(CTX_wm_manager(C), scene);
+ ED_space_image_uv_sculpt_update(bmain, CTX_wm_manager(C), scene);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index c2b1fcaf460..cee7801a9cb 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -708,7 +708,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;
wmWindow *win;
@@ -723,7 +723,7 @@ void ED_space_image_paint_update(wmWindowManager *wm, Scene *scene)
enabled = true;
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);
}
@@ -1086,7 +1086,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 7bbb4467f6f..93c8b1c8fea 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -56,6 +56,7 @@
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_deform.h"
+#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_object_deform.h"
@@ -1031,6 +1032,7 @@ static void vertex_paint_init_session_data(const ToolSettings *ts, Object *ob)
* \{ */
static void ed_vwpaintmode_enter_generic(
+ Main *bmain,
wmWindowManager *wm,
Scene *scene,
Object *ob, const eObjectMode mode_flag)
@@ -1048,7 +1050,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;
@@ -1059,7 +1061,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');
@@ -1082,33 +1084,35 @@ static void ed_vwpaintmode_enter_generic(
}
void ED_object_vpaintmode_enter_ex(
- wmWindowManager *wm,
+ Main *bmain, wmWindowManager *wm,
Scene *scene, Object *ob)
{
ed_vwpaintmode_enter_generic(
- wm, scene, ob, OB_MODE_VERTEX_PAINT);
+ bmain, wm, scene, ob, OB_MODE_VERTEX_PAINT);
}
void ED_object_vpaintmode_enter(struct bContext *C)
{
+ Main *bmain = CTX_data_main(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(wm, scene, ob);
+ ED_object_vpaintmode_enter_ex(bmain, wm, scene, ob);
}
void ED_object_wpaintmode_enter_ex(
- wmWindowManager *wm,
+ Main *bmain, wmWindowManager *wm,
Scene *scene, Object *ob)
{
ed_vwpaintmode_enter_generic(
- wm, scene, ob, OB_MODE_WEIGHT_PAINT);
+ bmain, wm, scene, ob, OB_MODE_WEIGHT_PAINT);
}
void ED_object_wpaintmode_enter(struct bContext *C)
{
+ Main *bmain = CTX_data_main(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(wm, scene, ob);
+ ED_object_wpaintmode_enter_ex(bmain, wm, scene, ob);
}
/** \} */
@@ -1188,6 +1192,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);
Object *ob = CTX_data_active_object(C);
const int mode_flag = OB_MODE_WEIGHT_PAINT;
const bool is_mode_set = (ob->mode & mode_flag) != 0;
@@ -1206,7 +1211,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
}
else {
wmWindowManager *wm = CTX_wm_manager(C);
- ED_object_wpaintmode_enter_ex(wm, scene, ob);
+ ED_object_wpaintmode_enter_ex(bmain, wm, scene, ob);
}
/* Weightpaint works by overriding colors in mesh,
@@ -2315,6 +2320,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot)
*/
static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Object *ob = CTX_data_active_object(C);
const int mode_flag = OB_MODE_VERTEX_PAINT;
const bool is_mode_set = (ob->mode & mode_flag) != 0;
@@ -2334,7 +2340,7 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op)
}
else {
wmWindowManager *wm = CTX_wm_manager(C);
- ED_object_vpaintmode_enter_ex(wm, scene, ob);
+ ED_object_vpaintmode_enter_ex(bmain, wm, scene, ob);
}
/* update modifier stack for mapping requirements */
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index d5bdd4c8b98..bef705a29b1 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5672,7 +5672,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 e93a68b9350..78274332660 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -43,13 +43,14 @@
#include "DNA_meshdata_types.h"
#include "BKE_brush.h"
-#include "BKE_paint.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
-#include "BKE_depsgraph.h"
-#include "BKE_mesh_mapping.h"
#include "BKE_customdata.h"
+#include "BKE_depsgraph.h"
#include "BKE_editmesh.h"
+#include "BKE_main.h"
+#include "BKE_mesh_mapping.h"
+#include "BKE_paint.h"
#include "ED_screen.h"
#include "ED_image.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 8175f494cf0..b22ab9d5878 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -117,7 +117,7 @@ void ED_editors_init(bContext *C)
/* image editor paint mode */
if (sce) {
- ED_space_image_paint_update(wm, sce);
+ ED_space_image_paint_update(bmain, wm, sce);
}
SWAP(int, reports->flag, reports_flag_prev);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 2ce84d82b1c..cb5844f1b03 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -602,7 +602,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);
}
static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 6d77f3a9158..a3ba43db2d4 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -770,7 +770,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/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 7b027729850..d3a6373f29c 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -389,9 +389,9 @@ struct ListBase *get_constraint_lb(struct Object *ob, struct bConstraint *con, s
bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit) RET_ZERO
bool ED_space_image_show_render(struct SpaceImage *sima) RET_ZERO
bool ED_space_image_show_paint(struct SpaceImage *sima) RET_ZERO
-void ED_space_image_paint_update(struct wmWindowManager *wm, struct Scene *scene) RET_NONE
+void ED_space_image_paint_update(struct Main *bmain, struct wmWindowManager *wm, struct Scene *scene) RET_NONE
void ED_space_image_set(struct Main *bmain, struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima) RET_NONE
-void ED_space_image_uv_sculpt_update(struct wmWindowManager *wm, struct Scene *scene) RET_NONE
+void ED_space_image_uv_sculpt_update(struct Main *bmain, struct wmWindowManager *wm, struct Scene *scene) RET_NONE
void ED_space_image_scopes_update(const struct bContext *C, struct SpaceImage *sima, struct ImBuf *ibuf, bool use_view_settings) RET_NONE
void ED_uvedit_get_aspect(struct Scene *scene, struct Object *ob, struct BMesh *em, float *aspx, float *aspy) RET_NONE