Merge pull request #2734 from manongjohn/keyframe_shortcuts
Add next/prev keyframe shortcuts
This commit is contained in:
commit
011361bdba
11 changed files with 147 additions and 8 deletions
|
@ -232,6 +232,8 @@
|
||||||
<separator/>
|
<separator/>
|
||||||
<command>MI_PrevDrawing</command>
|
<command>MI_PrevDrawing</command>
|
||||||
<command>MI_NextDrawing</command>
|
<command>MI_NextDrawing</command>
|
||||||
|
<command>MI_PrevKeyframe</command>
|
||||||
|
<command>MI_NextKeyframe</command>
|
||||||
<separator/>
|
<separator/>
|
||||||
<command>MI_Link</command>
|
<command>MI_Link</command>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -103,6 +103,13 @@ public:
|
||||||
int getStartFrame() { return m_frame0; }
|
int getStartFrame() { return m_frame0; }
|
||||||
int getEndFrame() { return m_frame1; }
|
int getEndFrame() { return m_frame1; }
|
||||||
|
|
||||||
|
void emitTriggerNextKeyframe(QWidget *panel) {
|
||||||
|
emit triggerNextKeyframe(panel);
|
||||||
|
}
|
||||||
|
void emitTriggerPrevKeyframe(QWidget *panel) {
|
||||||
|
emit triggerPrevKeyframe(panel);
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void nextFrame(TFrameId = 0);
|
void nextFrame(TFrameId = 0);
|
||||||
|
@ -118,6 +125,9 @@ signals:
|
||||||
void frameTypeChanged();
|
void frameTypeChanged();
|
||||||
void isPlayingStatusChanged();
|
void isPlayingStatusChanged();
|
||||||
|
|
||||||
|
void triggerNextKeyframe(QWidget *panel);
|
||||||
|
void triggerPrevKeyframe(QWidget *panel);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *event) override;
|
void timerEvent(QTimerEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -95,6 +95,9 @@ public slots:
|
||||||
void setCurve(TDoubleParam *curve);
|
void setCurve(TDoubleParam *curve);
|
||||||
void setFrame(double frame);
|
void setFrame(double frame);
|
||||||
|
|
||||||
|
void onNextKeyframe(QWidget *panel);
|
||||||
|
void onPrevKeyframe(QWidget *panel);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void onValueFieldChanged();
|
void onValueFieldChanged();
|
||||||
|
|
|
@ -43,6 +43,8 @@ class DVAPI KeyframeNavigator : public QToolBar {
|
||||||
|
|
||||||
TFrameHandle *m_frameHandle;
|
TFrameHandle *m_frameHandle;
|
||||||
|
|
||||||
|
QWidget *m_panel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KeyframeNavigator(QWidget *parent = 0, TFrameHandle *frameHandle = 0);
|
KeyframeNavigator(QWidget *parent = 0, TFrameHandle *frameHandle = 0);
|
||||||
|
|
||||||
|
@ -63,6 +65,9 @@ public slots:
|
||||||
}
|
}
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
void onNextKeyframe(QWidget *panel);
|
||||||
|
void onPrevKeyframe(QWidget *panel);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void toggleKeyAct() {
|
void toggleKeyAct() {
|
||||||
toggle();
|
toggle();
|
||||||
|
|
|
@ -1904,6 +1904,9 @@ void MainWindow::defineActions() {
|
||||||
createAction(MI_NextStep, tr("Next Step"), "", PlaybackCommandType);
|
createAction(MI_NextStep, tr("Next Step"), "", PlaybackCommandType);
|
||||||
createAction(MI_PrevStep, tr("Prev Step"), "", PlaybackCommandType);
|
createAction(MI_PrevStep, tr("Prev Step"), "", PlaybackCommandType);
|
||||||
|
|
||||||
|
createAction(MI_NextKeyframe, tr("Next Key"), "Ctrl+.", MenuXsheetCommandType);
|
||||||
|
createAction(MI_PrevKeyframe, tr("Prev Key"), "Ctrl+,", MenuXsheetCommandType);
|
||||||
|
|
||||||
createRGBAAction(MI_RedChannel, tr("Red Channel"), "");
|
createRGBAAction(MI_RedChannel, tr("Red Channel"), "");
|
||||||
createRGBAAction(MI_GreenChannel, tr("Green Channel"), "");
|
createRGBAAction(MI_GreenChannel, tr("Green Channel"), "");
|
||||||
createRGBAAction(MI_BlueChannel, tr("Blue Channel"), "");
|
createRGBAAction(MI_BlueChannel, tr("Blue Channel"), "");
|
||||||
|
|
|
@ -1334,8 +1334,10 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
|
||||||
addMenuItem(playMenu, MI_PrevStep);
|
addMenuItem(playMenu, MI_PrevStep);
|
||||||
addMenuItem(playMenu, MI_NextStep);
|
addMenuItem(playMenu, MI_NextStep);
|
||||||
playMenu->addSeparator();
|
playMenu->addSeparator();
|
||||||
addMenuItem(playMenu, MI_NextDrawing);
|
|
||||||
addMenuItem(playMenu, MI_PrevDrawing);
|
addMenuItem(playMenu, MI_PrevDrawing);
|
||||||
|
addMenuItem(playMenu, MI_NextDrawing);
|
||||||
|
addMenuItem(playMenu, MI_PrevKeyframe);
|
||||||
|
addMenuItem(playMenu, MI_NextKeyframe);
|
||||||
playMenu->addSeparator();
|
playMenu->addSeparator();
|
||||||
addMenuItem(playMenu, MI_Link);
|
addMenuItem(playMenu, MI_Link);
|
||||||
|
|
||||||
|
|
|
@ -210,6 +210,8 @@
|
||||||
#define MI_PrevDrawing "MI_PrevDrawing"
|
#define MI_PrevDrawing "MI_PrevDrawing"
|
||||||
#define MI_NextStep "MI_NextStep"
|
#define MI_NextStep "MI_NextStep"
|
||||||
#define MI_PrevStep "MI_PrevStep"
|
#define MI_PrevStep "MI_PrevStep"
|
||||||
|
#define MI_NextKeyframe "MI_NextKeyframe"
|
||||||
|
#define MI_PrevKeyframe "MI_PrevKeyframe"
|
||||||
|
|
||||||
#define MI_RedChannel "MI_RedChannel"
|
#define MI_RedChannel "MI_RedChannel"
|
||||||
#define MI_GreenChannel "MI_GreenChannel"
|
#define MI_GreenChannel "MI_GreenChannel"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Tnz6 includes
|
// Tnz6 includes
|
||||||
#include "menubarcommandids.h"
|
#include "menubarcommandids.h"
|
||||||
#include "tapp.h"
|
#include "tapp.h"
|
||||||
|
#include "sceneviewer.h"
|
||||||
|
|
||||||
// TnzQt includes
|
// TnzQt includes
|
||||||
#include "toonzqt/menubarcommand.h"
|
#include "toonzqt/menubarcommand.h"
|
||||||
|
@ -16,6 +17,8 @@
|
||||||
#include "toonz/tcolumnhandle.h"
|
#include "toonz/tcolumnhandle.h"
|
||||||
#include "toonz/preferences.h"
|
#include "toonz/preferences.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
//**********************************************************************************
|
//**********************************************************************************
|
||||||
// Commands definition
|
// Commands definition
|
||||||
//**********************************************************************************
|
//**********************************************************************************
|
||||||
|
@ -127,6 +130,64 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class NextKeyframeCommand final : public MenuItemHandler {
|
||||||
|
public:
|
||||||
|
NextKeyframeCommand() : MenuItemHandler(MI_NextKeyframe) {}
|
||||||
|
|
||||||
|
void execute() override {
|
||||||
|
QString navControlList[6] = {"LevelPalette", "StudioPalette",
|
||||||
|
"FunctionEditor", "FxSettings",
|
||||||
|
"ComboViewer", "SceneViewer"};
|
||||||
|
|
||||||
|
QWidget *panel = QApplication::focusWidget();
|
||||||
|
if (!panel) panel = TApp::instance()->getActiveViewer();
|
||||||
|
while (panel) {
|
||||||
|
QString pane = panel->objectName();
|
||||||
|
if (panel->windowType() == Qt::WindowType::SubWindow ||
|
||||||
|
panel->windowType() == Qt::WindowType::Tool) {
|
||||||
|
if (std::find(navControlList, navControlList + 6, pane) !=
|
||||||
|
(navControlList + 6)) {
|
||||||
|
TApp::instance()->getCurrentFrame()->emitTriggerNextKeyframe(panel);
|
||||||
|
break;
|
||||||
|
} else
|
||||||
|
panel = TApp::instance()->getActiveViewer()->parentWidget();
|
||||||
|
} else
|
||||||
|
panel = panel->parentWidget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class PrevKeyframeCommand final : public MenuItemHandler {
|
||||||
|
public:
|
||||||
|
PrevKeyframeCommand() : MenuItemHandler(MI_PrevKeyframe) {}
|
||||||
|
|
||||||
|
void execute() override {
|
||||||
|
QString navControlList[6] = {"LevelPalette", "StudioPalette",
|
||||||
|
"FunctionEditor", "FxSettings",
|
||||||
|
"ComboViewer", "SceneViewer"};
|
||||||
|
|
||||||
|
QWidget *panel = QApplication::focusWidget();
|
||||||
|
if (!panel) panel = TApp::instance()->getActiveViewer();
|
||||||
|
while (panel) {
|
||||||
|
QString pane = panel->objectName();
|
||||||
|
if (panel->windowType() == Qt::WindowType::SubWindow ||
|
||||||
|
panel->windowType() == Qt::WindowType::Tool) {
|
||||||
|
if (std::find(navControlList, navControlList + 6, pane) !=
|
||||||
|
(navControlList + 6)) {
|
||||||
|
TApp::instance()->getCurrentFrame()->emitTriggerPrevKeyframe(panel);
|
||||||
|
break;
|
||||||
|
} else
|
||||||
|
panel = TApp::instance()->getActiveViewer()->parentWidget();
|
||||||
|
} else
|
||||||
|
panel = panel->parentWidget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//**********************************************************************************
|
//**********************************************************************************
|
||||||
// Commands instantiation
|
// Commands instantiation
|
||||||
//**********************************************************************************
|
//**********************************************************************************
|
||||||
|
@ -154,3 +215,6 @@ NextDrawingCommand nextDrawingCommand;
|
||||||
PrevDrawingCommand prevDrawingCommand;
|
PrevDrawingCommand prevDrawingCommand;
|
||||||
NextStepCommand nextStepCommand;
|
NextStepCommand nextStepCommand;
|
||||||
PrevStepCommand prevStepCommand;
|
PrevStepCommand prevStepCommand;
|
||||||
|
|
||||||
|
NextKeyframeCommand nextKeyframeCommand;
|
||||||
|
PrevKeyframeCommand prevKeyframeCommand;
|
||||||
|
|
|
@ -150,6 +150,16 @@ void FunctionToolbar::setFrame(double frame) {
|
||||||
m_valueFld->setValue(0);
|
m_valueFld->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FunctionToolbar::onNextKeyframe(QWidget *panel) {
|
||||||
|
m_keyframeNavigator->onNextKeyframe(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
void FunctionToolbar::onPrevKeyframe(QWidget *panel) {
|
||||||
|
m_keyframeNavigator->onPrevKeyframe(panel);
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
void FunctionToolbar::onValueFieldChanged() {
|
void FunctionToolbar::onValueFieldChanged() {
|
||||||
|
|
|
@ -172,11 +172,11 @@ FunctionViewer::FunctionViewer(QWidget *parent, Qt::WFlags flags)
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
ret = ret && connect(m_toolbar, SIGNAL(numericalColumnToggled()), this,
|
ret = ret && connect(m_toolbar, SIGNAL(numericalColumnToggled()), this,
|
||||||
SLOT(toggleMode()));
|
SLOT(toggleMode()));
|
||||||
ret = ret && connect(ftModel, SIGNAL(activeChannelsChanged()),
|
ret = ret && connect(ftModel, SIGNAL(activeChannelsChanged()),
|
||||||
m_functionGraph, SLOT(update()));
|
m_functionGraph, SLOT(update()));
|
||||||
ret = ret && connect(ftModel, SIGNAL(activeChannelsChanged()),
|
ret = ret && connect(ftModel, SIGNAL(activeChannelsChanged()),
|
||||||
m_numericalColumns, SLOT(updateAll()));
|
m_numericalColumns, SLOT(updateAll()));
|
||||||
ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_treeView,
|
ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_treeView,
|
||||||
SLOT(update()));
|
SLOT(update()));
|
||||||
ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_functionGraph,
|
ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_functionGraph,
|
||||||
SLOT(update()));
|
SLOT(update()));
|
||||||
|
@ -241,11 +241,19 @@ void FunctionViewer::showEvent(QShowEvent *) {
|
||||||
ret;
|
ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_frameHandle)
|
if (m_frameHandle) {
|
||||||
ret = connect(m_frameHandle, SIGNAL(frameSwitched()), this,
|
ret = connect(m_frameHandle, SIGNAL(frameSwitched()), this,
|
||||||
SLOT(propagateExternalSetFrame())) &&
|
SLOT(propagateExternalSetFrame())) &&
|
||||||
ret;
|
ret;
|
||||||
|
|
||||||
|
ret = connect(m_frameHandle, SIGNAL(triggerNextKeyframe(QWidget *)),
|
||||||
|
m_toolbar, SLOT(onNextKeyframe(QWidget *))) &&
|
||||||
|
ret;
|
||||||
|
ret = connect(m_frameHandle, SIGNAL(triggerPrevKeyframe(QWidget *)),
|
||||||
|
m_toolbar, SLOT(onPrevKeyframe(QWidget *))) &&
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_objectHandle) {
|
if (m_objectHandle) {
|
||||||
ret = connect(m_objectHandle, SIGNAL(objectSwitched()), this,
|
ret = connect(m_objectHandle, SIGNAL(objectSwitched()), this,
|
||||||
SLOT(onStageObjectSwitched())) &&
|
SLOT(onStageObjectSwitched())) &&
|
||||||
|
@ -303,7 +311,10 @@ void FunctionViewer::showEvent(QShowEvent *) {
|
||||||
|
|
||||||
void FunctionViewer::hideEvent(QHideEvent *) {
|
void FunctionViewer::hideEvent(QHideEvent *) {
|
||||||
if (m_xshHandle) m_xshHandle->disconnect(this);
|
if (m_xshHandle) m_xshHandle->disconnect(this);
|
||||||
if (m_frameHandle) m_frameHandle->disconnect(this);
|
if (m_frameHandle) {
|
||||||
|
m_frameHandle->disconnect(this);
|
||||||
|
m_frameHandle->disconnect(m_toolbar);
|
||||||
|
}
|
||||||
if (m_objectHandle) m_objectHandle->disconnect(this);
|
if (m_objectHandle) m_objectHandle->disconnect(this);
|
||||||
if (m_fxHandle) m_fxHandle->disconnect(this);
|
if (m_fxHandle) m_fxHandle->disconnect(this);
|
||||||
if (m_sceneHandle) m_sceneHandle->disconnect(this);
|
if (m_sceneHandle) m_sceneHandle->disconnect(this);
|
||||||
|
@ -595,7 +606,7 @@ void FunctionViewer::onStageObjectChanged(bool isDragging) {
|
||||||
void FunctionViewer::onFxSwitched() {
|
void FunctionViewer::onFxSwitched() {
|
||||||
TFx *fx = m_fxHandle->getFx();
|
TFx *fx = m_fxHandle->getFx();
|
||||||
TZeraryColumnFx *zfx = dynamic_cast<TZeraryColumnFx *>(fx);
|
TZeraryColumnFx *zfx = dynamic_cast<TZeraryColumnFx *>(fx);
|
||||||
if (zfx) fx = zfx->getZeraryFx();
|
if (zfx) fx = zfx->getZeraryFx();
|
||||||
static_cast<FunctionTreeModel *>(m_treeView->model())->setCurrentFx(fx);
|
static_cast<FunctionTreeModel *>(m_treeView->model())->setCurrentFx(fx);
|
||||||
m_treeView->updateAll();
|
m_treeView->updateAll();
|
||||||
m_functionGraph->update();
|
m_functionGraph->update();
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "toonz/txshcolumn.h"
|
#include "toonz/txshcolumn.h"
|
||||||
#include "toonz/tstageobjectkeyframe.h"
|
#include "toonz/tstageobjectkeyframe.h"
|
||||||
#include "toonz/stageobjectutil.h"
|
#include "toonz/stageobjectutil.h"
|
||||||
|
#include "toonz/tapplication.h"
|
||||||
|
|
||||||
#include "tpixelutils.h"
|
#include "tpixelutils.h"
|
||||||
#include "tfx.h"
|
#include "tfx.h"
|
||||||
|
@ -35,7 +36,7 @@ using namespace std;
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
KeyframeNavigator::KeyframeNavigator(QWidget *parent, TFrameHandle *frameHandle)
|
KeyframeNavigator::KeyframeNavigator(QWidget *parent, TFrameHandle *frameHandle)
|
||||||
: QToolBar(parent), m_frameHandle(frameHandle) {
|
: QToolBar(parent), m_frameHandle(frameHandle), m_panel(0) {
|
||||||
setLayoutDirection(Qt::LeftToRight);
|
setLayoutDirection(Qt::LeftToRight);
|
||||||
|
|
||||||
setIconSize(QSize(18, 18));
|
setIconSize(QSize(18, 18));
|
||||||
|
@ -124,6 +125,22 @@ void KeyframeNavigator::showEvent(QShowEvent *e) {
|
||||||
update();
|
update();
|
||||||
if (!m_frameHandle) return;
|
if (!m_frameHandle) return;
|
||||||
connect(m_frameHandle, SIGNAL(frameSwitched()), this, SLOT(update()));
|
connect(m_frameHandle, SIGNAL(frameSwitched()), this, SLOT(update()));
|
||||||
|
|
||||||
|
connect(m_frameHandle, SIGNAL(triggerNextKeyframe(QWidget *)), this,
|
||||||
|
SLOT(onNextKeyframe(QWidget *)));
|
||||||
|
connect(m_frameHandle, SIGNAL(triggerPrevKeyframe(QWidget *)), this,
|
||||||
|
SLOT(onPrevKeyframe(QWidget *)));
|
||||||
|
if (!m_panel || m_panel == nullptr) {
|
||||||
|
QWidget *panel = this->parentWidget();
|
||||||
|
while (panel) {
|
||||||
|
if (panel->windowType() == Qt::WindowType::SubWindow ||
|
||||||
|
panel->windowType() == Qt::WindowType::Tool) {
|
||||||
|
m_panel = panel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
panel = panel->parentWidget();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -133,6 +150,16 @@ void KeyframeNavigator::hideEvent(QHideEvent *e) {
|
||||||
disconnect(m_frameHandle);
|
disconnect(m_frameHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeyframeNavigator::onNextKeyframe(QWidget *panel) {
|
||||||
|
if (!m_panel || m_panel != panel) return;
|
||||||
|
toggleNextKeyAct();
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeyframeNavigator::onPrevKeyframe(QWidget *panel) {
|
||||||
|
if (!m_panel || m_panel != panel) return;
|
||||||
|
togglePrevKeyAct();
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// ViewerKeyframeNavigator
|
// ViewerKeyframeNavigator
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue