Merge branch 'master' into blender2.8

Conflicts:
	source/blender/blenkernel/BKE_sequencer.h
	source/blender/blenkernel/intern/sequencer.c
	source/blender/editors/curve/editcurve_paint.c
	source/blender/editors/gpencil/gpencil_edit.c
	source/blender/editors/gpencil/gpencil_paint.c
	source/blender/editors/gpencil/gpencil_utils.c
	source/blender/editors/include/ED_object.h
	source/blender/editors/include/ED_view3d.h
	source/blender/editors/interface/interface_eyedropper_depth.c
	source/blender/editors/render/render_opengl.c
	source/blender/editors/sculpt_paint/paint_image_proj.c
	source/blender/editors/sculpt_paint/sculpt.c
	source/blender/editors/space_view3d/drawobject.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/editors/space_view3d/view3d_edit.c
	source/blender/editors/space_view3d/view3d_intern.h
	source/blender/editors/space_view3d/view3d_select.c
	source/blender/editors/space_view3d/view3d_utils.c
	source/blender/editors/transform/transform_conversions.c
	source/blender/editors/transform/transform_snap.c
	source/blender/python/intern/gpu_offscreen.c
	source/blender/windowmanager/intern/wm_files.c
This commit is contained in:
Bastien Montagne 2018-06-08 14:38:57 +02:00
commit 94aa4d1657
29 changed files with 102 additions and 63 deletions

@ -817,18 +817,20 @@ set(PLATFORM_LINKLIBS "")
set(PLATFORM_LINKFLAGS "")
set(PLATFORM_LINKFLAGS_DEBUG "")
if(WITH_COMPILER_ASAN)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}")
if (NOT CMAKE_BUILD_TYPE MATCHES "Release")
if(WITH_COMPILER_ASAN)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
if(MSVC)
set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
if(MSVC)
set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
endif()
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
endif()
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
endif()
#-----------------------------------------------------------------------------

@ -5026,7 +5026,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
const float mval[2] = {UNPACK2(event->mval)};
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
vc.scene, CTX_data_depsgraph(C), 0, vc.ar, vc.v3d);
vc.bmain, vc.scene, vc.depsgraph, 0, vc.ar, vc.v3d);
ED_transform_snap_object_project_view3d(
snap_context,

@ -34,6 +34,7 @@
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_fcurve.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
@ -616,6 +617,7 @@ static bool curve_draw_init(bContext *C, wmOperator *op, bool is_invoke)
}
}
else {
cdd->vc.bmain = CTX_data_main(C);
cdd->vc.depsgraph = CTX_data_depsgraph(C);
cdd->vc.scene = CTX_data_scene(C);
cdd->vc.view_layer = CTX_data_view_layer(C);

@ -57,6 +57,7 @@
#include "BKE_context.h"
#include "BKE_gpencil.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_screen.h"

@ -46,14 +46,15 @@
#include "PIL_time.h"
#include "BKE_paint.h"
#include "BKE_gpencil.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_main.h"
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_screen.h"
#include "BKE_tracking.h"
#include "BKE_colortools.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@ -115,6 +116,7 @@ typedef enum eGPencil_PaintFlags {
* "p" = op->customdata
*/
typedef struct tGPsdata {
Main *bmain;
Scene *scene; /* current scene from context */
struct Depsgraph *depsgraph;
@ -1399,6 +1401,7 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
}
/* pass on current scene and window */
p->bmain = CTX_data_main(C);
p->scene = CTX_data_scene(C);
p->depsgraph = CTX_data_depsgraph(C);
p->win = CTX_wm_window(C);

@ -47,10 +47,11 @@
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
#include "BKE_action.h"
#include "BKE_context.h"
#include "BKE_gpencil.h"
#include "BKE_main.h"
#include "BKE_tracking.h"
#include "BKE_action.h"
#include "WM_api.h"

@ -151,7 +151,7 @@ void ED_object_wpaintmode_exit_ex(struct Object *ob);
void ED_object_wpaintmode_exit(struct bContext *C);
void ED_object_sculptmode_enter_ex(
struct Depsgraph *depsgraph,
struct Main *bmain, struct Depsgraph *depsgraph,
struct Scene *scene, struct Object *ob,
struct ReportList *reports);
void ED_object_sculptmode_enter(struct bContext *C, struct ReportList *reports);

@ -79,9 +79,9 @@ struct SnapObjectParams {
typedef struct SnapObjectContext SnapObjectContext;
SnapObjectContext *ED_transform_snap_object_context_create(
struct Scene *scene, struct Depsgraph *depsgraph, int flag);
struct Main *bmain, struct Scene *scene, struct Depsgraph *depsgraph, int flag);
SnapObjectContext *ED_transform_snap_object_context_create_view3d(
struct Scene *scene, struct Depsgraph *depsgraph, int flag,
struct Main *bmain, struct Scene *scene, struct Depsgraph *depsgraph, int flag,
/* extra args for view3d */
const struct ARegion *ar, const struct View3D *v3d);
void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx);

