|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TFX_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
#define TFX_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tsmartpointer.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tpersist.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "texception.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "ttile.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tgeometry.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzBase includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tparamchange.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TFX_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 |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Forward declarations
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFxImp;
|
|
Toshihiro Shimizu |
890ddd |
class TFx;
|
|
Toshihiro Shimizu |
890ddd |
class TParam;
|
|
Toshihiro Shimizu |
890ddd |
class TFxAttributes;
|
|
Toshihiro Shimizu |
890ddd |
class TParamContainer;
|
|
Toshihiro Shimizu |
890ddd |
class TParamVar;
|
|
Toshihiro Shimizu |
890ddd |
class TRenderSettings;
|
|
Toshihiro Shimizu |
890ddd |
class TParamUIConcept;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TFxPort
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
friend class TFx;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
TFx *m_owner; //!< This is an input port of m_owner
|
|
Toshihiro Shimizu |
890ddd |
int m_groupIdx; //!< Dynamic group index this belongs to in m_owner (-1 if none)
|
|
Toshihiro Shimizu |
890ddd |
bool m_isControl;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxPort(bool isControl) : m_owner(0), m_groupIdx(-1), m_isControl(isControl) {}
|
|
Toshihiro Shimizu |
890ddd |
virtual ~TFxPort() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual TFx *getFx() const = 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual void setFx(TFx *) = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isConnected() const { return getFx() != 0; }
|
|
Toshihiro Shimizu |
890ddd |
bool isaControlPort() const { return m_isControl; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int getGroupIndex() const { return m_groupIdx; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFx *getOwnerFx() const { return m_owner; }
|
|
Toshihiro Shimizu |
890ddd |
void setOwnerFx(TFx *fx) { m_owner = fx; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// Not copiable
|
|
Toshihiro Shimizu |
890ddd |
TFxPort(const TFxPort &);
|
|
Toshihiro Shimizu |
890ddd |
TFxPort &operator=(const TFxPort &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <class t=""></class>
|
|
Toshihiro Shimizu |
890ddd |
class TFxPortT : public TFxPort
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
friend class TFx;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
T *m_fx;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxPortT(bool isControl = false) : TFxPort(isControl), m_fx(0) {}
|
|
Toshihiro Shimizu |
890ddd |
~TFxPortT()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_fx) {
|
|
Toshihiro Shimizu |
890ddd |
m_fx->removeOutputConnection(this);
|
|
Toshihiro Shimizu |
890ddd |
m_fx->release();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFx *getFx() const { return m_fx; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setFx(TFx *fx)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_fx)
|
|
Toshihiro Shimizu |
890ddd |
m_fx->removeOutputConnection(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (fx == 0) {
|
|
Toshihiro Shimizu |
890ddd |
if (m_fx)
|
|
Toshihiro Shimizu |
890ddd |
m_fx->release();
|
|
Toshihiro Shimizu |
890ddd |
m_fx = 0;
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
T *fxt = dynamic_cast<t *="">(fx);</t>
|
|
Toshihiro Shimizu |
890ddd |
if (!fxt)
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Fx: port type mismatch");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
fxt->addRef();
|
|
Toshihiro Shimizu |
890ddd |
if (m_fx)
|
|
Toshihiro Shimizu |
890ddd |
m_fx->release();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_fx = fxt;
|
|
Toshihiro Shimizu |
890ddd |
m_fx->addOutputConnection(this);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
T *operator->()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(m_fx);
|
|
Toshihiro Shimizu |
890ddd |
return m_fx;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
\brief A TFxPortDynamicGroup represents a group of fx ports with the
|
|
Toshihiro Shimizu |
890ddd |
same name prefix whose ports that are added or removed dynamically by
|
|
Toshihiro Shimizu |
890ddd |
Toonz on user request.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\sa The TFx::dynamicPortsGroup() method.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TFxPortDynamicGroup
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
typedef std::vector<tfxport *=""> PortsContainer;</tfxport>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxPortDynamicGroup(const std::string &portsPrefix, int minPortsCount = 1);
|
|
Toshihiro Shimizu |
890ddd |
~TFxPortDynamicGroup();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! Returns the group's displayed ports prefix (ports added to the group \b must
|
|
Toshihiro Shimizu |
890ddd |
//! have this prefix).
|
|
Toshihiro Shimizu |
890ddd |
const std::string &portsPrefix() const { return m_portsPrefix; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! Returns the minimal number of ports to be displayed in the group. The group
|
|
Toshihiro Shimizu |
890ddd |
//! must not <\B> be initialized in an fx implementation with more ports than
|
|
Toshihiro Shimizu |
890ddd |
//! this number.
|
|
Toshihiro Shimizu |
890ddd |
int minPortsCount() const { return m_minPortsCount; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! Returns the list of ports currently in the group (may contain empty ports).
|
|
Toshihiro Shimizu |
890ddd |
const PortsContainer &ports() const { return m_ports; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! Equivalent to checking the portName prefix against the stored one.
|
|
Toshihiro Shimizu |
890ddd |
bool contains(const std::string &portName) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return (strncmp(m_portsPrefix.c_str(), portName.c_str(), m_portsPrefix.size()) == 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
std::string m_portsPrefix; //!< Name prefix of each stored port
|
|
Toshihiro Shimizu |
890ddd |
int m_minPortsCount; //!< Ports count \a should not be smaller
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
std::vector<tfxport *=""> m_ports; //!< \b Owned ports (deleted on destruction)</tfxport>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
friend class TFx;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Not copyable
|
|
Toshihiro Shimizu |
890ddd |
TFxPortDynamicGroup(const TFxPortDynamicGroup &);
|
|
Toshihiro Shimizu |
890ddd |
TFxPortDynamicGroup &operator=(const TFxPortDynamicGroup &);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void addPort(TFxPort *port);
|
|
Toshihiro Shimizu |
890ddd |
void removePort(TFxPort *port); //!< Removes and deletes <\I> the specified port
|
|
Toshihiro Shimizu |
890ddd |
void clear();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
typedef TFxPortDynamicGroup TFxPortDG;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TFxTimeRegion
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxTimeRegion();
|
|
Toshihiro Shimizu |
890ddd |
TFxTimeRegion(double start, double end);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
static TFxTimeRegion createUnlimited();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFxTimeRegion &operator+=(const TFxTimeRegion &rhs)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_start = tmin(m_start, rhs.m_start);
|
|
Toshihiro Shimizu |
890ddd |
m_end = tmax(m_end, rhs.m_end);
|
|
Toshihiro Shimizu |
890ddd |
return *this;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFxTimeRegion &operator+=(double shift)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_start += shift;
|
|
Toshihiro Shimizu |
890ddd |
m_end += shift;
|
|
Toshihiro Shimizu |
890ddd |
return *this;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFxTimeRegion &operator-=(double shift)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return operator+=(-shift);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool contains(double time) const;
|
|
Toshihiro Shimizu |
890ddd |
bool isUnlimited() const;
|
|
Toshihiro Shimizu |
890ddd |
bool isEmpty() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool getFrameCount(int &count) const;
|
|
Toshihiro Shimizu |
890ddd |
int getFirstFrame() const;
|
|
Toshihiro Shimizu |
890ddd |
int getLastFrame() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
double m_start;
|
|
Toshihiro Shimizu |
890ddd |
double m_end;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline DVAPI TFxTimeRegion operator+(const TFxTimeRegion &tr1, const TFxTimeRegion &tr2)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return TFxTimeRegion(tr1) += tr2;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline DVAPI TFxTimeRegion operator+(const TFxTimeRegion &tr1, double shift)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return TFxTimeRegion(tr1) += shift;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline DVAPI TFxTimeRegion operator-(const TFxTimeRegion &tr1, double shift)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return TFxTimeRegion(tr1) -= shift;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TFxChange
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFx *m_fx;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
double m_firstAffectedFrame;
|
|
Toshihiro Shimizu |
890ddd |
double m_lastAffectedFrame;
|
|
Toshihiro Shimizu |
890ddd |
bool m_dragging;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
static double m_minFrame;
|
|
Toshihiro Shimizu |
890ddd |
static double m_maxFrame;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxChange(TFx *fx, double firstAffectedFrame, double lastAffectedFrame, bool dragging)
|
|
Toshihiro Shimizu |
890ddd |
: m_fx(fx), m_firstAffectedFrame(firstAffectedFrame), m_lastAffectedFrame(lastAffectedFrame), m_dragging(dragging) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
TFxChange();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFxParamChange : public TFxChange
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxParamChange(TFx *fx, double firstAffectedFrame, double lastAffectedFrame, bool dragging);
|
|
Toshihiro Shimizu |
890ddd |
TFxParamChange(TFx *fx, const TParamChange &src);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFxPortAdded : public TFxChange
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxPortAdded(TFx *fx) : TFxChange(fx, m_minFrame, m_maxFrame, false) {}
|
|
Toshihiro Shimizu |
890ddd |
~TFxPortAdded() {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFxPortRemoved : public TFxChange
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxPortRemoved(TFx *fx) : TFxChange(fx, m_minFrame, m_maxFrame, false) {}
|
|
Toshihiro Shimizu |
890ddd |
~TFxPortRemoved() {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFxParamAdded : public TFxChange
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxParamAdded(TFx *fx) : TFxChange(fx, m_minFrame, m_maxFrame, false) {}
|
|
Toshihiro Shimizu |
890ddd |
~TFxParamAdded() {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFxParamRemoved : public TFxChange
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxParamRemoved(TFx *fx) : TFxChange(fx, m_minFrame, m_maxFrame, false) {}
|
|
Toshihiro Shimizu |
890ddd |
~TFxParamRemoved() {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFxParamsUnlinked : public TFxChange
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxParamsUnlinked(TFx *fx) : TFxChange(fx, m_minFrame, m_maxFrame, false) {}
|
|
Toshihiro Shimizu |
890ddd |
~TFxParamsUnlinked() {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TFxObserver
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxObserver() {}
|
|
Toshihiro Shimizu |
890ddd |
virtual ~TFxObserver() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void onChange(const TFxChange &change) = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void onChange(const TFxPortAdded &change)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
onChange(static_cast<const &="" tfxchange="">(change));</const>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void onChange(const TFxPortRemoved &change)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
onChange(static_cast<const &="" tfxchange="">(change));</const>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void onChange(const TFxParamAdded &change)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
onChange(static_cast<const &="" tfxchange="">(change));</const>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void onChange(const TFxParamRemoved &change)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
onChange(static_cast<const &="" tfxchange="">(change));</const>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void onChange(const TFxParamsUnlinked &change)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
onChange(static_cast<const &="" tfxchange="">(change));</const>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFxInfo
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
std::string m_name;
|
|
Toshihiro Shimizu |
890ddd |
bool m_isHidden;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxInfo() {}
|
|
Toshihiro Shimizu |
890ddd |
TFxInfo(const std::string &name, bool isHidden)
|
|
Toshihiro Shimizu |
890ddd |
: m_name(name), m_isHidden(isHidden) {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef WIN32
|
|
Toshihiro Shimizu |
890ddd |
template class DVAPI TSmartPointerT<tfx>;</tfx>
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
typedef TSmartPointerT<tfx> TFxP;</tfx>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TFx : public TSmartObject, public TPersist, public TParamObserver
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
DECLARE_CLASS_CODE
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFxImp *m_imp;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
typedef TFx *CreateProc();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFx();
|
|
Toshihiro Shimizu |
890ddd |
virtual ~TFx();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual wstring getName() const;
|
|
Toshihiro Shimizu |
890ddd |
void setName(wstring name);
|
|
Toshihiro Shimizu |
890ddd |
wstring getFxId() const;
|
|
Toshihiro Shimizu |
890ddd |
void setFxId(wstring id);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TParamContainer *getParams();
|
|
Toshihiro Shimizu |
890ddd |
const TParamContainer *getParams() const;
|
|
Toshihiro Shimizu |
890ddd |
void addParamVar(TParamVar *var);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual TFx *clone(bool recursive = true) const;
|
|
Toshihiro Shimizu |
890ddd |
TFx *clone(TFx *fx, bool recursive) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void unlinkParams();
|
|
Toshihiro Shimizu |
890ddd |
void linkParams(TFx *src);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFx *getLinkedFx() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool addInputPort(const std::string &name, TFxPort &p); //!< Adds a port with given name, returns false on duplicate names.
|
|
Toshihiro Shimizu |
890ddd |
//! Ownership of the port belongs to derived implementations of TFx.
|
|
Toshihiro Shimizu |
890ddd |
bool addInputPort(const std::string &name, TFxPort *p,
|
|
Toshihiro Shimizu |
890ddd |
int groupIndex); //!< Adds a port with given name to the specified dynamic group,
|
|
Toshihiro Shimizu |
890ddd |
//! returns false on duplicate names. Ownership is transferred to the group.
|
|
Toshihiro Shimizu |
890ddd |
bool removeInputPort(const std::string &name); //!< Removes the port with given name, returns false if not found.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool renamePort(const string &oldName, const string &newName);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool connect(const std::string &name, TFx *other); //!< Equivalent to getInputPort(name)->setFx(other).
|
|
Toshihiro Shimizu |
890ddd |
bool disconnect(const std::string &name); //!< Equivalent to getInputPort(name)->setFx(0).
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int getInputPortCount() const;
|
|
Toshihiro Shimizu |
890ddd |
TFxPort *getInputPort(int index) const;
|
|
Toshihiro Shimizu |
890ddd |
TFxPort *getInputPort(const std::string &name) const;
|
|
Toshihiro Shimizu |
890ddd |
std::string getInputPortName(int index) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual int dynamicPortGroupsCount() const { return 0; }
|
|
Toshihiro Shimizu |
890ddd |
virtual const TFxPortDG *dynamicPortGroup(int g) const { return 0; }
|
|
Toshihiro Shimizu |
890ddd |
bool hasDynamicPortGroups() const { return (dynamicPortGroupsCount() > 0); }
|
|
Toshihiro Shimizu |
890ddd |
void clearDynamicPortGroup(int g); //!< \warning Users must ensure that the group's minimal
|
|
Toshihiro Shimizu |
890ddd |
//! ports count is respected - this method does \b not.
|
|
Toshihiro Shimizu |
890ddd |
bool addOutputConnection(TFxPort *port);
|
|
Toshihiro Shimizu |
890ddd |
bool removeOutputConnection(TFxPort *port);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
static void listFxs(std::vector<tfxinfo> &fxInfos);</tfxinfo>
|
|
Toshihiro Shimizu |
890ddd |
static TFxInfo getFxInfo(const std::string &fxIdentifier); //!< Returns info associated to an fx identifier, or an
|
|
Toshihiro Shimizu |
890ddd |
//! unnamed one if none was found.
|
|
Toshihiro Shimizu |
890ddd |
virtual bool isZerary() const { return getInputPortCount() == 0; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// returns the column index that provides reference frame for the FX.
|
|
Toshihiro Shimizu |
890ddd |
// (TColumnFx and Zerary fxs return their column indexes, n-ary FXs return
|
|
Toshihiro Shimizu |
890ddd |
// the reference column index of their first argument)
|
|
Toshihiro Shimizu |
890ddd |
// note: it returns -1 if the column is undefined (e.g. a n-ary FX with arguments undefined yet)
|
|
Toshihiro Shimizu |
890ddd |
virtual int getReferenceColumnIndex() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// se getXsheetPort() != 0 e la porta non e' connessa la si considera connessa
|
|
Toshihiro Shimizu |
890ddd |
// a tutte le colonne precedenti a quella corrente.
|
|
Toshihiro Shimizu |
890ddd |
// cfr. AddFx
|
|
Toshihiro Shimizu |
890ddd |
virtual TFxPort *getXsheetPort() const { return 0; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int getOutputConnectionCount() const;
|
|
Toshihiro Shimizu |
890ddd |
TFxPort *getOutputConnection(int i) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual TFxTimeRegion getTimeRegion() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setActiveTimeRegion(const TFxTimeRegion &tr);
|
|
Toshihiro Shimizu |
890ddd |
TFxTimeRegion getActiveTimeRegion() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual bool checkActiveTimeRegion() const { return true; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void disconnectAll();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! Returns a list of User Interface Concepts to be displayed when editing the fx parameters.
|
|
Toshihiro Shimizu |
890ddd |
//! \note Ownership of the returned array allocated with new[] is passed to callers.
|
|
Toshihiro Shimizu |
890ddd |
virtual void getParamUIs(TParamUIConcept *¶ms, int &length)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
params = 0, length = 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline string getFxType() const;
|
|
Toshihiro Shimizu |
890ddd |
virtual string getPluginId() const = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
static TFx *create(string name);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TParamObserver-related methods
|
|
Toshihiro Shimizu |
890ddd |
void onChange(const TParamChange &c);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void addObserver(TFxObserver *);
|
|
Toshihiro Shimizu |
890ddd |
void removeObserver(TFxObserver *);
|
|
Toshihiro Shimizu |
890ddd |
void notify(const TFxChange &change);
|
|
Toshihiro Shimizu |
890ddd |
void notify(const TFxPortAdded &change);
|
|
Toshihiro Shimizu |
890ddd |
void notify(const TFxPortRemoved &change);
|
|
Toshihiro Shimizu |
890ddd |
void notify(const TFxParamAdded &change);
|
|
Toshihiro Shimizu |
890ddd |
void notify(const TFxParamRemoved &change);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void loadData(TIStream &is);
|
|
Toshihiro Shimizu |
890ddd |
void saveData(TOStream &os);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void loadPreset(TIStream &is); // solleva un eccezione se il preset non corrisponde all'effetto
|
|
Toshihiro Shimizu |
890ddd |
void savePreset(TOStream &os);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFxAttributes *getAttributes() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual string getAlias(double frame, const TRenderSettings &info) const { return ""; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! Compatibility function - used to translate a port name from older Toonz
|
|
Toshihiro Shimizu |
890ddd |
//! versions into its current form.
|
|
Toshihiro Shimizu |
890ddd |
virtual void compatibilityTranslatePort(int majorVersion, int minorVersion, std::string &portName) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*-- Rendering(目玉)ボタンがOFFのときに使用されるInputPort --*/
|
|
Toshihiro Shimizu |
890ddd |
virtual int getPreferredInputPort() { return 0; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* RasterFxPluginHost 用の仮想関数 */
|
|
Toshihiro Shimizu |
890ddd |
virtual void callStartRenderHandler() {}
|
|
Toshihiro Shimizu |
890ddd |
virtual void callEndRenderHandler() {}
|
|
Toshihiro Shimizu |
890ddd |
virtual void callStartRenderFrameHandler(const TRenderSettings *rs, double frame) {}
|
|
Toshihiro Shimizu |
890ddd |
virtual void callEndRenderFrameHandler(const TRenderSettings *rs, double frame) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
// Id-related functions
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
unsigned long getIdentifier() const;
|
|
Toshihiro Shimizu |
890ddd |
void setIdentifier(unsigned long id);
|
|
Toshihiro Shimizu |
890ddd |
void setNewIdentifier();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
TFx(const TFx &);
|
|
Toshihiro Shimizu |
890ddd |
TFx &operator=(const TFx &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI TIStream &operator>>(TIStream &in, TFxP &p);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TFxDeclaration : public TPersistDeclaration
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxDeclaration(const TFxInfo &info);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <class t=""></class>
|
|
Toshihiro Shimizu |
890ddd |
class TFxDeclarationT : public TFxDeclaration
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFxDeclarationT(const TFxInfo &info) : TFxDeclaration(info) {}
|
|
Toshihiro Shimizu |
890ddd |
TPersist *create() const { return new T; }
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline string TFx::getFxType() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return getDeclaration()->getId();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define FX_DECLARATION(T) \
|
|
Toshihiro Shimizu |
890ddd |
public: \
|
|
Toshihiro Shimizu |
890ddd |
const TPersistDeclaration *getDeclaration() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define FX_IDENTIFIER(T, I) \
|
|
Toshihiro Shimizu |
890ddd |
namespace \
|
|
Toshihiro Shimizu |
890ddd |
{ \
|
|
Toshihiro Shimizu |
890ddd |
TFxDeclarationT<t> info##T(TFxInfo(I, false)); \</t>
|
|
Toshihiro Shimizu |
890ddd |
} \
|
|
Toshihiro Shimizu |
890ddd |
const TPersistDeclaration *T::getDeclaration() const { return &info##T; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define FX_IDENTIFIER_IS_HIDDEN(T, I) \
|
|
Toshihiro Shimizu |
890ddd |
namespace \
|
|
Toshihiro Shimizu |
890ddd |
{ \
|
|
Toshihiro Shimizu |
890ddd |
TFxDeclarationT<t> info##T(TFxInfo(I, true)); \</t>
|
|
Toshihiro Shimizu |
890ddd |
} \
|
|
Toshihiro Shimizu |
890ddd |
const TPersistDeclaration *T::getDeclaration() const { return &info##T; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|