Changeset View
Changeset View
Standalone View
Standalone View
plugins/dockers/animation/timeline_frames_model.cpp
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 62 | : activeLayerIndex(0), | |||
---|---|---|---|---|---|
66 | updateTimer(200, KisSignalCompressor::FIRST_INACTIVE), | 66 | updateTimer(200, KisSignalCompressor::FIRST_INACTIVE), | ||
67 | parentOfRemovedNode(0) | 67 | parentOfRemovedNode(0) | ||
68 | {} | 68 | {} | ||
69 | 69 | | |||
70 | int activeLayerIndex; | 70 | int activeLayerIndex; | ||
71 | 71 | | |||
72 | QPointer<KisDummiesFacadeBase> dummiesFacade; | 72 | QPointer<KisDummiesFacadeBase> dummiesFacade; | ||
73 | KisImageWSP image; | 73 | KisImageWSP image; | ||
74 | QList<KisNodeSP> cutCopyRoots; | ||||
74 | bool needFinishInsertRows; | 75 | bool needFinishInsertRows; | ||
75 | bool needFinishRemoveRows; | 76 | bool needFinishRemoveRows; | ||
76 | 77 | | |||
77 | QList<KisNodeDummy*> updateQueue; | 78 | QList<KisNodeDummy*> updateQueue; | ||
78 | KisSignalCompressor updateTimer; | 79 | KisSignalCompressor updateTimer; | ||
79 | 80 | | |||
80 | KisNodeDummy* parentOfRemovedNode; | 81 | KisNodeDummy* parentOfRemovedNode; | ||
81 | QScopedPointer<TimelineNodeListKeeper> converter; | 82 | QScopedPointer<TimelineNodeListKeeper> converter; | ||
▲ Show 20 Lines • Show All 498 Lines • ▼ Show 20 Line(s) | 577 | { | |||
580 | QDataStream stream(&encoded, QIODevice::WriteOnly); | 581 | QDataStream stream(&encoded, QIODevice::WriteOnly); | ||
581 | 582 | | |||
582 | const int baseRow = baseIndex.row(); | 583 | const int baseRow = baseIndex.row(); | ||
583 | const int baseColumn = baseIndex.column(); | 584 | const int baseColumn = baseIndex.column(); | ||
584 | 585 | | |||
585 | stream << indexes.size(); | 586 | stream << indexes.size(); | ||
586 | stream << baseRow << baseColumn; | 587 | stream << baseRow << baseColumn; | ||
587 | 588 | | |||
589 | m_d->cutCopyRoots.clear(); | ||||
590 | | ||||
588 | Q_FOREACH (const QModelIndex &index, indexes) { | 591 | Q_FOREACH (const QModelIndex &index, indexes) { | ||
589 | KisNodeSP node = nodeAt(index); | 592 | KisNodeSP node = nodeAt(index); | ||
593 | KisNodeSP tempNode = node->clone(); | ||||
594 | | ||||
595 | m_d->cutCopyRoots.append(tempNode); | ||||
596 | | ||||
590 | KIS_SAFE_ASSERT_RECOVER(node) { continue; } | 597 | KIS_SAFE_ASSERT_RECOVER(node) { continue; } | ||
591 | 598 | | |||
592 | stream << index.row() - baseRow << index.column() - baseColumn; | 599 | stream << index.row() - baseRow << index.column() - baseColumn; | ||
593 | 600 | | |||
594 | const QByteArray uuidData = node->uuid().toRfc4122(); | 601 | const QByteArray uuidData = tempNode->uuid().toRfc4122(); | ||
595 | stream << int(uuidData.size()); | 602 | stream << int(uuidData.size()); | ||
596 | stream.writeRawData(uuidData.data(), uuidData.size()); | 603 | stream.writeRawData(uuidData.data(), uuidData.size()); | ||
604 | | ||||
605 | if(copyPolicy == TimelineFramesModel::MoveFramesPolicy) { | ||||
606 | KisKeyframeChannel *channel = channelsAt(index).values().at(0); | ||||
607 | KisKeyframeSP frame = channel->keyframeAt(index.column()); | ||||
608 | channel->deleteKeyframe(frame, 0); | ||||
609 | } | ||||
597 | } | 610 | } | ||
598 | 611 | | |||
599 | stream << int(copyPolicy); | 612 | stream << int(copyPolicy); | ||
600 | data->setData("application/x-krita-frame", encoded); | 613 | data->setData("application/x-krita-frame", encoded); | ||
601 | 614 | | |||
602 | return data; | 615 | return data; | ||
603 | } | 616 | } | ||
604 | 617 | | |||
Show All 35 Lines | 646 | { | |||
640 | QDataStream stream(&encoded, QIODevice::ReadOnly); | 653 | QDataStream stream(&encoded, QIODevice::ReadOnly); | ||
641 | 654 | | |||
642 | int size, baseRow, baseColumn; | 655 | int size, baseRow, baseColumn; | ||
643 | stream >> size >> baseRow >> baseColumn; | 656 | stream >> size >> baseRow >> baseColumn; | ||
644 | 657 | | |||
645 | const QPoint offset(parent.column() - baseColumn, parent.row() - baseRow); | 658 | const QPoint offset(parent.column() - baseColumn, parent.row() - baseRow); | ||
646 | 659 | | |||
647 | KisAnimationUtils::FrameMovePairList frameMoves; | 660 | KisAnimationUtils::FrameMovePairList frameMoves; | ||
648 | | ||||
649 | for (int i = 0; i < size; i++) { | 661 | for (int i = 0; i < size; i++) { | ||
650 | int relRow, relColumn; | 662 | int relRow, relColumn; | ||
651 | stream >> relRow >> relColumn; | 663 | stream >> relRow >> relColumn; | ||
652 | 664 | | |||
653 | const int srcRow = baseRow + relRow; | 665 | const int srcRow = baseRow + relRow; | ||
654 | const int srcColumn = baseColumn + relColumn; | 666 | const int srcColumn = baseColumn + relColumn; | ||
655 | 667 | | |||
656 | int uuidLen = 0; | 668 | int uuidLen = 0; | ||
657 | stream >> uuidLen; | 669 | stream >> uuidLen; | ||
658 | QByteArray uuidData(uuidLen, '\0'); | 670 | QByteArray uuidData(uuidLen, '\0'); | ||
659 | stream.readRawData(uuidData.data(), uuidLen); | 671 | stream.readRawData(uuidData.data(), uuidLen); | ||
660 | QUuid nodeUuid = QUuid::fromRfc4122(uuidData); | 672 | QUuid nodeUuid = QUuid::fromRfc4122(uuidData); | ||
661 | 673 | | |||
662 | KisNodeSP srcNode; | 674 | KisNodeSP srcNode; | ||
663 | 675 | | |||
664 | if (!nodeUuid.isNull()) { | 676 | if (!nodeUuid.isNull()) { | ||
665 | KisNodeUuidInfo nodeInfo(nodeUuid); | 677 | KisNodeUuidInfo nodeInfo(nodeUuid); | ||
666 | srcNode = nodeInfo.findNode(m_d->image->root()); | 678 | srcNode = nodeInfo.findNode(m_d->cutCopyRoots.at(i)); | ||
667 | } else { | 679 | } else { | ||
668 | QModelIndex index = this->index(srcRow, srcColumn); | 680 | QModelIndex index = this->index(srcRow, srcColumn); | ||
669 | srcNode = nodeAt(index); | 681 | srcNode = nodeAt(index); | ||
670 | } | 682 | } | ||
671 | 683 | | |||
672 | KIS_SAFE_ASSERT_RECOVER(srcNode) { continue; } | 684 | KIS_SAFE_ASSERT_RECOVER(srcNode) { continue; } | ||
673 | 685 | | |||
674 | const QModelIndex dstRowIndex = this->index(srcRow + offset.y(), 0); | 686 | const QModelIndex dstRowIndex = this->index(srcRow + offset.y(), 0); | ||
▲ Show 20 Lines • Show All 308 Lines • Show Last 20 Lines |