diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-27 06:58:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-27 07:00:15 +0300 |
commit | ab0e839f9a96841615f747a4481323b280baf7c4 (patch) | |
tree | 4d4ce0b05b04beb9daca2dfc0953d46102bfc601 /source | |
parent | d525c76003b3e7dcda92df09e9009c2f67f5532e (diff) |
Fix T65074: Crash on switching color
Make buttons to take active `Paint` from the context.
D4946 by @Gvgeo
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index b9c77b13401..b8e97f58c2f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5563,9 +5563,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co if ((int)(but->a1) == UI_PALETTE_COLOR) { if (!event->ctrl) { float color[3]; - Scene *scene = CTX_data_scene(C); - ViewLayer *view_layer = CTX_data_view_layer(C); - Paint *paint = BKE_paint_get_active(scene, view_layer); + Paint *paint = BKE_paint_get_active_from_context(C); Brush *brush = BKE_paint_brush(paint); if (brush->flag & BRUSH_USE_GRADIENT) { @@ -5580,6 +5578,8 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co } } else { + Scene *scene = CTX_data_scene(C); + if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) { RNA_property_float_get_array(&but->rnapoin, but->rnaprop, color); BKE_brush_color_set(scene, brush, color); |