Make Show Camera a sub option of Show Keyframes

This commit is contained in:
manongjohn 2019-09-06 22:30:41 -04:00
parent 4334db09bc
commit 3fe913a942
13 changed files with 80 additions and 56 deletions

View file

@ -469,7 +469,13 @@ public:
}
void enableXsheetCameraColumn(bool on);
bool isXsheetCameraColumnEnabled() const { return m_showXsheetCameraColumn; }
bool isXsheetCameraColumnEnabled() const {
return m_showXsheetCameraColumn;
}
bool isXsheetCameraColumnVisible() const {
return m_showXsheetCameraColumn && m_showKeyframesOnXsheetCellArea;
}
// Animation tab

View file

@ -1251,20 +1251,20 @@ public:
bool viewer_changed = false;
int startCol =
Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
for (int i = startCol; i < xsh->getColumnCount(); i++) {
/*- 空のカラムの場合は飛ばす -*/
/*- Skip if empty column -*/
if (i >= 0 && xsh->isColumnEmpty(i)) continue;
/*- カラムが取得できなかったら飛ばす -*/
/*- Skip if column cannot be obtained -*/
TXshColumn *column = xsh->getColumn(i);
if (!column) continue;
/*- ターゲットが選択カラムのモードで、選択されていなかった場合は飛ばす -*/
/*- Skip if target is in selected column mode and not selected -*/
bool isSelected = selection && selection->isColumnSelected(i);
if (m_target == TARGET_SELECTED && !isSelected) continue;
/*-
* iがカレントカラムより左の場合は飛ばす
* Skip if target is "right side of current column" mode and i is left of current column
* -*/
if (m_target == TARGET_UPPER && i < cc) continue;

View file

@ -49,6 +49,8 @@ void TColumnSelection::enableCommands() {
enableCommand(this, MI_Resequence, &TColumnSelection::resequence);
enableCommand(this, MI_CloneChild, &TColumnSelection::cloneChild);
enableCommand(this, MI_FoldColumns, &TColumnSelection::hideColumns);
if (Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled())
enableCommand(this, MI_ToggleXsheetCameraColumn,
&TColumnSelection::toggleCameraColumn);
@ -141,7 +143,8 @@ static bool canMergeColumns(int column, int mColumn, bool forMatchlines) {
if (column < 0 || mColumn < 0) return false;
if (!xsh || !xsh->getColumn(column) || xsh->getColumn(column)->isLocked()) return false;
if (!xsh || !xsh->getColumn(column) || xsh->getColumn(column)->isLocked())
return false;
int start, end;
xsh->getCellRange(column, start, end);
@ -272,6 +275,6 @@ void TColumnSelection::hideColumns() {
void TColumnSelection::toggleCameraColumn() {
Preferences *pref = Preferences::instance();
pref->enableXsheetCameraColumn(!pref->isXsheetCameraColumnEnabled());
pref->enableXsheetCameraColumn(!pref->isXsheetCameraColumnVisible());
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
}

View file

@ -280,7 +280,7 @@ KeyframeMoverTool::KeyframeMoverTool(XsheetViewer *viewer, bool justMovement)
, m_firstKeyframeMovement(false)
, m_justMovement(justMovement) {
m_mover = new KeyframeMover();
m_firstCol = Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
m_firstCol = Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
}
//-----------------------------------------------------------------------------
@ -306,7 +306,7 @@ void KeyframeMoverTool::shiftSelect(int row, int col) {
TXsheet *xsh = getViewer()->getXsheet();
int r0 = 0, c0 = 0, r1 = -1, c1 = -1;
int c = 0;
if (Preferences::instance()->isXsheetCameraColumnEnabled()) {
if (Preferences::instance()->isXsheetCameraColumnVisible()) {
c0--;
c1--;
c--;

View file

@ -222,7 +222,7 @@ void LayerHeaderPanel::mouseReleaseEvent(QMouseEvent *event) {
if (m_doOnRelease != 0 && totcols > 0) {
int startCol =
Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
for (col = startCol; col < totcols; col++) {
if (startCol < 0 || !xsh->isColumnEmpty(col)) {
TXshColumn *column = xsh->getColumn(col);

View file

@ -874,8 +874,9 @@ void PreferencesPopup::onShowFrameNumberWithLettersChanged(int index) {
//-----------------------------------------------------------------------------
void PreferencesPopup::onShowKeyframesOnCellAreaChanged(int index) {
m_pref->enableShowKeyframesOnXsheetCellArea(index == Qt::Checked);
void PreferencesPopup::onShowKeyframesOnCellAreaChanged(bool checked) {
m_pref->enableShowKeyframesOnXsheetCellArea(checked);
TApp::instance()->getCurrentScene()->notifyPreferenceChanged("XsheetCamera");
}
//-----------------------------------------------------------------------------
@ -1512,8 +1513,9 @@ PreferencesPopup::PreferencesPopup()
m_cellsDragBehaviour = new QComboBox();
CheckBox *ignoreAlphaonColumn1CB =
new CheckBox(tr("Ignore Alpha Channel on Levels in Column 1"), this);
CheckBox *showKeyframesOnCellAreaCB =
new CheckBox(tr("Show Keyframes on Cell Area"), this);
m_showKeyframesOnCellAreaCB =
new QGroupBox(tr("Show Keyframes on Cell Area"), this);
m_showKeyframesOnCellAreaCB->setCheckable(true);
CheckBox *useArrowKeyToShiftCellSelectionCB =
new CheckBox(tr("Use Arrow Key to Shift Cell Selection"), this);
CheckBox *inputCellsWithoutDoubleClickingCB =
@ -1911,7 +1913,7 @@ PreferencesPopup::PreferencesPopup()
m_cellsDragBehaviour->addItem(tr("Cells and Column Data"));
m_cellsDragBehaviour->setCurrentIndex(m_pref->getDragCellsBehaviour());
ignoreAlphaonColumn1CB->setChecked(m_pref->isIgnoreAlphaonColumn1Enabled());
showKeyframesOnCellAreaCB->setChecked(
m_showKeyframesOnCellAreaCB->setChecked(
m_pref->isShowKeyframesOnXsheetCellAreaEnabled());
useArrowKeyToShiftCellSelectionCB->setChecked(
m_pref->isUseArrowKeyToShiftCellSelectionEnabled());
@ -2529,7 +2531,16 @@ PreferencesPopup::PreferencesPopup()
Qt::AlignLeft | Qt::AlignVCenter);
xsheetFrameLay->addWidget(ignoreAlphaonColumn1CB, 4, 0, 1, 2);
xsheetFrameLay->addWidget(showKeyframesOnCellAreaCB, 5, 0, 1, 2);
QVBoxLayout *showKeyframesOnCellAreaCBLay = new QVBoxLayout();
showKeyframesOnCellAreaCBLay->setMargin(11);
{
showKeyframesOnCellAreaCBLay->addWidget(
showXsheetCameraCB, 0, Qt::AlignLeft | Qt::AlignVCenter);
}
m_showKeyframesOnCellAreaCB->setLayout(showKeyframesOnCellAreaCBLay);
xsheetFrameLay->addWidget(m_showKeyframesOnCellAreaCB, 5, 0, 1, 2);
xsheetFrameLay->addWidget(useArrowKeyToShiftCellSelectionCB, 6, 0, 1,
2);
xsheetFrameLay->addWidget(inputCellsWithoutDoubleClickingCB, 7, 0, 1,
@ -2553,7 +2564,6 @@ PreferencesPopup::PreferencesPopup()
xsheetFrameLay->addWidget(new QLabel(tr("Current Column Color:")), 15,
0, Qt::AlignRight | Qt::AlignVCenter);
xsheetFrameLay->addWidget(m_currentColumnColor, 15, 1);
xsheetFrameLay->addWidget(showXsheetCameraCB, 16, 0, 1, 2);
}
xsheetFrameLay->setColumnStretch(0, 0);
xsheetFrameLay->setColumnStretch(1, 0);
@ -2994,8 +3004,8 @@ PreferencesPopup::PreferencesPopup()
SLOT(onXsheetStepChanged()));
ret = ret && connect(m_cellsDragBehaviour, SIGNAL(currentIndexChanged(int)),
SLOT(onDragCellsBehaviourChanged(int)));
ret = ret && connect(showKeyframesOnCellAreaCB, SIGNAL(stateChanged(int)),
this, SLOT(onShowKeyframesOnCellAreaChanged(int)));
ret = ret && connect(m_showKeyframesOnCellAreaCB, SIGNAL(clicked(bool)), this,
SLOT(onShowKeyframesOnCellAreaChanged(bool)));
ret = ret &&
connect(useArrowKeyToShiftCellSelectionCB, SIGNAL(stateChanged(int)),
SLOT(onUseArrowKeyToShiftCellSelectionClicked(int)));

View file

@ -90,7 +90,8 @@ private:
DVGui::FileField *m_ffmpegPathFileFld, *m_fastRenderPathFileField,
*m_lutPathFileField;
QGroupBox *m_autoSaveGroup, *m_showXSheetToolbar, *m_colorCalibration;
QGroupBox *m_autoSaveGroup, *m_showXSheetToolbar, *m_colorCalibration,
*m_showKeyframesOnCellAreaCB;
DVGui::ColorField *m_currentColumnColor;
@ -193,7 +194,7 @@ private slots:
void onRemoveSceneNumberFromLoadedLevelNameChanged(int index);
void onShowRasterImageDarkenBlendedInViewerChanged(int index);
void onShowFrameNumberWithLettersChanged(int index);
void onShowKeyframesOnCellAreaChanged(int);
void onShowKeyframesOnCellAreaChanged(bool);
void onFfmpegPathChanged();
void onFfmpegTimeoutChanged();
void onFastRenderPathChanged();

View file

@ -964,7 +964,7 @@ void RenameCellField::keyPressEvent(QKeyEvent *event) {
CellPosition offset(offset * stride);
int movedR0 = std::max(0, r0 + offset.frame());
int firstCol =
Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
int movedC0 = std::max(firstCol, c0 + offset.layer());
int diffFrame = movedR0 - r0;
int diffLayer = movedC0 - c0;

View file

@ -2291,7 +2291,7 @@ void ColumnArea::mouseReleaseEvent(QMouseEvent *event) {
}
} else if (m_doOnRelease == ToggleAllLock) {
int startCol =
Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
for (col = startCol; col < totcols; col++) {
TXshColumn *column = xsh->getColumn(col);
if (!xsh->isColumnEmpty(col)) {
@ -2440,13 +2440,17 @@ void ColumnArea::contextMenuEvent(QContextMenuEvent *event) {
}
menu.addSeparator();
menu.addAction(cmdManager->getAction(MI_FoldColumns));
QAction *cameraToggle = cmdManager->getAction(MI_ToggleXsheetCameraColumn);
bool cameraVisible = Preferences::instance()->isXsheetCameraColumnEnabled();
if (Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled()) {
QAction *cameraToggle =
cmdManager->getAction(MI_ToggleXsheetCameraColumn);
bool cameraVisible =
Preferences::instance()->isXsheetCameraColumnVisible();
if (cameraVisible)
cameraToggle->setText(tr("Hide Camera Column"));
else
cameraToggle->setText(tr("Show Camera Column"));
menu.addAction(cameraToggle);
}
menu.addSeparator();
menu.addAction(cmdManager->getAction(MI_ToggleXSheetToolbar));

View file

@ -363,7 +363,7 @@ void GlobalKeyframeUndo::doInsertGlobalKeyframes(
int i, colsCount = columns.size();
int startCol =
Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
for (i = startCol; i != colsCount; ++i) {
TStageObjectId objectId;
@ -395,7 +395,7 @@ void GlobalKeyframeUndo::doRemoveGlobalKeyframes(
int i, colsCount = columns.size();
int startCol =
Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
for (i = 0; i != colsCount; ++i) {
TStageObjectId objectId;
@ -1065,7 +1065,7 @@ public:
int col;
for (col = -1; col < xsh->getColumnCount(); col++) {
TStageObjectId objectId;
if (col == -1 && Preferences::instance()->isXsheetCameraColumnEnabled())
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
objectId = TStageObjectId::ColumnId(col);
@ -1127,7 +1127,7 @@ public:
int col;
for (col = -1; col < xsh->getColumnCount(); col++) {
TStageObjectId objectId;
if (col == -1 && Preferences::instance()->isXsheetCameraColumnEnabled())
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
objectId = TStageObjectId::ColumnId(col);
@ -1164,7 +1164,7 @@ public:
TXsheet *xsh = scene->getXsheet();
for (int col = -1; col < xsh->getColumnCount(); col++) {
TStageObjectId objectId;
if (col == -1 && Preferences::instance()->isXsheetCameraColumnEnabled())
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
objectId = TStageObjectId::ColumnId(col);
@ -1203,7 +1203,7 @@ public:
int col;
for (col = -1; col < xsh->getColumnCount(); col++) {
TStageObjectId objectId;
if (col == -1 && Preferences::instance()->isXsheetCameraColumnEnabled())
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
objectId = TStageObjectId::ColumnId(col);
@ -1244,7 +1244,7 @@ public:
TStageObjectId objectId =
TApp::instance()->getCurrentObject()->getObjectId();
if (objectId == TStageObjectId::CameraId(xsh->getCameraColumnIndex()) &&
Preferences::instance()->isXsheetCameraColumnEnabled())
Preferences::instance()->isXsheetCameraColumnVisible())
currentColumn = -1;
TStageObject *pegbar = xsh->getStageObject(objectId);
TStageObject::KeyframeMap keyframes;
@ -1281,7 +1281,7 @@ public:
TStageObjectId objectId =
TApp::instance()->getCurrentObject()->getObjectId();
if (objectId == TStageObjectId::CameraId(xsh->getCameraColumnIndex()) &&
Preferences::instance()->isXsheetCameraColumnEnabled())
Preferences::instance()->isXsheetCameraColumnVisible())
currentColumn = -1;
TStageObject *pegbar = xsh->getStageObject(objectId);
TStageObject::KeyframeMap keyframes;
@ -1318,7 +1318,7 @@ public:
int col;
for (col = -1; col <= currentColumn; col++) {
TStageObjectId objectId;
if (col == -1 && Preferences::instance()->isXsheetCameraColumnEnabled())
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
objectId = TStageObjectId::ColumnId(col);
@ -1359,7 +1359,7 @@ public:
TStageObjectId objectId =
TApp::instance()->getCurrentObject()->getObjectId();
if (objectId == TStageObjectId::CameraId(xsh->getCameraColumnIndex()) &&
Preferences::instance()->isXsheetCameraColumnEnabled())
Preferences::instance()->isXsheetCameraColumnVisible())
currentColumn = -1;
selection->selectNone();
@ -1403,7 +1403,7 @@ public:
int col;
for (col = -1; col < xsh->getColumnCount(); col++) {
TStageObjectId objectId;
if (col == -1 && Preferences::instance()->isXsheetCameraColumnEnabled())
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
objectId = TStageObjectId::ColumnId(col);

View file

@ -180,7 +180,7 @@ public:
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
int row = pos.frame(), col = pos.layer();
int firstCol =
Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
if (col < firstCol || (!getViewer()->orientation()->isVerticalTimeline() &&
col >= xsh->getColumnCount()))
return;
@ -1549,7 +1549,7 @@ public:
int col = pos.layer();
if (!m_enabled) return;
int firstCol =
Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
if (col < firstCol || (!getViewer()->orientation()->isVerticalTimeline() &&
col >= xsh->getColumnCount()))
return;

View file

@ -664,7 +664,7 @@ bool XsheetViewer::refreshContentSize(int dx, int dy) {
contentSize = positionToXY(CellPosition(frameCount + 1, columnCount + 1));
else {
int firstCol =
Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
contentSize = positionToXY(CellPosition(frameCount + 1, firstCol));
ColumnFan *fan = xsh->getColumnFan(m_orientation);
@ -718,7 +718,7 @@ void XsheetViewer::updateAreeSize() {
CellPosition(xsh->getFrameCount() + 1, xsh->getColumnCount() + 1));
else {
int firstCol =
Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
areaFilled =
positionToXY(CellPosition(xsh->getFrameCount() + 1, firstCol));
@ -1196,7 +1196,7 @@ void XsheetViewer::keyPressEvent(QKeyEvent *event) {
TCellSelection *cellSel =
dynamic_cast<TCellSelection *>(TSelection::getCurrent());
int firstCol =
Preferences::instance()->isXsheetCameraColumnEnabled() ? -1 : 0;
Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0;
// Use arrow keys to shift the cell selection. Ctrl + arrow keys to resize the
// selection range.
if (Preferences::instance()->isUseArrowKeyToShiftCellSelectionEnabled() &&

View file

@ -53,7 +53,7 @@ void ColumnFan::update() {
//-----------------------------------------------------------------------------
int ColumnFan::layerAxisToCol(int coord) const {
if (Preferences::instance()->isXsheetCameraColumnEnabled()) {
if (Preferences::instance()->isXsheetCameraColumnVisible()) {
int firstCol =
m_cameraActive
? m_unfolded
@ -75,7 +75,7 @@ int ColumnFan::layerAxisToCol(int coord) const {
int ColumnFan::colToLayerAxis(int col) const {
int m = m_columns.size();
int firstCol = 0;
if (Preferences::instance()->isXsheetCameraColumnEnabled()) {
if (Preferences::instance()->isXsheetCameraColumnVisible()) {
if (col < -1) return -m_unfolded;
if (col < 0) return 0;
firstCol =
@ -148,7 +148,7 @@ void ColumnFan::copyFoldedStateFrom(const ColumnFan &from) {
void ColumnFan::saveData(
TOStream &os) { // only saves indices of folded columns
int index, n = (int)m_columns.size();
if (Preferences::instance()->isXsheetCameraColumnEnabled() && !m_cameraActive)
if (Preferences::instance()->isXsheetCameraColumnVisible() && !m_cameraActive)
os << -1 << 1;
for (index = 0; index < n;) {
while (index < n && m_columns[index].m_active) index++;