From 5230690abed1fc9577d9d9e0dc901bc2b22aa6e2 Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Tue, 24 Dec 2019 16:03:30 +0900 Subject: [PATCH] fix pasted macro fx node position --- toonz/sources/toonzlib/fxcommand.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/toonz/sources/toonzlib/fxcommand.cpp b/toonz/sources/toonzlib/fxcommand.cpp index aab8e072..e2a7bf54 100644 --- a/toonz/sources/toonzlib/fxcommand.cpp +++ b/toonz/sources/toonzlib/fxcommand.cpp @@ -141,7 +141,7 @@ void showFx(TXsheet *xsh, TFx *fx) { fx->getAttributes()->setIsOpened(xsh->getFxDag()->getDagGridDimension() == 0); if (TZeraryColumnFx *zcfx = dynamic_cast(fx)) - fx = zcfx->getZeraryFx(); + fx = zcfx->getZeraryFx(); fx->getAttributes()->passiveCacheDataIdx() = -1; } @@ -589,9 +589,8 @@ template TFx *FxCommandUndo::leftmostConnectedFx(TFx *fx, Pred pred) { assert(fx); - fx = rightmostConnectedFx( - fx, pred); // The rightmost fx should be discovered first, - // then, we'll descend from that + fx = rightmostConnectedFx(fx, pred); // The rightmost fx should be discovered + // first, then, we'll descend from that do { fx = ::getActualIn(fx); @@ -630,7 +629,7 @@ namespace { struct True_pred { bool operator()(TFx *fx) { return true; } }; -} +} // namespace TFx *FxCommandUndo::leftmostConnectedFx(TFx *fx) { return leftmostConnectedFx(fx, ::True_pred()); @@ -1155,7 +1154,7 @@ void ReplaceFxUndo::initialize() { } TZeraryColumnFx *zcrepfx = dynamic_cast(repFx); - if (zcrepfx) repFx = zcrepfx->getZeraryFx(); + if (zcrepfx) repFx = zcrepfx->getZeraryFx(); bool fxHasCol = has_fx_column(fx); bool repfxHasCol = has_fx_column(repFx); @@ -2577,6 +2576,10 @@ void UndoPasteFxs::initialize(const std::map &zeraryFxColumnSize, int ip, ipCount = macroFx->getInputPortCount(); for (ip = 0; ip != ipCount; ++ip) locals::renamePort(macroFx, ip, oldFxId, newFxId); + // node position of the macrofx is defined by dag-pos of inner fxs. + // so we need to reset them here or pasted node will be at the same + // position as the copied one. + locals::buildDagPos(inFx, inFx, copyDagPos, addOffset); } }