Commit 4ce228b2 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix effect stack cleared on clip copy.

Related to #1333
parent 8370b5b7
Pipeline #149619 passed with stage
in 9 minutes and 37 seconds
......@@ -1501,7 +1501,6 @@ QString TimelineFunctions::copyClips(const std::shared_ptr<TimelineItemModel> &t
subtitleOnlyCopy = true;
}
timeline->requestClearSelection();
// TODO better guess for master track
int masterTid = timeline->getItemTrackId(mainId);
bool audioCopy = subtitleOnlyCopy ? false : timeline->isAudioTrack(masterTid);
......@@ -1561,9 +1560,24 @@ QString TimelineFunctions::copyClips(const std::shared_ptr<TimelineItemModel> &t
container.setAttribute(QStringLiteral("documentid"), pCore->currentDoc()->getDocumentProperty(QStringLiteral("documentid")));
QDomElement grp = copiedItems.createElement(QStringLiteral("groups"));
container.appendChild(grp);
std::unordered_set<int> groupRoots;
std::transform(allIds.begin(), allIds.end(), std::inserter(groupRoots, groupRoots.begin()), [&](int id) { return timeline->m_groups->getRootId(id); });
std::transform(allIds.begin(), allIds.end(), std::inserter(groupRoots, groupRoots.begin()), [&](int id) {
int parent = timeline->m_groups->getRootId(id);
if (timeline->m_groups->getType(parent) == GroupType::Selection) {
std::unordered_set<int> children = timeline->m_groups->getDirectChildren(parent);
for (const auto &gid : children) {
std::unordered_set<int> leaves = timeline->m_groups->getLeaves(gid);
if (leaves.count(id) == 1) {
return gid;
}
}
// This should not happen
qDebug()<<"INCORRECT GROUP ID FOUND";
return -1;
} else {
return parent;
}
});
qDebug() << "==============\n GROUP ROOTS: ";
for (int gp : groupRoots) {
......
......@@ -4359,7 +4359,7 @@ Fun TimelineModel::deregisterClip_lambda(int clipId)
{
return [this, clipId]() {
// Clear effect stack
clearAssetView(clipId);
emit requestClearAssetView(clipId);
if (!m_closing) {
emit checkItemDeletion(clipId);
}
......@@ -4799,7 +4799,7 @@ Fun TimelineModel::deregisterComposition_lambda(int compoId)
Q_ASSERT(m_allCompositions.count(compoId) > 0);
Q_ASSERT(!m_groups->isInGroup(compoId)); // composition must be ungrouped at this point
requestClearSelection(true);
clearAssetView(compoId);
emit requestClearAssetView(compoId);
m_allCompositions.erase(compoId);
m_groups->destructGroupItem(compoId);
return true;
......@@ -5365,11 +5365,6 @@ void TimelineModel::checkRefresh(int start, int end)
}
}
void TimelineModel::clearAssetView(int itemId)
{
emit requestClearAssetView(itemId);
}
std::shared_ptr<AssetParameterModel> TimelineModel::getCompositionParameterModel(int compoId) const
{
READ_LOCK();
......
......@@ -881,9 +881,6 @@ protected:
/** @brief Refresh project monitor if cursor was inside range */
void checkRefresh(int start, int end);
/** @brief Send signal to require clearing effet/composition view */
void clearAssetView(int itemId);
bool m_blockRefresh;
signals:
......
......@@ -547,7 +547,7 @@ void TimelineController::deleteSelectedClips()
// Check if a mix is selected
if (m_model->m_selectedMix > -1 && m_model->isClip(m_model->m_selectedMix)) {
m_model->removeMix(m_model->m_selectedMix);
m_model->clearAssetView(m_model->m_selectedMix);
m_model->requestClearAssetView(m_model->m_selectedMix);
m_model->requestClearSelection(true);
}
return;
......@@ -602,7 +602,6 @@ void TimelineController::copyItem()
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(copyString);
m_root->setProperty("copiedClip", clipId);
m_model->requestSetSelection(selectedIds);
}
bool TimelineController::pasteItem(int position, int tid)
......
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