| 869 | } |
| 870 | |
| 871 | void RenderGraphUI::renderPopupMenu() |
| 872 | { |
| 873 | bool isPopupOpen = ImGui::IsPopupOpen("PinMenu"); |
| 874 | if (!isPopupOpen) |
| 875 | { |
| 876 | ImGui::OpenPopup("PinMenu"); |
| 877 | } |
| 878 | |
| 879 | ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8, 8)); |
| 880 | if (ImGui::BeginPopup("PinMenu")) |
| 881 | { |
| 882 | if (!isPopupOpen) |
| 883 | ImGui::SetWindowPos({ImGui::GetWindowPos().x - 8, ImGui::GetWindowPos().y - 8}); |
| 884 | else if (isPopupOpen && !ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_ChildWindows)) |
| 885 | { |
| 886 | if (ImGui::IsMouseClicked(0) || ImGui::IsMouseClicked(1)) |
| 887 | { |
| 888 | mpNodeGraphEditor->selectedLink = -1; |
| 889 | mpNodeGraphEditor->setPopupNode(nullptr); |
| 890 | mpNodeGraphEditor->setPopupPin(-1, false); |
| 891 | } |
| 892 | else |
| 893 | mpNodeGraphEditor->deselectPopupPin(); |
| 894 | } |
| 895 | |
| 896 | if (mpNodeGraphEditor->getPopupNode() && mpNodeGraphEditor->getPopupPinIndex() != -1) |
| 897 | { |
| 898 | const std::string& passName = mpNodeGraphEditor->getPopupNode()->getName(); |
| 899 | RenderPassUI& renderPassUI = mRenderPassUI[passName]; |
| 900 | renderPassUI.renderPinUI(passName, this, mpNodeGraphEditor->getPopupPinIndex(), mpNodeGraphEditor->isPopupPinInput()); |
| 901 | ImGui::Separator(); |
| 902 | } |
| 903 | |
| 904 | if (mpNodeGraphEditor->selectedLink != -1) |
| 905 | { |
| 906 | ImGui::NodeLink& selectedLink = mpNodeGraphEditor->getLink(mpNodeGraphEditor->selectedLink); |
| 907 | std::string srcPassName = std::string(selectedLink.InputNode->getName()); |
| 908 | std::string dstPassName = std::string(selectedLink.OutputNode->getName()); |
| 909 | ImGui::TextUnformatted((std::string("Edge: ") + srcPassName + '-' + dstPassName).c_str()); |
| 910 | std::string inputName = |
| 911 | std::string(static_cast<RenderGraphNode*>(selectedLink.OutputNode)->getInputName(selectedLink.OutputSlot)); |
| 912 | std::string inputString = dstPassName + (inputName.empty() ? "" : ".") + inputName; |
| 913 | uint32_t linkID = mInputPinStringToLinkID[inputString]; |
| 914 | auto edgeIt = mpRenderGraph->mEdgeData.find(linkID); |
| 915 | |
| 916 | // link exists, but is not an edge (such as graph output edge) |
| 917 | if (edgeIt != mpRenderGraph->mEdgeData.end()) |
| 918 | { |
| 919 | RenderGraph::EdgeData& edgeData = edgeIt->second; |
| 920 | |
| 921 | if (edgeData.srcField.size()) |
| 922 | { |
| 923 | ImGui::TextUnformatted("Src Field : "); |
| 924 | ImGui::SameLine(); |
| 925 | ImGui::TextUnformatted(edgeData.srcField.c_str()); |
| 926 | } |
| 927 | |
| 928 | if (edgeData.dstField.size()) |
nothing calls this directly
no test coverage detected