Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

switch current fx on switching column

shun-iwasawa9a3b650f6fac
diff --git a/toonz/sources/toonz/xsheetviewer.cpp b/toonz/sources/toonz/xsheetviewer.cpp
index 9307049ec..ac8ea6f8e 100644
--- a/toonz/sources/toonz/xsheetviewer.cpp
+++ b/toonz/sources/toonz/xsheetviewer.cpp
@@ -36,6 +36,8 @@
#include "toonz/tproject.h"
#include "tconvert.h"
#include "toonz/navigationtags.h"
+#include "toonz/txshlevelcolumn.h"
+#include "toonz/txshpalettecolumn.h"
#include "tenv.h"
@@ -520,9 +522,22 @@ void XsheetViewer::setCurrentColumn(int col) {
objectHandle->setObjectId(TStageObjectId::ColumnId(col));
TXsheet *xsh = getXsheet();
TXshColumn *column = xsh->getColumn(col);
- if (!column || !column->getZeraryFxColumn()) return;
- TFx *fx = column->getZeraryFxColumn()->getZeraryColumnFx();
- TApp::instance()->getCurrentFx()->setFx(fx);
+ if (!column) return;
+ // switching the current fx
+ TFx *fx = nullptr;
+ bool doSwitchFxSettings = false;
+ if (TXshLevelColumn *lc = column->getLevelColumn())
+ fx = lc->getLevelColumnFx();
+ else if (TXshPaletteColumn *pc =
+ dynamic_cast<TXshPaletteColumn *>(column))
+ fx = pc->getPaletteColumnFx();
+ else if (TXshZeraryFxColumn *zc =
+ dynamic_cast<TXshZeraryFxColumn *>(column)) {
+ fx = zc->getZeraryColumnFx();
+ doSwitchFxSettings = true;
+ }
+ if (!fx) return;
+ TApp::instance()->getCurrentFx()->setFx(fx, doSwitchFxSettings);
}
return;
}