@ -75,6 +75,7 @@ enum eGPUFXFlags;
/* for derivedmesh drawing callbacks, for view3d_select, .... */
typedef struct ViewContext {
struct Main *bmain;
struct Depsgraph *depsgraph;
struct Scene *scene;
struct ViewLayer *view_layer;
@ -331,7 +332,8 @@ bool ED_view3d_autodist(
const bool alphaoverride, const float fallback_depth_pt[3]);
/* only draw so ED_view3d_autodist_simple can be called many times after */
void ED_view3d_autodist_init(struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, int mode);
void ED_view3d_autodist_init(
struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, int mode);
bool ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth);
bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
bool ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);

@ -860,7 +860,7 @@ void UI_popup_handlers_remove_all(struct bContext *C, struct ListBase *handlers)
* be used to reinitialize some internal state if user preferences change. */
void UI_init(void);
void UI_init_userdef(void);
void UI_init_userdef(struct Main *bmain);
void UI_reinit_font(void);
void UI_exit(void);

@ -53,10 +53,11 @@
#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_unit.h"
#include "BKE_idprop.h"
#include "BKE_main.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_idprop.h"
#include "BKE_unit.h"
#include "GPU_glew.h"
#include "GPU_matrix.h"
@ -4694,10 +4695,10 @@ void UI_init(void)
}
/* after reading userdef file */
void UI_init_userdef(void)
void UI_init_userdef(Main *bmain)
{
/* fix saved themes */
init_userdef_do_versions();
init_userdef_do_versions(bmain);
uiStyleInit();
}

@ -41,6 +41,7 @@
#include "BLI_math_vector.h"
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_screen.h"
#include "BKE_unit.h"

@ -784,7 +784,7 @@ void ui_icon_ensure_deferred(const struct bContext *C, const int icon_id, const
int ui_id_icon_get(const struct bContext *C, struct ID *id, const bool big);
/* resources.c */
void init_userdef_do_versions(void);
void init_userdef_do_versions(struct Main *bmain);
void ui_theme_init_default(void);
void ui_style_init_default(void);
void ui_resources_init(void);

@ -1818,10 +1818,8 @@ void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3]
/* ************************************************************* */
/* patching UserDef struct and Themes */
void init_userdef_do_versions(void)
void init_userdef_do_versions(Main *bmain)
{
Main *bmain = G.main;
#define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(bmain, ver, subver)
/* the UserDef struct is not corrected with do_versions() .... ugh! */

@ -359,6 +359,7 @@ void MESH_OT_unsubdivide(wmOperatorType *ot)
void EMBM_project_snap_verts(bContext *C, ARegion *ar, BMEditMesh *em)
{
Main *bmain = CTX_data_main(C);
Object *obedit = em->ob;
BMIter iter;
BMVert *eve;
@ -366,7 +367,7 @@ void EMBM_project_snap_verts(bContext *C, ARegion *ar, BMEditMesh *em)
ED_view3d_init_mats_rv3d(obedit, ar->regiondata);
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
CTX_data_scene(C), CTX_data_depsgraph(C), 0,
bmain, CTX_data_scene(C), CTX_data_depsgraph(C), 0,
ar, CTX_wm_view3d(C));
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {

@ -5643,7 +5643,7 @@ static int ed_object_sculptmode_flush_recalc_flag(Scene *scene, Object *ob, Mult
}
void ED_object_sculptmode_enter_ex(
Depsgraph *depsgraph,
Main *bmain, Depsgraph *depsgraph,
Scene *scene, Object *ob,
ReportList *reports)
{
@ -5695,7 +5695,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);
paint_cursor_start_explicit(paint, G.main->wm.first, sculpt_poll_view3d);
paint_cursor_start_explicit(paint, bmain->wm.first, sculpt_poll_view3d);
/* Check dynamic-topology flag; re-enter dynamic-topology mode when changing modes,
* As long as no data was added that is not supported. */
@ -5751,10 +5751,11 @@ void ED_object_sculptmode_enter_ex(
void ED_object_sculptmode_enter(struct bContext *C, ReportList *reports)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ED_object_sculptmode_enter_ex(depsgraph, scene, ob, reports);
ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, reports);
}
void ED_object_sculptmode_exit_ex(
@ -5815,6 +5816,7 @@ void ED_object_sculptmode_exit(bContext *C)
static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
{
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
Main *bmain = CTX_data_main(C);
Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
@ -5831,7 +5833,7 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
ED_object_sculptmode_exit_ex(depsgraph, scene, ob);
}
else {
ED_object_sculptmode_enter_ex(depsgraph, scene, ob, op->reports);
ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, op->reports);
}
WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);

@ -131,6 +131,7 @@ static void view3d_operator_properties_common(wmOperatorType *ot, const enum eV3
typedef struct ViewOpsData {
/** Context pointers (assigned by #viewops_data_alloc). */
Main *bmain;
Scene *scene;
ScrArea *sa;
ARegion *ar;
@ -221,6 +222,7 @@ static void viewops_data_alloc(bContext *C, wmOperator *op)
/* store data */
op->customdata = vod;
vod->bmain = CTX_data_main(C);
vod->depsgraph = CTX_data_depsgraph(C);
vod->scene = CTX_data_scene(C);
vod->sa = CTX_wm_area(C);
@ -4592,6 +4594,7 @@ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2])
void ED_view3d_cursor3d_update(bContext *C, const int mval[2])
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
ARegion *ar = CTX_wm_region(C);
@ -4609,7 +4612,7 @@ void ED_view3d_cursor3d_update(bContext *C, const int mval[2])
float ray_no[3];
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
scene, CTX_data_depsgraph(C), 0, ar, v3d);
bmain, scene, CTX_data_depsgraph(C), 0, ar, v3d);
float obmat[4][4];
Object *ob_dummy = NULL;

@ -134,7 +134,8 @@ void VIEW3D_OT_ruler(struct wmOperatorType *ot);
/* drawobject.c */
void draw_object_backbufsel(
struct Depsgraph *depsgraph, Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob,
struct Depsgraph *depsgraph, Scene *scene,
View3D *v3d, RegionView3D *rv3d, struct Object *ob,
short select_mode);
int view3d_effective_drawtype(const struct View3D *v3d);

@ -31,8 +31,10 @@
#include "BLT_translation.h"
#include "BKE_context.h"
#include "BKE_object.h"
#include "BKE_gpencil.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_unit.h"
#include "DNA_object_types.h"
@ -263,6 +265,7 @@ static bool view3d_ruler_pick(
*/
static void ruler_state_set(bContext *C, RulerInfo *ruler_info, int state)
{
Main *bmain = CTX_data_main(C);
if (state == ruler_info->state) {
return;
}
@ -278,7 +281,7 @@ static void ruler_state_set(bContext *C, RulerInfo *ruler_info, int state)
}
else if (state == RULER_STATE_DRAG) {
ruler_info->snap_context = ED_transform_snap_object_context_create_view3d(
CTX_data_scene(C), CTX_data_depsgraph(C), 0,
bmain, CTX_data_scene(C), CTX_data_depsgraph(C), 0,
ruler_info->ar, CTX_wm_view3d(C));
}
else {

@ -38,8 +38,9 @@
#include "BLT_translation.h"
#include "BKE_context.h"
#include "BKE_unit.h"
#include "BKE_gpencil.h"
#include "BKE_main.h"
#include "BKE_unit.h"
#include "BIF_gl.h"
@ -267,6 +268,7 @@ static bool view3d_ruler_pick(RulerInfo *ruler_info, const float mval[2],
*/
static void ruler_state_set(bContext *C, RulerInfo *ruler_info, int state)
{
Main *bmain = CTX_data_main(C);
if (state == ruler_info->state) {
return;
}
@ -282,7 +284,7 @@ static void ruler_state_set(bContext *C, RulerInfo *ruler_info, int state)
}
else if (state == RULER_STATE_DRAG) {
ruler_info->snap_context = ED_transform_snap_object_context_create_view3d(
CTX_data_scene(C), CTX_data_depsgraph(C), 0,
bmain, CTX_data_scene(C), CTX_data_depsgraph(C), 0,
ruler_info->ar, CTX_wm_view3d(C));
}
else {

@ -116,6 +116,7 @@ void ED_view3d_viewcontext_init(bContext *C, ViewContext *vc)
{
memset(vc, 0, sizeof(ViewContext));
vc->ar = CTX_wm_region(C);
vc->bmain = CTX_data_main(C);
vc->depsgraph = CTX_data_depsgraph(C);
vc->scene = CTX_data_scene(C);
vc->view_layer = CTX_data_view_layer(C);

@ -46,6 +46,7 @@
#include "BKE_camera.h"
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_screen.h"
@ -899,7 +900,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
* \param fallback_depth_pt: Use this points depth when no depth can be found.
*/
bool ED_view3d_autodist(
struct Depsgraph *depsgraph, ARegion *ar, View3D *v3d,
Depsgraph *depsgraph, ARegion *ar, View3D *v3d,
const int mval[2], float mouse_worldloc[3],
const bool alphaoverride, const float fallback_depth_pt[3])
{
@ -936,7 +937,7 @@ bool ED_view3d_autodist(
}
}
void ED_view3d_autodist_init(struct Depsgraph *depsgraph,
void ED_view3d_autodist_init(Depsgraph *depsgraph,
ARegion *ar, View3D *v3d, int mode)
{
/* Get Z Depths, needed for perspective, nice for ortho */

@ -37,6 +37,7 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BLT_translation.h"
@ -507,6 +508,7 @@ static float userdef_speed = -1.f;
static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
wmWindow *win = CTX_wm_window(C);
walk->rv3d = CTX_wm_region_view3d(C);
@ -602,7 +604,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
walk->rv3d->rflag |= RV3D_NAVIGATING;
walk->snap_context = ED_transform_snap_object_context_create_view3d(
walk->scene, CTX_data_depsgraph(C), 0,
bmain, walk->scene, CTX_data_depsgraph(C), 0,
walk->ar, walk->v3d);
walk->v3d_camera_control = ED_view3d_cameracontrol_acquire(

@ -851,6 +851,8 @@ static bool pchan_autoik_adjust(bPoseChannel *pchan, short chainlen)
/* change the chain-length of auto-ik */
void transform_autoik_update(TransInfo *t, short mode)
{
Main *bmain = CTX_data_main(t->context);
short *chainlen = &t->settings->autoik_chainlen;
bPoseChannel *pchan;
@ -887,12 +889,12 @@ void transform_autoik_update(TransInfo *t, short mode)
if (changed) {
/* TODO(sergey): Consider doing partial update only. */
DEG_relations_tag_update(G.main);
DEG_relations_tag_update(bmain);
}
}
/* frees temporal IKs */
static void pose_grab_with_ik_clear(Object *ob)
static void pose_grab_with_ik_clear(Main *bmain, Object *ob)
{
bKinematicConstraint *data;
bPoseChannel *pchan;
@ -930,7 +932,7 @@ static void pose_grab_with_ik_clear(Object *ob)
if (relations_changed) {
/* TODO(sergey): Consider doing partial update only. */
DEG_relations_tag_update(G.main);
DEG_relations_tag_update(bmain);
}
}
@ -1038,7 +1040,7 @@ static short pose_grab_with_ik_children(bPose *pose, Bone *bone)
}
/* main call which adds temporal IK chains */
static short pose_grab_with_ik(Object *ob)
static short pose_grab_with_ik(Main *bmain, Object *ob)
{
bArmature *arm;
bPoseChannel *pchan, *parent;
@ -1084,8 +1086,8 @@ static short pose_grab_with_ik(Object *ob)
/* iTaSC needs clear for new IK constraints */
if (tot_ik) {
BIK_clear_data(ob->pose);
/* TODO(sergey): Consuder doing partial update only. */
DEG_relations_tag_update(G.main);
/* TODO(sergey): Consider doing partial update only. */
DEG_relations_tag_update(bmain);
}
return (tot_ik) ? 1 : 0;
@ -1108,6 +1110,7 @@ static void createTransPose(TransInfo *t, Object **objects, uint objects_len)
tc->poseobj = objects[th_index];
}
}
Main *bmain = CTX_data_main(t->context);
t->data_len_all = 0;
@ -1135,7 +1138,7 @@ static void createTransPose(TransInfo *t, Object **objects, uint objects_len)
/* do we need to add temporal IK chains? */
if ((arm->flag & ARM_AUTO_IK) && t->mode == TFM_TRANSLATION) {
ik_on = pose_grab_with_ik(ob);
ik_on = pose_grab_with_ik(bmain, ob);
if (ik_on) t->flag |= T_AUTOIK;
}
@ -5776,8 +5779,7 @@ static void trans_object_base_deps_flag_finish(ViewLayer *view_layer)
/* it deselects Bases, so we have to call the clear function always after */
static void set_trans_object_base_flags(TransInfo *t)
{
/* TODO(sergey): Get rid of global, use explicit main. */
Main *bmain = G.main;
Main *bmain = CTX_data_main(t->context);
ViewLayer *view_layer = t->view_layer;
Scene *scene = t->scene;
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
@ -6329,6 +6331,9 @@ static void special_aftertrans_update__mesh(bContext *UNUSED(C), TransInfo *t)
* */
void special_aftertrans_update(bContext *C, TransInfo *t)
{
Main *bmain = CTX_data_main(t->context);
BLI_assert(bmain == CTX_data_main(C));
Object *ob;
// short redrawipo=0, resetslowpar=1;
const bool canceled = (t->state == TRANS_CANCEL);
@ -6517,7 +6522,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
// XXX: BAD! this get gpencil datablocks directly from main db...
// but that's how this currently works :/
for (gpd = G.main->gpencil.first; gpd; gpd = gpd->id.next) {
for (gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
if (ID_REAL_USERS(gpd))
posttrans_gpd_clean(gpd);
}
@ -6537,7 +6542,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
// XXX: BAD! this get gpencil datablocks directly from main db...
// but that's how this currently works :/
for (mask = G.main->mask.first; mask; mask = mask->id.next) {
for (mask = bmain->mask.first; mask; mask = mask->id.next) {
if (ID_REAL_USERS(mask))
posttrans_mask_clean(mask);
}
@ -6702,7 +6707,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
if (t->mode == TFM_TRANSLATION)
pose_grab_with_ik_clear(ob);
pose_grab_with_ik_clear(bmain, ob);
/* automatic inserting of keys and unkeyed tagging - only if transform wasn't canceled (or TFM_DUMMY) */
if (!canceled && (t->mode != TFM_DUMMY)) {

@ -270,6 +270,8 @@ eRedrawFlag handleSnapping(TransInfo *t, const wmEvent *event)
void applyProject(TransInfo *t)
{
Main *bmain = CTX_data_main(t->context);
/* XXX FLICKER IN OBJECT MODE */
if ((t->tsnap.project) && activeSnap(t) && (t->flag & T_NO_PROJECT) == 0) {
float tvec[3];
@ -500,6 +502,7 @@ static bool bm_face_is_snap_target(BMFace *f, void *UNUSED(user_data))
static void initSnappingMode(TransInfo *t)
{
Main *bmain = CTX_data_main(t->context);
ToolSettings *ts = t->settings;
/* All obedit types will match. */
const int obedit_type = t->data_container->obedit ? t->data_container->obedit->type : -1;
@ -587,7 +590,7 @@ static void initSnappingMode(TransInfo *t)
if (t->spacetype == SPACE_VIEW3D) {
if (t->tsnap.object_context == NULL) {
t->tsnap.object_context = ED_transform_snap_object_context_create_view3d(
t->scene, t->depsgraph, 0, t->ar, t->view);
bmain, t->scene, t->depsgraph, 0, t->ar, t->view);
ED_transform_snap_object_context_set_editmesh_callbacks(
t->tsnap.object_context,

@ -114,6 +114,7 @@ typedef struct SnapObjectData_EditMesh {
} SnapObjectData_EditMesh;
struct SnapObjectContext {
Main *bmain;
Scene *scene;
Depsgraph *depsgraph;
@ -2270,12 +2271,13 @@ static short snapObjectsRay(
* \{ */
SnapObjectContext *ED_transform_snap_object_context_create(
Scene *scene, Depsgraph *depsgraph, int flag)
Main *bmain, Scene *scene, Depsgraph *depsgraph, int flag)
{
SnapObjectContext *sctx = MEM_callocN(sizeof(*sctx), __func__);
sctx->flag = flag;
sctx->bmain = bmain;
sctx->scene = scene;
sctx->depsgraph = depsgraph;
@ -2286,11 +2288,11 @@ SnapObjectContext *ED_transform_snap_object_context_create(
}
SnapObjectContext *ED_transform_snap_object_context_create_view3d(
Scene *scene, Depsgraph *depsgraph, int flag,
Main *bmain, Scene *scene, Depsgraph *depsgraph, int flag,
/* extra args for view3d */
const ARegion *ar, const View3D *v3d)
{
SnapObjectContext *sctx = ED_transform_snap_object_context_create(scene, depsgraph, flag);
SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, depsgraph, flag);
sctx->use_v3d = true;
sctx->v3d_data.ar = ar;

@ -164,7 +164,7 @@ static void rna_SceneRender_get_frame_path(
}
static void rna_Scene_ray_cast(
Scene *scene, ViewLayer *view_layer,
Scene *scene, Main *bmain, ViewLayer *view_layer,
float origin[3], float direction[3], float ray_dist,
int *r_success, float r_location[3], float r_normal[3], int *r_index,
Object **r_ob, float r_obmat[16])
@ -172,8 +172,7 @@ static void rna_Scene_ray_cast(
normalize_v3(direction);
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
SnapObjectContext *sctx = ED_transform_snap_object_context_create(
scene, depsgraph, 0);
SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, depsgraph, 0);
bool ret = ED_transform_snap_object_project_ray_ex(
sctx,
@ -309,6 +308,7 @@ void RNA_api_scene(StructRNA *srna)
/* Ray Cast */
func = RNA_def_function(srna, "ray_cast", "rna_Scene_ray_cast");
RNA_def_function_flag(func, FUNC_USE_MAIN);
RNA_def_function_ui_description(func, "Cast a ray onto in object space");
parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Scene Layer");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);

@ -35,6 +35,8 @@
#include "WM_types.h"
#include "BKE_global.h"
#include "ED_screen.h"
#include "GPU_framebuffer.h"

@ -340,7 +340,7 @@ static void wm_window_match_do(
static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory)
{
/* versioning is here */
UI_init_userdef();
UI_init_userdef(bmain);
MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
BKE_sound_init(bmain);
@ -1157,7 +1157,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
/* blend file thumbnail */
/* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */
/* Main now can store a .blend thumbnail, usefull for background mode or thumbnail customization. */
main_thumb = thumb = CTX_data_main(C)->blen_thumb;
main_thumb = thumb = bmain->blen_thumb;
if ((U.flag & USER_SAVE_PREVIEWS) && BLI_thread_is_main()) {
ibuf_thumb = blend_file_thumb(C, CTX_data_scene(C), CTX_wm_screen(C), &thumb);
}