Reimplement Rotoscoping effect through keyframemodel
Needs ReviewPublic

Authored by mardelle on Feb 23 2018, 4:21 PM.

Details

Reviewers
alcinos
Summary

This reimplements the necessary bits to make Rotoscoping work again by adding specific functions to keyframemodel

Diff Detail

Repository
R158 Kdenlive
Lint
Lint Skipped
Unit
Unit Tests Skipped
mardelle requested review of this revision.Feb 23 2018, 4:21 PM
mardelle created this revision.

Looks mostly good to me, the main comments are 1) move some roto related functions out of the keyframe class 2) don't break keyframemodellist interface.

src/assets/keyframes/model/keyframemodel.cpp
294

to be moved (see above)

313

to be moved (see above)

334

To be merged in getInterpolatedData for one part, and moved for the other part (see above comment)

901

Can't see any parsing done over here, is that expected?

src/assets/keyframes/model/keyframemodel.hpp
154

getSpline and getPoints don't belong in this class. This class responsibility is to give you the QVariant that corresponds to the keyframe you're asking for, and that's it. Further processing should be deferred to a different class/helper function (may be worth it to create a roto folder with that and the bpoint definition)

155

This function shouldn't exist, at least in the public interface.
I think there are two different interpolations we need:

  • The one that should be in this class, and that should return the QVariant we need to store as a keyframe when we create a keyframe at a new position
  • The one that compute the actual points we should be displaying on screen or whatever. That doesn't belong here (see above remark)

(Note that for doubles params, both interpolations yield the same result, that's why there's only one function for them)

src/assets/keyframes/model/keyframemodellist.cpp
82

This function is super confusing. The whole idea of the KeyFrameModelList is that it should take care of adding/updating/removing keyframes to all the model it manages, and this function is breaking that assumption (possibly breaking some other things depending on usage).

I assume the intent behind that is that Rotoscoping keyframes are somewhat "independent" to whatever other parameters that could be there. Is that why you take extra care to add this keyframe only to that given underlying KeyFrameModel? If it's the case, and we do indeed think independent rotoscoping keyframes are desirable, then we should create a dedicated KeyFrameModelList (which would manage solely roto-related keyframes), and in that case that function is not needed (the normal addKeyframe will do)

src/assets/keyframes/model/keyframemodellist.hpp
84

To be deleted (see comment below)

121

To be deleted

src/assets/view/widgets/keyframewidget.cpp
270

Not a big fan of the capture of the monitor pointer here. Could you query it again inside the lambda (it makes sure you have a valid pointer and not a dangling one, for whatever reason).

275

(Carrying on the interface discussion, if no keyframe at given point, add a global one (without value). Then update regardless.

278

Seems unsafe to hook on seekToPos here. I think that logic should be in the more general slotRefreshParams ?

mardelle updated this revision to Diff 28474.Mar 3 2018, 1:15 PM

I tried to follow your advice, by limiting the changes to keyframemodel and keyframemodellist and integrating better with existing functions.
I created a new rotoscoping folder, with RotoWidget for related functions.
There is still a slightly odd function required:
KeyframeWidget::slotUpdateRotoMonitor()
because when initiated, the rotoscoping effect does not have a default keyframe. So we cannot use the interpolation. However I have fixed the logic so that it now correctly creates a keyframe in every model, not just the rotoscoping model.