[Bf-blender-cvs] [8055ed2741d] master: Cleanup: remove some G.main usages...
Bastien Montagne
noreply at git.blender.org
Mon Jun 11 12:15:46 CEST 2018
Commit: 8055ed2741d1da48f2bf84c75ccb37b54cef1ab8
Author: Bastien Montagne
Date: Mon Jun 11 11:05:37 2018 +0200
Branches: master
https://developer.blender.org/rB8055ed2741d1da48f2bf84c75ccb37b54cef1ab8
Cleanup: remove some G.main usages...
===================================================================
M source/blender/blenkernel/BKE_paint.h
M source/blender/blenkernel/intern/paint.c
M source/blender/editors/include/ED_image.h
M source/blender/editors/include/ED_object.h
M source/blender/editors/object/object_edit.c
M source/blender/editors/sculpt_paint/paint_image.c
M source/blender/editors/sculpt_paint/paint_vertex.c
M source/blender/editors/sculpt_paint/sculpt.c
M source/blender/editors/sculpt_paint/sculpt_uv.c
M source/blender/editors/util/ed_util.c
M source/blender/makesrna/intern/rna_scene.c
M source/blender/makesrna/intern/rna_space.c
M source/blenderplayer/bad_level_call_stubs/stubs.c
===================================================================
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
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list