Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Fix copying of data from animated layers
Dmitry Kazakov28bbeb6483df
diff --git a/libs/image/kis_paint_device.cc b/libs/image/kis_paint_device.ccindex ac4c9b4334..fda9633b10 100644--- a/libs/image/kis_paint_device.cc+++ b/libs/image/kis_paint_device.cc@@ -2190,35 +2190,6 @@ KisPaintDeviceFramesInterface* KisPaintDevice::framesInterface()return m_d->framesInterface.data();}-bool KisPaintDevice::burnKeyframe(int frameID)-{- KIS_ASSERT_RECOVER_RETURN_VALUE(m_d->framesInterface.data()->frames().contains(frameID), false);-- // Preserve keyframe data from frameID...- KisPaintDeviceSP holder = new KisPaintDevice(m_d->colorSpace());- m_d->framesInterface->writeFrameToDevice(frameID, holder);-- // Remove all keyframes..- QSet<int> times = m_d->contentChannel->allKeyframeTimes();- Q_FOREACH( const int& time, times ) {- m_d->contentChannel->removeKeyframe(time);- }-- // TODO: Eventually rewrite this to completely remove contentChannel.- // For now, importing it as frame 0 will be close enough.- m_d->contentChannel->importFrame(0, holder, nullptr);-- return true;-}--bool KisPaintDevice::burnKeyframe()-{- if (m_d->framesInterface) {- return burnKeyframe(m_d->framesInterface->currentFrameId());- }- return true;-}-/******************************************************************//* KisPaintDeviceFramesInterface *//******************************************************************/diff --git a/libs/image/kis_paint_device.h b/libs/image/kis_paint_device.hindex 6d94e792ad..dee76ab0c6 100644--- a/libs/image/kis_paint_device.h+++ b/libs/image/kis_paint_device.h@@ -777,24 +777,6 @@ public:*/KisPaintDeviceFramesInterface* framesInterface();- /**- * @brief burnKeyframe- *- * Take a frame from the keyframe channel,- * Copy the contents onto the "base" frame,- * and completely remove the keyframe channel.- *- * Should be useful for copy+paste operations where- * we shouldn't expect keyframe data to persist.- *- * Parameterless version simply gets the current frameID.- *- * @param frameID -- frameID (from the framesInterface, **not the time**) to burn to device.- * @return success- */- bool burnKeyframe(int frameID);- bool burnKeyframe();-public:/**diff --git a/libs/ui/actions/kis_selection_action_factories.cpp b/libs/ui/actions/kis_selection_action_factories.cppindex f343aae684..9ba1f4f5b7 100644--- a/libs/ui/actions/kis_selection_action_factories.cpp+++ b/libs/ui/actions/kis_selection_action_factories.cpp@@ -271,7 +271,12 @@ void KisCutCopyActionFactory::run(Flags flags, KisViewManager *view)KisNodeList nodes;Q_FOREACH (KisNodeSP node, selectedNodes) {KisNodeSP dupNode;- if (node->inherits("KisShapeLayer") || node->inherits("KisFileLayer")) {+ if (node->inherits("KisShapeLayer") || node->inherits("KisFileLayer")++ // also recreate the node for animated layers, since we have no+ // API for making a node non-animated+ || (node->inherits("KisPaintLayer") && node->isAnimated())) {+KisPaintDeviceSP dev = new KisPaintDevice(*node->projection());// might have to change node's name (vector to paint layer)dupNode = new KisPaintLayer(image, node->name(), node->opacity(), dev);@@ -283,10 +288,6 @@ void KisCutCopyActionFactory::run(Flags flags, KisViewManager *view)Q_FOREACH (KisNodeSP node, nodes) {KisLayerUtils::recursiveApplyNodes(node, [image, view, flags] (KisNodeSP node) {- if (node && node->paintDevice()) {- node->paintDevice()->burnKeyframe();- }-if (node && node->paintDevice() && !node->inherits("KisMask")) {KisToolUtils::trimDeviceForClipboard(image, node->paintDevice(), view->selection(), flags.testFlag(SharpClip));}