Commit 54928c45 authored by Agata Cacko's avatar Agata Cacko

Fix cloning not-opacity scalar keyframe channels

Before this commit, duplicating a layer with keyframe channels
that weren't specifically an opacity keyframe channel resulted in
loss of those channels. This commit provides an universal solution for
all scalar kyeframe channels available.

At this point there is no way of making a scalar keyframe channel
except for opacity keyframes unless you make a change in the code and
compile it yourself (see animation_docker.cpp, line 508), so there
is/should be no change in behaviour for users. However if you enable
animated transform masks, this become crucial for both duplicating
layers and saving the file with keyframes (it doesn't work for now,
but without this commit it most probably wouldn't).
parent 0da6c85b
......@@ -100,9 +100,28 @@ KisBaseNode::KisBaseNode(const KisBaseNode & rhs)
, KisShared()
, m_d(new Private(*rhs.m_d))
if (rhs.m_d->opacityChannel) {
m_d->opacityChannel.reset(new KisScalarKeyframeChannel(*rhs.m_d->opacityChannel, 0));
m_d->keyframeChannels.insert(m_d->opacityChannel->id(), m_d->;
if (rhs.m_d->keyframeChannels.size() > 0) {
Q_FOREACH(QString key, rhs.m_d->keyframeChannels.keys()) {
KisKeyframeChannel* channel = rhs.m_d->keyframeChannels.value(key);
if (!channel) {
if (channel->inherits("KisScalarKeyframeChannel")) {
KisScalarKeyframeChannel* pchannel = qobject_cast<KisScalarKeyframeChannel*>(channel);
KIS_ASSERT_RECOVER(pchannel) { continue; }
KisScalarKeyframeChannel* channelNew = new KisScalarKeyframeChannel(*pchannel, 0);
m_d->keyframeChannels.insert(channelNew->id(), channelNew);
if (KoID(key) == KisKeyframeChannel::Opacity) {
Markdown is supported
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