Fix implicit Lipsync creating explicit cells
This commit is contained in:
parent
36fcc8cb90
commit
6f35c5c257
1 changed files with 40 additions and 23 deletions
|
@ -122,8 +122,10 @@ void LipSyncUndo::undo() const {
|
|||
void LipSyncUndo::redo() const {
|
||||
TXsheet *xsh = TApp::instance()->getCurrentScene()->getScene()->getXsheet();
|
||||
int i = 0;
|
||||
int currentLine = 0;
|
||||
int size = m_textLines.size();
|
||||
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;
|
||||
xsh->setCell(currFrame, m_col, cell);
|
||||
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);
|
||||
}
|
||||
|
@ -236,7 +248,7 @@ LipSyncPopup::LipSyncPopup()
|
|||
m_progressDialog =
|
||||
new DVGui::ProgressDialog("Analyzing audio...", "", 1, 100, this);
|
||||
m_progressDialog->hide();
|
||||
|
||||
|
||||
m_soundLevels = new QComboBox(this);
|
||||
m_playButton = new QPushButton(tr(""), this);
|
||||
m_playIcon = createQIcon("play");
|
||||
|
@ -486,18 +498,18 @@ LipSyncPopup::LipSyncPopup()
|
|||
void LipSyncPopup::setPage(int index) {
|
||||
m_stackedChooser->setCurrentIndex(index);
|
||||
if (index == 1) {
|
||||
m_insertAtLabel->show();
|
||||
m_startAt->show();
|
||||
m_insertAtLabel->show();
|
||||
m_startAt->show();
|
||||
}
|
||||
else {
|
||||
if (m_soundLevels->currentIndex() < m_soundLevels->count() - 1) {
|
||||
m_insertAtLabel->hide();
|
||||
m_startAt->hide();
|
||||
}
|
||||
else {
|
||||
m_insertAtLabel->show();
|
||||
m_startAt->show();
|
||||
}
|
||||
if (m_soundLevels->currentIndex() < m_soundLevels->count() - 1) {
|
||||
m_insertAtLabel->hide();
|
||||
m_startAt->hide();
|
||||
}
|
||||
else {
|
||||
m_insertAtLabel->show();
|
||||
m_startAt->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -575,12 +587,12 @@ void LipSyncPopup::refreshSoundLevels() {
|
|||
if (currentIndex < m_soundLevels->count())
|
||||
m_soundLevels->setCurrentIndex(currentIndex);
|
||||
if (m_soundLevels->currentIndex() < m_soundLevels->count() - 1) {
|
||||
m_insertAtLabel->hide();
|
||||
m_startAt->hide();
|
||||
m_insertAtLabel->hide();
|
||||
m_startAt->hide();
|
||||
}
|
||||
else {
|
||||
m_insertAtLabel->show();
|
||||
m_startAt->show();
|
||||
m_insertAtLabel->show();
|
||||
m_startAt->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -812,12 +824,12 @@ void LipSyncPopup::onLevelChanged(int index) {
|
|||
m_audioFile->hide();
|
||||
}
|
||||
if (m_soundLevels->currentIndex() < m_soundLevels->count() - 1) {
|
||||
m_insertAtLabel->hide();
|
||||
m_startAt->hide();
|
||||
m_insertAtLabel->hide();
|
||||
m_startAt->hide();
|
||||
}
|
||||
else {
|
||||
m_insertAtLabel->show();
|
||||
m_startAt->show();
|
||||
m_insertAtLabel->show();
|
||||
m_startAt->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue