Skip to content

Commit f946ad2

Browse files
committed
Restore viz modules if deferred operator canceled
Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
1 parent c962310 commit f946ad2

3 files changed

Lines changed: 37 additions & 1 deletion

File tree

tomviz/pipeline/NodeEditDialog.cxx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
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

tomviz/pipeline/sinks/LegacyModuleSink.cxx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
296308
void LegacyModuleSink::onInputDisconnected(InputPort*)
297309
{
298310
resetVisualization();

tomviz/pipeline/sinks/LegacyModuleSink.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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(

0 commit comments

Comments
 (0)