MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / launchDefaultViewer

Function launchDefaultViewer

source/MRViewer/MRViewer.cpp:367–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365}
366
367int launchDefaultViewer( const Viewer::LaunchParams& params, const ViewerSetup& setup )
368{
369 static bool firstLaunch = true;
370 if ( !firstLaunch )
371 {
372 spdlog::error( "Viewer can be launched only once" );
373 return 1;
374 }
375 else
376 {
377 firstLaunch = false;
378 }
379
380 CommandLoop::setMainThreadId( std::this_thread::get_id() );
381
382 auto& viewer = MR::Viewer::instanceRef();
383
384 MR::setupLoggerByDefault( setup.setupCustomLogSink );
385
386 setup.setupBasePlugins( &viewer );
387 setup.setupCommonModifiers( &viewer );
388 setup.setupCommonPlugins( &viewer );
389 setup.setupSettingsManager( &viewer, params.name, params.resetConfig );
390 setup.setupConfiguration( &viewer );
391 CommandLoop::appendCommand( [&] ()
392 {
393 setup.setupExtendedLibraries();
394 setup.setupMcp();
395 }, CommandLoop::StartPosition::AfterSplashAppear );
396
397 int res = 0;
398#if defined(__EMSCRIPTEN__) || !defined(NDEBUG)
399 res = viewer.launch( params );
400#else
401 try
402 {
403 res = viewer.launch( params );
404 }
405 catch ( ... )
406 {
407 spdlog::critical( boost::current_exception_diagnostic_information() );
408 spdlog::info( "Exception stacktrace:\n{}", getCurrentStacktrace() );
409 printCurrentTimerBranch();
410 res = 1;
411 }
412#endif
413 setup.shutdownMcp();
414 if ( params.unloadPluginsAtEnd )
415 setup.unloadExtendedLibraries();
416 if ( setup.shutdownCustomLogSink )
417 setup.shutdownCustomLogSink();
418 return res;
419}
420
421void filterReservedCmdArgs( std::vector<std::string>& args )
422{

Callers 5

pythonLaunchFunction · 0.85
WinMainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 11

setupLoggerByDefaultFunction · 0.85
getCurrentStacktraceFunction · 0.85
printCurrentTimerBranchFunction · 0.85
setupSettingsManagerMethod · 0.80
setupMcpMethod · 0.80
launchMethod · 0.80
shutdownMcpMethod · 0.80
setupBasePluginsMethod · 0.45
setupConfigurationMethod · 0.45

Tested by

no test coverage detected