tahoma2d/toonz/sources/include/tdoublekeyframe.h

76 lines
1.4 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef TDOUBLEKEYFRAME_INCLUDED
#define TDOUBLEKEYFRAME_INCLUDED
#include "tgeometry.h"
#include "tfilepath.h"
#undef DVAPI
#undef DVVAR
#ifdef TPARAM_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
class TOStream;
class TIStream;
class TUnit;
2016-06-15 18:43:10 +12:00
class DVAPI TDoubleKeyframe {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
enum Type {
None = 0,
Constant,
Linear,
SpeedInOut,
EaseInOut,
EaseInOutPercentage,
Exponential,
Expression,
File,
SimilarShape
};
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
class DVAPI FileParams {
public:
TFilePath m_path;
int m_fieldIndex;
FileParams() : m_path(), m_fieldIndex(0) {}
};
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
static inline bool isKeyframeBased(int type) {
return type < TDoubleKeyframe::Expression &&
type != TDoubleKeyframe::SimilarShape;
}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
// private:
Type m_type;
Type m_prevType;
double m_frame;
double m_value;
bool m_isKeyframe;
int m_step;
TPointD m_speedIn, m_speedOut;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
bool m_linkedHandles;
std::string m_expressionText;
FileParams m_fileParams;
std::string m_unitName; // file/expression only
double m_similarShapeOffset;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void saveData(TOStream &os) const;
void loadData(TIStream &is);
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TDoubleKeyframe(double frame = 0, double value = 0);
~TDoubleKeyframe();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
bool operator<(const TDoubleKeyframe &k) const { return m_frame < k.m_frame; }
2016-03-19 06:57:51 +13:00
};
#endif