Bug 377803 - Background for title clip contains title clip itself if cursor is over that title clip [video demo included]
Summary: Background for title clip contains title clip itself if cursor is over that t...
Status: RESOLVED FIXED
Alias: None
Product: kdenlive
Classification: Applications
Component: Video Display & Export (show other bugs)
Version: git-master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL: https://youtu.be/n8AmeunCnNw
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-19 15:05 UTC by Andrew Shark
Modified: 2017-03-19 21:45 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Shark 2017-03-19 15:05:22 UTC
There is a problem when editing title clips.
In some conditions a background frame for title clips contain title itself, which you want to edit at the moment. So it prevents you to watch how it would be in final video.

Expected behavior:
Background frame contains all layers under cursor, except title clip which is subject to edit.
Comment 1 Jean-Baptiste Mardelle 2017-03-19 16:09:33 UTC
Yes, I have also often been annoyed by that issue, but never took time to try to fix it. Thanks for your report, I will try to work on it in the next days
Comment 2 Andrew Shark 2017-03-19 17:25:04 UTC
Here is my exploration path:
1) "Show background" sting is contained in titlewidget_ui.ui. Name of checkbox widget is "displayBg".
2) "displayBg" is mentioned in titlewidget.cpp on line 229:
 connect(displayBg, &QCheckBox::stateChanged, this, &TitleWidget::displayBackgroundFrame);
 and there is TitleWidget::displayBackgroundFrame() method.
3) TitleWidget::displayBackgroundFrame() is defined in the same file on line 840. It checks if checkbox is activated and if yes,
 emit signal requestBackgroundFrame(true);

Also this file contains 
void TitleWidget::slotGotBackground(const QImage &img)(const QImage &img)
{
    QRectF r = m_frameBorder->sceneBoundingRect();
    m_frameImage->setPixmap(QPixmap::fromImage(img.scaled(r.width() / 2, r.height() / 2)));
    emit requestBackgroundFrame(false);
}

As you can see, it already gets image as a parameter.
So we should find where it prepares image and I think temporary disable title clip before getting it.
But I could not find place where slotGotBackground(const QImage &img) is called from.

4) Perhaps bin.cpp is a place where title editing is done (line 3393 says "TODO: move title editing into a better place..."). File contains the following:
connect(&dia_ui, &TitleWidget::requestBackgroundFrame, pCore->monitorManager()->projectMonitor(), &Monitor::slotGetCurrentImage);
Comment 3 Jean-Baptiste Mardelle 2017-03-19 20:05:08 UTC
Git commit 8e054c9a5205650ffd05d1f5725ff3a39290ab54 by Jean-Baptiste Mardelle.
Committed on 19/03/2017 at 20:04.
Pushed by mardelle into branch 'master'.

Hide currently edited title clip when requesting background in title widget

M  +6    -3    src/bin/bin.cpp
M  +5    -2    src/bin/bin.h
M  +5    -1    src/monitor/glwidget.cpp
M  +1    -0    src/monitor/glwidget.h
M  +2    -2    src/monitor/monitor.cpp
M  +0    -2    src/monitor/monitormanager.cpp
M  +9    -0    src/timeline/timeline.cpp
M  +4    -0    src/timeline/timeline.h
M  +36   -0    src/timeline/track.cpp
M  +4    -0    src/timeline/track.h
M  +8    -6    src/titler/titlewidget.cpp
M  +17   -11   src/titler/titlewidget.h

https://commits.kde.org/kdenlive/8e054c9a5205650ffd05d1f5725ff3a39290ab54
Comment 4 Andrew Shark 2017-03-19 21:45:42 UTC
It works! Thank you very much, Mardelle =)