Some usability tweaks for UE Wingman.
This commit is contained in:
@@ -44,7 +44,9 @@ public:
|
||||
virtual void Register() override
|
||||
{
|
||||
UWingServer::AddHandler(this,
|
||||
TEXT("Connect pins between nodes in a graph (Blueprint or Material)."));
|
||||
TEXT("Connect pins between nodes in a graph (Blueprint or Material). "
|
||||
"Pin IDs use fetcher path syntax relative to the graph, eg: "
|
||||
"node:K2Node_CallFunction_0,pin:ReturnValue"));
|
||||
}
|
||||
virtual void Handle() override
|
||||
{
|
||||
|
||||
@@ -15,19 +15,6 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
USTRUCT()
|
||||
struct FDisconnectPinEntry
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY()
|
||||
FString Pin;
|
||||
|
||||
UPROPERTY(EditAnywhere, meta=(Optional))
|
||||
FString TargetPin;
|
||||
};
|
||||
|
||||
|
||||
UCLASS()
|
||||
class UWing_GraphPin_Disconnect : public UWingHandler
|
||||
{
|
||||
@@ -37,14 +24,15 @@ public:
|
||||
UPROPERTY(EditAnywhere, meta=(Description="Target graph"))
|
||||
FString Graph;
|
||||
|
||||
UPROPERTY(EditAnywhere, meta=(Description="Array of {pin, targetPin?} objects. If targetPin is omitted, all connections on the pin are broken."))
|
||||
FWingJsonArray Disconnections;
|
||||
UPROPERTY(EditAnywhere, meta=(Description="Array of pin ID strings"))
|
||||
FWingJsonArray Pins;
|
||||
|
||||
virtual void Register() override
|
||||
{
|
||||
UWingServer::AddHandler(this,
|
||||
TEXT("Disconnect pins in a graph (Blueprint or Material). "
|
||||
"Can disconnect a specific link or all links on a pin."));
|
||||
TEXT("Disconnect all connections on the specified pins. "
|
||||
"Pin IDs use fetcher path syntax relative to the graph, eg: "
|
||||
"node:K2Node_CallFunction_0,pin:ReturnValue"));
|
||||
}
|
||||
virtual void Handle() override
|
||||
{
|
||||
@@ -55,47 +43,26 @@ public:
|
||||
int32 SuccessCount = 0;
|
||||
int32 TotalDisconnected = 0;
|
||||
|
||||
FDisconnectPinEntry Entry;
|
||||
TArray<FWingProperty> EntryProps = FWingProperty::GetAll(&Entry);
|
||||
for (const TSharedPtr<FJsonValue>& DiscVal : Disconnections.Array)
|
||||
for (const TSharedPtr<FJsonValue>& PinVal : Pins.Array)
|
||||
{
|
||||
if (!FWingProperty::PopulateFromJson(EntryProps, *DiscVal, false, WingOut::Stdout)) continue;
|
||||
FString PinPath;
|
||||
if (!PinVal->TryGetString(PinPath))
|
||||
{
|
||||
WingOut::Stdout.Print(TEXT("ERROR: Expected a string pin ID.\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
WingFetcher FP(G, WingOut::Stdout);
|
||||
UWingGraphPinRef* PinRef = FP.Walk(Entry.Pin).Cast<UWingGraphPinRef>();
|
||||
UWingGraphPinRef* PinRef = FP.Walk(PinPath).Cast<UWingGraphPinRef>();
|
||||
if (!PinRef) continue;
|
||||
UEdGraphPin* Pin = WingUtils::CheckGetPin(PinRef->Node, PinRef->PinName, WingOut::Stdout);
|
||||
if (!Pin) continue;
|
||||
|
||||
int32 DisconnectedCount = 0;
|
||||
|
||||
if (!Entry.TargetPin.IsEmpty())
|
||||
{
|
||||
WingFetcher FT(G, WingOut::Stdout);
|
||||
UWingGraphPinRef* TargetRef = FT.Walk(Entry.TargetPin).Cast<UWingGraphPinRef>();
|
||||
if (!TargetRef) continue;
|
||||
UEdGraphPin* Target = WingUtils::CheckGetPin(TargetRef->Node, TargetRef->PinName, WingOut::Stdout);
|
||||
if (!Target) continue;
|
||||
|
||||
if (!Pin->LinkedTo.Contains(Target))
|
||||
{
|
||||
WingOut::Stdout.Printf(TEXT("Error: %s.%s is not connected to %s.%s\n"),
|
||||
*WingUtils::FormatName(Pin->GetOwningNode()), *WingUtils::FormatName(Pin),
|
||||
*WingUtils::FormatName(Target->GetOwningNode()), *WingUtils::FormatName(Target));
|
||||
continue;
|
||||
}
|
||||
|
||||
Pin->BreakLinkTo(Target);
|
||||
DisconnectedCount = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
DisconnectedCount = Pin->LinkedTo.Num();
|
||||
int32 DisconnectedCount = Pin->LinkedTo.Num();
|
||||
if (DisconnectedCount > 0)
|
||||
{
|
||||
Pin->BreakAllPinLinks(true);
|
||||
}
|
||||
}
|
||||
|
||||
WingOut::Stdout.Printf(TEXT("Disconnected %d link(s) from %s.%s\n"),
|
||||
DisconnectedCount,
|
||||
@@ -105,6 +72,6 @@ public:
|
||||
}
|
||||
|
||||
WingOut::Stdout.Printf(TEXT("Done: %d/%d succeeded, %d links broken.\n"),
|
||||
SuccessCount, Disconnections.Array.Num(), TotalDisconnected);
|
||||
SuccessCount, Pins.Array.Num(), TotalDisconnected);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -169,6 +169,36 @@ void UWingManualSections::MaterialEditing()
|
||||
));
|
||||
}
|
||||
|
||||
void UWingManualSections::NodeContextMenus()
|
||||
{
|
||||
WingOut::Stdout.Print(TEXT(
|
||||
"\n NODE CONTEXT MENUS:"
|
||||
"\n"
|
||||
"\n GraphNode_ShowMenu and GraphNode_ChooseMenu give access"
|
||||
"\n to the node context menu. This menu includes both node"
|
||||
"\n operations and pin operations (e.g. Split Struct Pin,"
|
||||
"\n Add Pin)."
|
||||
"\n"
|
||||
));
|
||||
}
|
||||
|
||||
void UWingManualSections::VariableGettersAndSetters()
|
||||
{
|
||||
WingOut::Stdout.Print(TEXT(
|
||||
"\n VARIABLE GETTERS AND SETTERS:"
|
||||
"\n"
|
||||
"\n Access to local vars, function parameters, and "
|
||||
"\n blueprint vars is through getter and setter nodes. "
|
||||
"\n These can be found in GraphNode_SearchTypes by "
|
||||
"\n searching for 'Variable'. Some examples:"
|
||||
"\n"
|
||||
"\n SKEL_WB_Menu_C|Variables|Default|GetPlaceTangible"
|
||||
"\n SKEL_WB_Menu_C|Variables|Default|SetPlaceTangible"
|
||||
"\n SKEL_WB_Menu_C|Variables|WB_Menu|GetMenuPanel"
|
||||
"\n"
|
||||
));
|
||||
}
|
||||
|
||||
void UWingManualSections::ImportantCommands()
|
||||
{
|
||||
WingOut::Stdout.Print(TEXT(
|
||||
|
||||
@@ -42,4 +42,10 @@ public:
|
||||
|
||||
UFUNCTION()
|
||||
static void ImportantCommands();
|
||||
|
||||
UFUNCTION()
|
||||
static void NodeContextMenus();
|
||||
|
||||
UFUNCTION()
|
||||
static void VariableGettersAndSetters();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user