diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-03-30 12:18:57 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-03-30 12:25:53 +0300 |
commit | 35b731c9c8bdd996e9f418763f107a2e8e98516d (patch) | |
tree | af1dfeda74693aae40f962958ef61d8c195ad691 /source/blender/editors/space_buttons | |
parent | f4d597efffcb129614988f081d7f239ec1733642 (diff) |
Prevent crash on weight paint
Weight painting is still wrong, but it doesn't crash any more.
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 3727c29d9d0..f6e0d7100e9 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -370,7 +370,7 @@ static int buttons_context_path_particle(ButsContextPath *path) return 0; } -static int buttons_context_path_brush(ButsContextPath *path) +static int buttons_context_path_brush(const bContext *C, ButsContextPath *path) { Scene *scene; Brush *br = NULL; @@ -384,8 +384,10 @@ static int buttons_context_path_brush(ButsContextPath *path) else if (buttons_context_path_scene(path)) { scene = path->ptr[path->len - 1].data; - if (scene) - br = BKE_paint_brush(BKE_paint_get_active(scene)); + if (scene) { + SceneLayer *sl = CTX_data_scene_layer(C); + br = BKE_paint_brush(BKE_paint_get_active(scene, sl)); + } if (br) { RNA_id_pointer_create((ID *)br, &path->ptr[path->len]); @@ -399,7 +401,7 @@ static int buttons_context_path_brush(ButsContextPath *path) return 0; } -static int buttons_context_path_texture(ButsContextPath *path, ButsContextTexture *ct) +static int buttons_context_path_texture(const bContext *C, ButsContextPath *path, ButsContextTexture *ct) { if (ct) { /* new shading system */ @@ -417,7 +419,7 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur if (id) { if (GS(id->name) == ID_BR) - buttons_context_path_brush(path); + buttons_context_path_brush(C, path); else if (GS(id->name) == ID_MA) buttons_context_path_material(path, false, true); else if (GS(id->name) == ID_WO) @@ -650,7 +652,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma found = buttons_context_path_material(path, false, (sbuts->texuser != NULL)); break; case BCONTEXT_TEXTURE: - found = buttons_context_path_texture(path, sbuts->texuser); + found = buttons_context_path_texture(C, path, sbuts->texuser); break; case BCONTEXT_BONE: found = buttons_context_path_bone(path); |