fix for drag-toggle, bit-buttons weren't handled which made drag toggle fail for buttons in the graph editor for eg.
This commit is contained in:
@@ -776,12 +776,12 @@ static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data,
|
||||
#ifdef USE_DRAG_TOGGLE
|
||||
if (ui_is_but_bool(but)) {
|
||||
/* assumes button has already been pressed */
|
||||
const bool is_set = (ui_get_but_val(but) == 0.0);
|
||||
const bool is_set = ui_is_but_push(but);
|
||||
PointerRNA ptr;
|
||||
/* auto-key is typically called on mouse-up, but we'r leaving the button so call here */
|
||||
ui_apply_autokey(C, but);
|
||||
WM_operator_properties_create(&ptr, "UI_OT_drag_toggle");
|
||||
RNA_boolean_set(&ptr, "state", !is_set);
|
||||
RNA_boolean_set(&ptr, "state", is_set);
|
||||
RNA_int_set(&ptr, "last_x", data->dragstartx);
|
||||
RNA_int_set(&ptr, "last_y", data->dragstarty);
|
||||
WM_operator_name_call(C, "UI_OT_drag_toggle", WM_OP_INVOKE_DEFAULT, &ptr);
|
||||
|
||||
@@ -1103,7 +1103,7 @@ static bool ui_but_set_xy_xy(bContext *C, ARegion *ar, const bool is_set, const
|
||||
/* execute the button */
|
||||
if (ui_is_but_bool(but) && but->type == but_type_start) {
|
||||
/* is it pressed? */
|
||||
bool is_set_but = (ui_get_but_val(but) != 0.0);
|
||||
bool is_set_but = ui_is_but_push(but);
|
||||
BLI_assert(ui_is_but_bool(but) == true);
|
||||
if (is_set_but != is_set) {
|
||||
uiButExecute(C, but);
|
||||
|
||||
Reference in New Issue
Block a user