| 65 | } |
| 66 | |
| 67 | ref<RenderGraph> RenderGraphImporter::import(std::string graphName, std::filesystem::path path, std::string funcName) |
| 68 | { |
| 69 | while (true) |
| 70 | { |
| 71 | try |
| 72 | { |
| 73 | updateGraphStrings(graphName, path, funcName); |
| 74 | std::string custom; |
| 75 | if (funcName.size()) |
| 76 | custom += "\n" + graphName + '=' + funcName + "()"; |
| 77 | // TODO: Rendergraph scripts should be executed in an isolated scripting context. |
| 78 | runScriptFile(path, custom); |
| 79 | |
| 80 | auto pGraph = Scripting::getDefaultContext().getObject<ref<RenderGraph>>(graphName); |
| 81 | if (!pGraph) |
| 82 | throw("Unspecified error"); |
| 83 | |
| 84 | pGraph->setName(graphName); |
| 85 | return pGraph; |
| 86 | } |
| 87 | catch (const std::exception& e) |
| 88 | { |
| 89 | if (loadFailed(e, path)) |
| 90 | return nullptr; |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | std::vector<ref<RenderGraph>> RenderGraphImporter::importAllGraphs(const std::filesystem::path& path) |
| 96 | { |
nothing calls this directly
no test coverage detected