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