|
Toshihiro Shimizu |
890ddd |
#ifndef PLUGIN_UI_PAGE_INTERFACE
|
|
Toshihiro Shimizu |
890ddd |
#define PLUGIN_UI_PAGE_INTERFACE
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz_hostif.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfx.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "plugin_param_interface.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "plugin_param_view_interface.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "pluginhost.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* 公開ヘッダからは引っ込められた都合上ここで宣言(内部ではまだ使っているので) */
|
|
Toshihiro Shimizu |
890ddd |
typedef void *toonz_ui_page_handle_t;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* あるエフェクトのパラメータ画面 */
|
|
Toshihiro Shimizu |
890ddd |
class UIPage
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
class Group
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
std::string name_;
|
|
Toshihiro Shimizu |
890ddd |
std::vector<std::pair<std::string, *="" paramview="">> params_;</std::pair<std::string,>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Group(const std::string &name) : name_(name) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Group(const Group &group) : name_(group.name_), params_(group.params_) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline const std::string &name() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return name_;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline void add_param(const std::string ¶m, ParamView *components)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
params_.push_back(std::make_pair(param, components));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline ParamsPage *build(RasterFxPluginHost *fx, ParamsPage *page)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
page->beginGroup(name_.c_str());
|
|
Toshihiro Shimizu |
890ddd |
for (std::size_t i = 0, size = params_.size(); i < size; i++) {
|
|
Toshihiro Shimizu |
890ddd |
params_[i].second->build(fx, page, params_[i].first.c_str());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
page->endGroup();
|
|
Toshihiro Shimizu |
890ddd |
return page;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
std::string name_;
|
|
Toshihiro Shimizu |
890ddd |
std::vector<group *=""> groups_;</group>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
inline UIPage(const char *name) : name_(name)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline ~UIPage()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
for (std::size_t i = 0, size = groups_.size(); i < size; ++i) {
|
|
Toshihiro Shimizu |
890ddd |
delete groups_[i];
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
groups_.clear();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline int begin_group(const char *name)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
groups_.push_back(NULL);
|
|
Toshihiro Shimizu |
890ddd |
groups_.back() = new Group(name);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return TOONZ_OK;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline int end_group(const char *name)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (groups_.back()->name() != name) {
|
|
Toshihiro Shimizu |
890ddd |
return TOONZ_ERROR_NOT_FOUND;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return TOONZ_OK;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int bind_param(Param *param, ParamView *pt)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (groups_.empty()) {
|
|
Toshihiro Shimizu |
890ddd |
return TOONZ_ERROR_PREREQUISITE;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
groups_.back()->add_param(param->name(), pt);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return TOONZ_OK;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void build(RasterFxPluginHost *fx, ParamsPageSet *pages) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
ParamsPage *page = pages->createParamsPage();
|
|
Toshihiro Shimizu |
890ddd |
for (std::size_t i = 0, size = groups_.size(); i < size; ++i) {
|
|
Toshihiro Shimizu |
890ddd |
groups_[i]->build(fx, page);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
pages->addParamsPage(page, name_.c_str());
|
|
Toshihiro Shimizu |
890ddd |
page->setPageSpace();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
UIPage *clone(TFx *fx) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
UIPage *page = new UIPage(name_.c_str());
|
|
Toshihiro Shimizu |
890ddd |
for (std::size_t i = 0, size = groups_.size(); i < size; ++i) {
|
|
Toshihiro Shimizu |
890ddd |
page->groups_.push_back(new Group(*groups_[i]));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
return page;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int begin_group(toonz_ui_page_handle_t page, const char *name);
|
|
Toshihiro Shimizu |
890ddd |
int end_group(toonz_ui_page_handle_t page, const char *name);
|
|
Toshihiro Shimizu |
890ddd |
int bind_param(toonz_ui_page_handle_t page, toonz_param_handle_t param, toonz_param_view_handle_t traits);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|