Skip to content

Commit

Permalink
app: fix tree-node simulation-editor
Browse files Browse the repository at this point in the history
The old algorithm destroy connection from or to another tree-node.
  • Loading branch information
quesnel committed Nov 12, 2024
1 parent d76b979 commit 9f939c9
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions app/gui/generic/simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1328,16 +1328,18 @@ static int show_connection(simulation& sim,
auto et = list->end();

while (it != et) {
if (auto* mdl_dst = sim.models.try_to_get(it->model);
mdl_dst and
exists_model_in_tree_node(tn, *mdl_dst)) {
int out = make_output_node_id(sim.get_id(dyn), i);
int in =
make_input_node_id(it->model, it->port_index);
ImNodes::Link(con_id++, out, in);
++it;
} else {
auto* mdl_dst = sim.models.try_to_get(it->model);
if (not mdl_dst) {
it = list->erase(it);
} else {
if (exists_model_in_tree_node(tn, *mdl_dst)) {
auto out =
make_output_node_id(sim.get_id(dyn), i);
auto in =
make_input_node_id(it->model, it->port_index);
ImNodes::Link(con_id++, out, in);
}
++it;
}
}
}
Expand Down

0 comments on commit 9f939c9

Please sign in to comment.