MCPcopy Create free account
hub / github.com/chrxh/alien / onOpenPattern

Method onOpenPattern

source/Gui/PatternEditorWindow.cpp:322–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322void PatternEditorWindow::onOpenPattern()
323{
324 GenericFileDialog::get().showOpenFileDialog(
325 "Open pattern", "Pattern file (*.sim){.sim},.*", _startingPath, [&](std::filesystem::path const& path) {
326 auto firstFilename = ifd::FileDialog::Instance().GetResult();
327 auto firstFilenameCopy = firstFilename;
328 _startingPath = firstFilenameCopy.remove_filename().string();
329 ClusteredDataDescription content;
330 if (SerializerService::get().deserializeContentFromFile(content, firstFilename.string())) {
331 auto center = Viewport::get().getCenterInWorldPos();
332 content.setCenter(center);
333 _simulationFacade->addAndSelectSimulationData(DataDescription(content));
334 EditorModel::get().update();
335 } else {
336 GenericMessageDialog::get().information("Open pattern", "The selected file could not be opened.");
337 }
338 });
339}
340
341void PatternEditorWindow::onSavePattern()
342{

Callers

nothing calls this directly

Calls 8

showOpenFileDialogMethod · 0.80
getCenterInWorldPosMethod · 0.80
setCenterMethod · 0.80
informationMethod · 0.80
DataDescriptionClass · 0.50
updateMethod · 0.45

Tested by

no test coverage detected