| 405 | } |
| 406 | |
| 407 | void RenderGraphUI::NodeGraphEditorGui::setLinkFromGui( |
| 408 | ImGui::NodeLink& link, |
| 409 | ImGui::NodeGraphEditor::LinkState state, |
| 410 | ImGui::NodeGraphEditor& editor |
| 411 | ) |
| 412 | { |
| 413 | if (state == ImGui::NodeGraphEditor::LinkState::LS_ADDED) |
| 414 | { |
| 415 | RenderGraphNode *inputNode = static_cast<RenderGraphNode*>(link.InputNode), |
| 416 | *outputNode = static_cast<RenderGraphNode*>(link.OutputNode); |
| 417 | RenderGraphUI::NodeGraphEditorGui* pGraphEditorGui = static_cast<RenderGraphUI::NodeGraphEditorGui*>(&editor); |
| 418 | |
| 419 | bool addStatus = false; |
| 420 | std::string outputName = inputNode->getOutputName(link.InputSlot); |
| 421 | addStatus = pGraphEditorGui->getRenderGraphUI()->addLink( |
| 422 | inputNode->getName(), outputNode->getName(), outputName, outputNode->getInputName(link.OutputSlot), link.LinkColor |
| 423 | ); |
| 424 | |
| 425 | // immediately remove link if it is not a legal edge in the render graph |
| 426 | if (!addStatus && !editor.isInited()) // only call after graph is setup |
| 427 | { |
| 428 | // does not call link callback surprisingly enough |
| 429 | editor.removeLink(link.InputNode, link.InputSlot, link.OutputNode, link.OutputSlot); |
| 430 | return; |
| 431 | } |
| 432 | |
| 433 | if (outputName[0] == '#') |
| 434 | { |
| 435 | static_cast<RenderGraphNode*>(link.InputNode)->setPinColor(link.LinkColor, link.InputSlot, false); |
| 436 | static_cast<RenderGraphNode*>(link.OutputNode)->setPinColor(link.LinkColor, link.OutputSlot, true); |
| 437 | } |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | // callback for ImGui setting link from render graph changes |
| 442 | void RenderGraphUI::NodeGraphEditorGui::setLinkFromGraph( |
nothing calls this directly
no test coverage detected