MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / loadScript

Method loadScript

Source/Mogwai/Mogwai.cpp:456–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454 }
455
456 void Renderer::loadScript(const std::filesystem::path& path)
457 {
458 FALCOR_ASSERT(!path.empty());
459
460 try
461 {
462 if (getProgressBar().isActive())
463 getProgressBar().show("Loading Configuration");
464
465 // Add script directory to search paths (add it to the front to make it highest priority).
466 AssetResolver oldResolver = AssetResolver::getDefaultResolver();
467 auto directory = std::filesystem::absolute(path).parent_path();
468 AssetResolver::getDefaultResolver().addSearchPath(directory, SearchPathPriority::First);
469
470 Scripting::runScriptFromFile(path);
471
472 // Restore asset resolver.
473 AssetResolver::getDefaultResolver() = oldResolver;
474 }
475 catch (const std::exception& e)
476 {
477 std::string msg = fmt::format("Error when loading configuration file: {}\n{}", path, e.what());
478 if (is_set(getErrorDiagnosticFlags(), ErrorDiagnosticFlags::ShowMessageBoxOnError))
479 reportErrorAndContinue(msg);
480 else
481 FALCOR_THROW(msg);
482 }
483 }
484
485 void Renderer::saveConfigDialog()
486 {

Callers

nothing calls this directly

Calls 6

getErrorDiagnosticFlagsFunction · 0.85
reportErrorAndContinueFunction · 0.85
addSearchPathMethod · 0.80
whatMethod · 0.80
emptyMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected