diff --git a/toonz/sources/toonzlib/fxcommand.cpp b/toonz/sources/toonzlib/fxcommand.cpp index 1234217..97c7c26 100644 --- a/toonz/sources/toonzlib/fxcommand.cpp +++ b/toonz/sources/toonzlib/fxcommand.cpp @@ -1152,7 +1152,13 @@ void ReplaceFxUndo::initialize() { fx = zcfx->getZeraryFx(); } - if (has_fx_column(fx)) { + TZeraryColumnFx *zcrepfx = dynamic_cast(repFx); + if (zcrepfx) repFx = zcrepfx->getZeraryFx(); + + bool fxHasCol = has_fx_column(fx); + bool repfxHasCol = has_fx_column(repFx); + + if (fxHasCol && repfxHasCol) { if (zcfx) { // Build a column with the same source cells pattern m_repColumn = new TXshZeraryFxColumn(*zcfx->getColumn()); @@ -1170,6 +1176,10 @@ void ReplaceFxUndo::initialize() { m_repColIdx = xsh->getFirstFreeColumnIndex(); m_repFx = static_cast(m_repColumn->getFx()); } + } else if (!fxHasCol && repfxHasCol) { + m_repColumn = FxCommandUndo::createZeraryFxColumn(xsh, repFx); + m_repColIdx = xsh->getFirstFreeColumnIndex(); + m_repFx = static_cast(m_repColumn->getFx()); } FxCommandUndo::cloneGroupStack(fx, m_repFx.getPointer());