Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TPARAMSET_H
Toshihiro Shimizu 890ddd
#define TPARAMSET_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tparam.h"
Toshihiro Shimizu 890ddd
#include "tparamchange.h"
Toshihiro Shimizu 890ddd
#include "tgeometry.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tpixel.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
// forward declaration
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TParamSetImp;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TParamSetChange : public TParamChange {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  std::vector<tparamchange *=""> m_paramChanges;</tparamchange>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TParamSetChange(TParam *param, double firstAffectedFrame,
Shinya Kitaoka 120a6e
                  double lastAffectedFrame,
Shinya Kitaoka 120a6e
                  const std::vector<tparamchange *=""> ¶mChanges)</tparamchange>
Shinya Kitaoka 120a6e
      : TParamChange(param, firstAffectedFrame, lastAffectedFrame, true, false,
Shinya Kitaoka 120a6e
                     false)
Shinya Kitaoka 120a6e
      , m_paramChanges(paramChanges) {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~TParamSetChange() { clearPointerContainer(m_paramChanges); }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TParamChange *clone() const { return new TParamSetChange(*this); }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
#pragma warning(push)
Toshihiro Shimizu 890ddd
#pragma warning(disable : 4251)
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TParamSet : public TParam {
Shinya Kitaoka 120a6e
  PERSIST_DECLARATION(TParamSet)
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TParamSet(std::string name = "");
Shinya Kitaoka 120a6e
  TParamSet(const TParamSet &src);
Shinya Kitaoka 120a6e
  ~TParamSet();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void addParam(const TParamP ¶m, const std::string &name);
Shinya Kitaoka 120a6e
  void insertParam(const TParamP ¶m, const std::string &name, int index);
Shinya Kitaoka 120a6e
  void removeParam(const TParamP ¶m);
Shinya Kitaoka 120a6e
  void removeAllParam();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int getParamCount() const;
Shinya Kitaoka 120a6e
  TParamP getParam(int index) const;
Shinya Kitaoka 120a6e
  std::string getParamName(int index) const;
Shinya Kitaoka 120a6e
  int getParamIdx(const std::string &name) const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void getAnimatableParams(std::vector<tparamp> ¶ms, bool recursive = true);</tparamp>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void addObserver(TParamObserver *observer) override;
Shinya Kitaoka 473e70
  void removeObserver(TParamObserver *observer) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void beginParameterChange();
Shinya Kitaoka 120a6e
  void endParameterChange();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void enableDragging(bool on);
Shinya Kitaoka 473e70
  void enableNotification(bool on) override;
Shinya Kitaoka 473e70
  bool isNotificationEnabled() const override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  bool isAnimatable() const override { return true; }
Shinya Kitaoka 473e70
  bool isKeyframe(double frame) const override;
Shinya Kitaoka 473e70
  void deleteKeyframe(double frame) override;
Shinya Kitaoka 473e70
  void clearKeyframes() override;
Shinya Kitaoka 120a6e
  void assignKeyframe(double frame, const TSmartPointerT<tparam> &src,</tparam>
Shinya Kitaoka 473e70
                      double srcFrame, bool changedOnly = false) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void getKeyframes(std::set<double> &frames) const override;</double>
Shinya Kitaoka 120a6e
  int getKeyframeCount() const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  double keyframeIndexToFrame(int index) const override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  TParam *clone() const override;
Shinya Kitaoka 473e70
  void copy(TParam *src) override;
Shinya Kitaoka 473e70
  void loadData(TIStream &) override;
Shinya Kitaoka 473e70
  void saveData(TOStream &) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  int getNextKeyframe(double frame) const override;
Shinya Kitaoka 473e70
  int getPrevKeyframe(double frame) const override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  bool hasKeyframes() const override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  std::string getValueAlias(double frame, int precision) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  TParamSetImp *m_imp = nullptr;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
#pragma warning(pop)
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TSmartPointerT<tparamset>;</tparamset>
Toshihiro Shimizu 890ddd
template class DVAPI TDerivedSmartPointerT<tparamset, tparam="">;</tparamset,>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef TDerivedSmartPointerT<tparamset, tparam=""> TParamSetP;</tparamset,>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TPointParamObserver {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TPointParamObserver() {}
Shinya Kitaoka 120a6e
  virtual ~TPointParamObserver() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void onChange(const TParamChange &) = 0;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
class TPointParam;
Toshihiro Shimizu 890ddd
template class DVAPI TPersistDeclarationT<tpointparam>;</tpointparam>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TPointParamImp;
Toshihiro Shimizu 890ddd
class TDoubleParamP;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TPointParam : public TParamSet {
Shinya Kitaoka 120a6e
  PERSIST_DECLARATION(TPointParam)
Shinya Kitaoka 120a6e
  TPointParamImp *m_data;
Shinya Kitaoka 120a6e
  bool m_from_plugin;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TPointParam(const TPointD &p = TPointD(), bool from_plugin = false);
Shinya Kitaoka 120a6e
  TPointParam(const TPointParam &src);
Shinya Kitaoka 120a6e
  ~TPointParam();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  TParam *clone() const override { return new TPointParam(*this); }
Shinya Kitaoka 473e70
  void copy(TParam *src) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointD getDefaultValue() const;
Shinya Kitaoka 120a6e
  TPointD getValue(double frame) const;
Shinya Kitaoka 120a6e
  bool setValue(double frame, const TPointD &p);
Shinya Kitaoka 120a6e
  void setDefaultValue(const TPointD &p);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void loadData(TIStream &is) override;
Shinya Kitaoka 473e70
  void saveData(TOStream &os) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TDoubleParamP &getX();
Shinya Kitaoka 120a6e
  TDoubleParamP &getY();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool isFromPlugin() const { return m_from_plugin; }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DEFINE_PARAM_SMARTPOINTER(TPointParam, TPointD)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
class TPixelParam;
Toshihiro Shimizu 890ddd
template class DVAPI TPersistDeclarationT<tpixelparam>;</tpixelparam>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TPixelParamObserver {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TPixelParamObserver() {}
Shinya Kitaoka 120a6e
  virtual ~TPixelParamObserver() {}
Shinya Kitaoka 120a6e
  virtual void onChange(const TParamChange &) = 0;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TPixelParamImp;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TPixelParam : public TParamSet {
Shinya Kitaoka 120a6e
  PERSIST_DECLARATION(TPixelParam)
Shinya Kitaoka 120a6e
  TPixelParamImp *m_data;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TPixelParam(const TPixel32 &pix = TPixel32::Black);
Shinya Kitaoka 120a6e
  TPixelParam(const TPixelParam &);
Shinya Kitaoka 120a6e
  ~TPixelParam();
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  TParam *clone() const override { return new TPixelParam(*this); }
Shinya Kitaoka 473e70
  void copy(TParam *src) override;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TPixel32 getDefaultValue() const;
Shinya Kitaoka 120a6e
  TPixelD getValueD(double frame) const;
Shinya Kitaoka 120a6e
  TPixel32 getValue(double frame) const;
Shinya Kitaoka 120a6e
  TPixel64 getValue64(double frame) const;
Shinya Kitaoka 120a6e
  TPixel32 getPremultipliedValue(double frame) const;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setDefaultValue(const TPixel32 &pix);
Shinya Kitaoka 120a6e
  bool setValueD(double frame, const TPixelD &pix);
Shinya Kitaoka 120a6e
  bool setValue(double frame, const TPixel32 &pix);
Shinya Kitaoka 120a6e
  bool setValue64(double frame, const TPixel64 &pix);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void enableMatte(bool on);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  bool isMatteEnabled() const;
Shinya Kitaoka 473e70
  void loadData(TIStream &is) override;
Shinya Kitaoka 473e70
  void saveData(TOStream &os) override;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TDoubleParamP &getRed();
Shinya Kitaoka 120a6e
  TDoubleParamP &getGreen();
Shinya Kitaoka 120a6e
  TDoubleParamP &getBlue();
Shinya Kitaoka 120a6e
  TDoubleParamP &getMatte();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DEFINE_PARAM_SMARTPOINTER(TPixelParam, TPixel32)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TRangeParamObserver {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TRangeParamObserver() {}
Shinya Kitaoka 120a6e
  virtual ~TRangeParamObserver() {}
Shinya Kitaoka 120a6e
  virtual void onChange(const TParamChange &) = 0;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
class TRangeParam;
Toshihiro Shimizu 890ddd
template class DVAPI TPersistDeclarationT<trangeparam>;</trangeparam>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TRangeParamImp;
Toshihiro Shimizu 890ddd
class TDoubleParamP;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TRangeParam : public TParamSet {
Shinya Kitaoka 120a6e
  PERSIST_DECLARATION(TRangeParam)
Shinya Kitaoka 120a6e
  TRangeParamImp *m_data;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TRangeParam(const DoublePair &range = DoublePair(0, 0));
Shinya Kitaoka 120a6e
  TRangeParam(const TRangeParam &src);
Shinya Kitaoka 120a6e
  ~TRangeParam();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  TParam *clone() const override { return new TRangeParam(*this); }
Shinya Kitaoka 473e70
  void copy(TParam *src) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  DoublePair getDefaultValue() const;
Shinya Kitaoka 120a6e
  DoublePair getValue(double frame) const;
Shinya Kitaoka 120a6e
  bool setValue(double frame, const DoublePair &v);
Shinya Kitaoka 120a6e
  void setDefaultValue(const DoublePair &v);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void loadData(TIStream &is) override;
Shinya Kitaoka 473e70
  void saveData(TOStream &os) override;
Shinya Kitaoka 120a6e
  int getKeyframeCount() const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TDoubleParamP &getMin();
Shinya Kitaoka 120a6e
  TDoubleParamP &getMax();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DEFINE_PARAM_SMARTPOINTER(TRangeParam, DoublePair)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif