UI: support dragging to key-frame

This commit is contained in:
Campbell Barton 2018-06-16 16:19:18 +02:00
parent d8c2c63c00
commit 3cf239ccfa
2 changed files with 7 additions and 0 deletions

View File

@ -1274,6 +1274,9 @@ static bool ui_drag_toggle_but_is_supported(const uiBut *but)
if (ui_but_is_bool(but)) {
return true;
}
else if (UI_but_is_decorator(but)) {
return ELEM(but->icon, ICON_SPACE2, ICON_SPACE3, ICON_DOT);
}
else {
return false;
}
@ -1284,6 +1287,9 @@ static bool ui_drag_toggle_but_is_pushed(uiBut *but)
if (ui_but_is_bool(but)) {
return ui_but_is_pushed(but);
}
else if (UI_but_is_decorator(but)) {
return (but->icon == ICON_SPACE2);
}
else {
return false;
}

View File

@ -1709,6 +1709,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
block, UI_BTYPE_BUT, 0, ICON_DOT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Animate property"));
UI_but_func_set(but, ui_but_anim_decorate_cb, but, NULL);
but->flag |= UI_BUT_DRAG_LOCK;
}
else {
/* We may show other information here in future, for now use empty space. */