Fix initial exposed subscene frames on Collapse in Implicit Mode
This commit is contained in:
parent
31951072a8
commit
ec6127a146
2 changed files with 39 additions and 4 deletions
|
@ -31,6 +31,7 @@
|
||||||
#include "toonz/tstageobjectspline.h"
|
#include "toonz/tstageobjectspline.h"
|
||||||
#include "toonz/tcamera.h"
|
#include "toonz/tcamera.h"
|
||||||
#include "toonz/expressionreferencemonitor.h"
|
#include "toonz/expressionreferencemonitor.h"
|
||||||
|
#include "toonz/preferences.h"
|
||||||
|
|
||||||
// TnzQt includes
|
// TnzQt includes
|
||||||
#include "toonzqt/menubarcommand.h"
|
#include "toonzqt/menubarcommand.h"
|
||||||
|
@ -1282,6 +1283,39 @@ 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;
|
||||||
|
@ -1337,7 +1371,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 = childXsh->getFrameCount();
|
int r, rowCount = getChildFrameCount(childXsh);
|
||||||
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)));
|
||||||
|
|
||||||
|
@ -1440,7 +1474,7 @@ void collapseColumns(std::set<int> indices,
|
||||||
|
|
||||||
xsh->insertColumn(index);
|
xsh->insertColumn(index);
|
||||||
|
|
||||||
int r, rowCount = childXsh->getFrameCount();
|
int r, rowCount = getChildFrameCount(childXsh);
|
||||||
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)));
|
||||||
|
|
||||||
|
@ -1514,7 +1548,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 = childXsh->getFrameCount();
|
int rowCount = getChildFrameCount(childXsh);
|
||||||
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)));
|
||||||
|
|
|
@ -2243,7 +2243,8 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference,
|
||||||
isRed = true;
|
isRed = true;
|
||||||
TXshChildLevel *cl = cell.getChildLevel();
|
TXshChildLevel *cl = cell.getChildLevel();
|
||||||
if (cl && !cell.getFrameId().isStopFrame() &&
|
if (cl && !cell.getFrameId().isStopFrame() &&
|
||||||
cell.getFrameId().getNumber() - 1 >= cl->getFrameCount())
|
cell.getFrameId().getNumber() - 1 >= cl->getFrameCount() &&
|
||||||
|
!Preferences::instance()->isImplicitHoldEnabled())
|
||||||
isRed = true;
|
isRed = true;
|
||||||
QColor penColor =
|
QColor penColor =
|
||||||
isRed ? QColor(m_viewer->getErrorTextColor()) : m_viewer->getTextColor();
|
isRed ? QColor(m_viewer->getErrorTextColor()) : m_viewer->getTextColor();
|
||||||
|
|
Loading…
Reference in a new issue