Skip to content

Commit 4ca8741

Browse files
committed
Do not propagate data to multiple outputs because of one new connection (paceholder#312)
We have a source node A and consumer nodes B1 B2 B3. If a node B4 is created and connected, all B-nodes receive the inpute data propagated. This was wrong. The correct behavior is just to notify the new B4 node.
1 parent 70558c8 commit 4ca8741

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

examples/calculator/NumberDisplayDataModel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ void
5353
NumberDisplayDataModel::
5454
setInData(std::shared_ptr<NodeData> data, PortIndex portIndex)
5555
{
56+
qWarning() << this;
5657
_numberData = std::dynamic_pointer_cast<DecimalData>(data);
5758

5859
if (!_label)

examples/calculator/NumberSourceDataModel.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ onTextEdited(QString const& str)
8585
{
8686
_number = std::make_shared<DecimalData>(number);
8787

88+
qWarning() << "================";
89+
8890
Q_EMIT dataUpdated(0);
91+
8992
}
9093
else
9194
{

src/DataFlowGraphModel.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,16 @@ addConnection(ConnectionId const connectionId)
145145

146146
Q_EMIT connectionCreated(connectionId);
147147

148-
onOutPortDataUpdated(getNodeId(PortType::Out, connectionId),
149-
getPortIndex(PortType::Out, connectionId));
148+
QVariant const portDataToPropagate = portData(connectionId.outNodeId,
149+
PortType::Out,
150+
connectionId.outPortIndex,
151+
PortRole::Data);
152+
153+
setPortData(connectionId.inNodeId,
154+
PortType::In,
155+
connectionId.inPortIndex,
156+
portDataToPropagate,
157+
PortRole::Data);
150158
}
151159

152160

0 commit comments

Comments
 (0)