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