| 626 | } |
| 627 | |
| 628 | void RenderGraphUI::updateGraph(RenderContext* pRenderContext) |
| 629 | { |
| 630 | if (!mShouldUpdate) |
| 631 | return; |
| 632 | std::string newCommands = mpIr->getIR(); |
| 633 | mpIr = std::make_shared<RenderGraphIR>(mRenderGraphName, false); // reset |
| 634 | if (mLastCommand == newCommands) |
| 635 | return; |
| 636 | |
| 637 | mLastCommand = newCommands; |
| 638 | if (mRecordUpdates) |
| 639 | mUpdateCommands += newCommands; |
| 640 | |
| 641 | // update reference graph to check if valid before sending to next |
| 642 | // TODO: Rendergraph scripts should be executed in an isolated scripting context. |
| 643 | Scripting::getDefaultContext().setObject("g", mpRenderGraph); |
| 644 | Scripting::runScript(newCommands); |
| 645 | if (newCommands.size()) |
| 646 | mLogString += newCommands; |
| 647 | |
| 648 | // only send updates that we know are valid. |
| 649 | if (mpRenderGraph->compile(pRenderContext) == false) |
| 650 | mLogString += "Graph is currently invalid\n"; |
| 651 | mShouldUpdate = false; |
| 652 | mRebuildDisplayData = true; |
| 653 | } |
| 654 | |
| 655 | void RenderGraphUI::writeUpdateScriptToFile(RenderContext* pRenderContext, const std::filesystem::path& filePath, float lastFrameTime) |
| 656 | { |