Fix wildcard pin resolution in UnrealMCPython's ConnectBlueprintPins

ConnectBlueprintPins called SourcePin->MakeLinkTo(TargetPin) but never
notified either node of the new connection, so wildcard-typed pins
(MacroInstance nodes like ForEachLoop, and by extension any wildcard
array/map library call) never resolved their type -- compilation
failed with "type ... is undetermined" regardless of how many times
you recompiled. The real graph editor triggers this via the schema's
TryCreateConnection; MakeLinkTo alone doesn't.

Fix: call NodeConnectionListChanged() on both nodes after linking,
matching what the schema does. Verified against the exact ForEachLoop
scenario that failed twice before the fix -- the Array pin now
resolves to a concrete type and the graph compiles.

Rebuilt via full offline Build.bat (UnrealEditor target) rather than
Live Coding -- Live Coding's patch-link step hit a persistent
"Could not spawn process UbaCli.exe (Error 267)" in this environment,
unrelated to the code change itself (the .cpp compiled cleanly both
times; only the hot-patch link step failed).
This commit is contained in:
Joshua Deville
2026-07-08 20:37:33 -04:00
parent fb74e789af
commit 8ac602168d

View File

@@ -783,6 +783,13 @@ FString UMCPythonHelper::ConnectBlueprintPins(UBlueprint* Blueprint, const FStri
SourcePin->MakeLinkTo(TargetPin);
// Notify both nodes so wildcard pins (e.g. MacroInstance nodes like ForEachLoop, or
// wildcard array library calls) can resolve their type from the new connection. The
// real graph editor does this via the schema's TryCreateConnection; MakeLinkTo alone
// doesn't trigger it, so wildcard-typed pins were silently left unresolved.
SourceNode->NodeConnectionListChanged();
TargetNode->NodeConnectionListChanged();
FBlueprintEditorUtils::MarkBlueprintAsModified(Blueprint);
return MakeJsonSuccess(FString::Printf(TEXT("Connected %s.%s -> %s.%s"),
*SourceNodeName, *SourcePinName, *TargetNodeName, *TargetPinName));