diff options
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 6a9632f54bb..088a904ec78 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3994,7 +3994,12 @@ static void ui_block_open_begin(bContext *C, uiBut *but, uiHandleButtonData *dat copy_v3_v3(data->vec, data->origvec); but->editvec = data->vec; - handlefunc = ui_block_func_COLOR; + if (ui_but_menu_draw_as_popover(but)) { + popoverfunc = but->menu_create_func; + } + else { + handlefunc = ui_block_func_COLOR; + } arg = but; break; @@ -4063,8 +4068,8 @@ int ui_but_menu_direction(uiBut *but) } /** - * Hack for #uiList #UI_BTYPE_LISTROW buttons to "give" events to overlaying #UI_BTYPE_TEXT buttons - * (Ctrl-Click rename feature & co). + * Hack for #uiList #UI_BTYPE_LISTROW buttons to "give" events to overlaying #UI_BTYPE_TEXT + * buttons (Ctrl-Click rename feature & co). */ static uiBut *ui_but_list_row_text_activate(bContext *C, uiBut *but, @@ -5553,14 +5558,13 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co button_activate_state(C, but, BUTTON_STATE_EXIT); ui_apply_but(C, but->block, but, data, true); - /* Button's state need to be changed to EXIT so moving mouse away from this mouse wouldn't - * lead to cancel changes made to this button, but changing state to EXIT also makes no - * button active for a while which leads to triggering operator - * when doing fast scrolling mouse wheel. - * using post activate stuff from button allows to make button be active again after - * checking for all all that mouse leave and cancel stuff, - * so quick scroll wouldn't be an issue anymore. - * Same goes for scrolling wheel in another direction below (sergey). + /* Button's state need to be changed to EXIT so moving mouse away from this mouse + * wouldn't lead to cancel changes made to this button, but changing state to EXIT also + * makes no button active for a while which leads to triggering operator when doing fast + * scrolling mouse wheel. using post activate stuff from button allows to make button be + * active again after checking for all all that mouse leave and cancel stuff, so quick + * scroll wouldn't be an issue anymore. Same goes for scrolling wheel in another + * direction below (sergey). */ data->postbut = but; data->posttype = BUTTON_ACTIVATE_OVER; @@ -5797,15 +5801,27 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co } else { Scene *scene = CTX_data_scene(C); + bool updated = false; 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); + updated = true; } else if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR) { RNA_property_float_get_array(&but->rnapoin, but->rnaprop, color); IMB_colormanagement_scene_linear_to_srgb_v3(color); BKE_brush_color_set(scene, brush, color); + updated = true; + } + + if (updated) { + PointerRNA brush_ptr; + PropertyRNA *brush_color_prop; + + RNA_id_pointer_create(&brush->id, &brush_ptr); + brush_color_prop = RNA_struct_find_property(&brush_ptr, "color"); + RNA_property_update(C, &brush_ptr, brush_color_prop); } } @@ -9519,7 +9535,8 @@ static int ui_handle_menu_event(bContext *C, /* Closing sub-levels of pull-downs. * * The actual event is handled by the button under the cursor. - * This is done so we can right click on menu items even when they have sub-menus open. */ + * This is done so we can right click on menu items even when they have sub-menus open. + */ case RIGHTMOUSE: if (inside == false) { if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) { |