Merge pull request #217 from shun-iwasawa/revert_key_on_xsheet

Revert keyframes on xsheet cell area
This commit is contained in:
tomosu 2016-04-25 16:13:13 +09:00
commit 678e76b782
11 changed files with 239 additions and 55 deletions

View file

@ -334,6 +334,12 @@ public:
void setDragCellsBehaviour(int dragCellsBehaviour); void setDragCellsBehaviour(int dragCellsBehaviour);
int getDragCellsBehaviour() const { return m_dragCellsBehaviour; } int getDragCellsBehaviour() const { return m_dragCellsBehaviour; }
void enableShowKeyframesOnXsheetCellArea(bool on);
bool isShowKeyframesOnXsheetCellAreaEnabled() const
{
return m_showKeyframesOnXsheetCellArea;
}
// Animation tab // Animation tab
void setKeyframeType(int s); void setKeyframeType(int s);
@ -528,6 +534,8 @@ private:
--*/ --*/
int m_paletteTypeOnLoadRasterImageAsColorModel; int m_paletteTypeOnLoadRasterImageAsColorModel;
bool m_showKeyframesOnXsheetCellArea;
private: private:
Preferences(); Preferences();
~Preferences(); ~Preferences();

View file

@ -119,7 +119,7 @@ public:
QString getHistoryString() QString getHistoryString()
{ {
return QObject::tr("Set Keyframe %1 at frame %2").arg(QString::fromStdString(m_objId.toString())).arg(m_frame); return QObject::tr("Set Keyframe %1 at frame %2").arg(QString::fromStdString(m_objId.toString())).arg(m_frame+1);
} }
}; };

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -6,6 +6,9 @@
#include "tapp.h" #include "tapp.h"
#include "xsheetviewer.h" #include "xsheetviewer.h"
// TnzQt includes
#include "historytypes.h"
// TnzLib includes // TnzLib includes
#include "toonz/txsheethandle.h" #include "toonz/txsheethandle.h"
#include "toonz/tscenehandle.h" #include "toonz/tscenehandle.h"
@ -230,6 +233,16 @@ public:
{ {
return sizeof(*this); return sizeof(*this);
} }
QString getHistoryString()
{
return QObject::tr("Move Keyframe");
}
int getHistoryType()
{
return HistoryType::Xsheet;
}
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -637,6 +637,13 @@ void PreferencesPopup::onPaletteTypeForRasterColorModelChanged(int index)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void PreferencesPopup::onShowKeyframesOnCellAreaChanged(int index)
{
m_pref->enableShowKeyframesOnXsheetCellArea(index == Qt::Checked);
}
//-----------------------------------------------------------------------------
void PreferencesPopup::onStyleSheetTypeChanged(int index) void PreferencesPopup::onStyleSheetTypeChanged(int index)
{ {
m_pref->setCurrentStyleSheet(index); m_pref->setCurrentStyleSheet(index);
@ -943,6 +950,7 @@ PreferencesPopup::PreferencesPopup()
m_xsheetStep = new DVGui::IntLineEdit(this, Preferences::instance()->getXsheetStep(), 0); m_xsheetStep = new DVGui::IntLineEdit(this, Preferences::instance()->getXsheetStep(), 0);
m_cellsDragBehaviour = new QComboBox(); m_cellsDragBehaviour = new QComboBox();
CheckBox *ignoreAlphaonColumn1CB = new CheckBox(tr("Ignore Alpha Channel on Levels in Column 1"), this); 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);
//--- Animation ------------------------------ //--- Animation ------------------------------
categoryList->addItem(tr("Animation")); categoryList->addItem(tr("Animation"));
@ -1129,6 +1137,7 @@ PreferencesPopup::PreferencesPopup()
m_cellsDragBehaviour->addItem(tr("Cells and Column Data")); m_cellsDragBehaviour->addItem(tr("Cells and Column Data"));
m_cellsDragBehaviour->setCurrentIndex(m_pref->getDragCellsBehaviour()); m_cellsDragBehaviour->setCurrentIndex(m_pref->getDragCellsBehaviour());
ignoreAlphaonColumn1CB->setChecked(m_pref->isIgnoreAlphaonColumn1Enabled()); ignoreAlphaonColumn1CB->setChecked(m_pref->isIgnoreAlphaonColumn1Enabled());
showKeyframesOnCellAreaCB->setChecked(m_pref->isShowKeyframesOnXsheetCellAreaEnabled());
//--- Animation ------------------------------ //--- Animation ------------------------------
QStringList list; QStringList list;
@ -1416,11 +1425,12 @@ PreferencesPopup::PreferencesPopup()
xsheetFrameLay->addWidget(m_cellsDragBehaviour, 2, 1); xsheetFrameLay->addWidget(m_cellsDragBehaviour, 2, 1);
xsheetFrameLay->addWidget(ignoreAlphaonColumn1CB, 3, 0, 1, 2); xsheetFrameLay->addWidget(ignoreAlphaonColumn1CB, 3, 0, 1, 2);
xsheetFrameLay->addWidget(showKeyframesOnCellAreaCB, 4, 0, 1, 2);
} }
xsheetFrameLay->setColumnStretch(0, 0); xsheetFrameLay->setColumnStretch(0, 0);
xsheetFrameLay->setColumnStretch(1, 0); xsheetFrameLay->setColumnStretch(1, 0);
xsheetFrameLay->setColumnStretch(2, 1); xsheetFrameLay->setColumnStretch(2, 1);
xsheetFrameLay->setRowStretch(4, 1); xsheetFrameLay->setRowStretch(5, 1);
xsheetBox->setLayout(xsheetFrameLay); xsheetBox->setLayout(xsheetFrameLay);
stackedWidget->addWidget(xsheetBox); stackedWidget->addWidget(xsheetBox);
@ -1628,6 +1638,7 @@ PreferencesPopup::PreferencesPopup()
ret = ret && connect(ignoreAlphaonColumn1CB, SIGNAL(stateChanged(int)), this, SLOT(onIgnoreAlphaonColumn1Changed(int))); ret = ret && connect(ignoreAlphaonColumn1CB, SIGNAL(stateChanged(int)), this, SLOT(onIgnoreAlphaonColumn1Changed(int)));
ret = ret && connect(m_xsheetStep, SIGNAL(editingFinished()), SLOT(onXsheetStepChanged())); ret = ret && connect(m_xsheetStep, SIGNAL(editingFinished()), SLOT(onXsheetStepChanged()));
ret = ret && connect(m_cellsDragBehaviour, SIGNAL(currentIndexChanged(int)), SLOT(onDragCellsBehaviourChanged(int))); ret = ret && connect(m_cellsDragBehaviour, SIGNAL(currentIndexChanged(int)), SLOT(onDragCellsBehaviourChanged(int)));
ret = ret && connect(showKeyframesOnCellAreaCB, SIGNAL(stateChanged(int)), this, SLOT(onShowKeyframesOnCellAreaChanged(int)));
//--- Animation ---------------------- //--- Animation ----------------------
ret = ret && connect(m_keyframeType, SIGNAL(currentIndexChanged(int)), SLOT(onKeyframeTypeChanged(int))); ret = ret && connect(m_keyframeType, SIGNAL(currentIndexChanged(int)), SLOT(onKeyframeTypeChanged(int)));

