Skip to content

Opacity Keyframes Cache Correction

Eoin O'Neill requested to merge (removed):opacity-keyframes into master

Works with KisAnimationCachePopulator (background cacher) but has issues with the KisAsyncAnimationRenderBase (animation_docker playback cache creation).

To see the difference, let the cache populator run (by either waiting or manually scrubbing through the frames) and you will notice that all opacity keyframes will work as expected. However, if you flush your cache (the easiest way to do this is to click on the blank part of the canvas with a brush) and use the play button on the animation docker to cache your animation, you'll see that the opacity playback does not work as expected.

@dkazakov I was looking into reasons why KisAsyncAnimationRenderBase was having issues and my first thought is that there is some kind of data-race issue going on where the images are being filled into the cache buffer before any opacity-change calculations are fulfilled. Do you have any idea why this might be the case? I noticed that (despite it being very wrong to do this) if you change connect(this, SIGNAL(sigCompleteRegenerationInternal(int)), SLOT(slotCompleteRegenerationInternal(int))); signal located at libs/ui/KisAsyncAnimationCacheRenderer.cpp line 34 to connect(this, SIGNAL(sigCompleteRegenerationInternal(int)), SLOT(slotCompleteRegenerationInternal(int)), Qt::DirectConnection); the opacity will correctly work every time, but will eventually run into data integrity issues due to multiple threads accessing the same shared pointer data. The point stands though that there's some issue currently with the threading and the application of an individual node's opacity value in a given image. Any ideas on what can be done with this?

Testing File: scott-opacitykey-240x240.kra

Remaining Tasks:

  • Correct KisAsyncAnimationRenderBase to correctly render opacity frames into the cache.
    • Create KisDefaultBoundsNodeWrapper to correct data-race issues and copy-constructor madness.
    • Once that's done, add KIS_SAFE_ASSERT_RECOVER_NOOP to KisRasterKeyFrameChannel::createKeyframe
    • KisBaseNode::SetImage should update image pointer to all keyframe channels
Edited by Eoin O'Neill

Merge request reports