Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TDOUBLEKEYFRAME_INCLUDED
Toshihiro Shimizu 890ddd
#define TDOUBLEKEYFRAME_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tgeometry.h"
Toshihiro Shimizu 890ddd
#include "tfilepath.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TPARAM_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TOStream;
Toshihiro Shimizu 890ddd
class TIStream;
Toshihiro Shimizu 890ddd
class TUnit;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TDoubleKeyframe
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	enum Type {
Toshihiro Shimizu 890ddd
		None = 0,
Toshihiro Shimizu 890ddd
		Constant,
Toshihiro Shimizu 890ddd
		Linear,
Toshihiro Shimizu 890ddd
		SpeedInOut,
Toshihiro Shimizu 890ddd
		EaseInOut,
Toshihiro Shimizu 890ddd
		EaseInOutPercentage,
Toshihiro Shimizu 890ddd
		Exponential,
Toshihiro Shimizu 890ddd
		Expression,
Toshihiro Shimizu 890ddd
		File,
Toshihiro Shimizu 890ddd
		SimilarShape
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	class DVAPI FileParams
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
	public:
Toshihiro Shimizu 890ddd
		TFilePath m_path;
Toshihiro Shimizu 890ddd
		int m_fieldIndex;
Toshihiro Shimizu 890ddd
		FileParams() : m_path(), m_fieldIndex(0) {}
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static inline bool isKeyframeBased(int type)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return type < TDoubleKeyframe::Expression && type != TDoubleKeyframe::SimilarShape;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//private:
Toshihiro Shimizu 890ddd
	Type m_type;
Toshihiro Shimizu 890ddd
	Type m_prevType;
Toshihiro Shimizu 890ddd
	double m_frame;
Toshihiro Shimizu 890ddd
	double m_value;
Toshihiro Shimizu 890ddd
	bool m_isKeyframe;
Toshihiro Shimizu 890ddd
	int m_step;
Toshihiro Shimizu 890ddd
	TPointD m_speedIn, m_speedOut;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool m_linkedHandles;
Shinya Kitaoka 3bfa54
	std::string m_expressionText;
Toshihiro Shimizu 890ddd
	FileParams m_fileParams;
Shinya Kitaoka 3bfa54
	std::string m_unitName; // file/expression only
Toshihiro Shimizu 890ddd
	double m_similarShapeOffset;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void saveData(TOStream &os) const;
Toshihiro Shimizu 890ddd
	void loadData(TIStream &is);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TDoubleKeyframe(double frame = 0, double value = 0);
Toshihiro Shimizu 890ddd
	~TDoubleKeyframe();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool operator<(const TDoubleKeyframe &k) const { return m_frame < k.m_frame; }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif