Cleanup: remove some G.main usages...
This commit is contained in:
parent
13d238729b
commit
8055ed2741
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue