From c46a376c30e0625330e975463801a6c7fd6cec6f Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Dec 11 2020 02:21:20 +0000 Subject: additional fix for #3488 --- diff --git a/toonz/sources/toonz/subscenecommand.cpp b/toonz/sources/toonz/subscenecommand.cpp index e454d85..8322b24 100644 --- a/toonz/sources/toonz/subscenecommand.cpp +++ b/toonz/sources/toonz/subscenecommand.cpp @@ -488,10 +488,6 @@ TFx *explodeFxSubTree(TFx *innerFx, QMap> &fxs, } else { TFxSet *innerTerminals = innerDag->getTerminalFxs(); int i, terminalCount = innerTerminals->getFxCount(); - if (!terminalCount) { - fxs[innerFx] = QPair(nullptr, -1); - return nullptr; - } QMultiMap sortedFx; for (i = 0; i < terminalCount; i++) { TFx *terminalFx = innerTerminals->getFx(i); @@ -508,6 +504,13 @@ TFx *explodeFxSubTree(TFx *innerFx, QMap> &fxs, return nullptr; } + // in case no nodes connected to the xsheet the xsheet node will not be + // merged, but will just be removed + if (terminalCount == 0) { + fxs[innerFx] = QPair(nullptr, -1); + return innerFx; // just to return non-zero value + } + TFx *root = sortedFx.begin().value(); // If only one node is connected to the Xsheet node, then skip bringing it @@ -836,7 +839,7 @@ void explodeFxs(TXsheet *xsh, TXsheet *subXsh, const GroupData &fxGroupData, innerDag, fxGroupData, outPorts); // in case the child and parent Xsheet nodes will be "merged" - if (!root && innerDag->getTerminalFxs()->getFxCount()) { + if (!root) { TFxSet *internals = innerDag->getTerminalFxs(); for (int j = 0; j < internals->getFxCount(); j++) { TFx *fx = internals->getFx(j); @@ -942,12 +945,13 @@ void setGrammerToParams(const ParamCont *cont, //----------------------------------------------------------------------------- std::set explode(TXsheet *xsh, TXsheet *subXsh, int index, - const TStageObjectId &parentId, const GroupData &objGroupData, - const TPointD &stageSubPos, const GroupData &fxGroupData, - const TPointD &fxSubPos, QList &pegObjects, - QMap &splines, - const std::vector &outPorts, bool onlyColumn, - bool linkToXsheet) { + const TStageObjectId &parentId, + const GroupData &objGroupData, const TPointD &stageSubPos, + const GroupData &fxGroupData, const TPointD &fxSubPos, + QList &pegObjects, + QMap &splines, + const std::vector &outPorts, bool onlyColumn, + bool linkToXsheet) { // innerFx->outerFxs QMap> fxs; // inner id->outer id @@ -972,6 +976,7 @@ std::set explode(TXsheet *xsh, TXsheet *subXsh, int index, QMap fxMap; for (auto it = fxs.constBegin(); it != fxs.constEnd(); ++it) { + if (it.value().first == nullptr) continue; setGrammerToParams(it.value().first->getParams(), grammer); fxMap.insert(it.key(), it.value().first); }