|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef FUNCTIONTREEMODEL_H
|
|
Toshihiro Shimizu |
890ddd |
#define FUNCTIONTREEMODEL_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tdoubleparam.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzQt includes
|
|
Toshihiro Shimizu |
890ddd |
#include "treemodel.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Qt includes
|
|
Toshihiro Shimizu |
890ddd |
#include <qscrollbar></qscrollbar>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TOONZQT_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 TStageObject;
|
|
Toshihiro Shimizu |
890ddd |
class TFx;
|
|
Toshihiro Shimizu |
890ddd |
class TDoubleParam;
|
|
Toshihiro Shimizu |
890ddd |
class TXsheet;
|
|
Toshihiro Shimizu |
890ddd |
class TParamContainer;
|
|
Toshihiro Shimizu |
890ddd |
class TFxHandle;
|
|
Toshihiro Shimizu |
890ddd |
class TObjectHandle;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class FunctionTreeView;
|
|
Toshihiro Shimizu |
890ddd |
class FunctionViewer;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//*****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// FunctionTreeModel declaration
|
|
Toshihiro Shimizu |
890ddd |
//*****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief The Function Editor's (tree-like) \a model, as in the model-view architecture.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\details This class represents the data associated to Toonz's Function Editor panels in a
|
|
Toshihiro Shimizu |
890ddd |
view-independent way. The model's purpose is that of representing all \a channels of the
|
|
Toshihiro Shimizu |
890ddd |
objects in a scene. A \a channel is here intended as an animatable parameter
|
|
Toshihiro Shimizu |
890ddd |
represented by a single real-valued function.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Animatable objects are currently subdivided in two main types: stage objects
|
|
Toshihiro Shimizu |
890ddd |
(which consist roughly all the objects represented in the \a stage schematic view,
|
|
Toshihiro Shimizu |
890ddd |
including cameras, spline curves and pegbars), and \a fxs. Stage objects typically
|
|
Toshihiro Shimizu |
890ddd |
feature a uniform channels group structure, whereas each fx type have a different set
|
|
Toshihiro Shimizu |
890ddd |
of parameters (and thus channels). Recently, \a column objects can sport an additional
|
|
Toshihiro Shimizu |
890ddd |
group of channels, related to Plastic skeleton animations (see TnzExt library).
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class FunctionTreeModel : public TreeModel, public TParamObserver
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief FunctionTreeModel's abstract base item class, adding the requirement to
|
|
Toshihiro Shimizu |
890ddd |
return features visibility data.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class Item : public TreeModel::Item
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Item() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual bool isActive() const = 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual bool isAnimated() const = 0;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! The model item representing a channels group.
|
|
Toshihiro Shimizu |
890ddd |
class ChannelGroup : public Item
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
enum ShowFilter {
|
|
Toshihiro Shimizu |
890ddd |
ShowAllChannels,
|
|
Toshihiro Shimizu |
890ddd |
ShowAnimatedChannels
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
QString m_name;
|
|
Toshihiro Shimizu |
890ddd |
ShowFilter m_showFilter;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ChannelGroup(const QString &name = "");
|
|
Toshihiro Shimizu |
890ddd |
~ChannelGroup();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isActive() const;
|
|
Toshihiro Shimizu |
890ddd |
bool isAnimated() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual QString getShortName() const { return m_name; }
|
|
Toshihiro Shimizu |
890ddd |
virtual QString getLongName() const { return m_name; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual QString getIdName() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setShowFilter(ShowFilter showFilter);
|
|
Toshihiro Shimizu |
890ddd |
ShowFilter getShowFilter() const { return m_showFilter; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void applyShowFilter(); // call this method when a channel changes
|
|
Toshihiro Shimizu |
890ddd |
// its animation status
|
|
Toshihiro Shimizu |
890ddd |
QVariant data(int role) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//used in FunctionTreeView::onActivated
|
|
Toshihiro Shimizu |
890ddd |
void setChildrenAllActive(bool active);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void displayAnimatedChannels();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief The common class representing a \a parameter in the model.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\remark This class's concept is different from that of a Channel, as a \a parameter could
|
|
Toshihiro Shimizu |
890ddd |
be composed of multiple channels, e.g. like an animated \p RGBA color, which
|
|
Toshihiro Shimizu |
890ddd |
has 4 channels.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class ParamWrapper
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
TParamP m_param; //!< The wrapped parameter.
|
|
Shinya Kitaoka |
3bfa54 |
std::wstring m_fxId; //!< Fx identifier for m_param's owner, if any.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
3bfa54 |
ParamWrapper(const TParamP ¶m, const std::wstring &fxId) : m_param(param), m_fxId(fxId) {}
|
|
Toshihiro Shimizu |
890ddd |
virtual ~ParamWrapper() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
3bfa54 |
const std::wstring &getFxId() const { return m_fxId; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TParamP getParam() const { return m_param; }
|
|
Toshihiro Shimizu |
890ddd |
virtual void setParam(const TParamP ¶m) { m_param = param; }
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! The model item representing a channel (i.e. a real-valued function).
|
|
Toshihiro Shimizu |
890ddd |
class Channel : public ParamWrapper, public Item, public TParamObserver
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
FunctionTreeModel *m_model; //!< (\p not \p owned) Reference to the model
|
|
Toshihiro Shimizu |
890ddd |
ChannelGroup *m_group; //!< (\p not \p owned) Reference to the enclosing group
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
3bfa54 |
std::string m_paramNamePref;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool m_isActive; //!< Whether the channels is active, ie visible
|
|
Toshihiro Shimizu |
890ddd |
//!< as a curve and numeric column
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Channel(FunctionTreeModel *model, TDoubleParam *param,
|
|
Shinya Kitaoka |
3bfa54 |
std::string paramNamePrefix = "", std::wstring fxId = L"");
|
|
Toshihiro Shimizu |
890ddd |
~Channel();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParam *getParam() const { return (TDoubleParam *)m_param.getPointer(); }
|
|
Toshihiro Shimizu |
890ddd |
void setParam(const TParamP ¶m);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString getShortName() const;
|
|
Toshihiro Shimizu |
890ddd |
QString getLongName() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//in order to show the expression name in the tooltip
|
|
Toshihiro Shimizu |
890ddd |
QString getExprRefName() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ChannelGroup *getChannelGroup() const { return m_group; }
|
|
Toshihiro Shimizu |
890ddd |
void setChannelGroup(ChannelGroup *group) { m_group = group; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QVariant data(int role) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isActive() const { return m_isActive; }
|
|
Toshihiro Shimizu |
890ddd |
void setIsActive(bool active);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isAnimated() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isCurrent() const;
|
|
Toshihiro Shimizu |
890ddd |
void setIsCurrent(bool current);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isHidden() const; // the channel is hidden if it is filtered out
|
|
Toshihiro Shimizu |
890ddd |
// by its channelgroup
|
|
Toshihiro Shimizu |
890ddd |
void onChange(const TParamChange &);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void *getInternalPointer() const;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
ChannelGroup *m_stageObjects, //!< Predefined group for stage object channels.
|
|
Toshihiro Shimizu |
890ddd |
*m_fxs; //!< Predefined group for fx parameters.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
std::vector<channel *=""> m_activeChannels;</channel>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Channel *m_currentChannel; //!< (\p not \p owned) Current channel.
|
|
Toshihiro Shimizu |
890ddd |
TStageObject *m_currentStageObject; //!< (\p not \p owned) Current stage object.
|
|
Toshihiro Shimizu |
890ddd |
TFx *m_currentFx; //!< (\p not \p owned) Current fx.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool m_paramsChanged;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFxHandle *m_fxHandle;
|
|
Toshihiro Shimizu |
890ddd |
TObjectHandle *m_objectHandle;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
FunctionTreeModel(FunctionTreeView *parent = 0); // BUT! Should be view-independent! :o
|
|
Toshihiro Shimizu |
890ddd |
~FunctionTreeModel();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Channel *getCurrentChannel() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_currentChannel;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Channel *getActiveChannel(int index) const;
|
|
Toshihiro Shimizu |
890ddd |
int getActiveChannelCount() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_activeChannels.size();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int getColumnIndexByCurve(TDoubleParam *param) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
double getValue(Channel *channel, double frame) const;
|
|
Toshihiro Shimizu |
890ddd |
int getClosestKeyframe(Channel *channel, double frame) const; // -1 if not found
|
|
Toshihiro Shimizu |
890ddd |
Channel *getClosestChannel(double frame, double value) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void refreshActiveChannels();
|
|
Toshihiro Shimizu |
890ddd |
void refreshData(TXsheet *xsh); // call this method when the stageObject/Fx structure
|
|
Toshihiro Shimizu |
890ddd |
// has been modified
|
|
Toshihiro Shimizu |
890ddd |
void resetAll();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void applyShowFilters();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setCurrentStageObject(TStageObject *obj)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_currentStageObject = obj;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
TStageObject *getCurrentStageObject() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_currentStageObject;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setCurrentFx(TFx *fx);
|
|
Toshihiro Shimizu |
890ddd |
TFx *getCurrentFx() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_currentFx;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void addParameter(TParam *parameter,
|
|
Toshihiro Shimizu |
890ddd |
const TFilePath &folder); //!< See function FunctionViewer::addParameter().
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFxHandle *getFxHandle() { return m_fxHandle; }
|
|
Toshihiro Shimizu |
890ddd |
void setFxHandle(TFxHandle *fxHandle) { m_fxHandle = fxHandle; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TObjectHandle *getObjectHandle() { return m_objectHandle; }
|
|
Toshihiro Shimizu |
890ddd |
void setObjectHandle(TObjectHandle *objectHandle) { m_objectHandle = objectHandle; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void activeChannelsChanged();
|
|
Toshihiro Shimizu |
890ddd |
void curveSelected(TDoubleParam *);
|
|
Toshihiro Shimizu |
890ddd |
void curveChanged(bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
void currentChannelChanged(FunctionTreeModel::Channel *);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
void addParameter(ChannelGroup *group,
|
|
Toshihiro Shimizu |
890ddd |
const std::string &prefixString,
|
|
Toshihiro Shimizu |
890ddd |
const std::wstring &fxId,
|
|
Toshihiro Shimizu |
890ddd |
TParam *param);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! remove channel from m_activeChannels and m_currentChannel
|
|
Toshihiro Shimizu |
890ddd |
void onChannelDestroyed(Channel *channel);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! called when channel status (active/current) has been modified
|
|
Toshihiro Shimizu |
890ddd |
void emitDataChanged(Channel *channel)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QModelIndex index = channel->createIndex();
|
|
Toshihiro Shimizu |
890ddd |
emit dataChanged(index, index);
|
|
Toshihiro Shimizu |
890ddd |
emit activeChannelsChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void emitCurveSelected(TDoubleParam *curve)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
emit curveSelected(curve);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void emitCurrentChannelChanged(FunctionTreeModel::Channel *channel)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
emit currentChannelChanged(channel);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void addChannels(TFx *fx, ChannelGroup *fxItem, TParamContainer *params);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Observers notification functions
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onChange(const TParamChange &); // Multiple param notifications ...
|
|
Toshihiro Shimizu |
890ddd |
void onParamChange(bool isDragging); // ... that get compressed into one
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Update functions
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void refreshStageObjects(TXsheet *xsh);
|
|
Toshihiro Shimizu |
890ddd |
void refreshFxs(TXsheet *xsh);
|
|
Toshihiro Shimizu |
890ddd |
void refreshPlasticDeformations();
|
|
Toshihiro Shimizu |
890ddd |
void addActiveChannels(TreeModel::Item *item);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ChannelGroup *getStageObjectChannel(int index) const;
|
|
Toshihiro Shimizu |
890ddd |
ChannelGroup *getFxChannel(int index) const;
|
|
Toshihiro Shimizu |
890ddd |
int getStageObjectsChannelCount() const { return m_stageObjects->getChildCount(); }
|
|
Toshihiro Shimizu |
890ddd |
int getFxsChannelCount() const { return m_fxs->getChildCount(); }
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class FxChannelGroup : public FunctionTreeModel::ChannelGroup
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFx *m_fx;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
FxChannelGroup(TFx *fx);
|
|
Toshihiro Shimizu |
890ddd |
~FxChannelGroup();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString getShortName() const;
|
|
Toshihiro Shimizu |
890ddd |
QString getLongName() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString getIdName() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void *getInternalPointer() const { return static_cast<void *="">(m_fx); }</void>
|
|
Toshihiro Shimizu |
890ddd |
TFx *getFx() const { return m_fx; }
|
|
Toshihiro Shimizu |
890ddd |
QVariant data(int role) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void refresh();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//*****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// FunctionTreeView declaration
|
|
Toshihiro Shimizu |
890ddd |
//*****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! TreeView with stage object and fx channels. controls channel visibility and
|
|
Toshihiro Shimizu |
890ddd |
//! current channel
|
|
Toshihiro Shimizu |
890ddd |
class FunctionTreeView : public TreeView
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFilePath m_scenePath;
|
|
Toshihiro Shimizu |
890ddd |
FunctionTreeModel::Channel *m_clickedItem;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
FunctionTreeModel::Channel *m_draggingChannel;
|
|
Toshihiro Shimizu |
890ddd |
QPoint m_dragStartPosition;
|
|
Toshihiro Shimizu |
890ddd |
//---
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//set color by using style sheet
|
|
Toshihiro Shimizu |
890ddd |
QColor m_textColor; //text color (black)
|
|
Toshihiro Shimizu |
890ddd |
QColor m_currentTextColor; //current item text color (red)
|
|
Toshihiro Shimizu |
890ddd |
Q_PROPERTY(QColor TextColor READ getTextColor WRITE setTextColor)
|
|
Toshihiro Shimizu |
890ddd |
Q_PROPERTY(QColor CurrentTextColor READ getCurrentTextColor WRITE setCurrentTextColor)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
FunctionTreeView(FunctionViewer *parent);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setCurrentScenePath(TFilePath scenePath) { m_scenePath = scenePath; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void openContextMenu(TreeModel::Item *item, const QPoint &globalPos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setTextColor(const QColor &color) { m_textColor = color; }
|
|
Toshihiro Shimizu |
890ddd |
QColor getTextColor() const { return m_textColor; }
|
|
Toshihiro Shimizu |
890ddd |
void setCurrentTextColor(const QColor &color) { m_currentTextColor = color; }
|
|
Toshihiro Shimizu |
890ddd |
QColor getCurrentTextColor() const { return m_currentTextColor; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void onClick(TreeModel::Item *item, const QPoint &itemPos, QMouseEvent *e);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onMidClick(TreeModel::Item *item, const QPoint &itemPos, QMouseEvent *e);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onDrag(TreeModel::Item *item, const QPoint &itemPos, QMouseEvent *e);
|
|
Toshihiro Shimizu |
890ddd |
void onRelease();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void openContextMenu(FunctionTreeModel::Channel *channel, const QPoint &globalPos);
|
|
Toshihiro Shimizu |
890ddd |
void openContextMenu(FunctionTreeModel::ChannelGroup *group, const QPoint &globalPos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onActivated(const QModelIndex &index);
|
|
Toshihiro Shimizu |
890ddd |
void updateAll();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//show all the animated channels when the scene switched
|
|
Toshihiro Shimizu |
890ddd |
void displayAnimatedChannels();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void switchCurrentObject(TStageObject *obj);
|
|
Toshihiro Shimizu |
890ddd |
void switchCurrentFx(TFx *fx);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif // FUNCTIONTREEMODEL_H
|