Fix T57390: properties editor crash creating new scene in some cases.
This commit is contained in:
@@ -412,7 +412,8 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
|
||||
scene = path->ptr[path->len - 1].data;
|
||||
|
||||
if (scene) {
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
ViewLayer *view_layer = WM_window_get_active_view_layer(window);
|
||||
br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer));
|
||||
}
|
||||
|
||||
@@ -467,7 +468,8 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path
|
||||
#ifdef WITH_FREESTYLE
|
||||
static bool buttons_context_linestyle_pinnable(const bContext *C, ViewLayer *view_layer)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
Scene *scene = WM_window_get_active_scene(window);
|
||||
FreestyleConfig *config;
|
||||
SpaceButs *sbuts;
|
||||
|
||||
@@ -491,13 +493,15 @@ static bool buttons_context_linestyle_pinnable(const bContext *C, ViewLayer *vie
|
||||
|
||||
static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int flag)
|
||||
{
|
||||
/* Note we don't use CTX_data here, instead we get it from the window.
|
||||
* Otherwise there is a loop reading the context that we are setting. */
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
Scene *scene = WM_window_get_active_scene(window);
|
||||
ViewLayer *view_layer = WM_window_get_active_view_layer(window);
|
||||
Object *ob = OBACT(view_layer);
|
||||
ID *id;
|
||||
int found;
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
memset(path, 0, sizeof(*path));
|
||||
path->flag = flag;
|
||||
@@ -593,7 +597,9 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
|
||||
|
||||
static int buttons_shading_context(const bContext *C, int mainb)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
ViewLayer *view_layer = WM_window_get_active_view_layer(window);
|
||||
Object *ob = OBACT(view_layer);
|
||||
|
||||
if (ELEM(mainb, BCONTEXT_MATERIAL, BCONTEXT_WORLD, BCONTEXT_TEXTURE))
|
||||
return 1;
|
||||
@@ -605,7 +611,9 @@ static int buttons_shading_context(const bContext *C, int mainb)
|
||||
|
||||
static int buttons_shading_new_context(const bContext *C, int flag)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
ViewLayer *view_layer = WM_window_get_active_view_layer(window);
|
||||
Object *ob = OBACT(view_layer);
|
||||
|
||||
if (flag & (1 << BCONTEXT_MATERIAL))
|
||||
return BCONTEXT_MATERIAL;
|
||||
|
||||
Reference in New Issue
Block a user