[Bf-blender-cvs] [ab0e839f9a9] master: Fix T65074: Crash on switching color
Campbell Barton
noreply at git.blender.org
Mon May 27 06:01:27 CEST 2019
Commit: ab0e839f9a96841615f747a4481323b280baf7c4
Author: Campbell Barton
Date: Mon May 27 13:58:02 2019 +1000
Branches: master
https://developer.blender.org/rBab0e839f9a96841615f747a4481323b280baf7c4
Fix T65074: Crash on switching color
Make buttons to take active `Paint` from the context.
D4946 by @Gvgeo
===================================================================
M source/blender/editors/interface/interface_handlers.c
===================================================================
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);
More information about the Bf-blender-cvs
mailing list