Fix implicit Lipsync creating explicit cells

This commit is contained in:
manongjohn 2022-03-06 01:15:44 -05:00
parent 36fcc8cb90
commit 6f35c5c257

View file

@ -124,6 +124,8 @@ void LipSyncUndo::redo() const {
int i = 0;
int currentLine = 0;
int size = m_textLines.size();
bool useImplicitHold = Preferences::instance()->isImplicitHoldEnabled();
const TXshCell emptyCell;
while (currentLine < m_textLines.size()) {
int endAt;
if (currentLine + 2 >= m_textLines.size()) {
@ -165,6 +167,7 @@ void LipSyncUndo::redo() const {
continue;
}
bool firstCell = true;
while (i < endAt && i < m_lastFrame - m_startFrame) {
int currFrame = i + m_startFrame;
TXshCell cell = xsh->getCell(currFrame, m_col);
@ -173,11 +176,20 @@ void LipSyncUndo::redo() const {
else
cell.m_level = m_cl;
cell.m_frameId = currentId;
if (useImplicitHold && !firstCell)
xsh->setCell(currFrame, m_col, emptyCell);
else {
xsh->setCell(currFrame, m_col, cell);
firstCell = false;
}
i++;
}
currentLine += 2;
}
if (useImplicitHold)
xsh->setCell(m_lastFrame, m_col,
TXshCell((m_sl ? m_sl : m_cl), TFrameId::STOP_FRAME));
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
TApp::instance()->getCurrentScene()->setDirtyFlag(true);
}
@ -929,7 +941,12 @@ void LipSyncPopup::onApplyButton() {
std::vector<TXshLevelP> previousLevels;
for (int previousFrame = startFrame; previousFrame < lastFrame;
previousFrame++) {
TXshCell cell = xsh->getCell(previousFrame, m_col);
TXshCell cell = xsh->getCell(previousFrame, m_col, false);
previousFrameIds.push_back(cell.m_frameId);
previousLevels.push_back(cell.m_level);
}
if (Preferences::instance()->isImplicitHoldEnabled()) {
TXshCell cell = xsh->getCell(lastFrame, m_col, false);
previousFrameIds.push_back(cell.m_frameId);
previousLevels.push_back(cell.m_level);
}