File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99#include " Node.h"
1010#include " OutputPort.h"
1111#include " Pipeline.h"
12+ #include " sinks/LegacyModuleSink.h"
1213
1314#include " Utilities.h"
1415
@@ -150,7 +151,21 @@ void NodeEditDialog::reject()
150151 // Recreate the original links that were broken to insert the node.
151152 for (const auto & ep : m_deferred.linksToRestore ) {
152153 if (ep.from && ep.to ) {
153- m_pipeline->createLink (ep.from , ep.to );
154+ auto * link = m_pipeline->createLink (ep.from , ep.to );
155+ // Breaking the link to insert the node hid any downstream module
156+ // (onInputDisconnected -> clearVisualization). Re-link alone does not
157+ // re-show it, and we deliberately do not re-execute, so restore the
158+ // module's visibility explicitly here. The VTK objects still hold the
159+ // last data, so this is presentation-only -- no pipeline run and no
160+ // dependence on upstream PortData (which a transient source releases on
161+ // disconnect). Done only on this cancel path so the insertion preview
162+ // keeps its current behavior (the moved module stays hidden until the
163+ // not-yet-run transform produces data).
164+ if (link) {
165+ if (auto * sink = dynamic_cast <LegacyModuleSink*>(ep.to ->node ())) {
166+ sink->restoreVisualization ();
167+ }
168+ }
154169 }
155170 }
156171
Original file line number Diff line number Diff line change @@ -293,6 +293,18 @@ void LegacyModuleSink::resetVisualization()
293293 emit renderNeeded ();
294294}
295295
296+ void LegacyModuleSink::restoreVisualization ()
297+ {
298+ // Re-apply the current visibility flag. Each subclass's setVisibility()
299+ // override pushes visibility onto its props/widgets unconditionally before
300+ // the base call, so this re-shows props that clearVisualization() hid even
301+ // though m_visible never changed (the base call's guard then suppresses a
302+ // redundant visibilityChanged signal). The VTK objects still hold the last
303+ // consumed data, so nothing needs to be re-read or re-executed.
304+ setVisibility (m_visible);
305+ emit renderNeeded ();
306+ }
307+
296308void LegacyModuleSink::onInputDisconnected (InputPort*)
297309{
298310 resetVisualization ();
Original file line number Diff line number Diff line change @@ -106,6 +106,15 @@ class LegacyModuleSink : public SinkNode
106106 // / direct input disconnect.
107107 void resetVisualization ();
108108
109+ // / Re-show the props this sink owns according to its current visibility
110+ // / flag, then request a repaint. The counterpart of resetVisualization():
111+ // / the underlying VTK objects still hold the last-consumed data after a
112+ // / clearVisualization(), so reconnecting an input only needs to re-apply
113+ // / visibility -- no upstream data and no pipeline run required. Used to
114+ // / restore a module when a broken link is recreated (e.g. cancelling a
115+ // / deferred operator insertion).
116+ void restoreVisualization ();
117+
109118 // / Return sibling LegacyModuleSinks connected to the same upstream
110119 // / OutputPort as this sink's given input port (excluding this node).
111120 QList<LegacyModuleSink*> siblingSinks (
You can’t perform that action at this time.
0 commit comments