Toshihiro Shimizu 890ddd
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
Toshihiro Shimizu 890ddd
class TParamSetChange : public TParamChange
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 3bfa54
	std::vector<tparamchange *=""> m_paramChanges;</tparamchange>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TParamSetChange(TParam *param, double firstAffectedFrame, double lastAffectedFrame,
Shinya Kitaoka 3bfa54
		const std::vector<tparamchange *=""> ¶mChanges)</tparamchange>
Toshihiro Shimizu 890ddd
		: TParamChange(param, firstAffectedFrame, lastAffectedFrame, true, false, false), m_paramChanges(paramChanges)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	~TParamSetChange() { clearPointerContainer(m_paramChanges); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	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
Toshihiro Shimizu 890ddd
class DVAPI TParamSet : public TParam
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	PERSIST_DECLARATION(TParamSet)
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 3bfa54
	TParamSet(std::string name = "");
Toshihiro Shimizu 890ddd
	TParamSet(const TParamSet &src);
Toshihiro Shimizu 890ddd
	~TParamSet();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	void addParam(const TParamP ¶m, const std::string &name);
Shinya Kitaoka 3bfa54
	void insertParam(const TParamP ¶m, const std::string &name, int index);
Toshihiro Shimizu 890ddd
	void removeParam(const TParamP ¶m);
Toshihiro Shimizu 890ddd
	void removeAllParam();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int getParamCount() const;
Toshihiro Shimizu 890ddd
	TParamP getParam(int index) const;
Shinya Kitaoka 3bfa54
	std::string getParamName(int index) const;
Shinya Kitaoka 3bfa54
	int getParamIdx(const std::string &name) const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	void getAnimatableParams(std::vector<tparamp> ¶ms, bool recursive = true);</tparamp>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void addObserver(TParamObserver *observer);
Toshihiro Shimizu 890ddd
	void removeObserver(TParamObserver *observer);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void beginParameterChange();
Toshihiro Shimizu 890ddd
	void endParameterChange();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void enableDragging(bool on);
Toshihiro Shimizu 890ddd
	void enableNotification(bool on);
Toshihiro Shimizu 890ddd
	bool isNotificationEnabled() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isAnimatable() const { return true; }
Toshihiro Shimizu 890ddd
	bool isKeyframe(double frame) const;
Toshihiro Shimizu 890ddd
	void deleteKeyframe(double frame);
Toshihiro Shimizu 890ddd
	void clearKeyframes();
Toshihiro Shimizu 890ddd
	void assignKeyframe(
Toshihiro Shimizu 890ddd
		double frame,
Toshihiro Shimizu 890ddd
		const TSmartPointerT<tparam> &src, double srcFrame,</tparam>
Toshihiro Shimizu 890ddd
		bool changedOnly = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void getKeyframes(std::set<double> &frames) const;</double>
Toshihiro Shimizu 890ddd
	int getKeyframeCount() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	double keyframeIndexToFrame(int index) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TParam *clone() const;
Toshihiro Shimizu 890ddd
	virtual void copy(TParam *src);
Toshihiro Shimizu 890ddd
	virtual void loadData(TIStream &);
Toshihiro Shimizu 890ddd
	virtual void saveData(TOStream &);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int getNextKeyframe(double frame) const;
Toshihiro Shimizu 890ddd
	int getPrevKeyframe(double frame) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool hasKeyframes() const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	std::string getValueAlias(double frame, int precision);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	TParamSetImp *m_imp;
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
Toshihiro Shimizu 890ddd
class TPointParamObserver
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TPointParamObserver() {}
Toshihiro Shimizu 890ddd
	virtual ~TPointParamObserver() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	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
Toshihiro Shimizu 890ddd
class DVAPI TPointParam : public TParamSet
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	PERSIST_DECLARATION(TPointParam)
Toshihiro Shimizu 890ddd
	TPointParamImp *m_data;
Toshihiro Shimizu 890ddd
	bool m_from_plugin;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TPointParam(const TPointD &p = TPointD(), bool from_plugin = false);
Toshihiro Shimizu 890ddd
	TPointParam(const TPointParam &src);
Toshihiro Shimizu 890ddd
	~TPointParam();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TParam *clone() const { return new TPointParam(*this); }
Toshihiro Shimizu 890ddd
	void copy(TParam *src);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPointD getDefaultValue() const;
Toshihiro Shimizu 890ddd
	TPointD getValue(double frame) const;
Toshihiro Shimizu 890ddd
	bool setValue(double frame, const TPointD &p);
Toshihiro Shimizu 890ddd
	void setDefaultValue(const TPointD &p);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void loadData(TIStream &is);
Toshihiro Shimizu 890ddd
	void saveData(TOStream &os);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TDoubleParamP &getX();
Toshihiro Shimizu 890ddd
	TDoubleParamP &getY();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	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
Toshihiro Shimizu 890ddd
class TPixelParamObserver
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TPixelParamObserver() {}
Toshihiro Shimizu 890ddd
	virtual ~TPixelParamObserver() {}
Toshihiro Shimizu 890ddd
	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
Toshihiro Shimizu 890ddd
class DVAPI TPixelParam : public TParamSet
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	PERSIST_DECLARATION(TPixelParam)
Toshihiro Shimizu 890ddd
	TPixelParamImp *m_data;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TPixelParam(const TPixel32 &pix = TPixel32::Black);
Toshihiro Shimizu 890ddd
	TPixelParam(const TPixelParam &);
Toshihiro Shimizu 890ddd
	~TPixelParam();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TParam *clone() const { return new TPixelParam(*this); }
Toshihiro Shimizu 890ddd
	void copy(TParam *src);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPixel32 getDefaultValue() const;
Toshihiro Shimizu 890ddd
	TPixelD getValueD(double frame) const;
Toshihiro Shimizu 890ddd
	TPixel32 getValue(double frame) const;
Toshihiro Shimizu 890ddd
	TPixel64 getValue64(double frame) const;
Toshihiro Shimizu 890ddd
	TPixel32 getPremultipliedValue(double frame) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setDefaultValue(const TPixel32 &pix);
Toshihiro Shimizu 890ddd
	bool setValueD(double frame, const TPixelD &pix);
Toshihiro Shimizu 890ddd
	bool setValue(double frame, const TPixel32 &pix);
Toshihiro Shimizu 890ddd
	bool setValue64(double frame, const TPixel64 &pix);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void enableMatte(bool on);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isMatteEnabled() const;
Toshihiro Shimizu 890ddd
	void loadData(TIStream &is);
Toshihiro Shimizu 890ddd
	void saveData(TOStream &os);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TDoubleParamP &getRed();
Toshihiro Shimizu 890ddd
	TDoubleParamP &getGreen();
Toshihiro Shimizu 890ddd
	TDoubleParamP &getBlue();
Toshihiro Shimizu 890ddd
	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
Toshihiro Shimizu 890ddd
class TRangeParamObserver
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TRangeParamObserver() {}
Toshihiro Shimizu 890ddd
	virtual ~TRangeParamObserver() {}
Toshihiro Shimizu 890ddd
	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
Toshihiro Shimizu 890ddd
class DVAPI TRangeParam : public TParamSet
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	PERSIST_DECLARATION(TRangeParam)
Toshihiro Shimizu 890ddd
	TRangeParamImp *m_data;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TRangeParam(const DoublePair &range = DoublePair(0, 0));
Toshihiro Shimizu 890ddd
	TRangeParam(const TRangeParam &src);
Toshihiro Shimizu 890ddd
	~TRangeParam();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TParam *clone() const { return new TRangeParam(*this); }
Toshihiro Shimizu 890ddd
	void copy(TParam *src);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	DoublePair getDefaultValue() const;
Toshihiro Shimizu 890ddd
	DoublePair getValue(double frame) const;
Toshihiro Shimizu 890ddd
	bool setValue(double frame, const DoublePair &v);
Toshihiro Shimizu 890ddd
	void setDefaultValue(const DoublePair &v);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void loadData(TIStream &is);
Toshihiro Shimizu 890ddd
	void saveData(TOStream &os);
Toshihiro Shimizu 890ddd
	int getKeyframeCount() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TDoubleParamP &getMin();
Toshihiro Shimizu 890ddd
	TDoubleParamP &getMax();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DEFINE_PARAM_SMARTPOINTER(TRangeParam, DoublePair)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif