| 280 | { |
| 281 | NodeEditor::PushStyleVar(NodeEditor::StyleVar_PivotAlignment, ImVec2(0.5f, 0.5f)); |
| 282 | NodeEditor::PushStyleVar(NodeEditor::StyleVar_PivotSize, ImVec2(0, 0)); |
| 283 | NodeEditor::PushStyleVar(NodeEditor::StyleVar_PinRadius, DotRadius); |
| 284 | NodeEditor::BeginPin(OutputPin->GetPinGUID(), NodeEditor::PinKind::Output); |
| 285 | NodeEditor::PinPivotRect(Center, Center); |
| 286 | NodeEditor::PinRect(OutputRectMin, OutputRectMax); |
| 287 | NodeEditor::EndPin(); |
| 288 | NodeEditor::PopStyleVar(3); |
| 289 | } |
| 290 | |
| 291 | ImGui::PopID(); |
| 292 | NodeEditor::EndNode(); |
| 293 | |
| 294 | NodeEditor::PopStyleColor(2); |
| 295 | NodeEditor::PopStyleVar(3); |
| 296 | |
| 297 | // Painted on the node background list, so it sits behind wires but above the node background. |
| 298 | if (ImDrawList* DrawList = NodeEditor::GetNodeBackgroundDrawList(Node->GetNodeID())) |
| 299 | { |
| 300 | DrawList->AddCircleFilled(Center, DotRadius + 1.5f, DotShadow, 16); |
| 301 | DrawList->AddCircleFilled(Center, DotRadius, DotColor, 16); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | CEdGraphNode* CEdNodeGraph::InsertRerouteOnLink(CEdNodeGraphPin* OutputPin, CEdNodeGraphPin* InputPin, ImVec2 CanvasPos) |
| 306 | { |
| 307 | if (OutputPin == nullptr || InputPin == nullptr) |
| 308 | { |
| 309 | return nullptr; |
| 310 | } |
| 311 | |
| 312 | CClass* RerouteClass = GetRerouteNodeClass(); |
| 313 | if (RerouteClass == nullptr) |
| 314 | { |
| 315 | return nullptr; |
| 316 | } |
| 317 | |
| 318 | CEdGraphNode* RerouteNode = CreateNode(RerouteClass); |
| 319 | if (RerouteNode == nullptr) |
| 320 | { |
| 321 | return nullptr; |
| 322 | } |
| 323 | |
| 324 | CEdNodeGraphPin* RerouteIn = RerouteNode->GetInputPins().empty() ? nullptr : RerouteNode->GetInputPins()[0].Get(); |
| 325 | CEdNodeGraphPin* RerouteOut = RerouteNode->GetOutputPins().empty() ? nullptr : RerouteNode->GetOutputPins()[0].Get(); |
| 326 | if (RerouteIn == nullptr || RerouteOut == nullptr) |
| 327 | { |
| 328 | return RerouteNode; |
| 329 | } |
| 330 | |
| 331 | // Break the original wire and rebuild it as Source -> RerouteIn, RerouteOut -> Target. |
| 332 | OutputPin->DisconnectFrom(InputPin); |
| 333 | |
| 334 | OutputPin->AddConnection(RerouteIn); |
| 335 | RerouteIn->AddConnection(OutputPin); |
| 336 | |
| 337 | RerouteOut->AddConnection(InputPin); |
| 338 | InputPin->AddConnection(RerouteOut); |
| 339 |
no test coverage detected