OpenToonz - An open-source full-featured 2D animation creation software
C
fix fx intensity
shun-iwasawad64a5b87ad48
diff --git a/toonz/sources/toonzlib/scenefx.cpp b/toonz/sources/toonzlib/scenefx.cppindex 072dcd448..33c10d018 100644--- a/toonz/sources/toonzlib/scenefx.cpp+++ b/toonz/sources/toonzlib/scenefx.cpp@@ -551,7 +551,12 @@ public:// (at least) of a particle Fxint m_particleDescendentCount;- QList<std::wstring> m_globalControlledFx;+ // fxid and pointer to the correspondent blend fx for the global+ // control. Boolean is the flag indicating that the makePF is just called+ // from the blend fx. If the flag is true then just compute the+ // global controlled Fx without inserting the same blend fx in order to+ // prevent infinite loop.+ QMap<std::wstring, QPair<TFxP, bool>> m_globalControlledFx;public:FxBuilder(ToonzScene *scene, TXsheet *xsh, double frame, int whichLevels,@@ -1006,20 +1011,27 @@ PlacedFx FxBuilder::makePFfromUnaryFx(TFx *fx) {if (!inputFx) return PlacedFx();// global controllable fx- if (fx->getAttributes()->hasGlobalControl() &&- !m_globalControlledFx.contains(fx->getFxId())) {- GlobalControllableFx *gcFx = dynamic_cast<GlobalControllableFx *>(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<TDoubleParam *>(blendFx->getParams()->getParam("value"))- ->setDefaultValue(val * 100.0);- return makePF(blendFx.getPointer());+ if (fx->getAttributes()->hasGlobalControl()) {+ if (!m_globalControlledFx.contains(fx->getFxId())) {+ GlobalControllableFx *gcFx = dynamic_cast<GlobalControllableFx *>(fx);+ double val = gcFx->getGrobalControlValue(m_frame);+ if (val < 1.0) {+ // 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<TDoubleParam *>(blendFx->getParams()->getParam("value"))+ ->setDefaultValue(val * 100.0);+ m_globalControlledFx.insert(fx->getFxId(), {blendFx, true});+ return makePF(blendFx.getPointer());+ }+ } else if (m_globalControlledFx.value(fx->getFxId()).second)+ m_globalControlledFx[fx->getFxId()].second = false;+ else {+ m_globalControlledFx[fx->getFxId()].second = true;+ return makePF(+ m_globalControlledFx.value(fx->getFxId()).first.getPointer());}}@@ -1090,22 +1102,29 @@ PlacedFx FxBuilder::makePFfromGenericFx(TFx *fx) {}// global controllable fx- if (fx->getAttributes()->hasGlobalControl() &&- !m_globalControlledFx.contains(fx->getFxId())) {- GlobalControllableFx *gcFx = dynamic_cast<GlobalControllableFx *>(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<TDoubleParam *>(blendFx->getParams()->getParam("value"))- ->setDefaultValue(val * 100.0);- return makePF(blendFx.getPointer());+ if (fx->getAttributes()->hasGlobalControl()) {+ if (!m_globalControlledFx.contains(fx->getFxId())) {+ GlobalControllableFx *gcFx = dynamic_cast<GlobalControllableFx *>(fx);+ double val = gcFx->getGrobalControlValue(m_frame);+ if (val < 1.0) {+ TFxP inputFx = fx->getInputPort(fx->getPreferredInputPort())->getFx();+ if (!inputFx) return pf;+ // insert cross disolve fx and mix with the input fx+ TFxP blendFx = TFx::create("blendFx");+ blendFx->connect("Source1", fx);+ blendFx->connect("Source2", inputFx.getPointer());+ m_globalControlledFx.insert(fx->getFxId(), {blendFx, true});+ // set the global intensity value to the cross disolve fx+ dynamic_cast<TDoubleParam *>(blendFx->getParams()->getParam("value"))+ ->setDefaultValue(val * 100.0);+ return makePF(blendFx.getPointer());+ }+ } else if (m_globalControlledFx.value(fx->getFxId()).second)+ m_globalControlledFx[fx->getFxId()].second = false;+ else {+ m_globalControlledFx[fx->getFxId()].second = true;+ return makePF(+ m_globalControlledFx.value(fx->getFxId()).first.getPointer());}}