Commit 4f8506a3 authored by Emmet O'Neill's avatar Emmet O'Neill
Browse files

Fixed animated transparency mask -> paint layer conversion.

Before, converting an animated transparency mask to a paint layer
would discard everything but the active frame. Now, each of the
animation keyframes is converted correctly.

BUG:419223
parent 25dcdecf
......@@ -376,14 +376,12 @@ void KisLayerManager::convertNodeToPaintLayer(KisNodeSP source)
KisImageWSP image = m_view->image();
if (!image) return;
KisLayer *srcLayer = qobject_cast<KisLayer*>(source.data());
if (srcLayer && (srcLayer->inherits("KisGroupLayer") || srcLayer->layerStyle() || srcLayer->childCount() > 0)) {
image->flattenLayer(srcLayer);
return;
}
KisPaintDeviceSP srcDevice =
source->paintDevice() ? source->projection() : source->original();
......@@ -416,7 +414,6 @@ void KisLayerManager::convertNodeToPaintLayer(KisNodeSP source)
QRect rc(srcDevice->extent());
KisPainter::copyAreaOptimized(rc.topLeft(), srcDevice, clone, rc);
} else {
clone = new KisPaintDevice(*srcDevice);
}
......@@ -425,6 +422,17 @@ void KisLayerManager::convertNodeToPaintLayer(KisNodeSP source)
source->name(),
source->opacity(),
clone);
if (srcDevice->framesInterface()) {
KisKeyframeChannel *cloneKeyChannel = layer->getKeyframeChannel(KisKeyframeChannel::Content.id(), true);
layer->enableAnimation();
KisKeyframeChannel *sourceKeyChannel = srcDevice->keyframeChannel();
foreach (const int &index, sourceKeyChannel->allKeyframeIds()) {
cloneKeyChannel->copyExternalKeyframe(sourceKeyChannel, index, index);
}
}
layer->setCompositeOpId(newCompositeOp);
KisNodeSP parent = source->parent();
......@@ -443,7 +451,6 @@ void KisLayerManager::convertNodeToPaintLayer(KisNodeSP source)
m_commandsAdapter->removeNode(source);
m_commandsAdapter->addNode(layer, parent, above);
m_commandsAdapter->endMacro();
}
void KisLayerManager::convertGroupToAnimated()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment