From 1f073102d58ddf1e637365a6369471418415bc68 Mon Sep 17 00:00:00 2001 From: Rodney <rodney.baker@gmail.com> Date: Mar 31 2023 14:33:56 +0000 Subject: Merge pull request #4800 from shun-iwasawa/switch_current_fx_on_switching_column Switch current fx on switching columns --- diff --git a/toonz/sources/toonz/xsheetviewer.cpp b/toonz/sources/toonz/xsheetviewer.cpp index 9307049..ac8ea6f 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; }