redesign pass through node
This commit is contained in:
parent
4a619a2ef7
commit
cbdb991f25
16 changed files with 363 additions and 43 deletions
|
@ -1729,6 +1729,7 @@ SchematicViewer {
|
|||
qproperty-ActiveOutputColor: #4073a3;
|
||||
qproperty-OtherOutputColor: #5e9aa3;
|
||||
qproperty-XsheetColor: #62628c;
|
||||
qproperty-PassThroughColor: #858585;
|
||||
qproperty-NormalFxColor: #5b90a3;
|
||||
qproperty-MacroFxColor: #815c79;
|
||||
qproperty-ImageAdjustFxColor: #656287;
|
||||
|
|
|
@ -1729,6 +1729,7 @@ SchematicViewer {
|
|||
qproperty-ActiveOutputColor: #4073a3;
|
||||
qproperty-OtherOutputColor: #5e9aa3;
|
||||
qproperty-XsheetColor: #62628c;
|
||||
qproperty-PassThroughColor: #858585;
|
||||
qproperty-NormalFxColor: #5b90a3;
|
||||
qproperty-MacroFxColor: #815c79;
|
||||
qproperty-ImageAdjustFxColor: #656287;
|
||||
|
|
|
@ -1729,6 +1729,7 @@ SchematicViewer {
|
|||
qproperty-ActiveOutputColor: #b7dbfc;
|
||||
qproperty-OtherOutputColor: #9ad9e2;
|
||||
qproperty-XsheetColor: #cbcbe4;
|
||||
qproperty-PassThroughColor: #e7dfdf;
|
||||
qproperty-NormalFxColor: #b1c2d7;
|
||||
qproperty-MacroFxColor: #d7b0cc;
|
||||
qproperty-ImageAdjustFxColor: #c1bedc;
|
||||
|
|
|
@ -1729,6 +1729,7 @@ SchematicViewer {
|
|||
qproperty-ActiveOutputColor: #4073a3;
|
||||
qproperty-OtherOutputColor: #5e9aa3;
|
||||
qproperty-XsheetColor: #62628c;
|
||||
qproperty-PassThroughColor: #858585;
|
||||
qproperty-NormalFxColor: #5b90a3;
|
||||
qproperty-MacroFxColor: #815c79;
|
||||
qproperty-ImageAdjustFxColor: #656287;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1729,6 +1729,7 @@ SchematicViewer {
|
|||
qproperty-ActiveOutputColor: #6491be;
|
||||
qproperty-OtherOutputColor: #8f9c9e;
|
||||
qproperty-XsheetColor: #a4a4bf;
|
||||
qproperty-PassThroughColor: #bdbdbd;
|
||||
qproperty-NormalFxColor: #8d9caf;
|
||||
qproperty-MacroFxColor: #ae8ca5;
|
||||
qproperty-ImageAdjustFxColor: #9c9ab4;
|
||||
|
|
|
@ -196,6 +196,8 @@ class FxSchematicPort final : public SchematicPort {
|
|||
QList<SchematicLink *> m_hiddenLinks;
|
||||
QList<SchematicLink *> 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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -296,6 +296,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)
|
||||
|
@ -474,6 +479,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; }
|
||||
|
|
61
toonz/sources/toonzqt/Resources/fxport_pt_red.svg
Normal file
61
toonz/sources/toonzqt/Resources/fxport_pt_red.svg
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 288 288"
|
||||
version="1.1"
|
||||
xml:space="preserve"
|
||||
style="clip-rule:evenodd;fill-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5"
|
||||
id="svg9"
|
||||
sodipodi:docname="fxport_red.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
|
||||
id="metadata15"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs13" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="908"
|
||||
inkscape:window-height="983"
|
||||
id="namedview11"
|
||||
showgrid="true"
|
||||
units="px"
|
||||
inkscape:zoom="14.75"
|
||||
inkscape:cx="8"
|
||||
inkscape:cy="10.711864"
|
||||
inkscape:window-x="124"
|
||||
inkscape:window-y="32"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="Layer1"><inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid825" /></sodipodi:namedview><g
|
||||
id="Layer1"
|
||||
transform="scale(18)"
|
||||
style="stroke-width:0.05555556"><rect
|
||||
x="0"
|
||||
y="0"
|
||||
width="16"
|
||||
height="16"
|
||||
style="fill:none;stroke-width:0.05555556"
|
||||
id="rect2" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="M 12.444444,8.0000003 4.4444444,12.444444 V 3.5555558 Z"
|
||||
style="clip-rule:evenodd;fill:#d83d3d;fill-opacity:1;fill-rule:evenodd;stroke-width:0.04938272;stroke-linejoin:round;stroke-miterlimit:2"
|
||||
id="path6-5" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 12.876444,8.7768891 c 0.281778,-0.1564444 0.456889,-0.4542222 0.456889,-0.7768888 0,-0.3226667 -0.175111,-0.6204445 -0.456889,-0.7768889 L 4.8764444,2.7786669 c -0.275555,-0.1528889 -0.611555,-0.1493333 -0.882666,0.010667 -0.272,0.16 -0.438223,0.4515555 -0.438223,0.7662222 v 8.8888889 c 0,0.314667 0.166223,0.606222 0.438223,0.766222 0.271111,0.16 0.607111,0.163556 0.882666,0.01067 z m -0.432,-0.7768888 -7.9999996,4.4444437 V 3.5555558 Z"
|
||||
style="clip-rule:evenodd;fill:#4a1111;fill-opacity:1;fill-rule:evenodd;stroke-width:0.04938272;stroke-linejoin:round;stroke-miterlimit:2"
|
||||
id="path8" /></g></svg>
|
After Width: | Height: | Size: 2.7 KiB |
|
@ -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());
|
||||
|
|
|
@ -822,7 +822,7 @@ void FxPainter::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) {
|
|||
|
||||
//------------------------------------------------------------------------
|
||||
/*! for small-scaled display
|
||||
*/
|
||||
*/
|
||||
void FxPainter::paint_small(QPainter *painter) {
|
||||
FxSchematicScene *sceneFx = dynamic_cast<FxSchematicScene *>(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<TZeraryColumnFx *>(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<FxSchematicNode *>(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<TZeraryColumnFx *>(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<TZeraryColumnFx *>(targetOwnerFx);
|
||||
TFx *targetOwnerFx = targetPort->getOwnerFx();
|
||||
TZeraryColumnFx *colFx = dynamic_cast<TZeraryColumnFx *>(targetOwnerFx);
|
||||
if (colFx) targetOwnerFx = colFx->getZeraryFx();
|
||||
|
||||
// if the target fx has no dynamic port or has dinamic ports but the tatgert
|
||||
|
@ -1806,7 +1827,7 @@ FxSchematicDock::FxSchematicDock(FxSchematicNode *parent, const QString &name,
|
|||
}
|
||||
} else {
|
||||
TZeraryColumnFx *zeraryFx = dynamic_cast<TZeraryColumnFx *>(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)
|
||||
|
@ -3044,7 +3065,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)));
|
||||
|
@ -3701,11 +3722,153 @@ bool FxGroupNode::isCached() const {
|
|||
for (i = 0; i < m_roots.size(); i++) {
|
||||
TFx *fx = m_roots[i].getPointer();
|
||||
if (TZeraryColumnFx *zcFx = dynamic_cast<TZeraryColumnFx *>(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<FxSchematicScene *>(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<FxSchematicScene *>(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();
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <QMenu>
|
||||
#include <QApplication>
|
||||
#include <QGraphicsSceneContextMenuEvent>
|
||||
#include <QStack>
|
||||
|
||||
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<TOutputFx *>(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<FxSchematicPassThroughNode *>(
|
||||
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<FxSchematicPassThroughNode *>(
|
||||
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)) {
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
<file>Resources/spline_parent_port.svg</file>
|
||||
<file>Resources/fxport_red.svg</file>
|
||||
<file>Resources/fxport_blue.svg</file>
|
||||
<file>Resources/fxport_pt_red.svg</file>
|
||||
<file>Resources/cachefx.png</file>
|
||||
<file>Resources/schematic_link.svg</file>
|
||||
<file>Resources/schematic_link_small.svg</file>
|
||||
|
|
Loading…
Reference in a new issue