Skip to content

Commit f29622f

Browse files
Clear existing tracks/events on pipeline execution
Modify WAMI Viewer to erase all existing tracks (and also events, because they depend on the tracks) after executing a pipeline (but only if the pipeline actually produces tracks).
1 parent 81cdada commit f29622f

1 file changed

Lines changed: 36 additions & 3 deletions

File tree

Applications/VpView/vpViewCore.cxx

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8874,7 +8874,36 @@ void vpViewCore::executeEmbeddedPipeline(
88748874
{
88758875
const auto& timeMap = this->FrameMap->timeMap();
88768876

8877-
auto trackModel = this->Projects[session]->TrackModel;
8877+
auto* const project = this->Projects[session];
8878+
auto trackModel = project->TrackModel;
8879+
auto eventModel = project->EventModel;
8880+
8881+
// Remove existing data
8882+
QVector<vtkIdType> allTrackIds;
8883+
QVector<vtkIdType> allEventIds;
8884+
8885+
eventModel->InitEventTraversal();
8886+
while (auto* const event = eventModel->GetNextEvent().GetEvent())
8887+
{
8888+
allEventIds.append(event->GetId());
8889+
}
8890+
for (const auto eid : allEventIds)
8891+
{
8892+
eventModel->RemoveEvent(eid);
8893+
}
8894+
8895+
trackModel->InitTrackTraversal();
8896+
while (auto* const track = trackModel->GetNextTrack().GetTrack())
8897+
{
8898+
if (!(track->GetDisplayFlags() & vtkVgTrack::DF_SceneElement))
8899+
{
8900+
allTrackIds.append(track->GetId());
8901+
}
8902+
}
8903+
for (const auto tid : allTrackIds)
8904+
{
8905+
trackModel->RemoveTrack(tid);
8906+
}
88788907

88798908
// Add tracks produced by pipeline
88808909
for (const auto tid : tracks->all_track_ids())
@@ -8893,13 +8922,17 @@ void vpViewCore::executeEmbeddedPipeline(
88938922
newTrack->SetColor(color);
88948923

88958924
this->updateTrack(trackModel, newTrack, kwiverTrack, timeMap,
8896-
videoHeight, true);
8925+
videoHeight, true);
88978926

88988927
trackModel->AddTrack(newTrack);
88998928
newTrack->FastDelete();
89008929
}
89018930
}
8902-
this->refreshSelectionPanel(true);
8931+
8932+
this->EventModifiedTime.Modified();
8933+
this->TrackModifiedTime.Modified();
8934+
this->updateScene();
8935+
this->refreshSelectionPanel();
89038936
}
89048937
#endif
89058938
}

0 commit comments

Comments
 (0)