Changeset View
Changeset View
Standalone View
Standalone View
plugins/dockers/animation/timeline_frames_model.cpp
Context not available. | |||||
794 | return m_d->addKeyframe(dstIndex.row(), dstIndex.column(), true); | 794 | return m_d->addKeyframe(dstIndex.row(), dstIndex.column(), true); | ||
---|---|---|---|---|---|
795 | } | 795 | } | ||
796 | 796 | | |||
797 | bool TimelineFramesModel::insertFrames(int dstColumn, const QList<int> &dstRows, int count) | 797 | bool TimelineFramesModel::insertFrames(int dstColumn, const QList<int> &dstRows, int count, int timing) | ||
798 | { | 798 | { | ||
799 | if (dstRows.isEmpty() || count <= 0) return true; | 799 | if (dstRows.isEmpty() || count <= 0) return true; | ||
800 | timing = qMax(timing, 1); | ||||
800 | 801 | | |||
801 | KUndo2Command *parentCommand = new KUndo2Command(kundo2_i18np("Insert frame", "Insert %1 frames", count)); | 802 | KUndo2Command *parentCommand = new KUndo2Command(kundo2_i18np("Insert frame", "Insert %1 frames", count)); | ||
802 | 803 | | |||
Context not available. | |||||
811 | } | 812 | } | ||
812 | } | 813 | } | ||
813 | 814 | | |||
814 | setLastVisibleFrame(columnCount() + count - 1); | 815 | setLastVisibleFrame(columnCount() + (count * timing) - 1); | ||
815 | 816 | | |||
816 | 817 | createOffsetFramesCommand(indexes, QPoint((count * timing), 0), false, parentCommand); | |||
817 | createOffsetFramesCommand(indexes, QPoint(count, 0), false, parentCommand); | | |||
818 | 818 | | |||
819 | Q_FOREACH (int row, dstRows) { | 819 | Q_FOREACH (int row, dstRows) { | ||
820 | KisNodeDummy *dummy = m_d->converter->dummyFromRow(row); | 820 | KisNodeDummy *dummy = m_d->converter->dummyFromRow(row); | ||
Context not available. | |||||
823 | KisNodeSP node = dummy->node(); | 823 | KisNodeSP node = dummy->node(); | ||
824 | if (!KisAnimationUtils::supportsContentFrames(node)) continue; | 824 | if (!KisAnimationUtils::supportsContentFrames(node)) continue; | ||
825 | 825 | | |||
826 | for (int column = dstColumn; column < dstColumn + count; column++) { | 826 | for (int column = dstColumn; column < dstColumn + (count * timing); column += timing) { | ||
827 | KisAnimationUtils::createKeyframeCommand(m_d->image, node, KisKeyframeChannel::Content.id(), column, false, parentCommand); | 827 | KisAnimationUtils::createKeyframeCommand(m_d->image, node, KisKeyframeChannel::Content.id(), column, false, parentCommand); | ||
828 | } | 828 | } | ||
829 | } | 829 | } | ||
830 | 830 | | |||
831 | const int oldTime = m_d->image->animationInterface()->currentUITime(); | 831 | const int oldTime = m_d->image->animationInterface()->currentUITime(); | ||
832 | const int newTime = dstColumn > oldTime ? dstColumn : dstColumn + count - 1; | 832 | const int newTime = dstColumn > oldTime ? dstColumn : dstColumn + (count * timing) - 1; | ||
833 | 833 | | |||
834 | new KisSwitchCurrentTimeCommand(m_d->image->animationInterface(), | 834 | new KisSwitchCurrentTimeCommand(m_d->image->animationInterface(), | ||
835 | oldTime, | 835 | oldTime, | ||
Context not available. | |||||
934 | return true; | 934 | return true; | ||
935 | } | 935 | } | ||
936 | 936 | | |||
937 | | ||||
938 | QString TimelineFramesModel::audioChannelFileName() const | 937 | QString TimelineFramesModel::audioChannelFileName() const | ||
939 | { | 938 | { | ||
940 | return m_d->image ? m_d->image->animationInterface()->audioChannelFileName() : QString(); | 939 | return m_d->image ? m_d->image->animationInterface()->audioChannelFileName() : QString(); | ||
Context not available. |