diff --git a/stuff/config/qss/Blue/Blue.qss b/stuff/config/qss/Blue/Blue.qss index a96719c..09d5d1d 100644 --- a/stuff/config/qss/Blue/Blue.qss +++ b/stuff/config/qss/Blue/Blue.qss @@ -1749,6 +1749,7 @@ SchematicViewer { qproperty-ActiveOutputColor: #4073a3; qproperty-OtherOutputColor: #5e9aa3; qproperty-XsheetColor: #62628c; + qproperty-PassThroughColor: #858585; qproperty-NormalFxColor: #5b90a3; qproperty-MacroFxColor: #815c79; qproperty-ImageAdjustFxColor: #656287; diff --git a/stuff/config/qss/Dark/Dark.qss b/stuff/config/qss/Dark/Dark.qss index 87b94c2..f62c3e7 100644 --- a/stuff/config/qss/Dark/Dark.qss +++ b/stuff/config/qss/Dark/Dark.qss @@ -1749,6 +1749,7 @@ SchematicViewer { qproperty-ActiveOutputColor: #4073a3; qproperty-OtherOutputColor: #5e9aa3; qproperty-XsheetColor: #62628c; + qproperty-PassThroughColor: #858585; qproperty-NormalFxColor: #5b90a3; qproperty-MacroFxColor: #815c79; qproperty-ImageAdjustFxColor: #656287; diff --git a/stuff/config/qss/Default/Default.qss b/stuff/config/qss/Default/Default.qss index 4834396..91656df 100644 --- a/stuff/config/qss/Default/Default.qss +++ b/stuff/config/qss/Default/Default.qss @@ -1749,6 +1749,7 @@ SchematicViewer { qproperty-ActiveOutputColor: #4073a3; qproperty-OtherOutputColor: #5e9aa3; qproperty-XsheetColor: #62628c; + qproperty-PassThroughColor: #858585; qproperty-NormalFxColor: #5b90a3; qproperty-MacroFxColor: #815c79; qproperty-ImageAdjustFxColor: #656287; diff --git a/stuff/config/qss/Default/less/Default.less b/stuff/config/qss/Default/less/Default.less index ff01577..94f2bb6 100644 --- a/stuff/config/qss/Default/less/Default.less +++ b/stuff/config/qss/Default/less/Default.less @@ -478,6 +478,7 @@ @schematic-ActiveOutputcolor: @xsheet-ActiveCamera-color; @schematic-OtherOutputcolor: @xsheet-OtherCamera-color; @schematic-XsheetColor: #62628c; +@schematic-PassThroughColor: #858585; @schematic-NormalFxColor: #5b90a3; @schematic-MacroFxColor: #815c79; @schematic-ImageAdjustFxColor: #656287; diff --git a/stuff/config/qss/Default/less/layouts/schematic.less b/stuff/config/qss/Default/less/layouts/schematic.less index 8bd0d51..80ed4a0 100644 --- a/stuff/config/qss/Default/less/layouts/schematic.less +++ b/stuff/config/qss/Default/less/layouts/schematic.less @@ -24,6 +24,7 @@ SchematicViewer { qproperty-ActiveOutputColor: saturate(lighten(@schematic-ActiveOutputcolor, @nodeLightness), @nodeSaturation); qproperty-OtherOutputColor: saturate(lighten(@schematic-OtherOutputcolor, @nodeLightness), @nodeSaturation); qproperty-XsheetColor: saturate(lighten(@schematic-XsheetColor, @nodeLightness), @nodeSaturation); + qproperty-PassThroughColor: saturate(lighten(@schematic-PassThroughColor, @nodeLightness), @nodeSaturation); qproperty-NormalFxColor: saturate(lighten(@schematic-NormalFxColor, @nodeLightness), @nodeSaturation); qproperty-MacroFxColor: saturate(lighten(@schematic-MacroFxColor, @nodeLightness), @nodeSaturation); qproperty-ImageAdjustFxColor: saturate(lighten(@schematic-ImageAdjustFxColor, @nodeLightness), @nodeSaturation); diff --git a/stuff/config/qss/Default/less/themes/Neutral.less b/stuff/config/qss/Default/less/themes/Neutral.less index 2cedd2a..6b8e83c 100644 --- a/stuff/config/qss/Default/less/themes/Neutral.less +++ b/stuff/config/qss/Default/less/themes/Neutral.less @@ -181,6 +181,7 @@ @schematic-ActiveOutputcolor: @xsheet-ActiveCamera-color; @schematic-OtherOutputcolor: @xsheet-OtherCamera-color; @schematic-XsheetColor: rgb(164, 164, 191); +@schematic-PassThroughColor: #bdbdbd; @schematic-NormalFxColor: rgb(141, 156, 175); @schematic-MacroFxColor: rgb(174, 140, 165); @schematic-ImageAdjustFxColor: rgb(156, 154, 180); diff --git a/stuff/config/qss/Light/Light.qss b/stuff/config/qss/Light/Light.qss index 9e10481..3f18192 100644 --- a/stuff/config/qss/Light/Light.qss +++ b/stuff/config/qss/Light/Light.qss @@ -1749,6 +1749,7 @@ SchematicViewer { qproperty-ActiveOutputColor: #b7dbfc; qproperty-OtherOutputColor: #9ad9e2; qproperty-XsheetColor: #cbcbe4; + qproperty-PassThroughColor: #e7dfdf; qproperty-NormalFxColor: #b1c2d7; qproperty-MacroFxColor: #d7b0cc; qproperty-ImageAdjustFxColor: #c1bedc; diff --git a/stuff/config/qss/Neutral/Neutral.qss b/stuff/config/qss/Neutral/Neutral.qss index 8465dc7..3743e3b 100644 --- a/stuff/config/qss/Neutral/Neutral.qss +++ b/stuff/config/qss/Neutral/Neutral.qss @@ -1749,6 +1749,7 @@ SchematicViewer { qproperty-ActiveOutputColor: #6491be; qproperty-OtherOutputColor: #8f9c9e; qproperty-XsheetColor: #a4a4bf; + qproperty-PassThroughColor: #bdbdbd; qproperty-NormalFxColor: #8d9caf; qproperty-MacroFxColor: #ae8ca5; qproperty-ImageAdjustFxColor: #9c9ab4; diff --git a/toonz/sources/include/toonzqt/fxschematicnode.h b/toonz/sources/include/toonzqt/fxschematicnode.h index 11c0a9d..056a631 100644 --- a/toonz/sources/include/toonzqt/fxschematicnode.h +++ b/toonz/sources/include/toonzqt/fxschematicnode.h @@ -196,6 +196,8 @@ class FxSchematicPort final : public SchematicPort { QList m_hiddenLinks; QList m_ghostLinks; + bool m_isPassThrough; + public: FxSchematicPort(FxSchematicDock *parent, int type); ~FxSchematicPort(); @@ -207,6 +209,8 @@ public: FxSchematicDock *getDock() const; SchematicLink *makeLink(SchematicPort *port) override; + void setIsPassThrough(); + protected: void contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) override; void mouseMoveEvent(QGraphicsSceneMouseEvent *me) override; @@ -596,4 +600,50 @@ protected slots: void onRenderToggleClicked(bool); }; +//***************************************************** +// FxPassThroughPainter +//***************************************************** +class FxSchematicPassThroughNode; +class FxPassThroughPainter final : public QObject, public QGraphicsItem { + Q_OBJECT + Q_INTERFACES(QGraphicsItem) + + double m_width, m_height; + + FxSchematicPassThroughNode *m_parent; + +public: + FxPassThroughPainter(FxSchematicPassThroughNode *parent, double width, + double height); + ~FxPassThroughPainter(); + + QRectF boundingRect() const override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, + QWidget *widget = 0) override; + +protected: + void contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) override; +}; + +//***************************************************** +// FxSchematicPassThroughNode +//***************************************************** + +class FxSchematicPassThroughNode final : public FxSchematicNode { + Q_OBJECT + + FxPassThroughPainter *m_passThroughPainter; + +public: + FxSchematicPassThroughNode(FxSchematicScene *scene, TFx *fx); + ~FxSchematicPassThroughNode(); + + QRectF boundingRect() const override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, + QWidget *widget = 0) override; + +protected: + void mousePressEvent(QGraphicsSceneMouseEvent *me) override; +}; + #endif // FXSCHEMATICNODE_H diff --git a/toonz/sources/include/toonzqt/fxschematicscene.h b/toonz/sources/include/toonzqt/fxschematicscene.h index 75a1bbc..346388e 100644 --- a/toonz/sources/include/toonzqt/fxschematicscene.h +++ b/toonz/sources/include/toonzqt/fxschematicscene.h @@ -24,6 +24,7 @@ class FxSchematicGroupEditor; class FxSchematicMacroEditor; class TMacroFx; +enum SearchDirection { Both = 0, Input, Output }; //================================================================== // // FXSchematic @@ -178,7 +179,10 @@ private: void placeNodeAndParents(TFx *fx, double x, double &maxX, double &maxY); QPointF nearestPoint(const QPointF &point); - void highlightLinks(FxSchematicNode *node, bool value); + + void highlightLinks(FxSchematicNode *node, bool value, + SearchDirection direction = Both); + void updatePosition(FxSchematicNode *node, const TPointD &pos); void simulateInsertSelection(SchematicLink *link, bool connect); void updatePositionOnResize(TFx *fx, bool maximizedNode); diff --git a/toonz/sources/include/toonzqt/schematicviewer.h b/toonz/sources/include/toonzqt/schematicviewer.h index 675512c..896abfa 100644 --- a/toonz/sources/include/toonzqt/schematicviewer.h +++ b/toonz/sources/include/toonzqt/schematicviewer.h @@ -294,6 +294,11 @@ class DVAPI SchematicViewer final : public QWidget { QColor m_xsheetColor; Q_PROPERTY(QColor XsheetColor READ getXsheetColor WRITE setXsheetColor) + // Pass Through node + QColor m_passThroughColor; + Q_PROPERTY(QColor PassThroughColor READ getPassThroughColor WRITE + setPassThroughColor) + // Fx nodes QColor m_normalFx; Q_PROPERTY(QColor NormalFxColor READ getNormalFxColor WRITE setNormalFxColor) @@ -472,6 +477,10 @@ public: void setXsheetColor(const QColor &color) { m_xsheetColor = color; } QColor getXsheetColor() const { return m_xsheetColor; } + // Pass Through node + void setPassThroughColor(const QColor &color) { m_passThroughColor = color; } + QColor getPassThroughColor() const { return m_passThroughColor; } + // Fx nodes QColor getNormalFxColor() const { return m_normalFx; } void setNormalFxColor(const QColor &color) { m_normalFx = color; } diff --git a/toonz/sources/toonzqt/Resources/fxport_pt_red.svg b/toonz/sources/toonzqt/Resources/fxport_pt_red.svg new file mode 100644 index 0000000..8b3e3cf --- /dev/null +++ b/toonz/sources/toonzqt/Resources/fxport_pt_red.svg @@ -0,0 +1,61 @@ + +image/svg+xml \ No newline at end of file diff --git a/toonz/sources/toonzqt/addfxcontextmenu.cpp b/toonz/sources/toonzqt/addfxcontextmenu.cpp index 40c5573..0191e37 100644 --- a/toonz/sources/toonzqt/addfxcontextmenu.cpp +++ b/toonz/sources/toonzqt/addfxcontextmenu.cpp @@ -556,6 +556,7 @@ void AddFxContextMenu::onAddFx(QAction *action) { m_currentCursorScenePos.setY(0); } + // the signal xsheetChanged is to be emitted in this function TFxCommand::addFx(fx, fxs, m_app, m_app->getCurrentColumn()->getColumnIndex(), m_app->getCurrentFrame()->getFrameIndex()); @@ -570,9 +571,9 @@ void AddFxContextMenu::onAddFx(QAction *action) { if (column) column->getZeraryColumnFx()->getAttributes()->setDagNodePos( fx->getAttributes()->getDagNodePos()); + m_app->getCurrentXsheet()->notifyXsheetChanged(); } - m_app->getCurrentXsheet()->notifyXsheetChanged(); // memorize the latest operation m_app->getCurrentFx()->setPreviousActionString(QString("A ") + action->data().toString()); diff --git a/toonz/sources/toonzqt/fxschematicnode.cpp b/toonz/sources/toonzqt/fxschematicnode.cpp index 31e227b..0df8305 100644 --- a/toonz/sources/toonzqt/fxschematicnode.cpp +++ b/toonz/sources/toonzqt/fxschematicnode.cpp @@ -787,7 +787,7 @@ void FxPainter::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) { menu.addAction(connectToXSheet); menu.addAction(duplicateFx); if ((zsrc && zsrc->getZeraryFx() && - zsrc->getZeraryFx()->getLinkedFx() != zsrc->getZeraryFx()) || + zsrc->getZeraryFx()->getLinkedFx() != zsrc->getZeraryFx()) || fx->getLinkedFx() != fx) menu.addAction(unlinkFx); } @@ -822,7 +822,7 @@ void FxPainter::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) { //------------------------------------------------------------------------ /*! for small-scaled display -*/ + */ void FxPainter::paint_small(QPainter *painter) { FxSchematicScene *sceneFx = dynamic_cast(scene()); if (!sceneFx) return; @@ -1139,17 +1139,19 @@ void FxSchematicLink::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) { //***************************************************** FxSchematicPort::FxSchematicPort(FxSchematicDock *parent, int type) - : SchematicPort(parent, parent->getNode(), type), m_currentTargetPort(0) { + : SchematicPort(parent, parent->getNode(), type) + , m_currentTargetPort(0) + , m_isPassThrough(false) { QRectF rect = boundingRect(); if (getType() == eFxInputPort || getType() == eFxGroupedInPort) m_hook = QPointF(rect.left(), (rect.top() + rect.bottom()) * 0.5); else if (getType() == eFxOutputPort || getType() == eFxGroupedOutPort) m_hook = QPointF(rect.right(), (rect.top() + rect.bottom()) * 0.5); else // link port - m_hook = QPointF(rect.right(), (rect.top() + rect.bottom()) * 0.5); - m_ownerFx = getOwnerFx(); + m_hook = QPointF(rect.right(), (rect.top() + rect.bottom()) * 0.5); + m_ownerFx = getOwnerFx(); TZeraryColumnFx *colFx = dynamic_cast(m_ownerFx); - if (colFx) m_ownerFx = colFx->getZeraryFx(); + if (colFx) m_ownerFx = colFx->getZeraryFx(); } //----------------------------------------------------- @@ -1159,6 +1161,8 @@ FxSchematicPort::~FxSchematicPort() {} //----------------------------------------------------- QRectF FxSchematicPort::boundingRect() const { + if (m_isPassThrough) return QRectF(0, 0, 15, 15); + // large scaled if (getDock()->getNode()->isNormalIconView()) { switch (getType()) { @@ -1234,6 +1238,8 @@ QRectF FxSchematicPort::boundingRect() const { void FxSchematicPort::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + if (m_isPassThrough && getLinkCount() > 0) return; + // large scaled if (getDock()->getNode()->isNormalIconView()) { switch (getType()) { @@ -1242,8 +1248,11 @@ void FxSchematicPort::paint(QPainter *painter, QRect sourceRect = scene()->views()[0]->matrix().mapRect(boundingRect()).toRect(); static QIcon fxPortRedIcon(":Resources/fxport_red.svg"); - QPixmap redPm = fxPortRedIcon.pixmap(sourceRect.size()); - sourceRect = QRect(0, 0, sourceRect.width() * getDevPixRatio(), + static QIcon fxPortPassThroughRedIcon(":Resources/fxport_pt_red.svg"); + QPixmap redPm = (m_isPassThrough) + ? fxPortPassThroughRedIcon.pixmap(sourceRect.size()) + : fxPortRedIcon.pixmap(sourceRect.size()); + sourceRect = QRect(0, 0, sourceRect.width() * getDevPixRatio(), sourceRect.height() * getDevPixRatio()); painter->drawPixmap(boundingRect(), redPm, sourceRect); } break; @@ -1338,6 +1347,18 @@ SchematicLink *FxSchematicPort::makeLink(SchematicPort *port) { //----------------------------------------------------- +void FxSchematicPort::setIsPassThrough() { + m_isPassThrough = true; + // recompute the hook position + QRectF rect = boundingRect(); + if (getType() == eFxInputPort) + m_hook = QPointF(rect.right(), (rect.top() + rect.bottom()) * 0.5); + else if (getType() == eFxOutputPort) + m_hook = QPointF(rect.left(), (rect.top() + rect.bottom()) * 0.5); +} + +//----------------------------------------------------- + bool FxSchematicPort::linkTo(SchematicPort *port, bool checkOnly) { if (port == this) return false; @@ -1490,7 +1511,7 @@ void FxSchematicPort::handleSnappedLinksOnDynamicPortFx( int startIndex) { FxSchematicNode *node = dynamic_cast(getNode()); if (!m_ownerFx->hasDynamicPortGroups() || !node) return; - int groupedPortCount = groupedPorts.size(); + int groupedPortCount = groupedPorts.size(); if (startIndex < 0) startIndex = groupedPortCount - 1; if (startIndex >= groupedPortCount || targetIndex >= groupedPortCount) return; int i; @@ -1613,7 +1634,7 @@ void FxSchematicPort::mouseMoveEvent(QGraphicsSceneMouseEvent *me) { m_currentTargetPort = targetPort; TFx *targetFx = targetPort->getOwnerFx(); TZeraryColumnFx *colFx = dynamic_cast(targetFx); - if (colFx) targetFx = colFx->getZeraryFx(); + if (colFx) targetFx = colFx->getZeraryFx(); if (targetPort->getType() != eFxInputPort || !targetFx->hasDynamicPortGroups() || targetPort == this) return; @@ -1670,8 +1691,8 @@ void FxSchematicPort::mouseReleaseEvent(QGraphicsSceneMouseEvent *me) { SchematicPort::mouseReleaseEvent(me); return; } - TFx *targetOwnerFx = targetPort->getOwnerFx(); - TZeraryColumnFx *colFx = dynamic_cast(targetOwnerFx); + TFx *targetOwnerFx = targetPort->getOwnerFx(); + TZeraryColumnFx *colFx = dynamic_cast(targetOwnerFx); if (colFx) targetOwnerFx = colFx->getZeraryFx(); // if the target fx has no dynamic port or has dynamic ports but the target @@ -1806,7 +1827,7 @@ FxSchematicDock::FxSchematicDock(FxSchematicNode *parent, const QString &name, } } else { TZeraryColumnFx *zeraryFx = dynamic_cast(inputFx); - if (zeraryFx) inputFx = zeraryFx->getZeraryFx(); + if (zeraryFx) inputFx = zeraryFx->getZeraryFx(); setToolTip(QString::fromStdWString(inputFx->getName())); } } @@ -2375,7 +2396,7 @@ bool isMatteFx(std::string id) { else return false; } -}; +}; // namespace FxSchematicNormalFxNode::FxSchematicNormalFxNode(FxSchematicScene *scene, TFx *fx) @@ -3034,7 +3055,7 @@ FxSchematicColumnNode::FxSchematicColumnNode(FxSchematicScene *scene, bool ret = true; ret = ret && connect(m_resizeItem, SIGNAL(toggled(bool)), this, SLOT(onChangedSize(bool))); - ret = ret && + ret = ret && connect(m_nameItem, SIGNAL(focusOut()), this, SLOT(onNameChanged())); ret = ret && connect(m_renderToggle, SIGNAL(toggled(bool)), this, SLOT(onRenderToggleClicked(bool))); @@ -3691,11 +3712,153 @@ bool FxGroupNode::isCached() const { for (i = 0; i < m_roots.size(); i++) { TFx *fx = m_roots[i].getPointer(); if (TZeraryColumnFx *zcFx = dynamic_cast(fx)) - isCached = - isCached && - TPassiveCacheManager::instance()->cacheEnabled(zcFx->getZeraryFx()); + isCached = isCached && TPassiveCacheManager::instance()->cacheEnabled( + zcFx->getZeraryFx()); else isCached = isCached && TPassiveCacheManager::instance()->cacheEnabled(fx); } return isCached; } + +//***************************************************** +// +// FxPassThroughPainter +// +//***************************************************** + +FxPassThroughPainter::FxPassThroughPainter(FxSchematicPassThroughNode *parent, + double width, double height) + : QGraphicsItem(parent) + , m_width(width) + , m_height(height) + , m_parent(parent) { + setFlag(QGraphicsItem::ItemIsMovable, false); + setFlag(QGraphicsItem::ItemIsSelectable, false); + setFlag(QGraphicsItem::ItemIsFocusable, false); +} + +//----------------------------------------------------- + +FxPassThroughPainter::~FxPassThroughPainter() {} + +//----------------------------------------------------- + +QRectF FxPassThroughPainter::boundingRect() const { + return QRectF(-5, -5, m_width + 10, m_height + 10); +} + +//----------------------------------------------------- + +void FxPassThroughPainter::paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) { + FxSchematicScene *sceneFx = dynamic_cast(scene()); + if (!sceneFx) return; + + SchematicViewer *viewer = sceneFx->getSchematicViewer(); + + painter->setBrush(viewer->getPassThroughColor()); + painter->setPen(Qt::NoPen); + painter->drawRoundedRect(QRectF(0, 0, m_width, m_height), 5, 5); +} + +//----------------------------------------------------- + +void FxPassThroughPainter::contextMenuEvent( + QGraphicsSceneContextMenuEvent *cme) { + FxSchematicScene *fxScene = dynamic_cast(scene()); + QMenu menu(fxScene->views()[0]); + + if (cme->modifiers() & Qt::ControlModifier) { + menu.addAction(fxScene->getAgainAction(AddFxContextMenu::Add | + AddFxContextMenu::Insert)); + if (!menu.actions().isEmpty()) { + menu.exec(cme->screenPos()); + return; + } + } + + QMenu *insertMenu = fxScene->getInsertFxMenu(); + fxScene->initCursorScenePos(); + QMenu *addMenu = fxScene->getAddFxMenu(); + + QAction *addOutputFx = + CommandManager::instance()->getAction("MI_NewOutputFx"); + + QAction *addPaste = new QAction(tr("&Paste Add"), &menu); + connect(addPaste, SIGNAL(triggered()), fxScene, SLOT(onAddPaste())); + + QAction *preview = new QAction(tr("&Preview"), &menu); + connect(preview, SIGNAL(triggered()), fxScene, SLOT(onPreview())); + + menu.addMenu(insertMenu); + menu.addMenu(addMenu); + menu.addSeparator(); + menu.addAction(addPaste); + menu.addAction(addOutputFx); + menu.addAction(preview); + menu.exec(cme->screenPos()); +} + +//***************************************************** +// +// FxSchematicPassThroughNode +// +//***************************************************** + +FxSchematicPassThroughNode::FxSchematicPassThroughNode(FxSchematicScene *scene, + TFx *fx) + : FxSchematicNode(scene, fx, 15, 15, eNormalFx) { + m_linkedNode = 0; + m_linkDock = 0; + + m_outDock = new FxSchematicDock(this, "", 0, eFxOutputPort); + FxSchematicDock *inDock = new FxSchematicDock(this, "", 0, eFxInputPort); + m_passThroughPainter = new FxPassThroughPainter(this, m_width, m_height); + + m_outDock->getPort()->setIsPassThrough(); + inDock->getPort()->setIsPassThrough(); + + addPort(0, m_outDock->getPort()); + addPort(1, inDock->getPort()); + + m_inDocks.push_back(inDock); + + m_outDock->setPos(15, 0); + inDock->setPos(-15, 0); + + m_outDock->setZValue(2); + inDock->setZValue(2); + m_passThroughPainter->setZValue(1); + + setToolTip(tr("Pass Through")); +} + +//----------------------------------------------------- + +FxSchematicPassThroughNode::~FxSchematicPassThroughNode() {} + +//----------------------------------------------------- + +QRectF FxSchematicPassThroughNode::boundingRect() const { + return QRectF(-5, -5, m_width + 10, m_height + 10); +} + +//----------------------------------------------------- + +void FxSchematicPassThroughNode::paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) { + FxSchematicNode::paint(painter, option, widget); +} + +//----------------------------------------------------- + +void FxSchematicPassThroughNode::mousePressEvent(QGraphicsSceneMouseEvent *me) { + FxSchematicNode::mousePressEvent(me); + + QAction *fxEditorPopup = + CommandManager::instance()->getAction(MI_FxParamEditor); + // this signal cause the update the contents of the FxSettings + if (fxEditorPopup->isVisible()) emit fxNodeDoubleClicked(); +} diff --git a/toonz/sources/toonzqt/fxschematicscene.cpp b/toonz/sources/toonzqt/fxschematicscene.cpp index af3eb71..1e5d653 100644 --- a/toonz/sources/toonzqt/fxschematicscene.cpp +++ b/toonz/sources/toonzqt/fxschematicscene.cpp @@ -44,6 +44,7 @@ #include #include #include +#include TEnv::IntVar IconifyFxSchematicNodes("IconifyFxSchematicNodes", 0); @@ -659,6 +660,9 @@ FxSchematicNode *FxSchematicScene::createFxSchematicNode(TFx *fx) { return new FxSchematicXSheetNode(this, xfx); else if (TOutputFx *ofx = dynamic_cast(fx)) return new FxSchematicOutputNode(this, ofx); + else if (fx && fx->getFxType().find("nothingFx") != + std::string::npos) // pass-through node + return new FxSchematicPassThroughNode(this, fx); else return new FxSchematicNormalFxNode(this, fx); } @@ -1855,35 +1859,54 @@ void FxSchematicScene::onEditGroup() { //------------------------------------------------------------------ -void FxSchematicScene::highlightLinks(FxSchematicNode *node, bool value) { - int i, portCount = node->getInputPortCount(); - // SchematicLink* ghostLink = m_supportLinks.getDisconnectionLink(eGhost); - for (i = 0; i < portCount; i++) { - FxSchematicPort *port = node->getInputPort(i); - int j, linkCount = port->getLinkCount(); - for (j = 0; j < linkCount; j++) { - SchematicLink *link = port->getLink(j); - if (!link) continue; - if (m_disconnectionLinks.isABridgeLink(link)) continue; - link->setHighlighted(value); - link->update(); - m_highlightedLinks.push_back(link); +void FxSchematicScene::highlightLinks(FxSchematicNode *node, bool value, + SearchDirection direction) { + int i; + if (direction == Both || direction == Input) { + int portCount = node->getInputPortCount(); + // SchematicLink* ghostLink = m_supportLinks.getDisconnectionLink(eGhost); + for (i = 0; i < portCount; i++) { + FxSchematicPort *port = node->getInputPort(i); + int j, linkCount = port->getLinkCount(); + for (j = 0; j < linkCount; j++) { + SchematicLink *link = port->getLink(j); + if (!link) continue; + if (m_disconnectionLinks.isABridgeLink(link)) continue; + link->setHighlighted(value); + link->update(); + m_highlightedLinks.push_back(link); + + if (FxSchematicPassThroughNode *ptNode = + dynamic_cast( + link->getOtherNode(node))) + highlightLinks(ptNode, value, Input); + } } } - FxSchematicPort *port = node->getOutputPort(); - if (port) { - int linkCount = port->getLinkCount(); - for (i = 0; i < linkCount; i++) { - SchematicLink *link = port->getLink(i); - if (!link) continue; - if (m_disconnectionLinks.isABridgeLink(link)) continue; - link->setHighlighted(value); - link->update(); - m_highlightedLinks.push_back(link); + if (direction == Both || direction == Output) { + FxSchematicPort *port = node->getOutputPort(); + if (port) { + int linkCount = port->getLinkCount(); + for (i = 0; i < linkCount; i++) { + SchematicLink *link = port->getLink(i); + if (!link) continue; + if (m_disconnectionLinks.isABridgeLink(link)) continue; + link->setHighlighted(value); + link->update(); + m_highlightedLinks.push_back(link); + + if (FxSchematicPassThroughNode *ptNode = + dynamic_cast( + link->getOtherNode(node))) + highlightLinks(ptNode, value, Output); + } } } - port = node->getLinkPort(); + + if (direction != Both) return; + + FxSchematicPort *port = node->getLinkPort(); if (port) { SchematicLink *link = port->getLink(0); if (link && !m_disconnectionLinks.isABridgeLink(link)) { diff --git a/toonz/sources/toonzqt/toonzqt.qrc b/toonz/sources/toonzqt/toonzqt.qrc index 4b74df4..a2a8845 100644 --- a/toonz/sources/toonzqt/toonzqt.qrc +++ b/toonz/sources/toonzqt/toonzqt.qrc @@ -40,6 +40,7 @@ Resources/spline_parent_port.svg Resources/fxport_red.svg Resources/fxport_blue.svg + Resources/fxport_pt_red.svg Resources/cachefx.png Resources/schematic_link.svg Resources/schematic_link_small.svg