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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-11-07 16:51:06 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-11-07 16:54:16 +0300
commit36b9ee1277519f1ae471afbc0a99e26eee1acbe4 (patch)
treee08d7cd8df01124483a4ef1ceef25389196c9114 /source/blender/editors/space_buttons
parent9d0eac6ba5efe1b3712152c337fb171a771a8921 (diff)
Fix T57390: properties editor crash creating new scene in some cases.
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index e63dd799582..226a663971e 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -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;