Fix implicit scene frame count
This commit is contained in:
parent
8861f5e46d
commit
085cab3d52
2 changed files with 37 additions and 37 deletions
|
@ -1283,39 +1283,6 @@ void removeFx(TXsheet *xsh, TFx *fx) {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
int getChildFrameCount(TXsheet *childXsh) {
|
|
||||||
if (!childXsh) return 0;
|
|
||||||
|
|
||||||
int frameCount = childXsh->getFrameCount();
|
|
||||||
|
|
||||||
// For implicit holds, use last Stop Frame marker or last Key frame marker as
|
|
||||||
// frame count
|
|
||||||
if (Preferences::instance()->isImplicitHoldEnabled()) {
|
|
||||||
for (int c = 0; c < childXsh->getColumnCount(); c++) {
|
|
||||||
int r0, r1;
|
|
||||||
|
|
||||||
r1 = childXsh->getMaxFrame(c);
|
|
||||||
TXshCell cell = childXsh->getCell(r1, c);
|
|
||||||
// If last frame is a stop frame, don't check for keyframe in the same
|
|
||||||
// column in case of overshoot
|
|
||||||
if (cell.getFrameId().isStopFrame()) {
|
|
||||||
frameCount = std::max(frameCount, (r1 + 1));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TStageObject *pegbar =
|
|
||||||
childXsh->getStageObject(TStageObjectId::ColumnId(c));
|
|
||||||
if (!pegbar) continue;
|
|
||||||
if (!pegbar->getKeyframeRange(r0, r1)) continue;
|
|
||||||
frameCount = std::max(frameCount, (r1 + 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return frameCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void collapseColumns(std::set<int> indices, bool columnsOnly) {
|
void collapseColumns(std::set<int> indices, bool columnsOnly) {
|
||||||
// return if there is no selected columns
|
// return if there is no selected columns
|
||||||
if (indices.empty()) return;
|
if (indices.empty()) return;
|
||||||
|
@ -1371,7 +1338,7 @@ void collapseColumns(std::set<int> indices, bool columnsOnly) {
|
||||||
xsh->insertColumn(index);
|
xsh->insertColumn(index);
|
||||||
|
|
||||||
// set subxsheet cells in the parent xhseet
|
// set subxsheet cells in the parent xhseet
|
||||||
int r, rowCount = getChildFrameCount(childXsh);
|
int r, rowCount = childXsh->getFrameCount();
|
||||||
for (r = 0; r < rowCount; ++r)
|
for (r = 0; r < rowCount; ++r)
|
||||||
xsh->setCell(r, index, TXshCell(xl, TFrameId(r + 1)));
|
xsh->setCell(r, index, TXshCell(xl, TFrameId(r + 1)));
|
||||||
|
|
||||||
|
@ -1474,7 +1441,7 @@ void collapseColumns(std::set<int> indices,
|
||||||
|
|
||||||
xsh->insertColumn(index);
|
xsh->insertColumn(index);
|
||||||
|
|
||||||
int r, rowCount = getChildFrameCount(childXsh);
|
int r, rowCount = childXsh->getFrameCount();
|
||||||
for (r = 0; r < rowCount; r++)
|
for (r = 0; r < rowCount; r++)
|
||||||
xsh->setCell(r, index, TXshCell(xl, TFrameId(r + 1)));
|
xsh->setCell(r, index, TXshCell(xl, TFrameId(r + 1)));
|
||||||
|
|
||||||
|
@ -1548,7 +1515,7 @@ void collapseColumns(std::set<int> indices, const std::set<TFx *> &fxs,
|
||||||
if (output) xsh->getFxDag()->removeOutputFx(output);
|
if (output) xsh->getFxDag()->removeOutputFx(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rowCount = getChildFrameCount(childXsh);
|
int rowCount = childXsh->getFrameCount();
|
||||||
int r;
|
int r;
|
||||||
for (r = 0; r < rowCount; r++)
|
for (r = 0; r < rowCount; r++)
|
||||||
xsh->setCell(r, index, TXshCell(xl, TFrameId(r + 1)));
|
xsh->setCell(r, index, TXshCell(xl, TFrameId(r + 1)));
|
||||||
|
|
|
@ -229,7 +229,40 @@ unsigned long TXsheet::id() const { return m_imp->m_id; }
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
int TXsheet::getFrameCount() const { return m_imp->m_frameCount; }
|
int TXsheet::getFrameCount() const {
|
||||||
|
if (!Preferences::instance()->isImplicitHoldEnabled())
|
||||||
|
return m_imp->m_frameCount;
|
||||||
|
|
||||||
|
// For implicit holds, use last Stop Frame marker or last Key frame marker as
|
||||||
|
// frame count
|
||||||
|
int r0, r1;
|
||||||
|
|
||||||
|
int frameCount = m_imp->m_frameCount;
|
||||||
|
for (int c = 0; c < getColumnCount(); c++) {
|
||||||
|
|
||||||
|
r1 = getMaxFrame(c);
|
||||||
|
TXshCell cell = getCell(r1, c);
|
||||||
|
// If last frame is a stop frame, don't check for keyframe in the same
|
||||||
|
// column in case of overshoot
|
||||||
|
if (cell.getFrameId().isStopFrame()) {
|
||||||
|
frameCount = std::max(frameCount, r1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
TStageObject *pegbar = getStageObject(TStageObjectId::ColumnId(c));
|
||||||
|
if (!pegbar) continue;
|
||||||
|
if (!pegbar->getKeyframeRange(r0, r1)) continue;
|
||||||
|
frameCount = std::max(frameCount, (r1 + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check camera keys
|
||||||
|
TStageObjectId cameraId = getStageObjectTree()->getCurrentCameraId();
|
||||||
|
TStageObject *camera = getStageObject(cameraId);
|
||||||
|
if (camera && camera->getKeyframeRange(r0, r1))
|
||||||
|
frameCount = std::max(frameCount, (r1 + 1));
|
||||||
|
|
||||||
|
return frameCount;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue