add move frame buttons

This commit is contained in:
2019-11-10 14:54:20 +01:00
parent 35937ad4c6
commit 802bce7383
5 changed files with 48 additions and 5 deletions

View File

@@ -33,6 +33,8 @@ void NodePanelAnimation::init_controls()
btn_remove = find<NodeButtonCustom>("btn-remove");
btn_up = find<NodeButtonCustom>("btn-up");
btn_down = find<NodeButtonCustom>("btn-down");
btn_left = find<NodeButtonCustom>("btn-left");
btn_right = find<NodeButtonCustom>("btn-right");
btn_duplicate = find<NodeButtonCustom>("btn-duplicate");
btn_next = find<NodeButtonCustom>("btn-next");
btn_prev = find<NodeButtonCustom>("btn-prev");
@@ -63,6 +65,22 @@ void NodePanelAnimation::init_controls()
layer->set_frame_duration(m_selected_frame_index, glm::max(layer->frame_duration(m_selected_frame_index) - 1, 1));
load_layers();
};
btn_left->on_click = [this](Node*) {
if (!m_selected_frame)
return;
if (auto layer = Canvas::I->layer_with_id(m_selected_frame_layer_id))
m_selected_frame_index = layer->move_frame_offset(m_selected_frame_index, -1);
Canvas::I->anim_goto_frame(m_selected_frame_index);
load_layers();
};
btn_right->on_click = [this](Node*) {
if (!m_selected_frame)
return;
if (auto layer = Canvas::I->layer_with_id(m_selected_frame_layer_id))
m_selected_frame_index = layer->move_frame_offset(m_selected_frame_index, +1);
Canvas::I->anim_goto_frame(m_selected_frame_index);
load_layers();
};
m_onion->on_select = [this] (Node* target, int index) {
m_timeline->m_onion_size = m_onion->get_int();