2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef KEYFRAMENAVIGATOR_INCLUDED
|
|
|
|
#define KEYFRAMENAVIGATOR_INCLUDED
|
|
|
|
|
|
|
|
#include "tpalette.h"
|
|
|
|
#include "tfxutil.h"
|
|
|
|
|
|
|
|
#include "toonz/tstageobject.h"
|
|
|
|
#include "toonz/tframehandle.h"
|
|
|
|
#include "toonz/tobjecthandle.h"
|
|
|
|
#include "toonz/txsheethandle.h"
|
|
|
|
#include "toonz/tpalettehandle.h"
|
|
|
|
#include "toonz/tfxhandle.h"
|
|
|
|
#include "toonz/tcolumnfx.h"
|
|
|
|
|
|
|
|
#include <QToolBar>
|
|
|
|
|
|
|
|
#undef DVAPI
|
|
|
|
#undef DVVAR
|
|
|
|
#ifdef TOONZQT_EXPORTS
|
|
|
|
#define DVAPI DV_EXPORT_API
|
|
|
|
#define DVVAR DV_EXPORT_VAR
|
|
|
|
#else
|
|
|
|
#define DVAPI DV_IMPORT_API
|
|
|
|
#define DVVAR DV_IMPORT_VAR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class TStyleSelection;
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// KeyframeNavigator
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI KeyframeNavigator : public QToolBar {
|
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QAction *m_actPreviewKey;
|
|
|
|
QAction *m_actKeyNo;
|
|
|
|
QAction *m_actKeyPartial;
|
|
|
|
QAction *m_actKeyTotal;
|
|
|
|
QAction *m_actNextKey;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TFrameHandle *m_frameHandle;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2019-08-27 15:55:22 +12:00
|
|
|
QWidget *m_panel;
|
|
|
|
|
2016-03-19 06:57:51 +13:00
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
KeyframeNavigator(QWidget *parent = 0, TFrameHandle *frameHandle = 0);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int getCurrentFrame() const {
|
|
|
|
if (!m_frameHandle) return -1;
|
|
|
|
return m_frameHandle->getFrameIndex();
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void setCurrentFrame(int frame) {
|
|
|
|
m_frameHandle->setFrameIndex(frame);
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void setFrameHandle(TFrameHandle *frameHandle) {
|
|
|
|
m_frameHandle = frameHandle;
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
void update();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2019-08-27 15:55:22 +12:00
|
|
|
void onNextKeyframe(QWidget *panel);
|
|
|
|
void onPrevKeyframe(QWidget *panel);
|
|
|
|
|
2016-03-19 06:57:51 +13:00
|
|
|
protected slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void toggleKeyAct() {
|
|
|
|
toggle();
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
void toggleNextKeyAct() {
|
|
|
|
goNext();
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
void togglePrevKeyAct() {
|
|
|
|
goPrev();
|
|
|
|
update();
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-15 18:43:10 +12:00
|
|
|
virtual bool hasNext() const = 0;
|
|
|
|
virtual bool hasPrev() const = 0;
|
|
|
|
virtual bool hasKeyframes() const = 0;
|
|
|
|
virtual bool isKeyframe() const = 0;
|
|
|
|
virtual bool isFullKeyframe() const = 0;
|
|
|
|
virtual void toggle() = 0;
|
|
|
|
virtual void goNext() = 0;
|
|
|
|
virtual void goPrev() = 0;
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void showEvent(QShowEvent *) override;
|
|
|
|
void hideEvent(QHideEvent *) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// ViewerKeyframeNavigator
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI ViewerKeyframeNavigator final : public KeyframeNavigator {
|
2016-06-15 18:43:10 +12:00
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TObjectHandle *m_objectHandle;
|
|
|
|
TXsheetHandle *m_xsheetHandle;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
ViewerKeyframeNavigator(QWidget *parent, TFrameHandle *frameHandle = 0)
|
|
|
|
: KeyframeNavigator(parent, frameHandle)
|
|
|
|
, m_objectHandle(0)
|
|
|
|
, m_xsheetHandle(0) {
|
|
|
|
update();
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TObjectHandle *getObjectHandle() const { return m_objectHandle; }
|
|
|
|
TXsheetHandle *getXsheetHandle() const { return m_xsheetHandle; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void setObjectHandle(TObjectHandle *objectHandle) {
|
|
|
|
m_objectHandle = objectHandle;
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
void setXsheetHandle(TXsheetHandle *xsheetHandle) {
|
|
|
|
m_xsheetHandle = xsheetHandle;
|
|
|
|
update();
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-15 18:43:10 +12:00
|
|
|
TStageObject *getStageObject() const;
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasNext() const override;
|
|
|
|
bool hasPrev() const override;
|
|
|
|
bool hasKeyframes() const override;
|
|
|
|
bool isKeyframe() const override;
|
|
|
|
bool isFullKeyframe() const override;
|
|
|
|
void toggle() override;
|
|
|
|
void goNext() override;
|
|
|
|
void goPrev() override;
|
|
|
|
|
|
|
|
void showEvent(QShowEvent *) override;
|
|
|
|
void hideEvent(QHideEvent *) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// PaletteKeyframeNavigator
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI PaletteKeyframeNavigator final : public KeyframeNavigator {
|
2016-06-15 18:43:10 +12:00
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TPaletteHandle *m_paletteHandle;
|
|
|
|
TStyleSelection *m_selection;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
PaletteKeyframeNavigator(QWidget *parent, TFrameHandle *frameHandle = 0)
|
|
|
|
: KeyframeNavigator(parent, frameHandle)
|
|
|
|
, m_paletteHandle(0)
|
|
|
|
, m_selection(0) {
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void setSelection(TStyleSelection *selection) { m_selection = selection; }
|
|
|
|
|
|
|
|
TPalette *getPalette() const {
|
|
|
|
if (!m_paletteHandle) return 0;
|
|
|
|
return m_paletteHandle->getPalette();
|
|
|
|
}
|
|
|
|
int getStyleIndex() const {
|
|
|
|
if (!m_paletteHandle) return 0;
|
|
|
|
return m_paletteHandle->getStyleIndex();
|
|
|
|
}
|
|
|
|
|
|
|
|
TPaletteHandle *getPaletteHandle() const { return m_paletteHandle; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void setPaletteHandle(TPaletteHandle *paletteHandle) {
|
|
|
|
m_paletteHandle = paletteHandle;
|
|
|
|
update();
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasNext() const override;
|
|
|
|
bool hasPrev() const override;
|
|
|
|
bool hasKeyframes() const override;
|
|
|
|
bool isKeyframe() const override;
|
|
|
|
bool isFullKeyframe() const override { return isKeyframe(); }
|
|
|
|
void toggle() override;
|
|
|
|
void goNext() override;
|
|
|
|
void goPrev() override;
|
|
|
|
|
|
|
|
void showEvent(QShowEvent *) override;
|
|
|
|
void hideEvent(QHideEvent *) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// FxKeyframeNavigator
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI FxKeyframeNavigator final : public KeyframeNavigator {
|
2016-06-15 18:43:10 +12:00
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TFxHandle *m_fxHandle;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
FxKeyframeNavigator(QWidget *parent, TFrameHandle *frameHandle = 0)
|
|
|
|
: KeyframeNavigator(parent, frameHandle), m_fxHandle(0) {
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
TFx *getFx() const {
|
|
|
|
if (!m_fxHandle) return 0;
|
|
|
|
TFx *fx = m_fxHandle->getFx();
|
|
|
|
if (TZeraryColumnFx *zfx = dynamic_cast<TZeraryColumnFx *>(fx))
|
|
|
|
fx = zfx->getZeraryFx();
|
|
|
|
return fx;
|
|
|
|
}
|
|
|
|
|
|
|
|
TFxHandle *getFxHandle() const { return m_fxHandle; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void setFxHandle(TFxHandle *fxHandle) {
|
|
|
|
m_fxHandle = fxHandle;
|
|
|
|
update();
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasNext() const override;
|
|
|
|
bool hasPrev() const override;
|
|
|
|
bool hasKeyframes() const override;
|
|
|
|
bool isKeyframe() const override;
|
|
|
|
bool isFullKeyframe() const override;
|
|
|
|
void toggle() override;
|
|
|
|
void goNext() override;
|
|
|
|
void goPrev() override;
|
|
|
|
|
|
|
|
void showEvent(QShowEvent *) override;
|
|
|
|
void hideEvent(QHideEvent *) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|