View file

@ -167,6 +167,7 @@ private slots:
void onShowRasterImageDarkenBlendedInViewerChanged(int index); void onShowRasterImageDarkenBlendedInViewerChanged(int index);
void onShowFrameNumberWithLettersChanged(int index); void onShowFrameNumberWithLettersChanged(int index);
void onPaletteTypeForRasterColorModelChanged(int index); void onPaletteTypeForRasterColorModelChanged(int index);
void onShowKeyframesOnCellAreaChanged(int);
}; };
//********************************************************************************** //**********************************************************************************

View file

@ -797,26 +797,27 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated)
} }
// smart tab // smart tab
int smartTabPosOffset = (Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled()) ? 31 : 20;
if (!cellSelection->isEmpty() && !m_viewer->areSoundCellsSelected()) { if (!cellSelection->isEmpty() && !m_viewer->areSoundCellsSelected()) {
m_levelExtenderRect = QRect(xS1 - 20, yS1 + 1, 19, 8); m_levelExtenderRect = QRect(xS1 - smartTabPosOffset, yS1 + 1, 19, 8);
p.setPen(Qt::black); p.setPen(Qt::black);
p.setBrush(SmartTabColor); p.setBrush(SmartTabColor);
p.drawRoundRect(m_levelExtenderRect, 30, 75); p.drawRoundRect(m_levelExtenderRect, 30, 75);
QColor color = ((rS1 + 1 - offset) % distance != 0) ? m_viewer->getLightLineColor() : m_viewer->getMarkerLineColor(); QColor color = ((rS1 + 1 - offset) % distance != 0) ? m_viewer->getLightLineColor() : m_viewer->getMarkerLineColor();
p.setPen(color); p.setPen(color);
p.drawLine(xS1 - 20, yS1 + 1, xS1 - 1, yS1 + 1); p.drawLine(xS1 - smartTabPosOffset, yS1 + 1, xS1 - 1, yS1 + 1);
// upper-directional smart tab // upper-directional smart tab
if (isCtrlPressed && if (isCtrlPressed &&
rS0 > 0 && rS0 > 0 &&
!m_viewer->areCellsSelectedEmpty()) { !m_viewer->areCellsSelectedEmpty()) {
m_upperLevelExtenderRect = QRect(xS1 - 20, yS0 - 8, 19, 8); m_upperLevelExtenderRect = QRect(xS1 - smartTabPosOffset, yS0 - 8, 19, 8);
p.setPen(Qt::black); p.setPen(Qt::black);
p.setBrush(SmartTabColor); p.setBrush(SmartTabColor);
p.drawRoundRect(m_upperLevelExtenderRect, 30, 75); p.drawRoundRect(m_upperLevelExtenderRect, 30, 75);
QColor color = ((rS0 - offset) % distance != 0) ? m_viewer->getLightLineColor() : m_viewer->getMarkerLineColor(); QColor color = ((rS0 - offset) % distance != 0) ? m_viewer->getLightLineColor() : m_viewer->getMarkerLineColor();
p.setPen(color); p.setPen(color);
p.drawLine(xS1 - 20, yS0, xS0 + 20, yS0); p.drawLine(xS1 - smartTabPosOffset, yS0, xS1 - 1, yS0);
} }
p.setBrush(Qt::NoBrush); p.setBrush(Qt::NoBrush);
@ -970,8 +971,10 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference)
int x = m_viewer->columnToX(col); int x = m_viewer->columnToX(col);
int y = m_viewer->rowToY(row); int y = m_viewer->rowToY(row);
QRect rect = QRect(x + 1, y + 1, ColumnWidth - 1, RowHeight - 1); QRect rect = QRect(x + 1, y + 1, ColumnWidth - 1, RowHeight - 1);
if (cell.isEmpty()) { // vuol dire che la precedente non e' vuota if (cell.isEmpty()) { // draw end-of-level mark of which the previous cell is not empty
p.setPen(XsheetGUI::LevelEndCrossColor); QColor levelEndColor = m_viewer->getTextColor();
levelEndColor.setAlphaF(0.3);
p.setPen(levelEndColor);
p.drawLine(rect.topLeft(), rect.bottomRight()); p.drawLine(rect.topLeft(), rect.bottomRight());
p.drawLine(rect.topRight(), rect.bottomLeft()); p.drawLine(rect.topRight(), rect.bottomLeft());
return; return;
@ -1008,7 +1011,7 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference)
//draw dot line if the column is locked //draw dot line if the column is locked
TXshColumn *column = xsh->getColumn(col); TXshColumn *column = xsh->getColumn(col);
if (column->isLocked()) { if (column->isLocked()) {
p.setPen(QPen(Qt::gray, 2, Qt::DotLine)); p.setPen(QPen(cellColor, 2, Qt::DotLine));
p.drawLine(x + 3, y, x + 3, y + RowHeight); p.drawLine(x + 3, y, x + 3, y + RowHeight);
} }
// draw "end of the level" // draw "end of the level"
@ -1036,6 +1039,14 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference)
QRect nameRect = rect.adjusted(7, 4, -6, 0); QRect nameRect = rect.adjusted(7, 4, -6, 0);
if (Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled())
{
TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col));
int r0, r1;
if (pegbar && pegbar->getKeyframeRange(r0,r1))
nameRect.adjust(0, 0, -9, 0);
}
//draw text in red if the file does not exist //draw text in red if the file does not exist
bool isRed = false; bool isRed = false;
TXshSimpleLevel *sl = cell.getSimpleLevel(); TXshSimpleLevel *sl = cell.getSimpleLevel();
@ -1182,8 +1193,10 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, bool isReference)
int x = m_viewer->columnToX(col); int x = m_viewer->columnToX(col);
int y = m_viewer->rowToY(row); int y = m_viewer->rowToY(row);
QRect rect = QRect(x + 1, y + 1, ColumnWidth - 1, RowHeight - 1); QRect rect = QRect(x + 1, y + 1, ColumnWidth - 1, RowHeight - 1);
if (cell.isEmpty()) { // vuol dire che la precedente non e' vuota if (cell.isEmpty()) { // draw end-of-level mark of which the previous cell is not empty
p.setPen(XsheetGUI::LevelEndCrossColor); QColor levelEndColor = m_viewer->getTextColor();
levelEndColor.setAlphaF(0.3);
p.setPen(levelEndColor);
p.drawLine(rect.topLeft(), rect.bottomRight()); p.drawLine(rect.topLeft(), rect.bottomRight());
p.drawLine(rect.topRight(), rect.bottomLeft()); p.drawLine(rect.topRight(), rect.bottomLeft());
return; return;
@ -1203,7 +1216,7 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, bool isReference)
TXshColumn *column = xsh->getColumn(col); TXshColumn *column = xsh->getColumn(col);
if (column->isLocked()) { if (column->isLocked()) {
p.setPen(QPen(Qt::gray, 2, Qt::DotLine)); p.setPen(QPen(cellColor, 2, Qt::DotLine));
p.drawLine(x + 3, y, x + 3, y + RowHeight); p.drawLine(x + 3, y, x + 3, y + RowHeight);
} }
@ -1286,12 +1299,16 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, bool isReference)
void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated) void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated)
{ {
int r0, r1, c0, c1; // range di righe e colonne visibili int r0, r1, c0, c1; // range of visible rows and columns
r0 = m_viewer->yToRow(toBeUpdated.top()); r0 = m_viewer->yToRow(toBeUpdated.top());
r1 = m_viewer->yToRow(toBeUpdated.bottom()); r1 = m_viewer->yToRow(toBeUpdated.bottom());
c0 = m_viewer->xToColumn(toBeUpdated.left()); c0 = m_viewer->xToColumn(toBeUpdated.left());
c1 = m_viewer->xToColumn(toBeUpdated.right()); c1 = m_viewer->xToColumn(toBeUpdated.right());
static QPixmap selectedKey = QPixmap(":Resources/selected_key.bmp");
static QPixmap key = QPixmap(":Resources/key.bmp");
int keyPixOffset = (RowHeight - key.height()) / 2;
TXsheet *xsh = m_viewer->getXsheet(); TXsheet *xsh = m_viewer->getXsheet();
ColumnFan *columnFan = xsh->getColumnFan(); ColumnFan *columnFan = xsh->getColumnFan();
int col; int col;
@ -1310,48 +1327,59 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated)
int row; int row;
row0 = tmax(row0, r0); row0 = tmax(row0, r0);
row1 = tmin(row1, r1); row1 = tmin(row1, r1);
/*- first, draw key segments -*/
p.setPen(m_viewer->getTextColor());
int x_line = x + ColumnWidth - 8;
for (row = row0; row <= row1; row++) { for (row = row0; row <= row1; row++) {
int y = m_viewer->rowToY(row); int hr0, hr1;
int r0, r1;
double e0, e1; double e0, e1;
p.setPen(Qt::black); if (pegbar->getKeyframeSpan(row, hr0, e0, hr1, e1)) {
int y0 = m_viewer->rowToY(hr0+1) - keyPixOffset;
int y1 = m_viewer->rowToY(hr1) + keyPixOffset;
p.drawLine(x_line, y0, x_line, y1);
if (hr1 - hr0 > 4) {
int rh0, rh1;
if (getEaseHandles(hr0, hr1, e0, e1, rh0, rh1)) {
int e0Y = m_viewer->rowToY(rh0) + keyPixOffset;
drawArrow(p, QPointF(x_line - 4, e0Y + 2),
QPointF(x_line + 4, e0Y + 2),
QPointF(x_line, e0Y + 6),
true, m_viewer->getLightLineColor(), m_viewer->getTextColor());
int e1Y = m_viewer->rowToY(rh1 + 1) - keyPixOffset;
drawArrow(p, QPointF(x_line - 4, e1Y - 2),
QPointF(x_line + 4, e1Y - 2),
QPointF(x_line, e1Y - 6),
true, m_viewer->getLightLineColor(), m_viewer->getTextColor());
}
}
// jump to next segment
row = hr1-1;
}
else if (pegbar->isKeyframe(row) && pegbar->isKeyframe(row+1)) {
int y0 = m_viewer->rowToY(row + 1);
p.drawLine(x_line, y0 - keyPixOffset, x_line, y0 + keyPixOffset);
}
}
/*- then draw keyframe pixmaps -*/
int x1 = x + ColumnWidth - 13;
for (row = row0; row <= row1; row++) {
int y = m_viewer->rowToY(row)+1;
p.setPen(m_viewer->getTextColor());
if (pegbar->isKeyframe(row)) { if (pegbar->isKeyframe(row)) {
if (m_viewer->getKeyframeSelection() && if (m_viewer->getKeyframeSelection() &&
m_viewer->getKeyframeSelection()->isSelected(row, col)) { m_viewer->getKeyframeSelection()->isSelected(row, col)) {
// keyframe selezionato // keyframe selezionato
static QPixmap selectedKey = QPixmap(":Resources/selected_key.bmp"); p.drawPixmap(x1, y + keyPixOffset, selectedKey);
p.drawPixmap(x + ColumnWidth - 11, y, selectedKey);
} else { } else {
// keyframe non selezionato // keyframe non selezionato
static QPixmap key = QPixmap(":Resources/key.bmp"); p.drawPixmap(x1, y + keyPixOffset, key);
p.drawPixmap(x + ColumnWidth - 11, y, key);
} }
} else if (pegbar->getKeyframeSpan(row, r0, e0, r1, e1)) { }
// sono fra due keyframe: devo disegnare la linea e i bilancini
int y1 = m_viewer->rowToY(r1 + 1);
int x1 = x + ColumnWidth - 6;
p.drawLine(x + ColumnWidth - 6, y, x + ColumnWidth - 6, y1);
if (r1 - r0 > 4) {
int rh0, rh1;
#ifndef STUDENT
if (getEaseHandles(r0, r1, e0, e1, rh0, rh1)) {
int e0Y = m_viewer->rowToY(rh0);
drawArrow(p, QPointF(x1 - 4, e0Y + 2),
QPointF(x1 + 4, e0Y + 2),
QPointF(x1, e0Y + 6),
true, m_viewer->getLightLineColor());
int e1Y = m_viewer->rowToY(rh1 + 1);
drawArrow(p, QPointF(x1 - 4, e1Y - 2),
QPointF(x1 + 4, e1Y - 2),
QPointF(x1, e1Y - 6),
true, m_viewer->getLightLineColor());
}
#endif
}
}
} }
int y1 = m_viewer->rowToY(row1 + 1); int y1 = m_viewer->rowToY(row1 + 1);
int x1 = x + ColumnWidth - 11;
if (!emptyKeyframeRange && row0 <= row1 + 1) { if (!emptyKeyframeRange && row0 <= row1 + 1) {
// c'e' piu' di un keyframe // c'e' piu' di un keyframe
// disegno il bottone per il ciclo // disegno il bottone per il ciclo
@ -1377,7 +1405,7 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated)
int qy = y1 + 12; int qy = y1 + 12;
int zig = 2; int zig = 2;
int qx = x1 + 5; int qx = x1 + 5;
p.setPen(Qt::black); p.setPen(m_viewer->getTextColor());
p.drawLine(qx, qy, qx - zig, qy + zig); p.drawLine(qx, qy, qx - zig, qy + zig);
while (qy < ymax) { while (qy < ymax) {
p.drawLine(qx - zig, qy + zig, qx + zig, qy + 3 * zig); p.drawLine(qx - zig, qy + zig, qx + zig, qy + 3 * zig);
@ -1485,7 +1513,8 @@ void CellArea::paintEvent(QPaintEvent *event)
p.fillRect(toBeUpdated, QBrush(m_viewer->getEmptyCellColor())); p.fillRect(toBeUpdated, QBrush(m_viewer->getEmptyCellColor()));
drawCells(p, toBeUpdated); drawCells(p, toBeUpdated);
//drawKeyframe(p, toBeUpdated); if (Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled())
drawKeyframe(p, toBeUpdated);
drawNotes(p, toBeUpdated); drawNotes(p, toBeUpdated);
if (getDragTool()) if (getDragTool())
@ -1518,6 +1547,15 @@ public:
} }
void redo() const { undo(); } void redo() const { undo(); }
int getSize() const { return sizeof *this; } int getSize() const { return sizeof *this; }
QString getHistoryString()
{
return QObject::tr("Toggle cycle of %1").arg(QString::fromStdString(m_pegbar->getName()));
}
int getHistoryType()
{
return HistoryType::Xsheet;
}
}; };
//---------------------------------------------------------- //----------------------------------------------------------
@ -1581,7 +1619,47 @@ void CellArea::mousePressEvent(QMouseEvent *event)
TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col)); TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col));
m_viewer->getKeyframeSelection()->selectNone(); if (Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled())
{
int k0, k1;
bool isKeyFrameArea = (pegbar && pegbar->getKeyframeRange(k0, k1) &&
(k1 > k0 || k0 == row) && k0 <= row && row <= k1 + 1 &&
ColumnWidth - 13 <= x && x <= ColumnWidth)
? true
: false;
if (isKeyFrameArea)
{ // They are in the keyframe selection
if (pegbar->isKeyframe(row))// in the keyframe
{
m_viewer->setCurrentRow(row); //If you click on the key, change the current row as well
setDragTool(XsheetGUI::DragTool::makeKeyframeMoverTool(m_viewer));
}
else
{
int r0, r1;
double e0, e1;
int rh0, rh1;
if (pegbar->getKeyframeSpan(row, r0, e0, r1, e1) &&
getEaseHandles(r0, r1, e0, e1, rh0, rh1))
{
if (rh0 == row) // in a keyframe handle
setDragTool(XsheetGUI::DragTool::makeKeyFrameHandleMoverTool(m_viewer, true, r0));
else if (rh1 == row) // in a keyframe handle
setDragTool(XsheetGUI::DragTool::makeKeyFrameHandleMoverTool(m_viewer, false, r1));
}
if (row == k1 + 1) // in the cycle toggle
{
pegbar->enableCycle(!pegbar->isCycleEnabled());
TUndoManager::manager()->add(new CycleUndo(pegbar, this));
}
}
m_viewer->dragToolClick(event);
event->accept();
update();
return;
}
}
if ((!xsh->getCell(row, col).isEmpty()) && x < 6) { if ((!xsh->getCell(row, col).isEmpty()) && x < 6) {
TXshColumn *column = xsh->getColumn(col); TXshColumn *column = xsh->getColumn(col);
@ -1669,7 +1747,30 @@ void CellArea::mouseMoveEvent(QMouseEvent *event)
isZeraryColumn = (!zeraryColumn) ? false : true; isZeraryColumn = (!zeraryColumn) ? false : true;
} }
if ((!xsh->getCell(row, col).isEmpty() || isSoundColumn) && x < 6) TStageObject* pegbar = xsh->getStageObject(m_viewer->getObjectId(col));
int k0, k1;
if (Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled() && pegbar && pegbar->getKeyframeRange(k0, k1) && k0 <= row && row <= k1 + 1 && ColumnWidth - 13 <= x && x <= ColumnWidth)
{
if (pegbar->isKeyframe(row)) // key frame
m_tooltip = tr("Click to select keyframe, drag to move it");
else
{
int r0, r1;
double e0, e1;
int rh0, rh1;
if (pegbar->getKeyframeSpan(row, r0, e0, r1, e1) &&
getEaseHandles(r0, r1, e0, e1, rh0, rh1))
{ // triangles in the segment betweeen key frames
if (rh0 == row)
m_tooltip = tr("Click and drag to set the acceleration range");
else if (rh1 == row)
m_tooltip = tr("Click and drag to set the deceleration range");
}
if (row == k1 + 1) // cycle toggle of key frames
m_tooltip = tr("Set the cycle of previous keyframes");
}
}
else if((!xsh->getCell(row, col).isEmpty() || isSoundColumn) && x < 6)
m_tooltip = tr("Click and drag to move the selection"); m_tooltip = tr("Click and drag to move the selection");
else if (isZeraryColumn) else if (isZeraryColumn)
m_tooltip = QString::fromStdWString(column->getZeraryFxColumn()->getZeraryColumnFx()->getZeraryFx()->getName()); m_tooltip = QString::fromStdWString(column->getZeraryFxColumn()->getZeraryColumnFx()->getZeraryFx()->getName());
@ -1743,6 +1844,22 @@ void CellArea::mouseDoubleClickEvent(QMouseEvent *event)
TObjectHandle *oh = TApp::instance()->getCurrentObject(); TObjectHandle *oh = TApp::instance()->getCurrentObject();
oh->setObjectId(m_viewer->getObjectId(col)); oh->setObjectId(m_viewer->getObjectId(col));
if (Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled())
{
int x = pos.x - m_viewer->columnToX(col);
TStageObject* pegbar = m_viewer->getXsheet()->getStageObject(m_viewer->getObjectId(col));
bool isKeyFrameArea = (pegbar && pegbar->isKeyframe(row) && ColumnWidth - 13 <= x && x <= ColumnWidth)
? true
: false;
//If you are in the keyframe area, open a function editor
if (isKeyFrameArea)
{
QAction *action = CommandManager::instance()->getAction(MI_OpenFunctionEditor);
action->trigger();
return;
}
}
if (col == -1) if (col == -1)
return; return;
@ -1786,11 +1903,35 @@ void CellArea::contextMenuEvent(QContextMenuEvent *event)
int y1 = m_viewer->rowToY(row) - 1; int y1 = m_viewer->rowToY(row) - 1;
int x = pos.x - x0; int x = pos.x - x0;
TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col)); TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col));
int k0, k1;
int r0, r1, c0, c1; int r0, r1, c0, c1;
if (col >= 0) if (col >= 0)
m_viewer->getCellSelection()->getSelectedCells(r0, c0, r1, c1); m_viewer->getCellSelection()->getSelectedCells(r0, c0, r1, c1);
if (col >= 0 && //Non e' la colonna di camera if (pegbar && pegbar->getKeyframeRange(k0, k1) && k0 <= row && row <= k1 &&
ColumnWidth - 13 <= x && x <= ColumnWidth &&
Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled())
{
TStageObjectId objectId;
if (col<0) objectId = TStageObjectId::CameraId(0);
else
{ //Set the current column and the current object
objectId = TStageObjectId::ColumnId(col);
m_viewer->setCurrentColumn(col);
}
TApp::instance()->getCurrentObject()->setObjectId(objectId);
m_viewer->setCurrentRow(row);
if (pegbar->isKeyframe(row))
{ //clicking on keyframes
TKeyframeSelection* keyframeSelection = m_viewer->getKeyframeSelection();
keyframeSelection->select(row, col);
keyframeSelection->makeCurrent();
createKeyMenu(menu);
}
else if (!xsh->getColumn(col) || !xsh->getColumn(col)->isLocked())// on the line between two keyframes
createKeyLineMenu(menu, row, col);
}
else if (col >= 0 && //Non e' la colonna di camera
m_viewer->getCellSelection()->isCellSelected(row, col) && //La cella e' selezionata m_viewer->getCellSelection()->isCellSelected(row, col) && //La cella e' selezionata
(abs(r1 - r0) > 0 || abs(c1 - c0) > 0)) //Il numero di celle selezionate e' maggiore di 1 (abs(r1 - r0) > 0 || abs(c1 - c0) > 0)) //Il numero di celle selezionate e' maggiore di 1
{ //Sono su una selezione di celle { //Sono su una selezione di celle
@ -1818,6 +1959,7 @@ void CellArea::contextMenuEvent(QContextMenuEvent *event)
else else
createCellMenu(menu, false); createCellMenu(menu, false);
} }
if (!menu.isEmpty()) if (!menu.isEmpty())
menu.exec(event->globalPos()); menu.exec(event->globalPos());
} }
@ -1989,6 +2131,7 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected)
menu.addAction(cmdManager->getAction(MI_RevertToCleanedUp)); menu.addAction(cmdManager->getAction(MI_RevertToCleanedUp));
if (selectionContainLevelImage(m_viewer->getCellSelection(), m_viewer->getXsheet())) if (selectionContainLevelImage(m_viewer->getCellSelection(), m_viewer->getXsheet()))
menu.addAction(cmdManager->getAction(MI_RevertToLastSaved)); menu.addAction(cmdManager->getAction(MI_RevertToLastSaved));
menu.addAction(cmdManager->getAction(MI_SetKeyframes));
} }
menu.addSeparator(); menu.addSeparator();

