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
Shinya Kitaoka 120a6e
class DVAPI TDoubleKeyframe {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  enum Type {
Shinya Kitaoka 120a6e
    None = 0,
Shinya Kitaoka 120a6e
    Constant,
Shinya Kitaoka 120a6e
    Linear,
Shinya Kitaoka 120a6e
    SpeedInOut,
Shinya Kitaoka 120a6e
    EaseInOut,
Shinya Kitaoka 120a6e
    EaseInOutPercentage,
Shinya Kitaoka 120a6e
    Exponential,
Shinya Kitaoka 120a6e
    Expression,
Shinya Kitaoka 120a6e
    File,
Shinya Kitaoka 120a6e
    SimilarShape
Shinya Kitaoka 120a6e
  };
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  class DVAPI FileParams {
Shinya Kitaoka 120a6e
  public:
Shinya Kitaoka 120a6e
    TFilePath m_path;
Shinya Kitaoka 120a6e
    int m_fieldIndex;
Shinya Kitaoka 120a6e
    FileParams() : m_path(), m_fieldIndex(0) {}
Shinya Kitaoka 120a6e
  };
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  static inline bool isKeyframeBased(int type) {
Shinya Kitaoka 120a6e
    return type < TDoubleKeyframe::Expression &&
Shinya Kitaoka 120a6e
           type != TDoubleKeyframe::SimilarShape;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // private:
Shinya Kitaoka 120a6e
  Type m_type;
Shinya Kitaoka 120a6e
  Type m_prevType;
Shinya Kitaoka 120a6e
  double m_frame;
Shinya Kitaoka 120a6e
  double m_value;
Shinya Kitaoka 120a6e
  bool m_isKeyframe;
Shinya Kitaoka 120a6e
  int m_step;
Shinya Kitaoka 120a6e
  TPointD m_speedIn, m_speedOut;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool m_linkedHandles;
Shinya Kitaoka 120a6e
  std::string m_expressionText;
Shinya Kitaoka 120a6e
  FileParams m_fileParams;
Shinya Kitaoka 120a6e
  std::string m_unitName;  // file/expression only
Shinya Kitaoka 120a6e
  double m_similarShapeOffset;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void saveData(TOStream &os) const;
Shinya Kitaoka 120a6e
  void loadData(TIStream &is);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TDoubleKeyframe(double frame = 0, double value = 0);
Shinya Kitaoka 120a6e
  ~TDoubleKeyframe();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool operator<(const TDoubleKeyframe &k) const { return m_frame < k.m_frame; }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif