diff --git a/stuff/profiles/layouts/fxs/STD_externalPaletteFx.xml b/stuff/profiles/layouts/fxs/STD_externalPaletteFx.xml
new file mode 100644
index 0000000..ff37293
--- /dev/null
+++ b/stuff/profiles/layouts/fxs/STD_externalPaletteFx.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/toonz/sources/include/tfxattributes.h b/toonz/sources/include/tfxattributes.h
index 90946d5..c8c361c 100644
--- a/toonz/sources/include/tfxattributes.h
+++ b/toonz/sources/include/tfxattributes.h
@@ -36,6 +36,9 @@ class DVAPI TFxAttributes {
// to maintain backward compatibility in the fx
int m_fxVersion;
+ bool m_hasGlobalControl;
+ double m_globalIntensity;
+
public:
TFxAttributes();
~TFxAttributes();
@@ -67,6 +70,10 @@ public:
void setFxVersion(int version) { m_fxVersion = version; }
int getFxVersion() const { return m_fxVersion; };
+ void setHasGlobalControl(bool yes) { m_hasGlobalControl = yes; }
+ bool hasGlobalControl() const { return m_hasGlobalControl; }
+ void setGlobalIntensity(double val) { m_globalIntensity = val; }
+ double getGlobalIntensity() { return m_globalIntensity; }
// Group management
int setGroupId(int value);
diff --git a/toonz/sources/include/toonzqt/fxsettings.h b/toonz/sources/include/toonzqt/fxsettings.h
index d01bd6f..f2ffb39 100644
--- a/toonz/sources/include/toonzqt/fxsettings.h
+++ b/toonz/sources/include/toonzqt/fxsettings.h
@@ -76,8 +76,9 @@ public:
ParamsPage(QWidget *parent = 0, ParamViewer *paramViewer = 0);
~ParamsPage();
- void setPage(TIStream &is, const TFxP &fx) {
+ void setPage(TIStream &is, const TFxP &fx, bool isFirstPage) {
setPageField(is, fx);
+ if (isFirstPage) addGlobalControl(fx);
setPageSpace();
}
@@ -98,6 +99,7 @@ public:
protected:
void setPageField(TIStream &is, const TFxP &fx, bool isVertical = true);
+ void addGlobalControl(const TFxP &fx);
public:
void setPageSpace();
diff --git a/toonz/sources/stdfx/CMakeLists.txt b/toonz/sources/stdfx/CMakeLists.txt
index 47ec706..b29fd9a 100644
--- a/toonz/sources/stdfx/CMakeLists.txt
+++ b/toonz/sources/stdfx/CMakeLists.txt
@@ -85,6 +85,7 @@ set(HEADERS
iwa_rainbowfx.h
iwa_bokeh_advancedfx.h
iwa_bokeh_util.h
+ globalcontrollablefx.h
)
if(OpenCV_FOUND)
diff --git a/toonz/sources/stdfx/adjustlevelsfx.cpp b/toonz/sources/stdfx/adjustlevelsfx.cpp
index 2f043c8..d2df1c5 100644
--- a/toonz/sources/stdfx/adjustlevelsfx.cpp
+++ b/toonz/sources/stdfx/adjustlevelsfx.cpp
@@ -6,10 +6,11 @@
#include "tpixelutils.h"
#include "tparamset.h"
#include "trop.h"
+#include "globalcontrollablefx.h"
//===================================================================
-class AdjustLevelsFx final : public TStandardRasterFx {
+class AdjustLevelsFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(AdjustLevelsFx)
TRasterFxPort m_input;
diff --git a/toonz/sources/stdfx/bright_contfx.cpp b/toonz/sources/stdfx/bright_contfx.cpp
index c69a60d..3e4c62b 100644
--- a/toonz/sources/stdfx/bright_contfx.cpp
+++ b/toonz/sources/stdfx/bright_contfx.cpp
@@ -3,8 +3,9 @@
#include "stdfx.h"
#include "tfxparam.h"
#include "tpixelutils.h"
+#include "globalcontrollablefx.h"
-class Bright_ContFx final : public TStandardRasterFx {
+class Bright_ContFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(Bright_ContFx)
TRasterFxPort m_input;
@@ -60,7 +61,7 @@ void my_compute_lut(double contrast, double brightness, std::vector &lut) {
if (value > 0.5)
nvalue = 1.0 - value;
else
- nvalue = value;
+ nvalue = value;
if (nvalue < 0.0) nvalue = 0.0;
nvalue = 0.5 * pow(nvalue * 2.0, (double)(1.0 + contrast));
if (value > 0.5)
@@ -71,7 +72,7 @@ void my_compute_lut(double contrast, double brightness, std::vector &lut) {
if (value > 0.5)
nvalue = 1.0 - value;
else
- nvalue = value;
+ nvalue = value;
if (nvalue < 0.0) nvalue = 0.0;
power = (contrast == 1.0) ? half_maxChannelValue : 1.0 / (1.0 - contrast);
nvalue = 0.5 * pow(2.0 * nvalue, power);
@@ -119,11 +120,11 @@ void Bright_ContFx::doCompute(TTile &tile, double frame,
m_input->compute(tile, frame, ri);
- double brightness = m_bright->getValue(frame) / 127.0;
- double contrast = m_contrast->getValue(frame) / 127.0;
- if (contrast > 1) contrast = 1;
+ double brightness = m_bright->getValue(frame) / 127.0;
+ double contrast = m_contrast->getValue(frame) / 127.0;
+ if (contrast > 1) contrast = 1;
if (contrast < -1) contrast = -1;
- TRaster32P raster32 = tile.getRaster();
+ TRaster32P raster32 = tile.getRaster();
if (raster32)
doBrightnessContrast(raster32, contrast, brightness);
else {
diff --git a/toonz/sources/stdfx/channelmixerfx.cpp b/toonz/sources/stdfx/channelmixerfx.cpp
index 89d4040..29a52f6 100644
--- a/toonz/sources/stdfx/channelmixerfx.cpp
+++ b/toonz/sources/stdfx/channelmixerfx.cpp
@@ -5,10 +5,11 @@
//#include "trop.h"
#include
#include "tpixelutils.h"
+#include "globalcontrollablefx.h"
//==================================================================
-class ChannelMixerFx final : public TStandardRasterFx {
+class ChannelMixerFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ChannelMixerFx)
TRasterFxPort m_input;
@@ -109,7 +110,7 @@ void depremult(PIXEL *pix) {
pix->g = (CHANNEL_TYPE)(pix->g * depremult);
pix->b = (CHANNEL_TYPE)(pix->b * depremult);
}
-}
+} // namespace
template
void doChannelMixer(TRasterPT ras, double r_r, double r_g, double r_b,
diff --git a/toonz/sources/stdfx/despecklefx.cpp b/toonz/sources/stdfx/despecklefx.cpp
index dcbde31..c50a025 100644
--- a/toonz/sources/stdfx/despecklefx.cpp
+++ b/toonz/sources/stdfx/despecklefx.cpp
@@ -9,9 +9,11 @@
// TnzStdfx includes
#include "stdfx.h"
+#include "globalcontrollablefx.h"
+
//--------------------------------------------------------------------------
-class DespeckleFx final : public TStandardRasterFx {
+class DespeckleFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(DespeckleFx)
TRasterFxPort m_input;
diff --git a/toonz/sources/stdfx/externalpalettefx.cpp b/toonz/sources/stdfx/externalpalettefx.cpp
index 296a3cd..7b3788a 100644
--- a/toonz/sources/stdfx/externalpalettefx.cpp
+++ b/toonz/sources/stdfx/externalpalettefx.cpp
@@ -8,10 +8,11 @@
#include "toonz/txshcell.h"
#include "toonz/txshsimplelevel.h"
#include "toonz/txshpalettelevel.h"
+#include "globalcontrollablefx.h"
//===================================================================
-class ExternalPaletteFx final : public TStandardRasterFx {
+class ExternalPaletteFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ExternalPaletteFx)
TRasterFxPort m_input;
@@ -85,7 +86,7 @@ TPalette *getPalette(TFx *fx, double frame) {
return 0;
}
-}
+} // namespace
//-------------------------------------------------------------------
diff --git a/toonz/sources/stdfx/globalcontrollablefx.h b/toonz/sources/stdfx/globalcontrollablefx.h
new file mode 100644
index 0000000..513daf8
--- /dev/null
+++ b/toonz/sources/stdfx/globalcontrollablefx.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#ifndef GLOBALCONTROLLABLEFX_H
+#define GLOBALCONTROLLABLEFX_H
+
+#include "tfxparam.h"
+#include "stdfx.h"
+#include "tfxattributes.h"
+
+class GlobalControllableFx : public TStandardRasterFx {
+protected:
+ TDoubleParamP m_globalIntensity;
+
+public:
+ GlobalControllableFx() : m_globalIntensity(1.0) {
+ m_globalIntensity->setValueRange(0.0, 1.0);
+
+ bindParam(this, "globalIntensity", m_globalIntensity);
+ getAttributes()->setHasGlobalControl(true);
+ m_globalIntensity->setUILabel("Fx Intensity");
+ }
+
+ double getGrobalControlValue(double frame) {
+ return m_globalIntensity->getValue(frame);
+ }
+};
+
+#endif
diff --git a/toonz/sources/stdfx/hsvkeyfx.cpp b/toonz/sources/stdfx/hsvkeyfx.cpp
index 760440d..56533c9 100644
--- a/toonz/sources/stdfx/hsvkeyfx.cpp
+++ b/toonz/sources/stdfx/hsvkeyfx.cpp
@@ -5,8 +5,9 @@
#include
#include "stdfx.h"
#include "hsvutil.h"
+#include "globalcontrollablefx.h"
-class HSVKeyFx final : public TStandardRasterFx {
+class HSVKeyFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(HSVKeyFx)
TRasterFxPort m_input;
diff --git a/toonz/sources/stdfx/hsvscalefx.cpp b/toonz/sources/stdfx/hsvscalefx.cpp
index 42cd16f..a2d2b8e 100644
--- a/toonz/sources/stdfx/hsvscalefx.cpp
+++ b/toonz/sources/stdfx/hsvscalefx.cpp
@@ -5,8 +5,9 @@
#include
#include "stdfx.h"
#include "hsvutil.h"
+#include "globalcontrollablefx.h"
-class HSVScaleFx final : public TStandardRasterFx {
+class HSVScaleFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(HSVScaleFx)
TRasterFxPort m_input;
diff --git a/toonz/sources/stdfx/ino_hls_add.cpp b/toonz/sources/stdfx/ino_hls_add.cpp
index ef7781e..96018f9 100644
--- a/toonz/sources/stdfx/ino_hls_add.cpp
+++ b/toonz/sources/stdfx/ino_hls_add.cpp
@@ -3,8 +3,9 @@
#include "stdfx.h"
#include "ino_common.h"
+#include "globalcontrollablefx.h"
//------------------------------------------------------------
-class ino_hls_add final : public TStandardRasterFx {
+class ino_hls_add final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ino_hls_add)
TRasterFxPort m_input;
TRasterFxPort m_noise;
@@ -117,7 +118,8 @@ void fx_(TRasterP in_ras, const TRasterP noise_ras, const TRasterP refer_ras,
,
in_ras->getLy(), in_ras->getLx() // Not use in_ras->getWrap()
,
- ino::channels(), ino::bits(in_ras)
+ ino::channels(),
+ ino::bits(in_ras)
//,noise_ras->getRawData() // BGRA
//,&refer_vec.at(0) // RGBA
@@ -151,7 +153,7 @@ void fx_(TRasterP in_ras, const TRasterP noise_ras, const TRasterP refer_ras,
noise_gr8->unlock();
in_gr8->unlock();
}
-}
+} // namespace
//------------------------------------------------------------
void ino_hls_add::doCompute(TTile &tile, double frame,
const TRenderSettings &rend_sets) {
@@ -199,7 +201,7 @@ void ino_hls_add::doCompute(TTile &tile, double frame,
tile.getRaster()->getLx(),
tile.getRaster()
->getLy()) /* ここtile.getRaster()->getSize()と同じ、将来修正する
- */
+ */
,
tile.getRaster(), frame, rend_sets);
}
@@ -237,7 +239,7 @@ void ino_hls_add::doCompute(TTile &tile, double frame,
,
xoffset, yoffset, from_rgba, offset, hue_scale, lig_scale, sat_scale,
alp_scale, anti_alias_sw // --> add_blend_sw, default is true
- );
+ );
if (refer_tile.getRaster() != nullptr) {
refer_tile.getRaster()->unlock();
}
diff --git a/toonz/sources/stdfx/ino_hls_adjust.cpp b/toonz/sources/stdfx/ino_hls_adjust.cpp
index 8ab7985..a83d23b 100644
--- a/toonz/sources/stdfx/ino_hls_adjust.cpp
+++ b/toonz/sources/stdfx/ino_hls_adjust.cpp
@@ -3,8 +3,9 @@
#include "stdfx.h"
#include "ino_common.h"
+#include "globalcontrollablefx.h"
//------------------------------------------------------------
-class ino_hls_adjust final : public TStandardRasterFx {
+class ino_hls_adjust final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ino_hls_adjust)
TRasterFxPort m_input;
TRasterFxPort m_refer;
@@ -124,7 +125,8 @@ void fx_(TRasterP in_ras, const TRasterP refer_ras, const int refer_mode,
,
hue_pivot, hue_scale, hue_shift, lig_pivot, lig_scale, lig_shift,
- sat_pivot, sat_scale, sat_shift
+ sat_pivot, sat_scale,
+ sat_shift
//,true /* add_blend_sw */
,
@@ -135,7 +137,7 @@ void fx_(TRasterP in_ras, const TRasterP refer_ras, const int refer_mode,
ino::arr_to_ras(in_gr8->getRawData(), ino::channels(), in_ras, 0);
in_gr8->unlock();
}
-}
+} // namespace
//------------------------------------------------------------
void ino_hls_adjust::doCompute(TTile &tile, double frame,
const TRenderSettings &rend_sets) {
@@ -215,7 +217,7 @@ void ino_hls_adjust::doCompute(TTile &tile, double frame,
hue_scale, hue_shift, lig_pivot, lig_scale, lig_shift, sat_pivot,
sat_scale, sat_shift,
anti_alias_sw // --> add_blend_sw, default is true
- );
+ );
if (refer_tile.getRaster() != nullptr) {
refer_tile.getRaster()->unlock();
}
diff --git a/toonz/sources/stdfx/ino_hls_noise.cpp b/toonz/sources/stdfx/ino_hls_noise.cpp
index 1122cc9..2e8aed7 100644
--- a/toonz/sources/stdfx/ino_hls_noise.cpp
+++ b/toonz/sources/stdfx/ino_hls_noise.cpp
@@ -3,8 +3,9 @@
#include "stdfx.h"
#include "ino_common.h"
+#include "globalcontrollablefx.h"
//------------------------------------------------------------
-class ino_hls_noise final : public TStandardRasterFx {
+class ino_hls_noise final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ino_hls_noise)
TRasterFxPort m_input;
TRasterFxPort m_refer;
@@ -150,7 +151,7 @@ void fx_(TRasterP in_ras, const TRasterP refer_ras, const int refer_mode,
ino::arr_to_ras(in_gr8->getRawData(), ino::channels(), in_ras, 0);
in_gr8->unlock();
}
-}
+} // namespace
//------------------------------------------------------------
void ino_hls_noise::doCompute(TTile &tile, double frame,
const TRenderSettings &rend_sets) {
@@ -203,7 +204,7 @@ void ino_hls_noise::doCompute(TTile &tile, double frame,
if ((0 <= margin_h && 0 < margin_w) /* 横方向のみ余白あり */
|| (0 < margin_h && 0 <= margin_w) /* 縦方向のみ余白あり */
|| (0 < margin_h && 0 < margin_w) /* 縦横両方に余白あり */
- ) {
+ ) {
/*camera_x = static_cast(ceil((double)margin_w / 2.));
camera_y = static_cast(ceil((double)margin_h / 2.));*/
camera_x = margin_w / 2;
@@ -263,7 +264,7 @@ void ino_hls_noise::doCompute(TTile &tile, double frame,
hue_range, lig_range, sat_range, mat_range, random_seed, near_blur,
term_effective, term_center, term_type, camera_x, camera_y, camera_w,
camera_h, anti_alias_sw // --> add_blend_sw, default is true
- );
+ );
if (refer_tile.getRaster() != nullptr) {
refer_tile.getRaster()->unlock();
}
diff --git a/toonz/sources/stdfx/ino_hsv_add.cpp b/toonz/sources/stdfx/ino_hsv_add.cpp
index 81200d6..319c6bf 100644
--- a/toonz/sources/stdfx/ino_hsv_add.cpp
+++ b/toonz/sources/stdfx/ino_hsv_add.cpp
@@ -3,8 +3,9 @@
#include "stdfx.h"
#include "ino_common.h"
+#include "globalcontrollablefx.h"
//------------------------------------------------------------
-class ino_hsv_add final : public TStandardRasterFx {
+class ino_hsv_add final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ino_hsv_add)
TRasterFxPort m_input;
TRasterFxPort m_noise;
@@ -120,7 +121,8 @@ void fx_(TRasterP in_ras, const TRasterP noise_ras, const TRasterP refer_ras,
,
in_ras->getLy(), in_ras->getLx() // Not use in_ras->getWrap()
,
- ino::channels(), ino::bits(in_ras)
+ ino::channels(),
+ ino::bits(in_ras)
//,noise_ras->getRawData() // BGRA
//,&refer_vec.at(0) // RGBA
@@ -154,7 +156,7 @@ void fx_(TRasterP in_ras, const TRasterP noise_ras, const TRasterP refer_ras,
noise_gr8->unlock();
in_gr8->unlock();
}
-}
+} // namespace
//------------------------------------------------------------
void ino_hsv_add::doCompute(TTile &tile, double frame,
const TRenderSettings &rend_sets) {
@@ -236,7 +238,7 @@ void ino_hsv_add::doCompute(TTile &tile, double frame,
,
xoffset, yoffset, from_rgba, offset, hue_scale, sat_scale, val_scale,
alp_scale, anti_alias_sw // --> add_blend_sw, default is true
- );
+ );
if (refer_tile.getRaster() != nullptr) {
refer_tile.getRaster()->unlock();
}
diff --git a/toonz/sources/stdfx/ino_hsv_adjust.cpp b/toonz/sources/stdfx/ino_hsv_adjust.cpp
index b826420..811df67 100644
--- a/toonz/sources/stdfx/ino_hsv_adjust.cpp
+++ b/toonz/sources/stdfx/ino_hsv_adjust.cpp
@@ -3,8 +3,9 @@
#include "stdfx.h"
#include "ino_common.h"
+#include "globalcontrollablefx.h"
//------------------------------------------------------------
-class ino_hsv_adjust final : public TStandardRasterFx {
+class ino_hsv_adjust final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ino_hsv_adjust)
TRasterFxPort m_input;
TRasterFxPort m_refer;
@@ -124,7 +125,8 @@ void fx_(TRasterP in_ras, const TRasterP refer_ras, const int refer_mode,
,
hue_pivot, hue_scale, hue_shift, sat_pivot, sat_scale, sat_shift,
- val_pivot, val_scale, val_shift
+ val_pivot, val_scale,
+ val_shift
//,true /* add_blend_sw */
,
@@ -135,7 +137,7 @@ void fx_(TRasterP in_ras, const TRasterP refer_ras, const int refer_mode,
ino::arr_to_ras(in_gr8->getRawData(), ino::channels(), in_ras, 0);
in_gr8->unlock();
}
-}
+} // namespace
//------------------------------------------------------------
void ino_hsv_adjust::doCompute(TTile &tile, double frame,
const TRenderSettings &rend_sets) {
@@ -216,7 +218,7 @@ void ino_hsv_adjust::doCompute(TTile &tile, double frame,
hue_scale, hue_shift, sat_pivot, sat_scale, sat_shift, val_pivot,
val_scale, val_shift,
anti_alias_sw // --> add_blend_sw, default is true
- );
+ );
if (refer_tile.getRaster() != nullptr) {
refer_tile.getRaster()->unlock();
}
diff --git a/toonz/sources/stdfx/ino_hsv_noise.cpp b/toonz/sources/stdfx/ino_hsv_noise.cpp
index 82ff665..1997d4b 100644
--- a/toonz/sources/stdfx/ino_hsv_noise.cpp
+++ b/toonz/sources/stdfx/ino_hsv_noise.cpp
@@ -3,8 +3,9 @@
#include "stdfx.h"
#include "ino_common.h"
+#include "globalcontrollablefx.h"
//------------------------------------------------------------
-class ino_hsv_noise final : public TStandardRasterFx {
+class ino_hsv_noise final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ino_hsv_noise)
TRasterFxPort m_input;
TRasterFxPort m_refer;
@@ -152,7 +153,7 @@ void fx_(TRasterP in_ras, const TRasterP refer_ras, const int refer_mode
ino::arr_to_ras(in_gr8->getRawData(), ino::channels(), in_ras, 0);
in_gr8->unlock();
}
-}
+} // namespace
//------------------------------------------------------------
void ino_hsv_noise::doCompute(TTile &tile, double frame,
const TRenderSettings &rend_sets) {
@@ -205,7 +206,7 @@ void ino_hsv_noise::doCompute(TTile &tile, double frame,
if ((0 <= margin_h && 0 < margin_w) /* 横方向のみ余白あり */
|| (0 < margin_h && 0 <= margin_w) /* 縦方向のみ余白あり */
|| (0 < margin_h && 0 < margin_w) /* 縦横両方に余白あり */
- ) {
+ ) {
/*camera_x = static_cast(ceil((double)margin_w / 2.));
camera_y = static_cast(ceil((double)margin_h / 2.));*/
camera_x = margin_w / 2;
@@ -265,7 +266,7 @@ void ino_hsv_noise::doCompute(TTile &tile, double frame,
hue_range, sat_range, val_range, mat_range, random_seed, near_blur,
term_effective, term_center, term_type, camera_x, camera_y, camera_w,
camera_h, anti_alias_sw // --> add_blend_sw, default is true
- );
+ );
if (refer_tile.getRaster() != nullptr) {
refer_tile.getRaster()->unlock();
}
diff --git a/toonz/sources/stdfx/ino_level_auto.cpp b/toonz/sources/stdfx/ino_level_auto.cpp
index 2260b66..824cb33 100644
--- a/toonz/sources/stdfx/ino_level_auto.cpp
+++ b/toonz/sources/stdfx/ino_level_auto.cpp
@@ -3,8 +3,9 @@
#include "stdfx.h"
#include "ino_common.h"
+#include "globalcontrollablefx.h"
//------------------------------------------------------------
-class ino_level_auto final : public TStandardRasterFx {
+class ino_level_auto final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ino_level_auto)
TRasterFxPort m_input;
TDoubleParamP m_in_min_shift;
@@ -86,7 +87,7 @@ void fx_(TRasterP in_ras, bool *act_sw, double *in_min_shift,
ino::arr_to_ras(in_gr8->getRawData(), ino::channels(), in_ras, 0);
in_gr8->unlock();
}
-}
+} // namespace
//------------------------------------------------------------
void ino_level_auto::doCompute(TTile &tile, double frame,
const TRenderSettings &rend_sets) {
@@ -133,7 +134,7 @@ void ino_level_auto::doCompute(TTile &tile, double frame,
if ((0 <= margin_h && 0 < margin_w) /* 横方向のみ余白あり */
|| (0 < margin_h && 0 <= margin_w) /* 縦方向のみ余白あり */
|| (0 < margin_h && 0 < margin_w) /* 縦横両方に余白あり */
- ) {
+ ) {
/*camera_x = static_cast(ceil((double)margin_w / 2.));
camera_y = static_cast(ceil((double)margin_h / 2.));*/
camera_x = margin_w / 2;
diff --git a/toonz/sources/stdfx/ino_level_master.cpp b/toonz/sources/stdfx/ino_level_master.cpp
index 12d5bfd..6f85fc1 100644
--- a/toonz/sources/stdfx/ino_level_master.cpp
+++ b/toonz/sources/stdfx/ino_level_master.cpp
@@ -4,8 +4,9 @@
#include "tparamset.h"
#include "ino_common.h"
+#include "globalcontrollablefx.h"
//------------------------------------------------------------
-class ino_level_master final : public TStandardRasterFx {
+class ino_level_master final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ino_level_master)
TRasterFxPort m_input;
TRasterFxPort m_refer;
@@ -175,7 +176,7 @@ void ino_level_master::doCompute(TTile &tile, double frame,
true // clamp_sw
,
alp_rend_sw, anti_alias_sw // --> add_blend_sw, default is true
- );
+ );
ino::arr_to_ras(in_gr8->getRawData(), ino::channels(), in_ras, 0);
diff --git a/toonz/sources/stdfx/ino_level_rgba.cpp b/toonz/sources/stdfx/ino_level_rgba.cpp
index afe060c..ae5a45c 100644
--- a/toonz/sources/stdfx/ino_level_rgba.cpp
+++ b/toonz/sources/stdfx/ino_level_rgba.cpp
@@ -4,8 +4,9 @@
#include "tparamset.h"
#include "ino_common.h"
+#include "globalcontrollablefx.h"
//------------------------------------------------------------
-class ino_level_rgba final : public TStandardRasterFx {
+class ino_level_rgba final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ino_level_rgba)
TRasterFxPort m_input;
TRasterFxPort m_refer;
@@ -270,7 +271,7 @@ void ino_level_rgba::doCompute(TTile &tile, double frame,
true // alpha_rendering_sw
,
anti_alias_sw // --> add_blend_sw, default is true
- );
+ );
ino::arr_to_ras(in_gr8->getRawData(), ino::channels(), in_ras, 0);
diff --git a/toonz/sources/stdfx/ino_negate.cpp b/toonz/sources/stdfx/ino_negate.cpp
index 5fa8713..921f600 100644
--- a/toonz/sources/stdfx/ino_negate.cpp
+++ b/toonz/sources/stdfx/ino_negate.cpp
@@ -2,9 +2,10 @@
#include "tfxparam.h"
#include "stdfx.h"
+#include "globalcontrollablefx.h"
#include "ino_common.h"
//------------------------------------------------------------
-class ino_negate final : public TStandardRasterFx {
+class ino_negate final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ino_negate)
TRasterFxPort m_input;
TBoolParamP m_red;
@@ -68,7 +69,7 @@ void fx_(TRasterP in_ras, const bool sw_array[4]) {
ino::arr_to_ras(in_gr8->getRawData(), ino::channels(), in_ras, 0);
in_gr8->unlock();
}
-}
+} // namespace
//------------------------------------------------------------
void ino_negate::doCompute(TTile &tile, double frame,
const TRenderSettings &rend_sets) {
diff --git a/toonz/sources/stdfx/multitonefx.cpp b/toonz/sources/stdfx/multitonefx.cpp
index 185ee14..568bf65 100644
--- a/toonz/sources/stdfx/multitonefx.cpp
+++ b/toonz/sources/stdfx/multitonefx.cpp
@@ -3,8 +3,9 @@
#include "stdfx.h"
#include "tfxparam.h"
#include "tspectrumparam.h"
+#include "globalcontrollablefx.h"
-class MultiToneFx final : public TStandardRasterFx {
+class MultiToneFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(MultiToneFx)
TRasterFxPort m_input;
diff --git a/toonz/sources/stdfx/palettefilterfx.cpp b/toonz/sources/stdfx/palettefilterfx.cpp
index b90fb9a..f3a19cd 100644
--- a/toonz/sources/stdfx/palettefilterfx.cpp
+++ b/toonz/sources/stdfx/palettefilterfx.cpp
@@ -3,10 +3,11 @@
#include "stdfx.h"
#include "tfxparam.h"
#include "ttzpimagefx.h"
+#include "globalcontrollablefx.h"
//===================================================================
-class PaletteFilterFx final : public TStandardRasterFx {
+class PaletteFilterFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(PaletteFilterFx)
TRasterFxPort m_input;
diff --git a/toonz/sources/stdfx/rgbkeyfx.cpp b/toonz/sources/stdfx/rgbkeyfx.cpp
index 8a84e0b..80ce8a9 100644
--- a/toonz/sources/stdfx/rgbkeyfx.cpp
+++ b/toonz/sources/stdfx/rgbkeyfx.cpp
@@ -6,8 +6,9 @@
#include "stdfx.h"
#include "tparamset.h"
+#include "globalcontrollablefx.h"
-class RGBKeyFx final : public TStandardRasterFx {
+class RGBKeyFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(RGBKeyFx)
TRasterFxPort m_input;
@@ -61,7 +62,7 @@ void update_param(int ¶m, TRaster64P ras) {
param = param * 257;
return;
}
-}
+} // namespace
//-------------------------------------------------------------------
diff --git a/toonz/sources/stdfx/rgbmcutfx.cpp b/toonz/sources/stdfx/rgbmcutfx.cpp
index 25ce3ea..4c82a8d 100644
--- a/toonz/sources/stdfx/rgbmcutfx.cpp
+++ b/toonz/sources/stdfx/rgbmcutfx.cpp
@@ -5,8 +5,9 @@
#include "tpixelutils.h"
#include "tparamset.h"
+#include "globalcontrollablefx.h"
-class RGBMCutFx final : public TStandardRasterFx {
+class RGBMCutFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(RGBMCutFx)
TRasterFxPort m_input;
diff --git a/toonz/sources/stdfx/rgbmscalefx.cpp b/toonz/sources/stdfx/rgbmscalefx.cpp
index cb96e3a..97ae025 100644
--- a/toonz/sources/stdfx/rgbmscalefx.cpp
+++ b/toonz/sources/stdfx/rgbmscalefx.cpp
@@ -4,10 +4,11 @@
#include "tfxparam.h"
#include "texception.h"
#include "stdfx.h"
+#include "globalcontrollablefx.h"
//===================================================================
-class RGBMScaleFx final : public TStandardRasterFx {
+class RGBMScaleFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(RGBMScaleFx)
TRasterFxPort m_input;
TDoubleParamP m_red;
diff --git a/toonz/sources/stdfx/tonecurvefx.cpp b/toonz/sources/stdfx/tonecurvefx.cpp
index f4b1ec6..168ff0d 100644
--- a/toonz/sources/stdfx/tonecurvefx.cpp
+++ b/toonz/sources/stdfx/tonecurvefx.cpp
@@ -6,6 +6,7 @@
#include "tparamset.h"
#include "ttonecurveparam.h"
#include "tcurves.h"
+#include "globalcontrollablefx.h"
//===================================================================
@@ -108,7 +109,7 @@ void fill_lut(QList points, std::vector &lut, bool isLinear) {
//===================================================================
-class ToneCurveFx final : public TStandardRasterFx {
+class ToneCurveFx final : public GlobalControllableFx {
FX_PLUGIN_DECLARATION(ToneCurveFx)
TRasterFxPort m_input;
diff --git a/toonz/sources/tnzbase/tfxattributes.cpp b/toonz/sources/tnzbase/tfxattributes.cpp
index 9f1a9f6..00c7029 100644
--- a/toonz/sources/tnzbase/tfxattributes.cpp
+++ b/toonz/sources/tnzbase/tfxattributes.cpp
@@ -14,7 +14,8 @@ TFxAttributes::TFxAttributes()
, m_speed()
, m_groupSelector(-1)
, m_passiveCacheDataIdx(-1)
- , m_fxVersion(1) {}
+ , m_fxVersion(1)
+ , m_hasGlobalControl(false) {}
//----------------------------------------------------------------------
diff --git a/toonz/sources/toonzlib/scenefx.cpp b/toonz/sources/toonzlib/scenefx.cpp
index 21c58eb..072dcd4 100644
--- a/toonz/sources/toonzlib/scenefx.cpp
+++ b/toonz/sources/toonzlib/scenefx.cpp
@@ -33,9 +33,12 @@
#include "../stdfx/motionawarebasefx.h"
#include "../stdfx/textawarebasefx.h"
+#include "../stdfx/globalcontrollablefx.h"
#include "toonz/scenefx.h"
+#include
+
/*
TODO: Some parts of the following render-tree building procedure should be
revised. In particular,
@@ -548,6 +551,8 @@ public:
// (at least) of a particle Fx
int m_particleDescendentCount;
+ QList m_globalControlledFx;
+
public:
FxBuilder(ToonzScene *scene, TXsheet *xsh, double frame, int whichLevels,
bool isPreview = false, bool expandXSheet = true);
@@ -1000,6 +1005,24 @@ PlacedFx FxBuilder::makePFfromUnaryFx(TFx *fx) {
TFx *inputFx = fx->getInputPort(0)->getFx();
if (!inputFx) return PlacedFx();
+ // global controllable fx
+ if (fx->getAttributes()->hasGlobalControl() &&
+ !m_globalControlledFx.contains(fx->getFxId())) {
+ GlobalControllableFx *gcFx = dynamic_cast(fx);
+ double val = gcFx->getGrobalControlValue(m_frame);
+ if (val < 1.0) {
+ m_globalControlledFx.append(fx->getFxId());
+ // insert cross disolve fx and mix with the input fx
+ TFxP blendFx = TFx::create("blendFx");
+ blendFx->connect("Source1", fx);
+ blendFx->connect("Source2", inputFx);
+ // set the global intensity value to the cross disolve fx
+ dynamic_cast(blendFx->getParams()->getParam("value"))
+ ->setDefaultValue(val * 100.0);
+ return makePF(blendFx.getPointer());
+ }
+ }
+
PlacedFx pf = makePF(inputFx); // Build sub-render-tree
if (!pf.m_fx) return PlacedFx();
@@ -1066,6 +1089,26 @@ PlacedFx FxBuilder::makePFfromGenericFx(TFx *fx) {
return pf;
}
+ // global controllable fx
+ if (fx->getAttributes()->hasGlobalControl() &&
+ !m_globalControlledFx.contains(fx->getFxId())) {
+ GlobalControllableFx *gcFx = dynamic_cast(fx);
+ double val = gcFx->getGrobalControlValue(m_frame);
+ if (val < 1.0) {
+ TFxP inputFx = fx->getInputPort(fx->getPreferredInputPort())->getFx();
+ if (!inputFx) return pf;
+ m_globalControlledFx.append(fx->getFxId());
+ // insert cross disolve fx and mix with the input fx
+ TFxP blendFx = TFx::create("blendFx");
+ blendFx->connect("Source1", fx);
+ blendFx->connect("Source2", inputFx.getPointer());
+ // set the global intensity value to the cross disolve fx
+ dynamic_cast(blendFx->getParams()->getParam("value"))
+ ->setDefaultValue(val * 100.0);
+ return makePF(blendFx.getPointer());
+ }
+ }
+
// Multi-input fxs are always cloned - since at least one of its input ports
// will have an NaAffineFx
// injected just before its actual input fx.
diff --git a/toonz/sources/toonzlib/txsheetexpr.cpp b/toonz/sources/toonzlib/txsheetexpr.cpp
index 526810e..680ee44 100644
--- a/toonz/sources/toonzlib/txsheetexpr.cpp
+++ b/toonz/sources/toonzlib/txsheetexpr.cpp
@@ -423,6 +423,20 @@ public:
if (paramName == paramNameToCheck ||
toLower(paramName) == toLower(paramNameToCheck))
return param;
+
+ // in case the parameter has ui label
+ // ( paramters of plugin fxs and intensity of GlobalControllableFx)
+ if (param->hasUILabel()) {
+ paramName = param->getUILabel();
+ int i = paramName.find_first_of(" -");
+ while (i != std::string::npos) {
+ paramName.erase(i, 1);
+ i = paramName.find_first_of(" -");
+ }
+ if (paramName == paramNameToCheck ||
+ toLower(paramName) == toLower(paramNameToCheck))
+ return param;
+ }
}
return 0;
}
diff --git a/toonz/sources/toonzqt/functiontreeviewer.cpp b/toonz/sources/toonzqt/functiontreeviewer.cpp
index 8ea83fe..d43c794 100644
--- a/toonz/sources/toonzqt/functiontreeviewer.cpp
+++ b/toonz/sources/toonzqt/functiontreeviewer.cpp
@@ -680,8 +680,12 @@ void FunctionTreeModel::Channel::setParam(const TParamP ¶m) {
/*! in order to show the expression name in the tooltip
*/
QString FunctionTreeModel::Channel::getExprRefName() const {
- QString tmpName = QString(QString::fromStdWString(
- TStringTable::translate(m_paramNamePref + m_param->getName())));
+ QString tmpName;
+ if (m_param->hasUILabel())
+ tmpName = QString::fromStdString(m_param->getUILabel());
+ else
+ tmpName = QString::fromStdWString(
+ TStringTable::translate(m_paramNamePref + m_param->getName()));
/*--- stage
* objectパラメータの場合、TableにあわせてtmpNameを代表的なExpression名にする---*/
StageObjectChannelGroup *stageGroup =
diff --git a/toonz/sources/toonzqt/fxsettings.cpp b/toonz/sources/toonzqt/fxsettings.cpp
index 3690a3a..7a00ba2 100644
--- a/toonz/sources/toonzqt/fxsettings.cpp
+++ b/toonz/sources/toonzqt/fxsettings.cpp
@@ -446,6 +446,44 @@ void ParamsPage::setPageField(TIStream &is, const TFxP &fx, bool isVertical) {
}
//-----------------------------------------------------------------------------
+// add a slider for global control
+void ParamsPage::addGlobalControl(const TFxP &fx) {
+ if (!fx->getAttributes()->hasGlobalControl()) return;
+
+ std::string name = "globalIntensity";
+
+ TParamP param = fx->getParams()->getParam(name);
+ if (!param) return;
+
+ assert(param->hasUILabel());
+ QString str = QString::fromStdString(param->getUILabel());
+ ParamField *field = ParamField::create(this, str, param);
+ if (!field) return;
+
+ int currentRow = m_mainLayout->rowCount();
+ if (!m_fields.isEmpty()) {
+ Separator *sep = new Separator("", this);
+ m_mainLayout->addWidget(sep, currentRow, 0, 1, 2);
+ m_mainLayout->setRowStretch(currentRow, 0);
+ currentRow = m_mainLayout->rowCount();
+ }
+
+ m_fields.push_back(field);
+ QLabel *label = new QLabel(str, this);
+ label->setObjectName("FxSettingsLabel");
+ m_mainLayout->addWidget(label, currentRow, 0,
+ Qt::AlignRight | Qt::AlignVCenter);
+ m_mainLayout->addWidget(field, currentRow, 1);
+
+ connect(field, SIGNAL(currentParamChanged()), m_paramViewer,
+ SIGNAL(currentFxParamChanged()));
+ connect(field, SIGNAL(actualParamChanged()), m_paramViewer,
+ SIGNAL(actualFxParamChanged()));
+ connect(field, SIGNAL(paramKeyToggle()), m_paramViewer,
+ SIGNAL(paramKeyChanged()));
+}
+
+//-----------------------------------------------------------------------------
void ParamsPage::setPageSpace() {
if (m_fields.count() != 0) {
@@ -917,7 +955,14 @@ void ParamsPageSet::createPage(TIStream &is, const TFxP &fx, int index) {
if (pageName == "") pageName = "page";
ParamsPage *paramsPage = new ParamsPage(this, m_parent);
- paramsPage->setPage(is, fx);
+
+ bool isFirstPageOfFx;
+ if (index < 0)
+ isFirstPageOfFx = (m_pagesList->count() == 0);
+ else // macro fx case
+ isFirstPageOfFx = !(m_pageFxIndexTable.values().contains(index));
+
+ paramsPage->setPage(is, fx, isFirstPageOfFx);
connect(paramsPage, SIGNAL(preferredPageSizeChanged()), this,
SLOT(recomputePreferredSize()));