View file

@ -64,7 +64,7 @@ class CellArea : public QWidget
QString m_tooltip; QString m_tooltip;
RenameCellField *m_renameCell; RenameCellField *m_renameCell;
void drawCells(QPainter &p, const QRect toBeUpdated); void drawCells(QPainter &p, const QRect toBeUpdated);
void drawLevelCell(QPainter &p, int row, int col, bool isReference = false); void drawLevelCell(QPainter &p, int row, int col, bool isReference = false);
void drawSoundTextCell(QPainter &p, int row, int col); void drawSoundTextCell(QPainter &p, int row, int col);
@ -123,6 +123,7 @@ protected slots:
void onStepChanged(QAction *); void onStepChanged(QAction *);
// replace level with another level in the cast // replace level with another level in the cast
void onReplaceByCastedLevel(QAction *action); void onReplaceByCastedLevel(QAction *action);
}; };
} // namespace XsheetGUI } // namespace XsheetGUI

View file

@ -1173,7 +1173,7 @@ public:
QString getHistoryString() QString getHistoryString()
{ {
return QObject::tr("Set Keyframe : %1 at Frame %2") return QObject::tr("Move keyframe handle : %1 Handle of the keyframe %2")
.arg(QString::fromStdString(m_objId.toString())) .arg(QString::fromStdString(m_objId.toString()))
.arg(QString::number(m_row + 1)); .arg(QString::number(m_row + 1));
} }

View file

@ -111,8 +111,6 @@ const QColor XsheetBGColor(212, 208, 200);
//Xsheet horizontal lines //Xsheet horizontal lines
const QColor NormalHLineColor(146, 144, 146); const QColor NormalHLineColor(146, 144, 146);
const QColor IntervalHLineColor(0, 255, 246); const QColor IntervalHLineColor(0, 255, 246);
//"X" mark at the end of the level
const QColor LevelEndCrossColor(50, 50, 50);
//column header //column header
const QColor EmptyColumnHeadColor(200, 200, 200); const QColor EmptyColumnHeadColor(200, 200, 200);

View file

@ -227,7 +227,7 @@ bool Preferences::LevelFormat::matches(const TFilePath &fp) const
//********************************************************************************** //**********************************************************************************
Preferences::Preferences() Preferences::Preferences()
: m_units("mm"), m_cameraUnits("inch"), m_scanLevelType("tif"), m_defLevelWidth(0.0), m_defLevelHeight(0.0), m_defLevelDpi(0.0), m_iconSize(160, 120), m_blankColor(TPixel32::White), m_frontOnionColor(TPixel::Black), m_backOnionColor(TPixel::Black), m_transpCheckBg(TPixel::White), m_transpCheckInk(TPixel::Black), m_transpCheckPaint(TPixel(127, 127, 127)), m_autosavePeriod(15), m_chunkSize(10), m_rasterOptimizedMemory(0), m_shrink(1), m_step(1), m_blanksCount(0), m_keyframeType(3), m_animationStep(1), m_textureSize(0), m_xsheetStep(10), m_shmmax(-1), m_shmseg(-1), m_shmall(-1), m_shmmni(-1), m_onionPaperThickness(50), m_currentLanguage(0), m_currentStyleSheet(0), m_undoMemorySize(100), m_dragCellsBehaviour(0), m_lineTestFpsCapture(25), m_defLevelType(0), m_autocreationType(1), m_autoExposeEnabled(true), m_autoCreateEnabled(true), m_subsceneFolderEnabled(true), m_generatedMovieViewEnabled(true), m_xsheetAutopanEnabled(true), m_ignoreAlphaonColumn1Enabled(false), m_rewindAfterPlaybackEnabled(true), m_fitToFlipbookEnabled(false), m_previewAlwaysOpenNewFlipEnabled(false), m_autosaveEnabled(false), m_defaultViewerEnabled(false), m_saveUnpaintedInCleanup(true), m_askForOverrideRender(true), m_automaticSVNFolderRefreshEnabled(true), m_SVNEnabled(false), m_minimizeSaveboxAfterEditing(true), m_levelsBackupEnabled(false), m_sceneNumberingEnabled(false), m_animationSheetEnabled(false), m_inksOnly(false), m_fillOnlySavebox(false), m_show0ThickLines(true), m_regionAntialias(false), m_viewerBGColor(128, 128, 128, 255), m_previewBGColor(64, 64, 64, 255), m_chessboardColor1(180, 180, 180), m_chessboardColor2(230, 230, 230), m_showRasterImagesDarkenBlendedInViewer(false), m_actualPixelViewOnSceneEditingMode(false), m_viewerZoomCenter(0), m_initialLoadTlvCachingBehavior(0), m_removeSceneNumberFromLoadedLevelName(false), m_replaceAfterSaveLevelAs(true), m_showFrameNumberWithLetters(false), m_levelNameOnEachMarker(false), m_columnIconLoadingPolicy((int)LoadAtOnce), m_moveCurrentFrameByClickCellArea(true), m_onionSkinEnabled(false), m_multiLayerStylePickerEnabled(false), m_paletteTypeOnLoadRasterImageAsColorModel(0) : m_units("mm"), m_cameraUnits("inch"), m_scanLevelType("tif"), m_defLevelWidth(0.0), m_defLevelHeight(0.0), m_defLevelDpi(0.0), m_iconSize(160, 120), m_blankColor(TPixel32::White), m_frontOnionColor(TPixel::Black), m_backOnionColor(TPixel::Black), m_transpCheckBg(TPixel::White), m_transpCheckInk(TPixel::Black), m_transpCheckPaint(TPixel(127, 127, 127)), m_autosavePeriod(15), m_chunkSize(10), m_rasterOptimizedMemory(0), m_shrink(1), m_step(1), m_blanksCount(0), m_keyframeType(3), m_animationStep(1), m_textureSize(0), m_xsheetStep(10), m_shmmax(-1), m_shmseg(-1), m_shmall(-1), m_shmmni(-1), m_onionPaperThickness(50), m_currentLanguage(0), m_currentStyleSheet(0), m_undoMemorySize(100), m_dragCellsBehaviour(0), m_lineTestFpsCapture(25), m_defLevelType(0), m_autocreationType(1), m_autoExposeEnabled(true), m_autoCreateEnabled(true), m_subsceneFolderEnabled(true), m_generatedMovieViewEnabled(true), m_xsheetAutopanEnabled(true), m_ignoreAlphaonColumn1Enabled(false), m_rewindAfterPlaybackEnabled(true), m_fitToFlipbookEnabled(false), m_previewAlwaysOpenNewFlipEnabled(false), m_autosaveEnabled(false), m_defaultViewerEnabled(false), m_saveUnpaintedInCleanup(true), m_askForOverrideRender(true), m_automaticSVNFolderRefreshEnabled(true), m_SVNEnabled(false), m_minimizeSaveboxAfterEditing(true), m_levelsBackupEnabled(false), m_sceneNumberingEnabled(false), m_animationSheetEnabled(false), m_inksOnly(false), m_fillOnlySavebox(false), m_show0ThickLines(true), m_regionAntialias(false), m_viewerBGColor(128, 128, 128, 255), m_previewBGColor(64, 64, 64, 255), m_chessboardColor1(180, 180, 180), m_chessboardColor2(230, 230, 230), m_showRasterImagesDarkenBlendedInViewer(false), m_actualPixelViewOnSceneEditingMode(false), m_viewerZoomCenter(0), m_initialLoadTlvCachingBehavior(0), m_removeSceneNumberFromLoadedLevelName(false), m_replaceAfterSaveLevelAs(true), m_showFrameNumberWithLetters(false), m_levelNameOnEachMarker(false), m_columnIconLoadingPolicy((int)LoadAtOnce), m_moveCurrentFrameByClickCellArea(true), m_onionSkinEnabled(false), m_multiLayerStylePickerEnabled(false), m_paletteTypeOnLoadRasterImageAsColorModel(0), m_showKeyframesOnXsheetCellArea(true)
{ {
TCamera camera; TCamera camera;
m_defLevelType = PLI_XSHLEVEL; m_defLevelType = PLI_XSHLEVEL;
@ -423,6 +423,7 @@ Preferences::Preferences()
getValue(*m_settings, "onionSkinEnabled", m_onionSkinEnabled); getValue(*m_settings, "onionSkinEnabled", m_onionSkinEnabled);
getValue(*m_settings, "multiLayerStylePickerEnabled", m_multiLayerStylePickerEnabled); getValue(*m_settings, "multiLayerStylePickerEnabled", m_multiLayerStylePickerEnabled);
getValue(*m_settings, "paletteTypeOnLoadRasterImageAsColorModel", m_paletteTypeOnLoadRasterImageAsColorModel); getValue(*m_settings, "paletteTypeOnLoadRasterImageAsColorModel", m_paletteTypeOnLoadRasterImageAsColorModel);
getValue(*m_settings, "showKeyframesOnXsheetCellArea", m_showKeyframesOnXsheetCellArea);
} }
//----------------------------------------------------------------- //-----------------------------------------------------------------
@ -480,6 +481,14 @@ void Preferences::enableIgnoreAlphaonColumn1(bool on)
m_settings->setValue("ignoreAlphaonColumn1Enabled", on ? "1" : "0"); m_settings->setValue("ignoreAlphaonColumn1Enabled", on ? "1" : "0");
} }
//------------------------------------------------------------------
void Preferences::enableShowKeyframesOnXsheetCellArea(bool on)
{
m_showKeyframesOnXsheetCellArea = on;
m_settings->setValue("showKeyframesOnXsheetCellArea", on ? "1" : "0");
}
//----------------------------------------------------------------- //-----------------------------------------------------------------
void Preferences::enableRewindAfterPlayback(bool on) void Preferences::enableRewindAfterPlayback(bool on)