diff --git a/plugins/dockers/animation/timeline_frames_model.h b/plugins/dockers/animation/timeline_frames_model.h --- a/plugins/dockers/animation/timeline_frames_model.h +++ b/plugins/dockers/animation/timeline_frames_model.h @@ -127,9 +127,9 @@ * be deleted automatically later */ void setNodeManipulationInterface(NodeManipulationInterface *iface); + KisNodeSP nodeAt(QModelIndex index) const override; protected: - KisNodeSP nodeAt(QModelIndex index) const override; QMap channelsAt(QModelIndex index) const override; private Q_SLOTS: diff --git a/plugins/dockers/animation/timeline_frames_view.cpp b/plugins/dockers/animation/timeline_frames_view.cpp --- a/plugins/dockers/animation/timeline_frames_view.cpp +++ b/plugins/dockers/animation/timeline_frames_view.cpp @@ -47,6 +47,7 @@ #include "kis_signal_compressor.h" #include "kis_time_range.h" #include "kis_color_label_selector_widget.h" +#include "kis_keyframe_channel.h" #include "kis_slider_spin_box.h" #include #include @@ -1419,7 +1420,29 @@ } if (!indexes.isEmpty()) { + + // add extra columns to the end of the timeline if we are adding hold frames + // they will be truncated if we don't do this + if (count > 0) { + // Scan all the layers and find out what layer has the most keyframes + // only keep a reference of layer that has the most keyframes + int keyframesInLayerNode = 0; + Q_FOREACH (const QModelIndex &index, indexes) { + KisNodeSP layerNode = m_d->model->nodeAt(index); + + KisKeyframeChannel *channel = layerNode->getKeyframeChannel(KisKeyframeChannel::Content.id()); + if (!channel) continue; + + if (keyframesInLayerNode < channel->allKeyframeIds().count()) { + keyframesInLayerNode = channel->allKeyframeIds().count(); + } + } + m_d->model->setLastVisibleFrame(m_d->model->columnCount() + count*keyframesInLayerNode); + } + + m_d->model->insertHoldFrames(indexes, count); + slotUpdateInfiniteFramesCount(); // trims timeline if we add too many columns during adding } }