MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / startColmapExport

Method startColmapExport

src/visualizer/gui/async_task_manager.cpp:792–909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

790 }
791
792 void AsyncTaskManager::startColmapExport(const std::filesystem::path& path) {
793 if (isExporting())
794 return;
795
796 auto* const scene_manager = viewer_->getSceneManager();
797 if (!scene_manager) {
798 std::string error = "Scene manager not initialized";
799 LOG_ERROR("COLMAP export failed: {}", error);
800 publishExportFailureState(ExportFormat::COLMAP, path, std::move(error));
801 return;
802 }
803
804 auto snapshot_result = makeColmapExportSnapshot(*scene_manager);
805 if (!snapshot_result) {
806 LOG_ERROR("COLMAP export failed: {}", snapshot_result.error());
807 publishExportFailureState(ExportFormat::COLMAP, path, snapshot_result.error());
808 lfs::core::events::state::ExportFailed{.error = snapshot_result.error()}.emit();
809 return;
810 }
811
812 export_state_.active.store(true);
813 export_state_.cancel_requested.store(false);
814 export_state_.progress.store(0.0f);
815 {
816 const std::lock_guard lock(export_state_.mutex);
817 export_state_.format = ExportFormat::COLMAP;
818 export_state_.stage = "Starting";
819 export_state_.error.clear();
820 export_state_.path = path;
821 }
822 publishExportState();
823
824 LOG_INFO("COLMAP export started: {}", lfs::core::path_to_utf8(path));
825
826 export_state_.thread.emplace(
827 [this, path, snapshot = std::move(*snapshot_result)](std::stop_token stop_token) mutable {
828 bool success = false;
829 bool cancelled = false;
830 std::string error_msg;
831
832 auto update_stage = [this](float progress, const std::string& stage) {
833 export_state_.progress.store(progress);
834 {
835 const std::lock_guard lock(export_state_.mutex);
836 export_state_.stage = stage;
837 }
838 publishExportState();
839 if (auto* window_manager = services().windowOrNull()) {
840 window_manager->wakeEventLoop();
841 }
842 };
843
844 try {
845 if (stop_token.stop_requested() || export_state_.cancel_requested.load()) {
846 cancelled = true;
847 error_msg = "Export cancelled by user";
848 } else {
849 update_stage(0.1f, "Writing COLMAP sparse files");

Callers

nothing calls this directly

Calls 14

isExportingFunction · 0.85
moveFunction · 0.85
makeColmapExportSnapshotFunction · 0.85
path_to_utf8Function · 0.85
wakeEventLoopMethod · 0.80
getSceneManagerMethod · 0.45
errorMethod · 0.45
emitMethod · 0.45
storeMethod · 0.45
clearMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected