Renaming to UE Wingman begins
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPPackageMaker.h"
|
#include "WingPackageMaker.h"
|
||||||
#include "Animation/AnimBlueprint.h"
|
#include "Animation/AnimBlueprint.h"
|
||||||
#include "Animation/AnimBlueprintGeneratedClass.h"
|
#include "Animation/AnimBlueprintGeneratedClass.h"
|
||||||
#include "Animation/AnimInstance.h"
|
#include "Animation/AnimInstance.h"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_AnimBlueprint_Create : public UObject, public IMCPHandler
|
class UWing_AnimBlueprint_Create : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -40,11 +40,11 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPPackageMaker Maker(AssetPath);
|
WingPackageMaker Maker(AssetPath);
|
||||||
if (!Maker.Ok()) return;
|
if (!Maker.Ok()) return;
|
||||||
|
|
||||||
// Resolve skeleton
|
// Resolve skeleton
|
||||||
MCPFetcher SkeletonFetcher;
|
WingFetcher SkeletonFetcher;
|
||||||
USkeleton* SkeletonObj = SkeletonFetcher.Asset(Skeleton).Cast<USkeleton>();
|
USkeleton* SkeletonObj = SkeletonFetcher.Asset(Skeleton).Cast<USkeleton>();
|
||||||
if (!SkeletonObj) return;
|
if (!SkeletonObj) return;
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
UClass* Found = nullptr;
|
UClass* Found = nullptr;
|
||||||
for (TObjectIterator<UClass> It; It; ++It)
|
for (TObjectIterator<UClass> It; It; ++It)
|
||||||
{
|
{
|
||||||
if (It->IsChildOf(UAnimInstance::StaticClass()) && MCPUtils::Identifies(ParentClass, *It))
|
if (It->IsChildOf(UAnimInstance::StaticClass()) && WingUtils::Identifies(ParentClass, *It))
|
||||||
{
|
{
|
||||||
Found = *It;
|
Found = *It;
|
||||||
break;
|
break;
|
||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
}
|
}
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Parent class '%s' not found (must derive from AnimInstance)\n"), *ParentClass);
|
UWingServer::Printf(TEXT("ERROR: Parent class '%s' not found (must derive from AnimInstance)\n"), *ParentClass);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ParentClassObj = Found;
|
ParentClassObj = Found;
|
||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
|
|
||||||
if (!NewAnimBP)
|
if (!NewAnimBP)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: FKismetEditorUtilities::CreateBlueprint returned null\n"));
|
UWingServer::Print(TEXT("ERROR: FKismetEditorUtilities::CreateBlueprint returned null\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,16 +93,16 @@ public:
|
|||||||
|
|
||||||
// Compile and save
|
// Compile and save
|
||||||
FKismetEditorUtilities::CompileBlueprint(NewAnimBP);
|
FKismetEditorUtilities::CompileBlueprint(NewAnimBP);
|
||||||
bool bSaved = MCPUtils::SaveBlueprintPackage(NewAnimBP);
|
bool bSaved = WingUtils::SaveBlueprintPackage(NewAnimBP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Created: %s\n"), *AssetPath);
|
UWingServer::Printf(TEXT("Created: %s\n"), *AssetPath);
|
||||||
UMCPServer::Printf(TEXT("ParentClass: %s\n"), *MCPUtils::FormatName(ParentClassObj));
|
UWingServer::Printf(TEXT("ParentClass: %s\n"), *WingUtils::FormatName(ParentClassObj));
|
||||||
UMCPServer::Printf(TEXT("Saved: %s\n"), bSaved ? TEXT("true") : TEXT("false"));
|
UWingServer::Printf(TEXT("Saved: %s\n"), bSaved ? TEXT("true") : TEXT("false"));
|
||||||
|
|
||||||
TArray<UEdGraph*> Graphs = MCPUtils::AllGraphs(NewAnimBP);
|
TArray<UEdGraph*> Graphs = WingUtils::AllGraphs(NewAnimBP);
|
||||||
for (UEdGraph* Graph : Graphs)
|
for (UEdGraph* Graph : Graphs)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Graph: %s\n"), *MCPUtils::FormatName(Graph));
|
UWingServer::Printf(TEXT("Graph: %s\n"), *WingUtils::FormatName(Graph));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Animation/AnimBlueprint.h"
|
#include "Animation/AnimBlueprint.h"
|
||||||
#include "AnimGraphNode_Base.h"
|
#include "AnimGraphNode_Base.h"
|
||||||
#include "AnimBlueprint_ListSlotNames.generated.h"
|
#include "AnimBlueprint_ListSlotNames.generated.h"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_AnimBlueprint_ListSlotNames : public UObject, public IMCPHandler
|
class UWing_AnimBlueprint_ListSlotNames : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -30,13 +30,13 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UAnimBlueprint* AnimBP = F.Asset(Blueprint).Cast<UAnimBlueprint>();
|
UAnimBlueprint* AnimBP = F.Asset(Blueprint).Cast<UAnimBlueprint>();
|
||||||
if (!AnimBP) return;
|
if (!AnimBP) return;
|
||||||
|
|
||||||
// Walk all anim nodes to collect slot names
|
// Walk all anim nodes to collect slot names
|
||||||
TSet<FString> SlotNames;
|
TSet<FString> SlotNames;
|
||||||
for (UAnimGraphNode_Base* AnimNode : MCPUtils::AllNodes<UAnimGraphNode_Base>(AnimBP))
|
for (UAnimGraphNode_Base* AnimNode : WingUtils::AllNodes<UAnimGraphNode_Base>(AnimBP))
|
||||||
{
|
{
|
||||||
for (TFieldIterator<FNameProperty> PropIt(AnimNode->GetClass()); PropIt; ++PropIt)
|
for (TFieldIterator<FNameProperty> PropIt(AnimNode->GetClass()); PropIt; ++PropIt)
|
||||||
{
|
{
|
||||||
@@ -53,12 +53,12 @@ public:
|
|||||||
|
|
||||||
for (const FString& Slot : SlotNames)
|
for (const FString& Slot : SlotNames)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("%s\n"), *Slot);
|
UWingServer::Printf(TEXT("%s\n"), *Slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SlotNames.Num() == 0)
|
if (SlotNames.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("No animation slot names found.\n"));
|
UWingServer::Print(TEXT("No animation slot names found.\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Animation/AnimBlueprint.h"
|
#include "Animation/AnimBlueprint.h"
|
||||||
#include "AnimGraphNode_Base.h"
|
#include "AnimGraphNode_Base.h"
|
||||||
#include "AnimBlueprint_ListSyncGroups.generated.h"
|
#include "AnimBlueprint_ListSyncGroups.generated.h"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_AnimBlueprint_ListSyncGroups : public UObject, public IMCPHandler
|
class UWing_AnimBlueprint_ListSyncGroups : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -30,13 +30,13 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UAnimBlueprint* AnimBP = F.Walk(Blueprint).Cast<UAnimBlueprint>();
|
UAnimBlueprint* AnimBP = F.Walk(Blueprint).Cast<UAnimBlueprint>();
|
||||||
if (!AnimBP) return;
|
if (!AnimBP) return;
|
||||||
|
|
||||||
// Walk all anim nodes to collect sync group names
|
// Walk all anim nodes to collect sync group names
|
||||||
TSet<FString> SyncGroupNames;
|
TSet<FString> SyncGroupNames;
|
||||||
for (UAnimGraphNode_Base* AnimNode : MCPUtils::AllNodes<UAnimGraphNode_Base>(AnimBP))
|
for (UAnimGraphNode_Base* AnimNode : WingUtils::AllNodes<UAnimGraphNode_Base>(AnimBP))
|
||||||
{
|
{
|
||||||
for (TFieldIterator<FNameProperty> PropIt(AnimNode->GetClass()); PropIt; ++PropIt)
|
for (TFieldIterator<FNameProperty> PropIt(AnimNode->GetClass()); PropIt; ++PropIt)
|
||||||
{
|
{
|
||||||
@@ -53,13 +53,13 @@ public:
|
|||||||
|
|
||||||
if (SyncGroupNames.Num() == 0)
|
if (SyncGroupNames.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("No sync groups found.\n"));
|
UWingServer::Print(TEXT("No sync groups found.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const FString& Group : SyncGroupNames)
|
for (const FString& Group : SyncGroupNames)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("%s\n"), *Group);
|
UWingServer::Printf(TEXT("%s\n"), *Group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Animation/AnimSequence.h"
|
#include "Animation/AnimSequence.h"
|
||||||
#include "Animation/BlendSpace.h"
|
#include "Animation/BlendSpace.h"
|
||||||
#include "AnimBlueprint_SetBlendSpaceSamples.generated.h"
|
#include "AnimBlueprint_SetBlendSpaceSamples.generated.h"
|
||||||
@@ -31,7 +31,7 @@ struct FBlendSpaceSampleEntry
|
|||||||
};
|
};
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_AnimBlueprint_SetBlendSpaceSamples : public UObject, public IMCPHandler
|
class UWing_AnimBlueprint_SetBlendSpaceSamples : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
float AxisYMax = 0.0f;
|
float AxisYMax = 0.0f;
|
||||||
|
|
||||||
UPROPERTY(meta=(Optional, Description="Array of sample points, each with animationAsset, x, y"))
|
UPROPERTY(meta=(Optional, Description="Array of sample points, each with animationAsset, x, y"))
|
||||||
FMCPJsonArray Samples;
|
FWingJsonArray Samples;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -69,7 +69,7 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Load the blend space
|
// Load the blend space
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlendSpace* BS = F.Asset(BlendSpace).Cast<UBlendSpace>();
|
UBlendSpace* BS = F.Asset(BlendSpace).Cast<UBlendSpace>();
|
||||||
if (!BS) return;
|
if (!BS) return;
|
||||||
|
|
||||||
@@ -102,12 +102,12 @@ public:
|
|||||||
for (const TSharedPtr<FJsonValue>& SampleVal : Samples.Array)
|
for (const TSharedPtr<FJsonValue>& SampleVal : Samples.Array)
|
||||||
{
|
{
|
||||||
FBlendSpaceSampleEntry Entry;
|
FBlendSpaceSampleEntry Entry;
|
||||||
if (!MCPJson::PopulateFromJson(FBlendSpaceSampleEntry::StaticStruct(), &Entry, SampleVal)) return;
|
if (!WingJson::PopulateFromJson(FBlendSpaceSampleEntry::StaticStruct(), &Entry, SampleVal)) return;
|
||||||
|
|
||||||
UAnimSequence* AnimSeq = nullptr;
|
UAnimSequence* AnimSeq = nullptr;
|
||||||
if (!Entry.AnimationAsset.IsEmpty())
|
if (!Entry.AnimationAsset.IsEmpty())
|
||||||
{
|
{
|
||||||
MCPFetcher F2;
|
WingFetcher F2;
|
||||||
AnimSeq = F2.Asset(Entry.AnimationAsset).Cast<UAnimSequence>();
|
AnimSeq = F2.Asset(Entry.AnimationAsset).Cast<UAnimSequence>();
|
||||||
if (!AnimSeq) return;
|
if (!AnimSeq) return;
|
||||||
}
|
}
|
||||||
@@ -127,12 +127,12 @@ public:
|
|||||||
BS->ValidateSampleData();
|
BS->ValidateSampleData();
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
bool bSaved = MCPUtils::SaveGenericPackage(BS);
|
bool bSaved = WingUtils::SaveGenericPackage(BS);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Set %d samples on %s\n"), SamplesSet, *MCPUtils::FormatName(BS));
|
UWingServer::Printf(TEXT("Set %d samples on %s\n"), SamplesSet, *WingUtils::FormatName(BS));
|
||||||
if (!bSaved)
|
if (!bSaved)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("WARNING: package save failed\n"));
|
UWingServer::Print(TEXT("WARNING: package save failed\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPPackageMaker.h"
|
#include "WingPackageMaker.h"
|
||||||
#include "Animation/Skeleton.h"
|
#include "Animation/Skeleton.h"
|
||||||
#include "Animation/BlendSpace.h"
|
#include "Animation/BlendSpace.h"
|
||||||
#include "BlendSpace_Create.generated.h"
|
#include "BlendSpace_Create.generated.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_BlendSpace_Create : public UObject, public IMCPHandler
|
class UWing_BlendSpace_Create : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -34,11 +34,11 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPPackageMaker Maker(AssetPath);
|
WingPackageMaker Maker(AssetPath);
|
||||||
if (!Maker.Ok()) return;
|
if (!Maker.Ok()) return;
|
||||||
|
|
||||||
// Resolve skeleton.
|
// Resolve skeleton.
|
||||||
MCPFetcher SkeletonFetcher;
|
WingFetcher SkeletonFetcher;
|
||||||
USkeleton* SkeletonObj = SkeletonFetcher.Asset(Skeleton).Cast<USkeleton>();
|
USkeleton* SkeletonObj = SkeletonFetcher.Asset(Skeleton).Cast<USkeleton>();
|
||||||
if (!SkeletonObj) return;
|
if (!SkeletonObj) return;
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
UBlendSpace* NewBS = NewObject<UBlendSpace>(Maker.Package(), FName(*Maker.Name()), RF_Public | RF_Standalone);
|
UBlendSpace* NewBS = NewObject<UBlendSpace>(Maker.Package(), FName(*Maker.Name()), RF_Public | RF_Standalone);
|
||||||
if (!NewBS)
|
if (!NewBS)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Failed to create Blend Space object\n"));
|
UWingServer::Print(TEXT("ERROR: Failed to create Blend Space object\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,11 +55,11 @@ public:
|
|||||||
NewBS->SetSkeleton(SkeletonObj);
|
NewBS->SetSkeleton(SkeletonObj);
|
||||||
|
|
||||||
NewBS->MarkPackageDirty();
|
NewBS->MarkPackageDirty();
|
||||||
bool bSaved = MCPUtils::SaveGenericPackage(NewBS);
|
bool bSaved = WingUtils::SaveGenericPackage(NewBS);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Created %s\n"), *NewBS->GetPathName());
|
UWingServer::Printf(TEXT("Created %s\n"), *NewBS->GetPathName());
|
||||||
UMCPServer::Printf(TEXT("Skeleton: %s\n"), *SkeletonObj->GetPathName());
|
UWingServer::Printf(TEXT("Skeleton: %s\n"), *SkeletonObj->GetPathName());
|
||||||
if (!bSaved)
|
if (!bSaved)
|
||||||
UMCPServer::Print(TEXT("WARNING: Package save failed\n"));
|
UWingServer::Print(TEXT("WARNING: Package save failed\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_BlueprintGraph_Create : public UObject, public IMCPHandler
|
class UWing_BlueprintGraph_Create : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -42,29 +42,29 @@ public:
|
|||||||
{
|
{
|
||||||
if (GraphType != TEXT("function") && GraphType != TEXT("macro") && GraphType != TEXT("customEvent"))
|
if (GraphType != TEXT("function") && GraphType != TEXT("macro") && GraphType != TEXT("customEvent"))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Invalid GraphType '%s'. Valid values: function, macro, customEvent\n"), *GraphType);
|
UWingServer::Printf(TEXT("ERROR: Invalid GraphType '%s'. Valid values: function, macro, customEvent\n"), *GraphType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
// Check graph name uniqueness
|
// Check graph name uniqueness
|
||||||
if (!MCPUtils::AllGraphsNamed(BP, Graph).IsEmpty())
|
if (!WingUtils::AllGraphsNamed(BP, Graph).IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: A graph named '%s' already exists in %s\n"), *Graph, *MCPUtils::FormatName(BP));
|
UWingServer::Printf(TEXT("ERROR: A graph named '%s' already exists in %s\n"), *Graph, *WingUtils::FormatName(BP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For custom events, also check for existing custom events with the same name
|
// For custom events, also check for existing custom events with the same name
|
||||||
if (GraphType == TEXT("customEvent"))
|
if (GraphType == TEXT("customEvent"))
|
||||||
{
|
{
|
||||||
for (UK2Node_CustomEvent* CE : MCPUtils::AllNodes<UK2Node_CustomEvent>(BP))
|
for (UK2Node_CustomEvent* CE : WingUtils::AllNodes<UK2Node_CustomEvent>(BP))
|
||||||
{
|
{
|
||||||
if (CE->CustomFunctionName == FName(*Graph))
|
if (CE->CustomFunctionName == FName(*Graph))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: A custom event named '%s' already exists in %s\n"), *Graph, *MCPUtils::FormatName(BP));
|
UWingServer::Printf(TEXT("ERROR: A custom event named '%s' already exists in %s\n"), *Graph, *WingUtils::FormatName(BP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,11 +76,11 @@ public:
|
|||||||
UEdGraph::StaticClass(), UEdGraphSchema_K2::StaticClass());
|
UEdGraph::StaticClass(), UEdGraphSchema_K2::StaticClass());
|
||||||
if (!NewGraph)
|
if (!NewGraph)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Failed to create function graph\n"));
|
UWingServer::Print(TEXT("ERROR: Failed to create function graph\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FBlueprintEditorUtils::AddFunctionGraph(BP, NewGraph, /*bIsUserCreated=*/true, /*SignatureFromObject=*/static_cast<UClass*>(nullptr));
|
FBlueprintEditorUtils::AddFunctionGraph(BP, NewGraph, /*bIsUserCreated=*/true, /*SignatureFromObject=*/static_cast<UClass*>(nullptr));
|
||||||
UMCPServer::Printf(TEXT("Created function graph: %s\n"), *MCPUtils::FormatName(NewGraph));
|
UWingServer::Printf(TEXT("Created function graph: %s\n"), *WingUtils::FormatName(NewGraph));
|
||||||
}
|
}
|
||||||
else if (GraphType == TEXT("macro"))
|
else if (GraphType == TEXT("macro"))
|
||||||
{
|
{
|
||||||
@@ -88,11 +88,11 @@ public:
|
|||||||
UEdGraph::StaticClass(), UEdGraphSchema_K2::StaticClass());
|
UEdGraph::StaticClass(), UEdGraphSchema_K2::StaticClass());
|
||||||
if (!NewGraph)
|
if (!NewGraph)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Failed to create macro graph\n"));
|
UWingServer::Print(TEXT("ERROR: Failed to create macro graph\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FBlueprintEditorUtils::AddMacroGraph(BP, NewGraph, /*bIsUserCreated=*/true, /*SignatureFromClass=*/nullptr);
|
FBlueprintEditorUtils::AddMacroGraph(BP, NewGraph, /*bIsUserCreated=*/true, /*SignatureFromClass=*/nullptr);
|
||||||
UMCPServer::Printf(TEXT("Created macro graph: %s\n"), *MCPUtils::FormatName(NewGraph));
|
UWingServer::Printf(TEXT("Created macro graph: %s\n"), *WingUtils::FormatName(NewGraph));
|
||||||
}
|
}
|
||||||
else // customEvent
|
else // customEvent
|
||||||
{
|
{
|
||||||
@@ -101,7 +101,7 @@ public:
|
|||||||
EventGraph = BP->UbergraphPages[0];
|
EventGraph = BP->UbergraphPages[0];
|
||||||
if (!EventGraph)
|
if (!EventGraph)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Blueprint has no EventGraph to add a custom event to\n"));
|
UWingServer::Print(TEXT("ERROR: Blueprint has no EventGraph to add a custom event to\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,9 +112,9 @@ public:
|
|||||||
NewEvent->CreateNewGuid();
|
NewEvent->CreateNewGuid();
|
||||||
NewEvent->PostPlacedNewNode();
|
NewEvent->PostPlacedNewNode();
|
||||||
NewEvent->AllocateDefaultPins();
|
NewEvent->AllocateDefaultPins();
|
||||||
UMCPServer::Printf(TEXT("Created custom event: %s\n"), *MCPUtils::FormatName(NewEvent));
|
UWingServer::Printf(TEXT("Created custom event: %s\n"), *WingUtils::FormatName(NewEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPUtils::SaveBlueprintPackage(BP);
|
WingUtils::SaveBlueprintPackage(BP);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_BlueprintGraph_Delete : public UObject, public IMCPHandler
|
class UWing_BlueprintGraph_Delete : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
F.Walk(Blueprint);
|
F.Walk(Blueprint);
|
||||||
if (!F.Ok()) return;
|
if (!F.Ok()) return;
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
|
|
||||||
for (UEdGraph* G : BP->FunctionGraphs)
|
for (UEdGraph* G : BP->FunctionGraphs)
|
||||||
{
|
{
|
||||||
if (G && MCPUtils::Identifies(Graph, G))
|
if (G && WingUtils::Identifies(Graph, G))
|
||||||
{
|
{
|
||||||
TargetGraph = G;
|
TargetGraph = G;
|
||||||
GraphType = TEXT("function");
|
GraphType = TEXT("function");
|
||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
{
|
{
|
||||||
for (UEdGraph* G : BP->MacroGraphs)
|
for (UEdGraph* G : BP->MacroGraphs)
|
||||||
{
|
{
|
||||||
if (G && MCPUtils::Identifies(Graph, G))
|
if (G && WingUtils::Identifies(Graph, G))
|
||||||
{
|
{
|
||||||
TargetGraph = G;
|
TargetGraph = G;
|
||||||
GraphType = TEXT("macro");
|
GraphType = TEXT("macro");
|
||||||
@@ -72,25 +72,25 @@ public:
|
|||||||
{
|
{
|
||||||
for (UEdGraph* G : BP->UbergraphPages)
|
for (UEdGraph* G : BP->UbergraphPages)
|
||||||
{
|
{
|
||||||
if (G && MCPUtils::Identifies(Graph, G))
|
if (G && WingUtils::Identifies(Graph, G))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Cannot delete UbergraphPage '%s'. EventGraph pages cannot be deleted.\n"),
|
UWingServer::Printf(TEXT("ERROR: Cannot delete UbergraphPage '%s'. EventGraph pages cannot be deleted.\n"),
|
||||||
*MCPUtils::FormatName(G));
|
*WingUtils::FormatName(G));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UMCPServer::Printf(TEXT("ERROR: Graph '%s' not found in blueprint %s\n"),
|
UWingServer::Printf(TEXT("ERROR: Graph '%s' not found in blueprint %s\n"),
|
||||||
*Graph, *MCPUtils::FormatName(BP));
|
*Graph, *WingUtils::FormatName(BP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the graph
|
// Remove the graph
|
||||||
FString GraphName = MCPUtils::FormatName(TargetGraph);
|
FString GraphName = WingUtils::FormatName(TargetGraph);
|
||||||
FBlueprintEditorUtils::RemoveGraph(BP, TargetGraph, EGraphRemoveFlags::Default);
|
FBlueprintEditorUtils::RemoveGraph(BP, TargetGraph, EGraphRemoveFlags::Default);
|
||||||
bool bSaved = MCPUtils::SaveBlueprintPackage(BP);
|
bool bSaved = WingUtils::SaveBlueprintPackage(BP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Deleted %s graph %s\n"), *GraphType, *GraphName);
|
UWingServer::Printf(TEXT("Deleted %s graph %s\n"), *GraphType, *GraphName);
|
||||||
if (!bSaved)
|
if (!bSaved)
|
||||||
UMCPServer::Print(TEXT("WARNING: Package save failed.\n"));
|
UWingServer::Print(TEXT("WARNING: Package save failed.\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_BlueprintGraph_Rename : public UObject, public IMCPHandler
|
class UWing_BlueprintGraph_Rename : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -34,22 +34,22 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraph* TargetGraph = F.Walk(Graph).Cast<UEdGraph>();
|
UEdGraph* TargetGraph = F.Walk(Graph).Cast<UEdGraph>();
|
||||||
if (!TargetGraph) return;
|
if (!TargetGraph) return;
|
||||||
|
|
||||||
UBlueprint* BP = Cast<UBlueprint>(TargetGraph->GetOuter());
|
UBlueprint* BP = Cast<UBlueprint>(TargetGraph->GetOuter());
|
||||||
if (!BP)
|
if (!BP)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Error: Graph '%s' is not owned by a Blueprint.\n"), *Graph);
|
UWingServer::Printf(TEXT("Error: Graph '%s' is not owned by a Blueprint.\n"), *Graph);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it's an UbergraphPage -- disallow rename
|
// Check if it's an UbergraphPage -- disallow rename
|
||||||
if (BP->UbergraphPages.Contains(TargetGraph))
|
if (BP->UbergraphPages.Contains(TargetGraph))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Error: Cannot rename UbergraphPage '%s'. EventGraph pages cannot be renamed.\n"),
|
UWingServer::Printf(TEXT("Error: Cannot rename UbergraphPage '%s'. EventGraph pages cannot be renamed.\n"),
|
||||||
*MCPUtils::FormatName(TargetGraph));
|
*WingUtils::FormatName(TargetGraph));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,27 +58,27 @@ public:
|
|||||||
bool bIsMacro = BP->MacroGraphs.Contains(TargetGraph);
|
bool bIsMacro = BP->MacroGraphs.Contains(TargetGraph);
|
||||||
if (!bIsFunction && !bIsMacro)
|
if (!bIsFunction && !bIsMacro)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Error: Graph '%s' is not a function or macro graph.\n"),
|
UWingServer::Printf(TEXT("Error: Graph '%s' is not a function or macro graph.\n"),
|
||||||
*MCPUtils::FormatName(TargetGraph));
|
*WingUtils::FormatName(TargetGraph));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for name collision
|
// Check for name collision
|
||||||
for (UEdGraph* Existing : MCPUtils::AllGraphsNamed(BP, NewName))
|
for (UEdGraph* Existing : WingUtils::AllGraphsNamed(BP, NewName))
|
||||||
{
|
{
|
||||||
if (Existing != TargetGraph)
|
if (Existing != TargetGraph)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Error: A graph named '%s' already exists in '%s'.\n"),
|
UWingServer::Printf(TEXT("Error: A graph named '%s' already exists in '%s'.\n"),
|
||||||
*NewName, *MCPUtils::FormatName(BP));
|
*NewName, *WingUtils::FormatName(BP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FBlueprintEditorUtils::RenameGraph(TargetGraph, NewName);
|
FBlueprintEditorUtils::RenameGraph(TargetGraph, NewName);
|
||||||
MCPUtils::SaveBlueprintPackage(BP);
|
WingUtils::SaveBlueprintPackage(BP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Renamed to %s %s\n"),
|
UWingServer::Printf(TEXT("Renamed to %s %s\n"),
|
||||||
bIsFunction ? TEXT("function") : TEXT("macro"),
|
bIsFunction ? TEXT("function") : TEXT("macro"),
|
||||||
*MCPUtils::FormatName(TargetGraph));
|
*WingUtils::FormatName(TargetGraph));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Engine/SimpleConstructionScript.h"
|
#include "Engine/SimpleConstructionScript.h"
|
||||||
#include "Engine/SCS_Node.h"
|
#include "Engine/SCS_Node.h"
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_AddComponent : public UObject, public IMCPHandler
|
class UWing_Blueprint_AddComponent : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -42,15 +42,15 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
USimpleConstructionScript* SCS = BP->SimpleConstructionScript;
|
USimpleConstructionScript* SCS = BP->SimpleConstructionScript;
|
||||||
if (!SCS)
|
if (!SCS)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Blueprint '%s' does not have a SimpleConstructionScript (not an Actor Blueprint)\n"),
|
UWingServer::Printf(TEXT("ERROR: Blueprint '%s' does not have a SimpleConstructionScript (not an Actor Blueprint)\n"),
|
||||||
*MCPUtils::FormatName(BP));
|
*WingUtils::FormatName(BP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,19 +59,19 @@ public:
|
|||||||
for (USCS_Node* Existing : ExistingNodes)
|
for (USCS_Node* Existing : ExistingNodes)
|
||||||
{
|
{
|
||||||
if (Existing && Existing->ComponentTemplate &&
|
if (Existing && Existing->ComponentTemplate &&
|
||||||
MCPUtils::Identifies(Component, Existing->ComponentTemplate))
|
WingUtils::Identifies(Component, Existing->ComponentTemplate))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: A component named '%s' already exists in Blueprint '%s'\n"),
|
UWingServer::Printf(TEXT("ERROR: A component named '%s' already exists in Blueprint '%s'\n"),
|
||||||
*Component, *MCPUtils::FormatName(BP));
|
*Component, *WingUtils::FormatName(BP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve the component class by name
|
// Resolve the component class by name
|
||||||
UClass* ComponentClassObj = MCPUtils::FindClassByName(ComponentClass);
|
UClass* ComponentClassObj = WingUtils::FindClassByName(ComponentClass);
|
||||||
if (!ComponentClassObj || !ComponentClassObj->IsChildOf(UActorComponent::StaticClass()))
|
if (!ComponentClassObj || !ComponentClassObj->IsChildOf(UActorComponent::StaticClass()))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Component class '%s' not found or is not a subclass of UActorComponent. "
|
UWingServer::Printf(TEXT("ERROR: Component class '%s' not found or is not a subclass of UActorComponent. "
|
||||||
"Common classes: StaticMeshComponent, SkeletalMeshComponent, AudioComponent, "
|
"Common classes: StaticMeshComponent, SkeletalMeshComponent, AudioComponent, "
|
||||||
"SceneComponent, BoxCollisionComponent, SphereCollisionComponent, CapsuleComponent, "
|
"SceneComponent, BoxCollisionComponent, SphereCollisionComponent, CapsuleComponent, "
|
||||||
"ArrowComponent, ChildActorComponent, SpotLightComponent, PointLightComponent, "
|
"ArrowComponent, ChildActorComponent, SpotLightComponent, PointLightComponent, "
|
||||||
@@ -87,7 +87,7 @@ public:
|
|||||||
for (USCS_Node* Node : ExistingNodes)
|
for (USCS_Node* Node : ExistingNodes)
|
||||||
{
|
{
|
||||||
if (Node && Node->ComponentTemplate &&
|
if (Node && Node->ComponentTemplate &&
|
||||||
MCPUtils::Identifies(ParentComponent, Node->ComponentTemplate))
|
WingUtils::Identifies(ParentComponent, Node->ComponentTemplate))
|
||||||
{
|
{
|
||||||
ParentSCSNode = Node;
|
ParentSCSNode = Node;
|
||||||
break;
|
break;
|
||||||
@@ -96,8 +96,8 @@ public:
|
|||||||
|
|
||||||
if (!ParentSCSNode)
|
if (!ParentSCSNode)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Parent component '%s' not found in Blueprint '%s'\n"),
|
UWingServer::Printf(TEXT("ERROR: Parent component '%s' not found in Blueprint '%s'\n"),
|
||||||
*ParentComponent, *MCPUtils::FormatName(BP));
|
*ParentComponent, *WingUtils::FormatName(BP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,8 +106,8 @@ public:
|
|||||||
USCS_Node* NewNode = SCS->CreateNode(ComponentClassObj, FName(*Component));
|
USCS_Node* NewNode = SCS->CreateNode(ComponentClassObj, FName(*Component));
|
||||||
if (!NewNode)
|
if (!NewNode)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Failed to create SCS node for component '%s' with class '%s'\n"),
|
UWingServer::Printf(TEXT("ERROR: Failed to create SCS node for component '%s' with class '%s'\n"),
|
||||||
*Component, *MCPUtils::FormatName(ComponentClassObj));
|
*Component, *WingUtils::FormatName(ComponentClassObj));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,15 +121,15 @@ public:
|
|||||||
SCS->AddNode(NewNode);
|
SCS->AddNode(NewNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bSaved = MCPUtils::SaveBlueprintPackage(BP);
|
bool bSaved = WingUtils::SaveBlueprintPackage(BP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Added component %s (%s)"),
|
UWingServer::Printf(TEXT("Added component %s (%s)"),
|
||||||
*MCPUtils::FormatName(NewNode->ComponentTemplate),
|
*WingUtils::FormatName(NewNode->ComponentTemplate),
|
||||||
*MCPUtils::FormatName(ComponentClassObj));
|
*WingUtils::FormatName(ComponentClassObj));
|
||||||
if (ParentSCSNode)
|
if (ParentSCSNode)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT(" under %s"), *MCPUtils::FormatName(ParentSCSNode->ComponentTemplate));
|
UWingServer::Printf(TEXT(" under %s"), *WingUtils::FormatName(ParentSCSNode->ComponentTemplate));
|
||||||
}
|
}
|
||||||
UMCPServer::Printf(TEXT("\nSaved: %s\n"), bSaved ? TEXT("true") : TEXT("false"));
|
UWingServer::Printf(TEXT("\nSaved: %s\n"), bSaved ? TEXT("true") : TEXT("false"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphPin.h"
|
#include "EdGraph/EdGraphPin.h"
|
||||||
@@ -33,7 +33,7 @@ struct FDispatcherParamEntry
|
|||||||
};
|
};
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_AddEventDispatcher : public UObject, public IMCPHandler
|
class UWing_Blueprint_AddEventDispatcher : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ public:
|
|||||||
FString DispatcherName;
|
FString DispatcherName;
|
||||||
|
|
||||||
UPROPERTY(meta=(Optional, Description="Array of parameter objects, each with 'name' and 'type' fields"))
|
UPROPERTY(meta=(Optional, Description="Array of parameter objects, each with 'name' and 'type' fields"))
|
||||||
FMCPJsonArray Parameters;
|
FWingJsonArray Parameters;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
@@ -65,15 +65,15 @@ public:
|
|||||||
{
|
{
|
||||||
if (Var.VarName == DispatcherFName)
|
if (Var.VarName == DispatcherFName)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Error: A variable or dispatcher named '%s' already exists.\n"), *DispatcherName);
|
UWingServer::Printf(TEXT("Error: A variable or dispatcher named '%s' already exists.\n"), *DispatcherName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check against existing graphs (functions, macros, etc.)
|
// Check against existing graphs (functions, macros, etc.)
|
||||||
if (!MCPUtils::AllGraphsNamed(BP, DispatcherName).IsEmpty())
|
if (!WingUtils::AllGraphsNamed(BP, DispatcherName).IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Error: A graph named '%s' already exists.\n"), *DispatcherName);
|
UWingServer::Printf(TEXT("Error: A graph named '%s' already exists.\n"), *DispatcherName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ public:
|
|||||||
DelegateType.PinCategory = UEdGraphSchema_K2::PC_MCDelegate;
|
DelegateType.PinCategory = UEdGraphSchema_K2::PC_MCDelegate;
|
||||||
if (!FBlueprintEditorUtils::AddMemberVariable(BP, DispatcherFName, DelegateType))
|
if (!FBlueprintEditorUtils::AddMemberVariable(BP, DispatcherFName, DelegateType))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Error: Failed to add delegate variable for '%s'.\n"), *DispatcherName);
|
UWingServer::Printf(TEXT("Error: Failed to add delegate variable for '%s'.\n"), *DispatcherName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
UEdGraph::StaticClass(), UEdGraphSchema_K2::StaticClass());
|
UEdGraph::StaticClass(), UEdGraphSchema_K2::StaticClass());
|
||||||
if (!SigGraph)
|
if (!SigGraph)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("Error: Failed to create delegate signature graph.\n"));
|
UWingServer::Print(TEXT("Error: Failed to create delegate signature graph.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ public:
|
|||||||
if (Parameters.Array.Num() > 0)
|
if (Parameters.Array.Num() > 0)
|
||||||
{
|
{
|
||||||
UK2Node_EditablePinBase* EntryNode = nullptr;
|
UK2Node_EditablePinBase* EntryNode = nullptr;
|
||||||
for (UK2Node_FunctionEntry* FE : MCPUtils::AllNodes<UK2Node_FunctionEntry>(SigGraph))
|
for (UK2Node_FunctionEntry* FE : WingUtils::AllNodes<UK2Node_FunctionEntry>(SigGraph))
|
||||||
{
|
{
|
||||||
EntryNode = FE;
|
EntryNode = FE;
|
||||||
break;
|
break;
|
||||||
@@ -118,19 +118,19 @@ public:
|
|||||||
|
|
||||||
if (!EntryNode)
|
if (!EntryNode)
|
||||||
{
|
{
|
||||||
MCPUtils::SaveBlueprintPackage(BP);
|
WingUtils::SaveBlueprintPackage(BP);
|
||||||
UMCPServer::Print(TEXT("Error: Event dispatcher created but entry node not found — parameters could not be added.\n"));
|
UWingServer::Print(TEXT("Error: Event dispatcher created but entry node not found — parameters could not be added.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const TSharedPtr<FJsonValue>& ParamVal : Parameters.Array)
|
for (const TSharedPtr<FJsonValue>& ParamVal : Parameters.Array)
|
||||||
{
|
{
|
||||||
FDispatcherParamEntry Entry;
|
FDispatcherParamEntry Entry;
|
||||||
if (!MCPJson::PopulateFromJson(FDispatcherParamEntry::StaticStruct(), &Entry, ParamVal)) return;
|
if (!WingJson::PopulateFromJson(FDispatcherParamEntry::StaticStruct(), &Entry, ParamVal)) return;
|
||||||
if (Entry.Name.IsEmpty() || Entry.Type.IsEmpty()) continue;
|
if (Entry.Name.IsEmpty() || Entry.Type.IsEmpty()) continue;
|
||||||
|
|
||||||
FEdGraphPinType PinType;
|
FEdGraphPinType PinType;
|
||||||
if (!UMCPTypes::TextToType(Entry.Type, PinType))
|
if (!UWingTypes::TextToType(Entry.Type, PinType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EntryNode->CreateUserDefinedPin(FName(*Entry.Name), PinType, EGPD_Output);
|
EntryNode->CreateUserDefinedPin(FName(*Entry.Name), PinType, EGPD_Output);
|
||||||
@@ -138,11 +138,11 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPUtils::SaveBlueprintPackage(BP);
|
WingUtils::SaveBlueprintPackage(BP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Created event dispatcher '%s'"), *DispatcherName);
|
UWingServer::Printf(TEXT("Created event dispatcher '%s'"), *DispatcherName);
|
||||||
if (ParamCount > 0)
|
if (ParamCount > 0)
|
||||||
UMCPServer::Printf(TEXT(" with %d parameter(s)"), ParamCount);
|
UWingServer::Printf(TEXT(" with %d parameter(s)"), ParamCount);
|
||||||
UMCPServer::Print(TEXT(".\n"));
|
UWingServer::Print(TEXT(".\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,143 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "MCPHandler.h"
|
|
||||||
#include "MCPFetcher.h"
|
|
||||||
#include "MCPTypes.h"
|
|
||||||
#include "MCPUtils.h"
|
|
||||||
#include "MCPServer.h"
|
|
||||||
#include "Engine/Blueprint.h"
|
|
||||||
#include "EdGraph/EdGraph.h"
|
|
||||||
#include "EdGraph/EdGraphPin.h"
|
|
||||||
#include "K2Node_FunctionEntry.h"
|
|
||||||
#include "K2Node_CustomEvent.h"
|
|
||||||
#include "K2Node_EditablePinBase.h"
|
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
|
||||||
#include "Blueprint_AddFunctionParameter.generated.h"
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
UCLASS()
|
|
||||||
class UMCP_Blueprint_AddFunctionParameter : public UObject, public IMCPHandler
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
public:
|
|
||||||
UPROPERTY(meta=(Description="Blueprint package path"))
|
|
||||||
FString Blueprint;
|
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Name of the function, custom event, or event dispatcher"))
|
|
||||||
FString FunctionName;
|
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Name for the new parameter"))
|
|
||||||
FString ParamName;
|
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Type for the new parameter (e.g. 'Float', 'Vector', 'MyStruct')"))
|
|
||||||
FString ParamType;
|
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
|
||||||
{
|
|
||||||
return TEXT("Add a new parameter to a function, custom event, or event dispatcher in a Blueprint.");
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Handle() override
|
|
||||||
{
|
|
||||||
MCPFetcher F;
|
|
||||||
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
|
||||||
if (!BP) return;
|
|
||||||
|
|
||||||
// Resolve param type
|
|
||||||
FEdGraphPinType PinType;
|
|
||||||
if (!UMCPTypes::TextToType(ParamType, PinType))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Find the entry node using 3 strategies
|
|
||||||
UK2Node_EditablePinBase* EntryNode = nullptr;
|
|
||||||
FString NodeType;
|
|
||||||
|
|
||||||
// Strategy 1: K2Node_FunctionEntry in function graphs
|
|
||||||
for (UK2Node_FunctionEntry* FE : MCPUtils::AllNodes<UK2Node_FunctionEntry>(BP))
|
|
||||||
{
|
|
||||||
UEdGraph* FEGraph = FE->GetGraph();
|
|
||||||
if (!MCPUtils::Identifies(FunctionName, FEGraph)) continue;
|
|
||||||
// Skip delegate signature graphs (handled in Strategy 3)
|
|
||||||
if (BP->DelegateSignatureGraphs.Contains(FEGraph)) continue;
|
|
||||||
|
|
||||||
EntryNode = FE;
|
|
||||||
NodeType = TEXT("FunctionEntry");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Strategy 2: K2Node_CustomEvent with matching CustomFunctionName
|
|
||||||
if (!EntryNode)
|
|
||||||
{
|
|
||||||
for (UK2Node_CustomEvent* CE : MCPUtils::AllNodes<UK2Node_CustomEvent>(BP))
|
|
||||||
{
|
|
||||||
if (CE->CustomFunctionName.ToString().Equals(FunctionName, ESearchCase::IgnoreCase))
|
|
||||||
{
|
|
||||||
EntryNode = CE;
|
|
||||||
NodeType = TEXT("CustomEvent");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Strategy 3: K2Node_FunctionEntry in DelegateSignatureGraphs
|
|
||||||
if (!EntryNode)
|
|
||||||
{
|
|
||||||
for (UK2Node_FunctionEntry* FE : MCPUtils::AllNodes<UK2Node_FunctionEntry>(BP))
|
|
||||||
{
|
|
||||||
UEdGraph* FEGraph = FE->GetGraph();
|
|
||||||
if (!MCPUtils::Identifies(FunctionName, FEGraph)) continue;
|
|
||||||
if (!BP->DelegateSignatureGraphs.Contains(FEGraph)) continue;
|
|
||||||
|
|
||||||
EntryNode = FE;
|
|
||||||
NodeType = TEXT("EventDispatcher");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EntryNode)
|
|
||||||
{
|
|
||||||
// Build a helpful error listing available functions, events, and dispatchers
|
|
||||||
UMCPServer::Printf(TEXT("ERROR: Function/event/dispatcher '%s' not found. Available:\n"), *FunctionName);
|
|
||||||
|
|
||||||
for (UEdGraph* Graph : BP->FunctionGraphs)
|
|
||||||
{
|
|
||||||
if (Graph) UMCPServer::Printf(TEXT(" function: %s\n"), *MCPUtils::FormatName(Graph));
|
|
||||||
}
|
|
||||||
for (UK2Node_CustomEvent* CE : MCPUtils::AllNodes<UK2Node_CustomEvent>(BP))
|
|
||||||
{
|
|
||||||
UMCPServer::Printf(TEXT(" custom event: %s\n"), *CE->CustomFunctionName.ToString());
|
|
||||||
}
|
|
||||||
TSet<FName> DelegateNames;
|
|
||||||
FBlueprintEditorUtils::GetDelegateNameList(BP, DelegateNames);
|
|
||||||
for (const FName& DN : DelegateNames)
|
|
||||||
{
|
|
||||||
UMCPServer::Printf(TEXT(" dispatcher: %s\n"), *DN.ToString());
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for duplicate parameter name
|
|
||||||
for (const TSharedPtr<FUserPinInfo>& Existing : EntryNode->UserDefinedPins)
|
|
||||||
{
|
|
||||||
if (Existing.IsValid() && Existing->PinName.ToString().Equals(ParamName, ESearchCase::IgnoreCase))
|
|
||||||
{
|
|
||||||
UMCPServer::Printf(TEXT("ERROR: Parameter '%s' already exists on '%s'\n"), *ParamName, *FunctionName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the parameter pin (EGPD_Output on entry = input to callers)
|
|
||||||
EntryNode->CreateUserDefinedPin(FName(*ParamName), PinType, EGPD_Output);
|
|
||||||
bool bSaved = MCPUtils::SaveBlueprintPackage(BP);
|
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Added %s parameter '%s' to %s '%s'%s\n"),
|
|
||||||
*ParamType, *ParamName, *NodeType, *FunctionName,
|
|
||||||
bSaved ? TEXT("") : TEXT(" (WARNING: save failed)"));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
#include "UObject/UObjectIterator.h"
|
#include "UObject/UObjectIterator.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_AddInterface : public UObject, public IMCPHandler
|
class UWing_Blueprint_AddInterface : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
@@ -48,8 +48,8 @@ public:
|
|||||||
{
|
{
|
||||||
if (IfaceDesc.Interface == InterfaceClass)
|
if (IfaceDesc.Interface == InterfaceClass)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Interface '%s' is already implemented by this Blueprint.\n"),
|
UWingServer::Printf(TEXT("ERROR: Interface '%s' is already implemented by this Blueprint.\n"),
|
||||||
*MCPUtils::FormatName(InterfaceClass));
|
*WingUtils::FormatName(InterfaceClass));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,21 +58,21 @@ public:
|
|||||||
bool bAdded = FBlueprintEditorUtils::ImplementNewInterface(BP, InterfacePath);
|
bool bAdded = FBlueprintEditorUtils::ImplementNewInterface(BP, InterfacePath);
|
||||||
if (!bAdded)
|
if (!bAdded)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: ImplementNewInterface failed for '%s'.\n"),
|
UWingServer::Printf(TEXT("ERROR: ImplementNewInterface failed for '%s'.\n"),
|
||||||
*MCPUtils::FormatName(InterfaceClass));
|
*WingUtils::FormatName(InterfaceClass));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect stub function graph names from the newly added interface entry
|
// Collect stub function graph names from the newly added interface entry
|
||||||
UMCPServer::Printf(TEXT("Added interface %s\n"), *MCPUtils::FormatName(InterfaceClass));
|
UWingServer::Printf(TEXT("Added interface %s\n"), *WingUtils::FormatName(InterfaceClass));
|
||||||
UMCPServer::Printf(TEXT("Function stubs:\n"));
|
UWingServer::Printf(TEXT("Function stubs:\n"));
|
||||||
for (const FBPInterfaceDescription& IfaceDesc : BP->ImplementedInterfaces)
|
for (const FBPInterfaceDescription& IfaceDesc : BP->ImplementedInterfaces)
|
||||||
{
|
{
|
||||||
if (IfaceDesc.Interface != InterfaceClass) continue;
|
if (IfaceDesc.Interface != InterfaceClass) continue;
|
||||||
for (const UEdGraph* Graph : IfaceDesc.Graphs)
|
for (const UEdGraph* Graph : IfaceDesc.Graphs)
|
||||||
{
|
{
|
||||||
if (Graph)
|
if (Graph)
|
||||||
UMCPServer::Printf(TEXT(" %s\n"), *MCPUtils::FormatName(Graph));
|
UWingServer::Printf(TEXT(" %s\n"), *WingUtils::FormatName(Graph));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -88,17 +88,17 @@ private:
|
|||||||
for (TObjectIterator<UClass> It; It; ++It)
|
for (TObjectIterator<UClass> It; It; ++It)
|
||||||
{
|
{
|
||||||
if (!It->IsChildOf(UInterface::StaticClass())) continue;
|
if (!It->IsChildOf(UInterface::StaticClass())) continue;
|
||||||
if (MCPUtils::Identifies(Name, *It))
|
if (WingUtils::Identifies(Name, *It))
|
||||||
return *It;
|
return *It;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strategy 2: Try loading as a Blueprint Interface asset by package path
|
// Strategy 2: Try loading as a Blueprint Interface asset by package path
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* IfaceBP = F.Asset(Name).Cast<UBlueprint>();
|
UBlueprint* IfaceBP = F.Asset(Name).Cast<UBlueprint>();
|
||||||
if (IfaceBP && IfaceBP->GeneratedClass && IfaceBP->GeneratedClass->IsChildOf(UInterface::StaticClass()))
|
if (IfaceBP && IfaceBP->GeneratedClass && IfaceBP->GeneratedClass->IsChildOf(UInterface::StaticClass()))
|
||||||
return IfaceBP->GeneratedClass;
|
return IfaceBP->GeneratedClass;
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("ERROR: Interface '%s' not found. Provide a native UInterface class name or Blueprint Interface package path.\n"),
|
UWingServer::Printf(TEXT("ERROR: Interface '%s' not found. Provide a native UInterface class name or Blueprint Interface package path.\n"),
|
||||||
*Name);
|
*Name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,160 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "MCPHandler.h"
|
|
||||||
#include "MCPFetcher.h"
|
|
||||||
#include "MCPUtils.h"
|
|
||||||
#include "MCPServer.h"
|
|
||||||
#include "MCPTypes.h"
|
|
||||||
#include "Engine/Blueprint.h"
|
|
||||||
#include "EdGraph/EdGraph.h"
|
|
||||||
#include "EdGraph/EdGraphPin.h"
|
|
||||||
#include "K2Node_FunctionEntry.h"
|
|
||||||
#include "K2Node_CustomEvent.h"
|
|
||||||
#include "K2Node_EditablePinBase.h"
|
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
|
||||||
#include "Blueprint_ChangeFunctionParameterType.generated.h"
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
UCLASS()
|
|
||||||
class UMCP_Blueprint_ChangeFunctionParameterType : public UObject, public IMCPHandler
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
public:
|
|
||||||
UPROPERTY(meta=(Description="Blueprint package path"))
|
|
||||||
FString Blueprint;
|
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Name of the function or custom event"))
|
|
||||||
FString FunctionName;
|
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Name of the parameter to change"))
|
|
||||||
FString ParamName;
|
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="New type for the parameter (e.g. 'Float', 'Vector', 'MyStruct')"))
|
|
||||||
FString NewType;
|
|
||||||
|
|
||||||
UPROPERTY(meta=(Optional, Description="If true, analyze impact without making changes"))
|
|
||||||
bool DryRun = false;
|
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
|
||||||
{
|
|
||||||
return TEXT("Change the type of an existing parameter on a function or custom event in a Blueprint.");
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Handle() override
|
|
||||||
{
|
|
||||||
MCPFetcher F;
|
|
||||||
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
|
||||||
if (!BP) return;
|
|
||||||
|
|
||||||
// Resolve the new type using the shared resolver (supports primitives, structs, enums, and object references)
|
|
||||||
FEdGraphPinType NewPinType;
|
|
||||||
if (!UMCPTypes::TextToType(NewType, NewPinType))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Find the entry node: K2Node_FunctionEntry in a function graph,
|
|
||||||
// or K2Node_CustomEvent in any graph
|
|
||||||
UK2Node_EditablePinBase* EntryNode = nullptr;
|
|
||||||
|
|
||||||
// Strategy 1: Look for a K2Node_FunctionEntry in a function graph matching the name
|
|
||||||
for (UK2Node_FunctionEntry* FuncEntry : MCPUtils::AllNodes<UK2Node_FunctionEntry>(BP))
|
|
||||||
{
|
|
||||||
if (MCPUtils::Identifies(FunctionName, FuncEntry->GetGraph()))
|
|
||||||
{
|
|
||||||
EntryNode = FuncEntry;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Strategy 2: Search for a K2Node_CustomEvent with matching name
|
|
||||||
if (!EntryNode)
|
|
||||||
{
|
|
||||||
for (UK2Node_CustomEvent* CustomEvent : MCPUtils::AllNodes<UK2Node_CustomEvent>(BP))
|
|
||||||
{
|
|
||||||
if (MCPUtils::Identifies(FunctionName, static_cast<UEdGraphNode*>(CustomEvent)))
|
|
||||||
{
|
|
||||||
EntryNode = CustomEvent;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EntryNode)
|
|
||||||
{
|
|
||||||
UMCPServer::Printf(TEXT("ERROR: Function or custom event '%s' not found. Available:\n"), *FunctionName);
|
|
||||||
for (UK2Node_FunctionEntry* FE : MCPUtils::AllNodes<UK2Node_FunctionEntry>(BP))
|
|
||||||
UMCPServer::Printf(TEXT(" function: %s\n"), *MCPUtils::FormatName(FE->GetGraph()));
|
|
||||||
for (UK2Node_CustomEvent* CE : MCPUtils::AllNodes<UK2Node_CustomEvent>(BP))
|
|
||||||
UMCPServer::Printf(TEXT(" event: %s\n"), *MCPUtils::FormatName(static_cast<UEdGraphNode*>(CE)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the UserDefinedPin matching ParamName
|
|
||||||
TSharedPtr<FUserPinInfo>* FoundPinInfo = nullptr;
|
|
||||||
for (TSharedPtr<FUserPinInfo>& PinInfo : EntryNode->UserDefinedPins)
|
|
||||||
{
|
|
||||||
if (PinInfo.IsValid() && PinInfo->PinName.ToString().Equals(ParamName, ESearchCase::IgnoreCase))
|
|
||||||
{
|
|
||||||
FoundPinInfo = &PinInfo;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!FoundPinInfo)
|
|
||||||
{
|
|
||||||
UMCPServer::Printf(TEXT("ERROR: Parameter '%s' not found. Available:\n"), *ParamName);
|
|
||||||
for (const TSharedPtr<FUserPinInfo>& PinInfo : EntryNode->UserDefinedPins)
|
|
||||||
if (PinInfo.IsValid())
|
|
||||||
UMCPServer::Printf(TEXT(" %s\n"), *PinInfo->PinName.ToString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dry run: report connected pins that may disconnect
|
|
||||||
if (DryRun)
|
|
||||||
{
|
|
||||||
int32 AtRisk = 0;
|
|
||||||
for (UEdGraphPin* Pin : EntryNode->Pins)
|
|
||||||
{
|
|
||||||
if (!Pin || !MCPUtils::Identifies(ParamName, Pin)) continue;
|
|
||||||
for (UEdGraphPin* Linked : Pin->LinkedTo)
|
|
||||||
{
|
|
||||||
if (!Linked || !Linked->GetOwningNode()) continue;
|
|
||||||
UMCPServer::Printf(TEXT("Connection at risk: %s -> %s on %s\n"),
|
|
||||||
*MCPUtils::FormatName(Pin),
|
|
||||||
*MCPUtils::FormatName(Linked),
|
|
||||||
*MCPUtils::FormatName(Linked->GetOwningNode()));
|
|
||||||
AtRisk++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
UMCPServer::Printf(TEXT("Dry run: %d connection(s) at risk.\n"), AtRisk);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply the type change (PreEdit/PostEdit on the node itself, not the BP —
|
|
||||||
// MCPUtils::PreEdit/PostEdit operates at BP level, not node level)
|
|
||||||
EntryNode->PreEditChange(nullptr);
|
|
||||||
(*FoundPinInfo)->PinType = NewPinType;
|
|
||||||
EntryNode->PostEditChange();
|
|
||||||
|
|
||||||
// Reconstruct the node to update output pins with the new type
|
|
||||||
if (UEdGraph* OwningGraph = EntryNode->GetGraph())
|
|
||||||
{
|
|
||||||
if (const UEdGraphSchema* Schema = OwningGraph->GetSchema())
|
|
||||||
{
|
|
||||||
Schema->ReconstructNode(*EntryNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save
|
|
||||||
bool bSaved = MCPUtils::SaveBlueprintPackage(BP);
|
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Changed '%s' to %s. Save %s.\n"),
|
|
||||||
*ParamName, *UMCPTypes::TypeToText(NewPinType),
|
|
||||||
bSaved ? TEXT("succeeded") : TEXT("failed"));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Kismet2/KismetEditorUtilities.h"
|
#include "Kismet2/KismetEditorUtilities.h"
|
||||||
#include "Blueprint_Compile.generated.h"
|
#include "Blueprint_Compile.generated.h"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_Compile : public UObject, public IMCPHandler
|
class UWing_Blueprint_Compile : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint *BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
UBlueprint *BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
||||||
|
|
||||||
EBlueprintCompileOptions CompileOpts =
|
EBlueprintCompileOptions CompileOpts =
|
||||||
@@ -41,14 +41,14 @@ public:
|
|||||||
FKismetEditorUtilities::CompileBlueprint(BP, CompileOpts, nullptr);
|
FKismetEditorUtilities::CompileBlueprint(BP, CompileOpts, nullptr);
|
||||||
|
|
||||||
// Collect compiler messages from nodes
|
// Collect compiler messages from nodes
|
||||||
for (UEdGraphNode* Node : MCPUtils::AllNodes(BP))
|
for (UEdGraphNode* Node : WingUtils::AllNodes(BP))
|
||||||
{
|
{
|
||||||
if (!Node->bHasCompilerMessage) continue;
|
if (!Node->bHasCompilerMessage) continue;
|
||||||
UMCPServer::Printf(TEXT("%s %s: %s\n"),
|
UWingServer::Printf(TEXT("%s %s: %s\n"),
|
||||||
*MCPUtils::FormatName(Node->GetGraph()),
|
*WingUtils::FormatName(Node->GetGraph()),
|
||||||
*MCPUtils::FormatName(Node),
|
*WingUtils::FormatName(Node),
|
||||||
*Node->ErrorMsg);
|
*Node->ErrorMsg);
|
||||||
}
|
}
|
||||||
UMCPServer::Printf(TEXT("Compilation Done.\n"));
|
UWingServer::Printf(TEXT("Compilation Done.\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_Diff : public UObject, public IMCPHandler
|
class UWing_Blueprint_Diff : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -41,11 +41,11 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Load both blueprints
|
// Load both blueprints
|
||||||
MCPFetcher FA;
|
WingFetcher FA;
|
||||||
UBlueprint* BPA = FA.Asset(BlueprintA).Cast<UBlueprint>();
|
UBlueprint* BPA = FA.Asset(BlueprintA).Cast<UBlueprint>();
|
||||||
if (!BPA) return;
|
if (!BPA) return;
|
||||||
|
|
||||||
MCPFetcher FB;
|
WingFetcher FB;
|
||||||
UBlueprint* BPB = FB.Asset(BlueprintB).Cast<UBlueprint>();
|
UBlueprint* BPB = FB.Asset(BlueprintB).Cast<UBlueprint>();
|
||||||
if (!BPB) return;
|
if (!BPB) return;
|
||||||
|
|
||||||
@@ -56,13 +56,13 @@ public:
|
|||||||
for (UEdGraph* G : BP->UbergraphPages)
|
for (UEdGraph* G : BP->UbergraphPages)
|
||||||
{
|
{
|
||||||
if (!G) continue;
|
if (!G) continue;
|
||||||
if (!Graph.IsEmpty() && !MCPUtils::Identifies(Graph, G)) continue;
|
if (!Graph.IsEmpty() && !WingUtils::Identifies(Graph, G)) continue;
|
||||||
Graphs.Add(G);
|
Graphs.Add(G);
|
||||||
}
|
}
|
||||||
for (UEdGraph* G : BP->FunctionGraphs)
|
for (UEdGraph* G : BP->FunctionGraphs)
|
||||||
{
|
{
|
||||||
if (!G) continue;
|
if (!G) continue;
|
||||||
if (!Graph.IsEmpty() && !MCPUtils::Identifies(Graph, G)) continue;
|
if (!Graph.IsEmpty() && !WingUtils::Identifies(Graph, G)) continue;
|
||||||
Graphs.Add(G);
|
Graphs.Add(G);
|
||||||
}
|
}
|
||||||
return Graphs;
|
return Graphs;
|
||||||
@@ -73,8 +73,8 @@ public:
|
|||||||
|
|
||||||
// Build graph name maps
|
// Build graph name maps
|
||||||
TMap<FString, UEdGraph*> GraphMapA, GraphMapB;
|
TMap<FString, UEdGraph*> GraphMapA, GraphMapB;
|
||||||
for (UEdGraph* G : GraphsA) GraphMapA.Add(MCPUtils::FormatName(G), G);
|
for (UEdGraph* G : GraphsA) GraphMapA.Add(WingUtils::FormatName(G), G);
|
||||||
for (UEdGraph* G : GraphsB) GraphMapB.Add(MCPUtils::FormatName(G), G);
|
for (UEdGraph* G : GraphsB) GraphMapB.Add(WingUtils::FormatName(G), G);
|
||||||
|
|
||||||
// Find all unique graph names
|
// Find all unique graph names
|
||||||
TSet<FString> AllGraphNames;
|
TSet<FString> AllGraphNames;
|
||||||
@@ -90,13 +90,13 @@ public:
|
|||||||
|
|
||||||
if (!pGA)
|
if (!pGA)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Graph %s: only in B (%d nodes)\n"), *GraphName, (*pGB)->Nodes.Num());
|
UWingServer::Printf(TEXT("Graph %s: only in B (%d nodes)\n"), *GraphName, (*pGB)->Nodes.Num());
|
||||||
TotalDiffs++;
|
TotalDiffs++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!pGB)
|
if (!pGB)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Graph %s: only in A (%d nodes)\n"), *GraphName, (*pGA)->Nodes.Num());
|
UWingServer::Printf(TEXT("Graph %s: only in A (%d nodes)\n"), *GraphName, (*pGA)->Nodes.Num());
|
||||||
TotalDiffs++;
|
TotalDiffs++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -110,12 +110,12 @@ public:
|
|||||||
for (UEdGraphNode* N : GA->Nodes)
|
for (UEdGraphNode* N : GA->Nodes)
|
||||||
{
|
{
|
||||||
if (!N) continue;
|
if (!N) continue;
|
||||||
NodesA.FindOrAdd(MCPUtils::FormatName(N)).Add(N);
|
NodesA.FindOrAdd(WingUtils::FormatName(N)).Add(N);
|
||||||
}
|
}
|
||||||
for (UEdGraphNode* N : GB->Nodes)
|
for (UEdGraphNode* N : GB->Nodes)
|
||||||
{
|
{
|
||||||
if (!N) continue;
|
if (!N) continue;
|
||||||
NodesB.FindOrAdd(MCPUtils::FormatName(N)).Add(N);
|
NodesB.FindOrAdd(WingUtils::FormatName(N)).Add(N);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nodes only in A
|
// Nodes only in A
|
||||||
@@ -144,8 +144,8 @@ public:
|
|||||||
auto MakeConnKey = [](UEdGraphPin* SrcPin, UEdGraphPin* TgtPin) -> FString
|
auto MakeConnKey = [](UEdGraphPin* SrcPin, UEdGraphPin* TgtPin) -> FString
|
||||||
{
|
{
|
||||||
return FString::Printf(TEXT("%s|%s|%s|%s"),
|
return FString::Printf(TEXT("%s|%s|%s|%s"),
|
||||||
*MCPUtils::FormatName(SrcPin->GetOwningNode()), *MCPUtils::FormatName(SrcPin),
|
*WingUtils::FormatName(SrcPin->GetOwningNode()), *WingUtils::FormatName(SrcPin),
|
||||||
*MCPUtils::FormatName(TgtPin->GetOwningNode()), *MCPUtils::FormatName(TgtPin));
|
*WingUtils::FormatName(TgtPin->GetOwningNode()), *WingUtils::FormatName(TgtPin));
|
||||||
};
|
};
|
||||||
|
|
||||||
auto GatherConnections = [&MakeConnKey](UEdGraph* G) -> TSet<FString>
|
auto GatherConnections = [&MakeConnKey](UEdGraph* G) -> TSet<FString>
|
||||||
@@ -182,39 +182,39 @@ public:
|
|||||||
|
|
||||||
if (bIdentical)
|
if (bIdentical)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Graph %s: identical (%d nodes)\n"), *GraphName, GA->Nodes.Num());
|
UWingServer::Printf(TEXT("Graph %s: identical (%d nodes)\n"), *GraphName, GA->Nodes.Num());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TotalDiffs++;
|
TotalDiffs++;
|
||||||
UMCPServer::Printf(TEXT("Graph %s: different (A=%d nodes, B=%d nodes)\n"), *GraphName, GA->Nodes.Num(), GB->Nodes.Num());
|
UWingServer::Printf(TEXT("Graph %s: different (A=%d nodes, B=%d nodes)\n"), *GraphName, GA->Nodes.Num(), GB->Nodes.Num());
|
||||||
|
|
||||||
if (!OnlyInA.IsEmpty())
|
if (!OnlyInA.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT(" Nodes only in A:\n"));
|
UWingServer::Print(TEXT(" Nodes only in A:\n"));
|
||||||
for (const FString& Line : OnlyInA) UMCPServer::Printf(TEXT(" %s\n"), *Line);
|
for (const FString& Line : OnlyInA) UWingServer::Printf(TEXT(" %s\n"), *Line);
|
||||||
}
|
}
|
||||||
if (!OnlyInB.IsEmpty())
|
if (!OnlyInB.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT(" Nodes only in B:\n"));
|
UWingServer::Print(TEXT(" Nodes only in B:\n"));
|
||||||
for (const FString& Line : OnlyInB) UMCPServer::Printf(TEXT(" %s\n"), *Line);
|
for (const FString& Line : OnlyInB) UWingServer::Printf(TEXT(" %s\n"), *Line);
|
||||||
}
|
}
|
||||||
if (!ConnsOnlyInA.IsEmpty())
|
if (!ConnsOnlyInA.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT(" Connections only in A:\n"));
|
UWingServer::Print(TEXT(" Connections only in A:\n"));
|
||||||
for (const FString& Line : ConnsOnlyInA) UMCPServer::Printf(TEXT(" %s\n"), *Line);
|
for (const FString& Line : ConnsOnlyInA) UWingServer::Printf(TEXT(" %s\n"), *Line);
|
||||||
}
|
}
|
||||||
if (!ConnsOnlyInB.IsEmpty())
|
if (!ConnsOnlyInB.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT(" Connections only in B:\n"));
|
UWingServer::Print(TEXT(" Connections only in B:\n"));
|
||||||
for (const FString& Line : ConnsOnlyInB) UMCPServer::Printf(TEXT(" %s\n"), *Line);
|
for (const FString& Line : ConnsOnlyInB) UWingServer::Printf(TEXT(" %s\n"), *Line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare variables
|
// Compare variables
|
||||||
TSet<FString> VarNamesA, VarNamesB;
|
TSet<FString> VarNamesA, VarNamesB;
|
||||||
for (const FBPVariableDescription& V : BPA->NewVariables) VarNamesA.Add(MCPUtils::FormatName(V));
|
for (const FBPVariableDescription& V : BPA->NewVariables) VarNamesA.Add(WingUtils::FormatName(V));
|
||||||
for (const FBPVariableDescription& V : BPB->NewVariables) VarNamesB.Add(MCPUtils::FormatName(V));
|
for (const FBPVariableDescription& V : BPB->NewVariables) VarNamesB.Add(WingUtils::FormatName(V));
|
||||||
|
|
||||||
TArray<FString> VarsOnlyInA, VarsOnlyInB;
|
TArray<FString> VarsOnlyInA, VarsOnlyInB;
|
||||||
for (const FString& Name : VarNamesA)
|
for (const FString& Name : VarNamesA)
|
||||||
@@ -226,17 +226,17 @@ public:
|
|||||||
|
|
||||||
if (!VarsOnlyInA.IsEmpty())
|
if (!VarsOnlyInA.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("Variables only in A:\n"));
|
UWingServer::Print(TEXT("Variables only in A:\n"));
|
||||||
for (const FString& Name : VarsOnlyInA) UMCPServer::Printf(TEXT(" %s\n"), *Name);
|
for (const FString& Name : VarsOnlyInA) UWingServer::Printf(TEXT(" %s\n"), *Name);
|
||||||
TotalDiffs += VarsOnlyInA.Num();
|
TotalDiffs += VarsOnlyInA.Num();
|
||||||
}
|
}
|
||||||
if (!VarsOnlyInB.IsEmpty())
|
if (!VarsOnlyInB.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("Variables only in B:\n"));
|
UWingServer::Print(TEXT("Variables only in B:\n"));
|
||||||
for (const FString& Name : VarsOnlyInB) UMCPServer::Printf(TEXT(" %s\n"), *Name);
|
for (const FString& Name : VarsOnlyInB) UWingServer::Printf(TEXT(" %s\n"), *Name);
|
||||||
TotalDiffs += VarsOnlyInB.Num();
|
TotalDiffs += VarsOnlyInB.Num();
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Total differences: %d\n"), TotalDiffs);
|
UWingServer::Printf(TEXT("Total differences: %d\n"), TotalDiffs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Animation/AnimBlueprint.h"
|
#include "Animation/AnimBlueprint.h"
|
||||||
#include "Animation/Skeleton.h"
|
#include "Animation/Skeleton.h"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_Dump : public UObject, public IMCPHandler
|
class UWing_Blueprint_Dump : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -35,44 +35,43 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
UMCPServer::Printf(TEXT("Blueprint: %s\n"), *MCPUtils::FormatName(BP));
|
UWingServer::Printf(TEXT("Blueprint: %s\n"), *WingUtils::FormatName(BP));
|
||||||
UMCPServer::Printf(TEXT("Parent: %s\n"), BP->ParentClass ? *MCPUtils::FormatName(BP->ParentClass) : TEXT("None"));
|
UWingServer::Printf(TEXT("Parent: %s\n"), BP->ParentClass ? *WingUtils::FormatName(BP->ParentClass) : TEXT("None"));
|
||||||
UMCPServer::Printf(TEXT("Type: %s\n"),
|
UWingServer::Printf(TEXT("Type: %s\n"), *WingUtils::EnumToString(BP->BlueprintType));
|
||||||
*MCPUtils::EnumToString(BP->BlueprintType));
|
|
||||||
|
|
||||||
// Animation Blueprint
|
// Animation Blueprint
|
||||||
if (UAnimBlueprint* AnimBP = Cast<UAnimBlueprint>(BP))
|
if (UAnimBlueprint* AnimBP = Cast<UAnimBlueprint>(BP))
|
||||||
{
|
{
|
||||||
if (AnimBP->TargetSkeleton)
|
if (AnimBP->TargetSkeleton)
|
||||||
UMCPServer::Printf(TEXT("TargetSkeleton: %s\n"), *AnimBP->TargetSkeleton->GetPathName());
|
UWingServer::Printf(TEXT("TargetSkeleton: %s\n"), *AnimBP->TargetSkeleton->GetPathName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interfaces
|
// Interfaces
|
||||||
for (const FBPInterfaceDescription& I : BP->ImplementedInterfaces)
|
for (const FBPInterfaceDescription& I : BP->ImplementedInterfaces)
|
||||||
{
|
{
|
||||||
if (I.Interface)
|
if (I.Interface)
|
||||||
UMCPServer::Printf(TEXT("Interface: %s\n"), *MCPUtils::FormatName(I.Interface));
|
UWingServer::Printf(TEXT("Interface: %s\n"), *WingUtils::FormatName(I.Interface));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
if (!BP->NewVariables.IsEmpty())
|
if (!BP->NewVariables.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("\nVariables:\n"));
|
UWingServer::Print(TEXT("\nVariables:\n"));
|
||||||
for (const FBPVariableDescription& V : BP->NewVariables)
|
for (const FBPVariableDescription& V : BP->NewVariables)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT(" %s %s"),
|
UWingServer::Printf(TEXT(" %s %s"),
|
||||||
*UMCPTypes::TypeToText(V.VarType),
|
*UWingTypes::TypeToText(V.VarType),
|
||||||
*MCPUtils::FormatName(V));
|
*WingUtils::FormatName(V));
|
||||||
if (!V.DefaultValue.IsEmpty())
|
if (!V.DefaultValue.IsEmpty())
|
||||||
UMCPServer::Printf(TEXT(" = %s"), *V.DefaultValue);
|
UWingServer::Printf(TEXT(" = %s"), *V.DefaultValue);
|
||||||
if (!V.Category.IsEmpty() && V.Category.ToString() != TEXT("Default"))
|
if (!V.Category.IsEmpty() && V.Category.ToString() != TEXT("Default"))
|
||||||
UMCPServer::Printf(TEXT(" [%s]"), *V.Category.ToString());
|
UWingServer::Printf(TEXT(" [%s]"), *V.Category.ToString());
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,27 +81,27 @@ public:
|
|||||||
const TArray<USCS_Node*>& AllNodes = SCS->GetAllNodes();
|
const TArray<USCS_Node*>& AllNodes = SCS->GetAllNodes();
|
||||||
if (!AllNodes.IsEmpty())
|
if (!AllNodes.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("\nComponents:\n"));
|
UWingServer::Print(TEXT("\nComponents:\n"));
|
||||||
for (USCS_Node* Node : AllNodes)
|
for (USCS_Node* Node : AllNodes)
|
||||||
{
|
{
|
||||||
if (!Node || !Node->ComponentTemplate) continue;
|
if (!Node || !Node->ComponentTemplate) continue;
|
||||||
UMCPServer::Printf(TEXT(" %s (%s)"),
|
UWingServer::Printf(TEXT(" %s (%s)"),
|
||||||
*MCPUtils::FormatName(Node->ComponentTemplate),
|
*WingUtils::FormatName(Node->ComponentTemplate),
|
||||||
*MCPUtils::FormatName(Node->ComponentClass));
|
*WingUtils::FormatName(Node->ComponentClass));
|
||||||
if (Node->ParentComponentOrVariableName != NAME_None)
|
if (Node->ParentComponentOrVariableName != NAME_None)
|
||||||
UMCPServer::Printf(TEXT(" parent=%s"), *Node->ParentComponentOrVariableName.ToString());
|
UWingServer::Printf(TEXT(" parent=%s"), *Node->ParentComponentOrVariableName.ToString());
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Graph names (without contents)
|
// Graph names (without contents)
|
||||||
TArray<UEdGraph*> Graphs = MCPUtils::AllGraphs(BP);
|
TArray<UEdGraph*> Graphs = WingUtils::AllGraphs(BP);
|
||||||
if (!Graphs.IsEmpty())
|
if (!Graphs.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("\nGraphs:\n"));
|
UWingServer::Print(TEXT("\nGraphs:\n"));
|
||||||
for (UEdGraph* Graph : Graphs)
|
for (UEdGraph* Graph : Graphs)
|
||||||
UMCPServer::Printf(TEXT(" %s\n"), *MCPUtils::FormatName(Graph));
|
UWingServer::Printf(TEXT(" %s\n"), *WingUtils::FormatName(Graph));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Engine/SimpleConstructionScript.h"
|
#include "Engine/SimpleConstructionScript.h"
|
||||||
#include "Engine/SCS_Node.h"
|
#include "Engine/SCS_Node.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_ListComponents : public UObject, public IMCPHandler
|
class UWing_Blueprint_ListComponents : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
F.Walk(Blueprint);
|
F.Walk(Blueprint);
|
||||||
if (!F.Ok()) return;
|
if (!F.Ok()) return;
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
USimpleConstructionScript* SCS = BP->SimpleConstructionScript;
|
USimpleConstructionScript* SCS = BP->SimpleConstructionScript;
|
||||||
if (!SCS)
|
if (!SCS)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Not an Actor Blueprint (no SimpleConstructionScript)\n"));
|
UWingServer::Print(TEXT("ERROR: Not an Actor Blueprint (no SimpleConstructionScript)\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,11 +51,11 @@ public:
|
|||||||
|
|
||||||
if (AllNodes.Num() == 0)
|
if (AllNodes.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("No components.\n"));
|
UWingServer::Print(TEXT("No components.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Print(TEXT("WARNING: This only lists components added in this blueprint's SCS. "
|
UWingServer::Print(TEXT("WARNING: This only lists components added in this blueprint's SCS. "
|
||||||
"It does not include inherited components from C++ parent classes "
|
"It does not include inherited components from C++ parent classes "
|
||||||
"(available via the CDO's OwnedComponents) or from parent blueprint SCS nodes.\n"));
|
"(available via the CDO's OwnedComponents) or from parent blueprint SCS nodes.\n"));
|
||||||
|
|
||||||
@@ -72,20 +72,20 @@ private:
|
|||||||
{
|
{
|
||||||
// Indent to show hierarchy
|
// Indent to show hierarchy
|
||||||
for (int32 i = 0; i < Depth; i++)
|
for (int32 i = 0; i < Depth; i++)
|
||||||
UMCPServer::Print(TEXT(" "));
|
UWingServer::Print(TEXT(" "));
|
||||||
|
|
||||||
FString ClassName = Node->ComponentClass
|
FString ClassName = Node->ComponentClass
|
||||||
? MCPUtils::FormatName(Node->ComponentClass)
|
? WingUtils::FormatName(Node->ComponentClass)
|
||||||
: TEXT("None");
|
: TEXT("None");
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("%s %s"),
|
UWingServer::Printf(TEXT("%s %s"),
|
||||||
*ClassName,
|
*ClassName,
|
||||||
*MCPUtils::FormatName(Node->ComponentTemplate));
|
*WingUtils::FormatName(Node->ComponentTemplate));
|
||||||
|
|
||||||
if (bIsSceneRoot && Depth == 0)
|
if (bIsSceneRoot && Depth == 0)
|
||||||
UMCPServer::Print(TEXT(" [SceneRoot]"));
|
UWingServer::Print(TEXT(" [SceneRoot]"));
|
||||||
|
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
|
|
||||||
for (USCS_Node* Child : Node->GetChildNodes())
|
for (USCS_Node* Child : Node->GetChildNodes())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphPin.h"
|
#include "EdGraph/EdGraphPin.h"
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_ListEventDispatchers : public UObject, public IMCPHandler
|
class UWing_Blueprint_ListEventDispatchers : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
@@ -44,33 +44,33 @@ public:
|
|||||||
|
|
||||||
for (const FName& DelegateName : DelegateNameSet)
|
for (const FName& DelegateName : DelegateNameSet)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("%s("), *DelegateName.ToString());
|
UWingServer::Printf(TEXT("%s("), *DelegateName.ToString());
|
||||||
|
|
||||||
UEdGraph* SigGraph = FBlueprintEditorUtils::GetDelegateSignatureGraphByName(BP, DelegateName);
|
UEdGraph* SigGraph = FBlueprintEditorUtils::GetDelegateSignatureGraphByName(BP, DelegateName);
|
||||||
if (SigGraph)
|
if (SigGraph)
|
||||||
{
|
{
|
||||||
bool bFirst = true;
|
bool bFirst = true;
|
||||||
for (UK2Node_FunctionEntry* FE : MCPUtils::AllNodes<UK2Node_FunctionEntry>(SigGraph))
|
for (UK2Node_FunctionEntry* FE : WingUtils::AllNodes<UK2Node_FunctionEntry>(SigGraph))
|
||||||
{
|
{
|
||||||
for (const TSharedPtr<FUserPinInfo>& PinInfo : FE->UserDefinedPins)
|
for (const TSharedPtr<FUserPinInfo>& PinInfo : FE->UserDefinedPins)
|
||||||
{
|
{
|
||||||
if (!PinInfo.IsValid()) continue;
|
if (!PinInfo.IsValid()) continue;
|
||||||
if (!bFirst) UMCPServer::Print(TEXT(", "));
|
if (!bFirst) UWingServer::Print(TEXT(", "));
|
||||||
bFirst = false;
|
bFirst = false;
|
||||||
UMCPServer::Printf(TEXT("%s %s"),
|
UWingServer::Printf(TEXT("%s %s"),
|
||||||
*UMCPTypes::TypeToText(PinInfo->PinType),
|
*UWingTypes::TypeToText(PinInfo->PinType),
|
||||||
*PinInfo->PinName.ToString());
|
*PinInfo->PinName.ToString());
|
||||||
}
|
}
|
||||||
break; // only need the first entry node
|
break; // only need the first entry node
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Print(TEXT(")\n"));
|
UWingServer::Print(TEXT(")\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DelegateNameSet.Num() == 0)
|
if (DelegateNameSet.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("No event dispatchers found.\n"));
|
UWingServer::Print(TEXT("No event dispatchers found.\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Blueprint_ListInterfaces.generated.h"
|
#include "Blueprint_ListInterfaces.generated.h"
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_ListInterfaces : public UObject, public IMCPHandler
|
class UWing_Blueprint_ListInterfaces : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
F.Walk(Blueprint);
|
F.Walk(Blueprint);
|
||||||
if (!F.Ok()) return;
|
if (!F.Ok()) return;
|
||||||
UBlueprint* BP = F.Cast<UBlueprint>();
|
UBlueprint* BP = F.Cast<UBlueprint>();
|
||||||
@@ -42,17 +42,17 @@ public:
|
|||||||
if (!IfaceDesc.Interface) continue;
|
if (!IfaceDesc.Interface) continue;
|
||||||
bAny = true;
|
bAny = true;
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Interface: %s\n"), *MCPUtils::FormatName(IfaceDesc.Interface));
|
UWingServer::Printf(TEXT("Interface: %s\n"), *WingUtils::FormatName(IfaceDesc.Interface));
|
||||||
for (const UEdGraph* Graph : IfaceDesc.Graphs)
|
for (const UEdGraph* Graph : IfaceDesc.Graphs)
|
||||||
{
|
{
|
||||||
if (!Graph) continue;
|
if (!Graph) continue;
|
||||||
UMCPServer::Printf(TEXT(" %s\n"), *MCPUtils::FormatName(Graph));
|
UWingServer::Printf(TEXT(" %s\n"), *WingUtils::FormatName(Graph));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bAny)
|
if (!bAny)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("No interfaces implemented.\n"));
|
UWingServer::Print(TEXT("No interfaces implemented.\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_RefreshAllNodes : public UObject, public IMCPHandler
|
class UWing_Blueprint_RefreshAllNodes : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -35,19 +35,19 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Load Blueprint
|
// Load Blueprint
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
int32 GraphCount = MCPUtils::AllGraphs(BP).Num();
|
int32 GraphCount = WingUtils::AllGraphs(BP).Num();
|
||||||
int32 NodeCount = MCPUtils::AllNodes(BP).Num();
|
int32 NodeCount = WingUtils::AllNodes(BP).Num();
|
||||||
|
|
||||||
// Refresh all nodes
|
// Refresh all nodes
|
||||||
FBlueprintEditorUtils::RefreshAllNodes(BP);
|
FBlueprintEditorUtils::RefreshAllNodes(BP);
|
||||||
|
|
||||||
// Remove orphaned pins from all nodes
|
// Remove orphaned pins from all nodes
|
||||||
int32 OrphanedPinsRemoved = 0;
|
int32 OrphanedPinsRemoved = 0;
|
||||||
for (UEdGraphNode* Node : MCPUtils::AllNodes(BP))
|
for (UEdGraphNode* Node : WingUtils::AllNodes(BP))
|
||||||
{
|
{
|
||||||
for (int32 i = Node->Pins.Num() - 1; i >= 0; --i)
|
for (int32 i = Node->Pins.Num() - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
@@ -62,26 +62,26 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Summary
|
// Summary
|
||||||
UMCPServer::Printf(TEXT("Refreshed %s: %d graphs, %d nodes"), *MCPUtils::FormatName(BP), GraphCount, NodeCount);
|
UWingServer::Printf(TEXT("Refreshed %s: %d graphs, %d nodes"), *WingUtils::FormatName(BP), GraphCount, NodeCount);
|
||||||
if (OrphanedPinsRemoved > 0)
|
if (OrphanedPinsRemoved > 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT(", %d orphaned pins removed"), OrphanedPinsRemoved);
|
UWingServer::Printf(TEXT(", %d orphaned pins removed"), OrphanedPinsRemoved);
|
||||||
}
|
}
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
|
|
||||||
// Collect compiler warnings and errors
|
// Collect compiler warnings and errors
|
||||||
if (BP->Status == BS_Error)
|
if (BP->Status == BS_Error)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Blueprint has compiler errors after refresh\n"));
|
UWingServer::Print(TEXT("ERROR: Blueprint has compiler errors after refresh\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (UEdGraphNode* Node : MCPUtils::AllNodes(BP))
|
for (UEdGraphNode* Node : WingUtils::AllNodes(BP))
|
||||||
{
|
{
|
||||||
if (!Node->bHasCompilerMessage) continue;
|
if (!Node->bHasCompilerMessage) continue;
|
||||||
const TCHAR* Prefix = (Node->ErrorType == EMessageSeverity::Error) ? TEXT("ERROR") : TEXT("WARNING");
|
const TCHAR* Prefix = (Node->ErrorType == EMessageSeverity::Error) ? TEXT("ERROR") : TEXT("WARNING");
|
||||||
UMCPServer::Printf(TEXT("%s: [%s] %s: %s\n"),
|
UWingServer::Printf(TEXT("%s: [%s] %s: %s\n"),
|
||||||
Prefix, *MCPUtils::FormatName(Node->GetGraph()),
|
Prefix, *WingUtils::FormatName(Node->GetGraph()),
|
||||||
*MCPUtils::FormatName(Node), *Node->ErrorMsg);
|
*WingUtils::FormatName(Node), *Node->ErrorMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Engine/SimpleConstructionScript.h"
|
#include "Engine/SimpleConstructionScript.h"
|
||||||
#include "Engine/SCS_Node.h"
|
#include "Engine/SCS_Node.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_RemoveComponent : public UObject, public IMCPHandler
|
class UWing_Blueprint_RemoveComponent : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -34,14 +34,14 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
USimpleConstructionScript* SCS = BP->SimpleConstructionScript;
|
USimpleConstructionScript* SCS = BP->SimpleConstructionScript;
|
||||||
if (!SCS)
|
if (!SCS)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Not an Actor Blueprint (no SimpleConstructionScript).\n"));
|
UWingServer::Print(TEXT("ERROR: Not an Actor Blueprint (no SimpleConstructionScript).\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
for (USCS_Node* Node : AllNodes)
|
for (USCS_Node* Node : AllNodes)
|
||||||
{
|
{
|
||||||
if (Node && Node->ComponentTemplate &&
|
if (Node && Node->ComponentTemplate &&
|
||||||
MCPUtils::Identifies(Component, Node->ComponentTemplate))
|
WingUtils::Identifies(Component, Node->ComponentTemplate))
|
||||||
{
|
{
|
||||||
NodeToRemove = Node;
|
NodeToRemove = Node;
|
||||||
break;
|
break;
|
||||||
@@ -60,12 +60,12 @@ public:
|
|||||||
|
|
||||||
if (!NodeToRemove)
|
if (!NodeToRemove)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Component '%s' not found.\nAvailable components:\n"),
|
UWingServer::Printf(TEXT("ERROR: Component '%s' not found.\nAvailable components:\n"),
|
||||||
*Component);
|
*Component);
|
||||||
for (USCS_Node* Node : AllNodes)
|
for (USCS_Node* Node : AllNodes)
|
||||||
{
|
{
|
||||||
if (Node && Node->ComponentTemplate)
|
if (Node && Node->ComponentTemplate)
|
||||||
UMCPServer::Printf(TEXT(" %s\n"), *MCPUtils::FormatName(Node->ComponentTemplate));
|
UWingServer::Printf(TEXT(" %s\n"), *WingUtils::FormatName(Node->ComponentTemplate));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -74,21 +74,21 @@ public:
|
|||||||
const TArray<USCS_Node*>& RootNodes = SCS->GetRootNodes();
|
const TArray<USCS_Node*>& RootNodes = SCS->GetRootNodes();
|
||||||
if (RootNodes.Contains(NodeToRemove) && NodeToRemove->GetChildNodes().Num() > 0)
|
if (RootNodes.Contains(NodeToRemove) && NodeToRemove->GetChildNodes().Num() > 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Cannot remove '%s' — it is a root component with %d child(ren). "
|
UWingServer::Printf(TEXT("ERROR: Cannot remove '%s' — it is a root component with %d child(ren). "
|
||||||
"Remove or re-parent the children first.\n"),
|
"Remove or re-parent the children first.\n"),
|
||||||
*MCPUtils::FormatName(NodeToRemove->ComponentTemplate),
|
*WingUtils::FormatName(NodeToRemove->ComponentTemplate),
|
||||||
NodeToRemove->GetChildNodes().Num());
|
NodeToRemove->GetChildNodes().Num());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString RemovedName = MCPUtils::FormatName(NodeToRemove->ComponentTemplate);
|
FString RemovedName = WingUtils::FormatName(NodeToRemove->ComponentTemplate);
|
||||||
|
|
||||||
// Remove the node (promotes children to parent if it has any — but we've guarded root above)
|
// Remove the node (promotes children to parent if it has any — but we've guarded root above)
|
||||||
SCS->RemoveNodeAndPromoteChildren(NodeToRemove);
|
SCS->RemoveNodeAndPromoteChildren(NodeToRemove);
|
||||||
|
|
||||||
bool bSaved = MCPUtils::SaveBlueprintPackage(BP);
|
bool bSaved = WingUtils::SaveBlueprintPackage(BP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Removed component %s.%s\n"),
|
UWingServer::Printf(TEXT("Removed component %s.%s\n"),
|
||||||
*RemovedName,
|
*RemovedName,
|
||||||
bSaved ? TEXT("") : TEXT(" WARNING: save failed."));
|
bSaved ? TEXT("") : TEXT(" WARNING: save failed."));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "MCPServer.h"
|
|
||||||
#include "MCPHandler.h"
|
|
||||||
#include "MCPFetcher.h"
|
|
||||||
#include "MCPUtils.h"
|
|
||||||
#include "K2Node_FunctionEntry.h"
|
|
||||||
#include "K2Node_CustomEvent.h"
|
|
||||||
#include "K2Node_EditablePinBase.h"
|
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
|
||||||
#include "Blueprint_RemoveFunctionParameter.generated.h"
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
UCLASS()
|
|
||||||
class UMCP_Blueprint_RemoveFunctionParameter : public UObject, public IMCPHandler
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
public:
|
|
||||||
UPROPERTY(meta=(Description="Blueprint package path"))
|
|
||||||
FString Blueprint;
|
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Name of the function or custom event"))
|
|
||||||
FString FunctionName;
|
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Name of the parameter to remove"))
|
|
||||||
FString ParamName;
|
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
|
||||||
{
|
|
||||||
return TEXT("Remove a parameter from a function or custom event in a Blueprint.");
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Handle() override
|
|
||||||
{
|
|
||||||
MCPFetcher F;
|
|
||||||
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
|
||||||
if (!BP) return;
|
|
||||||
|
|
||||||
// Find the entry node (function entry or custom event)
|
|
||||||
UK2Node_EditablePinBase* EntryNode = nullptr;
|
|
||||||
|
|
||||||
for (UK2Node_FunctionEntry* FuncEntry : MCPUtils::AllNodes<UK2Node_FunctionEntry>(BP))
|
|
||||||
{
|
|
||||||
if (MCPUtils::Identifies(FunctionName, FuncEntry->GetGraph()))
|
|
||||||
{
|
|
||||||
EntryNode = FuncEntry;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EntryNode)
|
|
||||||
{
|
|
||||||
for (UK2Node_CustomEvent* CustomEvent : MCPUtils::AllNodes<UK2Node_CustomEvent>(BP))
|
|
||||||
{
|
|
||||||
if (CustomEvent->CustomFunctionName.ToString().Equals(FunctionName, ESearchCase::IgnoreCase))
|
|
||||||
{
|
|
||||||
EntryNode = CustomEvent;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EntryNode)
|
|
||||||
{
|
|
||||||
UMCPServer::Printf(TEXT("Error: Function or event '%s' not found.\nAvailable:\n"), *FunctionName);
|
|
||||||
for (UK2Node_FunctionEntry* FE : MCPUtils::AllNodes<UK2Node_FunctionEntry>(BP))
|
|
||||||
UMCPServer::Printf(TEXT(" function: %s\n"), *MCPUtils::FormatName(FE->GetGraph()));
|
|
||||||
for (UK2Node_CustomEvent* CE : MCPUtils::AllNodes<UK2Node_CustomEvent>(BP))
|
|
||||||
UMCPServer::Printf(TEXT(" event: %s\n"), *MCPUtils::FormatName(CE));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the parameter to remove
|
|
||||||
int32 RemovedIndex = INDEX_NONE;
|
|
||||||
for (int32 i = 0; i < EntryNode->UserDefinedPins.Num(); ++i)
|
|
||||||
{
|
|
||||||
if (EntryNode->UserDefinedPins[i].IsValid() &&
|
|
||||||
EntryNode->UserDefinedPins[i]->PinName.ToString().Equals(ParamName, ESearchCase::IgnoreCase))
|
|
||||||
{
|
|
||||||
RemovedIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RemovedIndex == INDEX_NONE)
|
|
||||||
{
|
|
||||||
UMCPServer::Printf(TEXT("Error: Parameter '%s' not found on %s.\nAvailable:\n"),
|
|
||||||
*ParamName, *MCPUtils::FormatName(EntryNode));
|
|
||||||
for (const TSharedPtr<FUserPinInfo>& PinInfo : EntryNode->UserDefinedPins)
|
|
||||||
if (PinInfo.IsValid())
|
|
||||||
UMCPServer::Printf(TEXT(" %s\n"), *PinInfo->PinName.ToString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove the pin
|
|
||||||
EntryNode->UserDefinedPins.RemoveAt(RemovedIndex);
|
|
||||||
|
|
||||||
// Reconstruct the node to update output pins
|
|
||||||
if (UEdGraph* OwningGraph = EntryNode->GetGraph())
|
|
||||||
if (const UEdGraphSchema* Schema = OwningGraph->GetSchema())
|
|
||||||
Schema->ReconstructNode(*EntryNode);
|
|
||||||
|
|
||||||
bool bSaved = MCPUtils::SaveBlueprintPackage(BP);
|
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Removed parameter '%s' from %s.\n"), *ParamName, *MCPUtils::FormatName(EntryNode));
|
|
||||||
if (!bSaved)
|
|
||||||
UMCPServer::Print(TEXT("Warning: save failed.\n"));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
#include "Blueprint_RemoveInterface.generated.h"
|
#include "Blueprint_RemoveInterface.generated.h"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_RemoveInterface : public UObject, public IMCPHandler
|
class UWing_Blueprint_RemoveInterface : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
for (const FBPInterfaceDescription& IfaceDesc : BP->ImplementedInterfaces)
|
for (const FBPInterfaceDescription& IfaceDesc : BP->ImplementedInterfaces)
|
||||||
{
|
{
|
||||||
if (!IfaceDesc.Interface) continue;
|
if (!IfaceDesc.Interface) continue;
|
||||||
if (MCPUtils::Identifies(InterfaceName, IfaceDesc.Interface))
|
if (WingUtils::Identifies(InterfaceName, IfaceDesc.Interface))
|
||||||
{
|
{
|
||||||
FoundInterface = IfaceDesc.Interface;
|
FoundInterface = IfaceDesc.Interface;
|
||||||
break;
|
break;
|
||||||
@@ -55,11 +55,11 @@ public:
|
|||||||
|
|
||||||
if (!FoundInterface)
|
if (!FoundInterface)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Interface '%s' not found. Implemented interfaces:\n"), *InterfaceName);
|
UWingServer::Printf(TEXT("ERROR: Interface '%s' not found. Implemented interfaces:\n"), *InterfaceName);
|
||||||
for (const FBPInterfaceDescription& IfaceDesc : BP->ImplementedInterfaces)
|
for (const FBPInterfaceDescription& IfaceDesc : BP->ImplementedInterfaces)
|
||||||
{
|
{
|
||||||
if (IfaceDesc.Interface)
|
if (IfaceDesc.Interface)
|
||||||
UMCPServer::Printf(TEXT(" %s\n"), *MCPUtils::FormatName(IfaceDesc.Interface));
|
UWingServer::Printf(TEXT(" %s\n"), *WingUtils::FormatName(IfaceDesc.Interface));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -67,8 +67,8 @@ public:
|
|||||||
FTopLevelAssetPath InterfacePath = FoundInterface->GetClassPathName();
|
FTopLevelAssetPath InterfacePath = FoundInterface->GetClassPathName();
|
||||||
FBlueprintEditorUtils::RemoveInterface(BP, InterfacePath, PreserveFunctions);
|
FBlueprintEditorUtils::RemoveInterface(BP, InterfacePath, PreserveFunctions);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Removed interface %s\n"), *MCPUtils::FormatName(FoundInterface));
|
UWingServer::Printf(TEXT("Removed interface %s\n"), *WingUtils::FormatName(FoundInterface));
|
||||||
if (PreserveFunctions)
|
if (PreserveFunctions)
|
||||||
UMCPServer::Print(TEXT("Function graphs preserved as regular functions.\n"));
|
UWingServer::Print(TEXT("Function graphs preserved as regular functions.\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
#include "Kismet2/KismetEditorUtilities.h"
|
#include "Kismet2/KismetEditorUtilities.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_Reparent : public UObject, public IMCPHandler
|
class UWing_Blueprint_Reparent : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -35,18 +35,18 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Load Blueprint
|
// Load Blueprint
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Asset(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
FString OldParentName = BP->ParentClass ? MCPUtils::FormatName(BP->ParentClass) : TEXT("None");
|
FString OldParentName = BP->ParentClass ? WingUtils::FormatName(BP->ParentClass) : TEXT("None");
|
||||||
|
|
||||||
// Find the new parent class: try C++ classes first, then Blueprint package path
|
// Find the new parent class: try C++ classes first, then Blueprint package path
|
||||||
UClass* NewParentClassObj = MCPUtils::FindClassByName(NewParentClass);
|
UClass* NewParentClassObj = WingUtils::FindClassByName(NewParentClass);
|
||||||
|
|
||||||
if (!NewParentClassObj)
|
if (!NewParentClassObj)
|
||||||
{
|
{
|
||||||
MCPFetcher F2;
|
WingFetcher F2;
|
||||||
UBlueprint* ParentBP = F2.Asset(NewParentClass).Cast<UBlueprint>();
|
UBlueprint* ParentBP = F2.Asset(NewParentClass).Cast<UBlueprint>();
|
||||||
if (ParentBP && ParentBP->GeneratedClass)
|
if (ParentBP && ParentBP->GeneratedClass)
|
||||||
NewParentClassObj = ParentBP->GeneratedClass;
|
NewParentClassObj = ParentBP->GeneratedClass;
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
if (!NewParentClassObj)
|
if (!NewParentClassObj)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Could not find class '%s'. Provide a C++ class name or Blueprint package path.\n"),
|
UWingServer::Printf(TEXT("ERROR: Could not find class '%s'. Provide a C++ class name or Blueprint package path.\n"),
|
||||||
*NewParentClass);
|
*NewParentClass);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -63,11 +63,11 @@ public:
|
|||||||
BP->ParentClass = NewParentClassObj;
|
BP->ParentClass = NewParentClassObj;
|
||||||
FBlueprintEditorUtils::RefreshAllNodes(BP);
|
FBlueprintEditorUtils::RefreshAllNodes(BP);
|
||||||
FKismetEditorUtilities::CompileBlueprint(BP);
|
FKismetEditorUtilities::CompileBlueprint(BP);
|
||||||
bool bSaved = MCPUtils::SaveBlueprintPackage(BP);
|
bool bSaved = WingUtils::SaveBlueprintPackage(BP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Reparented %s: %s -> %s\n"),
|
UWingServer::Printf(TEXT("Reparented %s: %s -> %s\n"),
|
||||||
*MCPUtils::FormatName(BP), *OldParentName, *MCPUtils::FormatName(NewParentClassObj));
|
*WingUtils::FormatName(BP), *OldParentName, *WingUtils::FormatName(NewParentClassObj));
|
||||||
if (!bSaved)
|
if (!bSaved)
|
||||||
UMCPServer::Print(TEXT("Warning: save failed\n"));
|
UWingServer::Print(TEXT("Warning: save failed\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "UObject/UObjectIterator.h"
|
#include "UObject/UObjectIterator.h"
|
||||||
#include "Class_Search.generated.h"
|
#include "Class_Search.generated.h"
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Class_Search : public UObject, public IMCPHandler
|
class UWing_Class_Search : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
{
|
{
|
||||||
for (TObjectIterator<UClass> It; It; ++It)
|
for (TObjectIterator<UClass> It; It; ++It)
|
||||||
{
|
{
|
||||||
if (MCPUtils::Identifies(ParentClass, *It))
|
if (WingUtils::Identifies(ParentClass, *It))
|
||||||
{
|
{
|
||||||
ParentClassObj = *It;
|
ParentClassObj = *It;
|
||||||
break;
|
break;
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
}
|
}
|
||||||
if (!ParentClassObj)
|
if (!ParentClassObj)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Error: Parent class '%s' not found\n"), *ParentClass);
|
UWingServer::Printf(TEXT("Error: Parent class '%s' not found\n"), *ParentClass);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ public:
|
|||||||
if (Class->HasAnyClassFlags(CLASS_Deprecated | CLASS_NewerVersionExists)) continue;
|
if (Class->HasAnyClassFlags(CLASS_Deprecated | CLASS_NewerVersionExists)) continue;
|
||||||
if (ParentClassObj && !Class->IsChildOf(ParentClassObj)) continue;
|
if (ParentClassObj && !Class->IsChildOf(ParentClassObj)) continue;
|
||||||
|
|
||||||
FString ClassName = MCPUtils::FormatName(Class);
|
FString ClassName = WingUtils::FormatName(Class);
|
||||||
if (!Query.IsEmpty() && !ClassName.Contains(Query, ESearchCase::IgnoreCase)) continue;
|
if (!Query.IsEmpty() && !ClassName.Contains(Query, ESearchCase::IgnoreCase)) continue;
|
||||||
|
|
||||||
TotalMatched++;
|
TotalMatched++;
|
||||||
@@ -79,16 +79,16 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Found %d classes"), TotalMatched);
|
UWingServer::Printf(TEXT("Found %d classes"), TotalMatched);
|
||||||
if (TotalMatched > Limit)
|
if (TotalMatched > Limit)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT(" (showing %d)"), Limit);
|
UWingServer::Printf(TEXT(" (showing %d)"), Limit);
|
||||||
}
|
}
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
|
|
||||||
for (UClass* Class : Matches)
|
for (UClass* Class : Matches)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT(" %s"), *MCPUtils::FormatName(Class));
|
UWingServer::Printf(TEXT(" %s"), *WingUtils::FormatName(Class));
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
TStringBuilder<64> Flags;
|
TStringBuilder<64> Flags;
|
||||||
@@ -98,15 +98,15 @@ public:
|
|||||||
if (Class->ClassGeneratedBy) Flags.Append(TEXT(" Blueprint"));
|
if (Class->ClassGeneratedBy) Flags.Append(TEXT(" Blueprint"));
|
||||||
if (Flags.Len() > 0)
|
if (Flags.Len() > 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT(" [%s]"), Flags.ToString() + 1); // skip leading space
|
UWingServer::Printf(TEXT(" [%s]"), Flags.ToString() + 1); // skip leading space
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Class->GetSuperClass())
|
if (Class->GetSuperClass())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT(" : %s"), *MCPUtils::FormatName(Class->GetSuperClass()));
|
UWingServer::Printf(TEXT(" : %s"), *WingUtils::FormatName(Class->GetSuperClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Class_ShowProperties.generated.h"
|
#include "Class_ShowProperties.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Class_ShowProperties : public UObject, public IMCPHandler
|
class UWing_Class_ShowProperties : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -31,14 +31,14 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
UClass* FoundClass = MCPUtils::FindClassByName(ClassName);
|
UClass* FoundClass = WingUtils::FindClassByName(ClassName);
|
||||||
if (!FoundClass)
|
if (!FoundClass)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Class '%s' not found\n"), *ClassName);
|
UWingServer::Printf(TEXT("ERROR: Class '%s' not found\n"), *ClassName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Properties of %s:\n"), *MCPUtils::FormatName(FoundClass));
|
UWingServer::Printf(TEXT("Properties of %s:\n"), *WingUtils::FormatName(FoundClass));
|
||||||
|
|
||||||
int32 Count = 0;
|
int32 Count = 0;
|
||||||
for (TFieldIterator<FProperty> PropIt(FoundClass); PropIt; ++PropIt)
|
for (TFieldIterator<FProperty> PropIt(FoundClass); PropIt; ++PropIt)
|
||||||
@@ -63,18 +63,18 @@ public:
|
|||||||
if (Prop->HasAnyPropertyFlags(CPF_RepNotify)) Flags.Append(TEXT(" RepNotify"));
|
if (Prop->HasAnyPropertyFlags(CPF_RepNotify)) Flags.Append(TEXT(" RepNotify"));
|
||||||
|
|
||||||
UClass* OwnerClass = Prop->GetOwnerClass();
|
UClass* OwnerClass = Prop->GetOwnerClass();
|
||||||
UMCPServer::Printf(TEXT(" %s %s"), *UMCPTypes::TypeToText(Prop), *PropName);
|
UWingServer::Printf(TEXT(" %s %s"), *UWingTypes::TypeToText(Prop), *PropName);
|
||||||
if (OwnerClass && OwnerClass != FoundClass)
|
if (OwnerClass && OwnerClass != FoundClass)
|
||||||
UMCPServer::Printf(TEXT(" [%s]"), *MCPUtils::FormatName(OwnerClass));
|
UWingServer::Printf(TEXT(" [%s]"), *WingUtils::FormatName(OwnerClass));
|
||||||
if (Flags.Len() > 0)
|
if (Flags.Len() > 0)
|
||||||
UMCPServer::Printf(TEXT(" (%s)"), Flags.ToString() + 1); // skip leading space
|
UWingServer::Printf(TEXT(" (%s)"), Flags.ToString() + 1); // skip leading space
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
Count++;
|
Count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Count == 0)
|
if (Count == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("No properties found.\n"));
|
UWingServer::Print(TEXT("No properties found.\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/UserDefinedEnum.h"
|
#include "Engine/UserDefinedEnum.h"
|
||||||
#include "Kismet2/EnumEditorUtils.h"
|
#include "Kismet2/EnumEditorUtils.h"
|
||||||
#include "Factories/EnumFactory.h"
|
#include "Factories/EnumFactory.h"
|
||||||
#include "MCPPackageMaker.h"
|
#include "WingPackageMaker.h"
|
||||||
#include "Enum_Create.generated.h"
|
#include "Enum_Create.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Enum_Create : public UObject, public IMCPHandler
|
class UWing_Enum_Create : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
FString AssetPath;
|
FString AssetPath;
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Array of enum value names"))
|
UPROPERTY(meta=(Description="Array of enum value names"))
|
||||||
FMCPJsonArray Values;
|
FWingJsonArray Values;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPPackageMaker Maker(AssetPath);
|
WingPackageMaker Maker(AssetPath);
|
||||||
if (!Maker.Ok()) return;
|
if (!Maker.Ok()) return;
|
||||||
|
|
||||||
TArray<FString> EnumValues;
|
TArray<FString> EnumValues;
|
||||||
@@ -45,7 +45,7 @@ public:
|
|||||||
}
|
}
|
||||||
if (EnumValues.Num() == 0)
|
if (EnumValues.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Values must be a non-empty array of strings\n"));
|
UWingServer::Print(TEXT("ERROR: Values must be a non-empty array of strings\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,10 +62,10 @@ public:
|
|||||||
FEnumEditorUtils::SetEnumeratorDisplayName(NewEnum, NewIndex, FText::FromString(EnumValues[i]));
|
FEnumEditorUtils::SetEnumeratorDisplayName(NewEnum, NewIndex, FText::FromString(EnumValues[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bSaved = MCPUtils::SaveGenericPackage(NewEnum);
|
bool bSaved = WingUtils::SaveGenericPackage(NewEnum);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Created %s with %d values\n"), *NewEnum->GetPathName(), EnumValues.Num());
|
UWingServer::Printf(TEXT("Created %s with %d values\n"), *NewEnum->GetPathName(), EnumValues.Num());
|
||||||
if (!bSaved)
|
if (!bSaved)
|
||||||
UMCPServer::Print(TEXT("WARNING: Package save failed\n"));
|
UWingServer::Print(TEXT("WARNING: Package save failed\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Materials/MaterialFunction.h"
|
#include "Materials/MaterialFunction.h"
|
||||||
#include "Factories/MaterialFunctionFactoryNew.h"
|
#include "Factories/MaterialFunctionFactoryNew.h"
|
||||||
#include "MCPPackageMaker.h"
|
#include "WingPackageMaker.h"
|
||||||
#include "MaterialFunction_Create.generated.h"
|
#include "MaterialFunction_Create.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_MaterialFunction_Create : public UObject, public IMCPHandler
|
class UWing_MaterialFunction_Create : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPPackageMaker Maker(AssetPath);
|
WingPackageMaker Maker(AssetPath);
|
||||||
if (!Maker.Ok()) return;
|
if (!Maker.Ok()) return;
|
||||||
|
|
||||||
// Create via IAssetTools + factory.
|
// Create via IAssetTools + factory.
|
||||||
@@ -44,10 +44,10 @@ public:
|
|||||||
if (!Description.IsEmpty())
|
if (!Description.IsEmpty())
|
||||||
MF->Description = Description;
|
MF->Description = Description;
|
||||||
|
|
||||||
bool bSaved = MCPUtils::SaveGenericPackage(MF);
|
bool bSaved = WingUtils::SaveGenericPackage(MF);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Created %s\n"), *MF->GetPathName());
|
UWingServer::Printf(TEXT("Created %s\n"), *MF->GetPathName());
|
||||||
if (!bSaved)
|
if (!bSaved)
|
||||||
UMCPServer::Print(TEXT("WARNING: Package save failed\n"));
|
UWingServer::Print(TEXT("WARNING: Package save failed\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "Kismet2/KismetEditorUtilities.h"
|
#include "Kismet2/KismetEditorUtilities.h"
|
||||||
#include "Animation/AnimBlueprint.h"
|
#include "Animation/AnimBlueprint.h"
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_StateMachine_AddState : public UObject, public IMCPHandler
|
class UWing_StateMachine_AddState : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -52,22 +52,22 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Resolve the anim blueprint
|
// Resolve the anim blueprint
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UAnimBlueprint* AnimBP = F.Walk(Blueprint).Cast<UAnimBlueprint>();
|
UAnimBlueprint* AnimBP = F.Walk(Blueprint).Cast<UAnimBlueprint>();
|
||||||
if (!AnimBP) return;
|
if (!AnimBP) return;
|
||||||
|
|
||||||
// Find the state machine graph
|
// Find the state machine graph
|
||||||
UAnimationStateMachineGraph* SMGraph = MCPUtils::FindStateMachineGraph(AnimBP, Graph);
|
UAnimationStateMachineGraph* SMGraph = WingUtils::FindStateMachineGraph(AnimBP, Graph);
|
||||||
if (!SMGraph)
|
if (!SMGraph)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: State machine graph '%s' not found in %s\n"), *Graph, *MCPUtils::FormatName(AnimBP));
|
UWingServer::Printf(TEXT("ERROR: State machine graph '%s' not found in %s\n"), *Graph, *WingUtils::FormatName(AnimBP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for duplicate state name
|
// Check for duplicate state name
|
||||||
if (MCPUtils::FindStateByName(SMGraph, StateName))
|
if (WingUtils::FindStateByName(SMGraph, StateName))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: State '%s' already exists in %s\n"), *StateName, *MCPUtils::FormatName(SMGraph));
|
UWingServer::Printf(TEXT("ERROR: State '%s' already exists in %s\n"), *StateName, *WingUtils::FormatName(SMGraph));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
// Optionally set animation asset
|
// Optionally set animation asset
|
||||||
if (!AnimationAsset.IsEmpty() && NewState->GetBoundGraph())
|
if (!AnimationAsset.IsEmpty() && NewState->GetBoundGraph())
|
||||||
{
|
{
|
||||||
MCPFetcher F2;
|
WingFetcher F2;
|
||||||
UAnimSequence* AnimSeq = F2.Asset(AnimationAsset).Cast<UAnimSequence>();
|
UAnimSequence* AnimSeq = F2.Asset(AnimationAsset).Cast<UAnimSequence>();
|
||||||
if (!AnimSeq) return;
|
if (!AnimSeq) return;
|
||||||
|
|
||||||
@@ -109,9 +109,9 @@ public:
|
|||||||
|
|
||||||
// Compile and save
|
// Compile and save
|
||||||
FKismetEditorUtilities::CompileBlueprint(AnimBP);
|
FKismetEditorUtilities::CompileBlueprint(AnimBP);
|
||||||
MCPUtils::SaveBlueprintPackage(AnimBP);
|
WingUtils::SaveBlueprintPackage(AnimBP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Created state '%s' in %s\n"), *StateName, *MCPUtils::FormatName(SMGraph));
|
UWingServer::Printf(TEXT("Created state '%s' in %s\n"), *StateName, *WingUtils::FormatName(SMGraph));
|
||||||
UMCPServer::Printf(TEXT(" node: %s\n"), *MCPUtils::FormatName(NewState));
|
UWingServer::Printf(TEXT(" node: %s\n"), *WingUtils::FormatName(NewState));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Kismet2/KismetEditorUtilities.h"
|
#include "Kismet2/KismetEditorUtilities.h"
|
||||||
#include "Animation/AnimBlueprint.h"
|
#include "Animation/AnimBlueprint.h"
|
||||||
#include "AnimStateNode.h"
|
#include "AnimStateNode.h"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_StateMachine_AddTransition : public UObject, public IMCPHandler
|
class UWing_StateMachine_AddTransition : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -51,21 +51,21 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UAnimBlueprint* AnimBP = F.Asset(Blueprint).Cast<UAnimBlueprint>();
|
UAnimBlueprint* AnimBP = F.Asset(Blueprint).Cast<UAnimBlueprint>();
|
||||||
if (!AnimBP) return;
|
if (!AnimBP) return;
|
||||||
|
|
||||||
UAnimationStateMachineGraph* SMGraph = MCPUtils::FindStateMachineGraph(AnimBP, Graph);
|
UAnimationStateMachineGraph* SMGraph = WingUtils::FindStateMachineGraph(AnimBP, Graph);
|
||||||
if (!SMGraph)
|
if (!SMGraph)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: State machine graph '%s' not found in '%s'\n"), *Graph, *MCPUtils::FormatName(AnimBP));
|
UWingServer::Printf(TEXT("ERROR: State machine graph '%s' not found in '%s'\n"), *Graph, *WingUtils::FormatName(AnimBP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UAnimStateNode* FromStateNode = MCPUtils::FindStateByName(SMGraph, FromState);
|
UAnimStateNode* FromStateNode = WingUtils::FindStateByName(SMGraph, FromState);
|
||||||
if (!FromStateNode) return;
|
if (!FromStateNode) return;
|
||||||
|
|
||||||
UAnimStateNode* ToStateNode = MCPUtils::FindStateByName(SMGraph, ToState);
|
UAnimStateNode* ToStateNode = WingUtils::FindStateByName(SMGraph, ToState);
|
||||||
if (!ToStateNode) return;
|
if (!ToStateNode) return;
|
||||||
|
|
||||||
// Create transition node
|
// Create transition node
|
||||||
@@ -91,9 +91,9 @@ public:
|
|||||||
|
|
||||||
// Compile and save
|
// Compile and save
|
||||||
FKismetEditorUtilities::CompileBlueprint(AnimBP);
|
FKismetEditorUtilities::CompileBlueprint(AnimBP);
|
||||||
MCPUtils::SaveBlueprintPackage(AnimBP);
|
WingUtils::SaveBlueprintPackage(AnimBP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Created transition %s -> %s: %s\n"),
|
UWingServer::Printf(TEXT("Created transition %s -> %s: %s\n"),
|
||||||
*FromState, *ToState, *MCPUtils::FormatName(TransNode));
|
*FromState, *ToState, *WingUtils::FormatName(TransNode));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Kismet2/KismetEditorUtilities.h"
|
#include "Kismet2/KismetEditorUtilities.h"
|
||||||
#include "Animation/AnimBlueprint.h"
|
#include "Animation/AnimBlueprint.h"
|
||||||
#include "AnimStateNode.h"
|
#include "AnimStateNode.h"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_StateMachine_RemoveState : public UObject, public IMCPHandler
|
class UWing_StateMachine_RemoveState : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -36,8 +36,8 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Fetch the state machine graph via MCPFetcher
|
// Fetch the state machine graph via WingFetcher
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
F.Walk(Graph);
|
F.Walk(Graph);
|
||||||
if (!F.Ok()) return;
|
if (!F.Ok()) return;
|
||||||
|
|
||||||
@@ -48,12 +48,12 @@ public:
|
|||||||
UBlueprint* BP = Cast<UBlueprint>(SMGraph->GetOuter()->GetOuter());
|
UBlueprint* BP = Cast<UBlueprint>(SMGraph->GetOuter()->GetOuter());
|
||||||
if (!BP)
|
if (!BP)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Could not find owning blueprint.\n"));
|
UWingServer::Print(TEXT("ERROR: Could not find owning blueprint.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the state node
|
// Find the state node
|
||||||
UAnimStateNode* StateNode = MCPUtils::FindStateByName(SMGraph, StateName);
|
UAnimStateNode* StateNode = WingUtils::FindStateByName(SMGraph, StateName);
|
||||||
if (!StateNode) return;
|
if (!StateNode) return;
|
||||||
|
|
||||||
// Collect and remove transitions connected to this state
|
// Collect and remove transitions connected to this state
|
||||||
@@ -74,9 +74,9 @@ public:
|
|||||||
|
|
||||||
// Compile and save
|
// Compile and save
|
||||||
FKismetEditorUtilities::CompileBlueprint(BP);
|
FKismetEditorUtilities::CompileBlueprint(BP);
|
||||||
MCPUtils::SaveBlueprintPackage(BP);
|
WingUtils::SaveBlueprintPackage(BP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Removed state %s and %d transition(s).\n"),
|
UWingServer::Printf(TEXT("Removed state %s and %d transition(s).\n"),
|
||||||
*MCPUtils::FormatName(StateNode), RemovedTransitions);
|
*WingUtils::FormatName(StateNode), RemovedTransitions);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
#include "Kismet2/KismetEditorUtilities.h"
|
#include "Kismet2/KismetEditorUtilities.h"
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_StateMachine_SetAnimation : public UObject, public IMCPHandler
|
class UWing_StateMachine_SetAnimation : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -46,31 +46,31 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Resolve the anim blueprint
|
// Resolve the anim blueprint
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UAnimBlueprint* AnimBP = F.Walk(Blueprint).Cast<UAnimBlueprint>();
|
UAnimBlueprint* AnimBP = F.Walk(Blueprint).Cast<UAnimBlueprint>();
|
||||||
if (!AnimBP) return;
|
if (!AnimBP) return;
|
||||||
|
|
||||||
// Find the state machine graph
|
// Find the state machine graph
|
||||||
UAnimationStateMachineGraph* SMGraph = MCPUtils::FindStateMachineGraph(AnimBP, Graph);
|
UAnimationStateMachineGraph* SMGraph = WingUtils::FindStateMachineGraph(AnimBP, Graph);
|
||||||
if (!SMGraph)
|
if (!SMGraph)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: State machine graph '%s' not found in %s\n"), *Graph, *MCPUtils::FormatName(AnimBP));
|
UWingServer::Printf(TEXT("ERROR: State machine graph '%s' not found in %s\n"), *Graph, *WingUtils::FormatName(AnimBP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the target state
|
// Find the target state
|
||||||
UAnimStateNode* StateNode = MCPUtils::FindStateByName(SMGraph, StateName);
|
UAnimStateNode* StateNode = WingUtils::FindStateByName(SMGraph, StateName);
|
||||||
if (!StateNode) return;
|
if (!StateNode) return;
|
||||||
|
|
||||||
UEdGraph* InnerGraph = StateNode->GetBoundGraph();
|
UEdGraph* InnerGraph = StateNode->GetBoundGraph();
|
||||||
if (!InnerGraph)
|
if (!InnerGraph)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: State '%s' has no bound graph\n"), *StateName);
|
UWingServer::Printf(TEXT("ERROR: State '%s' has no bound graph\n"), *StateName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the animation asset
|
// Find the animation asset
|
||||||
MCPFetcher F2;
|
WingFetcher F2;
|
||||||
UAnimSequence* AnimSeq = F2.Asset(AnimationAsset).Cast<UAnimSequence>();
|
UAnimSequence* AnimSeq = F2.Asset(AnimationAsset).Cast<UAnimSequence>();
|
||||||
if (!AnimSeq) return;
|
if (!AnimSeq) return;
|
||||||
|
|
||||||
@@ -99,11 +99,11 @@ public:
|
|||||||
|
|
||||||
// Compile and save
|
// Compile and save
|
||||||
FKismetEditorUtilities::CompileBlueprint(AnimBP);
|
FKismetEditorUtilities::CompileBlueprint(AnimBP);
|
||||||
MCPUtils::SaveBlueprintPackage(AnimBP);
|
WingUtils::SaveBlueprintPackage(AnimBP);
|
||||||
|
|
||||||
if (bCreatedNew)
|
if (bCreatedNew)
|
||||||
UMCPServer::Printf(TEXT("Created sequence player in state '%s', assigned %s\n"), *StateName, *MCPUtils::FormatName(AnimSeq));
|
UWingServer::Printf(TEXT("Created sequence player in state '%s', assigned %s\n"), *StateName, *WingUtils::FormatName(AnimSeq));
|
||||||
else
|
else
|
||||||
UMCPServer::Printf(TEXT("Updated sequence player in state '%s' to %s\n"), *StateName, *MCPUtils::FormatName(AnimSeq));
|
UWingServer::Printf(TEXT("Updated sequence player in state '%s' to %s\n"), *StateName, *WingUtils::FormatName(AnimSeq));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
#include "EdGraph/EdGraphPin.h"
|
#include "EdGraph/EdGraphPin.h"
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_StateMachine_SetBlendSpace : public UObject, public IMCPHandler
|
class UWing_StateMachine_SetBlendSpace : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -56,22 +56,22 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Load the anim blueprint
|
// Load the anim blueprint
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UAnimBlueprint* AnimBP = F.Asset(Blueprint).Cast<UAnimBlueprint>();
|
UAnimBlueprint* AnimBP = F.Asset(Blueprint).Cast<UAnimBlueprint>();
|
||||||
if (!AnimBP) return;
|
if (!AnimBP) return;
|
||||||
|
|
||||||
// Find the state machine graph and state
|
// Find the state machine graph and state
|
||||||
UAnimationStateMachineGraph* SMGraph = MCPUtils::FindStateMachineGraph(AnimBP, Graph);
|
UAnimationStateMachineGraph* SMGraph = WingUtils::FindStateMachineGraph(AnimBP, Graph);
|
||||||
if (!SMGraph) { UMCPServer::Printf(TEXT("ERROR: State machine graph '%s' not found\n"), *Graph); return; }
|
if (!SMGraph) { UWingServer::Printf(TEXT("ERROR: State machine graph '%s' not found\n"), *Graph); return; }
|
||||||
|
|
||||||
UAnimStateNode* StateNode = MCPUtils::FindStateByName(SMGraph, StateName);
|
UAnimStateNode* StateNode = WingUtils::FindStateByName(SMGraph, StateName);
|
||||||
if (!StateNode) return;
|
if (!StateNode) return;
|
||||||
|
|
||||||
UEdGraph* InnerGraph = StateNode->GetBoundGraph();
|
UEdGraph* InnerGraph = StateNode->GetBoundGraph();
|
||||||
if (!InnerGraph) { UMCPServer::Printf(TEXT("ERROR: State '%s' has no bound graph\n"), *StateName); return; }
|
if (!InnerGraph) { UWingServer::Printf(TEXT("ERROR: State '%s' has no bound graph\n"), *StateName); return; }
|
||||||
|
|
||||||
// Load the blend space asset
|
// Load the blend space asset
|
||||||
MCPFetcher F2;
|
WingFetcher F2;
|
||||||
UBlendSpace* BlendSpaceAsset = F2.Asset(BlendSpace).Cast<UBlendSpace>();
|
UBlendSpace* BlendSpaceAsset = F2.Asset(BlendSpace).Cast<UBlendSpace>();
|
||||||
if (!BlendSpaceAsset) return;
|
if (!BlendSpaceAsset) return;
|
||||||
|
|
||||||
@@ -105,12 +105,12 @@ public:
|
|||||||
|
|
||||||
// Compile and save
|
// Compile and save
|
||||||
FKismetEditorUtilities::CompileBlueprint(AnimBP);
|
FKismetEditorUtilities::CompileBlueprint(AnimBP);
|
||||||
bool bSaved = MCPUtils::SaveBlueprintPackage(AnimBP);
|
bool bSaved = WingUtils::SaveBlueprintPackage(AnimBP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("BlendSpacePlayer %s placed in state %s\n"),
|
UWingServer::Printf(TEXT("BlendSpacePlayer %s placed in state %s\n"),
|
||||||
*MCPUtils::FormatName(BSNode), *StateName);
|
*WingUtils::FormatName(BSNode), *StateName);
|
||||||
if (!bSaved)
|
if (!bSaved)
|
||||||
UMCPServer::Print(TEXT("WARNING: Failed to save package\n"));
|
UWingServer::Print(TEXT("WARNING: Failed to save package\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -185,7 +185,7 @@ private:
|
|||||||
}
|
}
|
||||||
if (!bVarFound)
|
if (!bVarFound)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("WARNING: Variable '%s' not found, skipping %s wire\n"), *VarName, PinName);
|
UWingServer::Printf(TEXT("WARNING: Variable '%s' not found, skipping %s wire\n"), *VarName, PinName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Kismet2/KismetEditorUtilities.h"
|
#include "Kismet2/KismetEditorUtilities.h"
|
||||||
#include "Animation/AnimBlueprint.h"
|
#include "Animation/AnimBlueprint.h"
|
||||||
#include "AnimStateTransitionNode.h"
|
#include "AnimStateTransitionNode.h"
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_StateMachine_SetTransitionRule : public UObject, public IMCPHandler
|
class UWing_StateMachine_SetTransitionRule : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -56,21 +56,21 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UAnimBlueprint* AnimBP = F.Asset(Blueprint).Cast<UAnimBlueprint>();
|
UAnimBlueprint* AnimBP = F.Asset(Blueprint).Cast<UAnimBlueprint>();
|
||||||
if (!AnimBP) return;
|
if (!AnimBP) return;
|
||||||
|
|
||||||
UAnimationStateMachineGraph* SMGraph = MCPUtils::FindStateMachineGraph(AnimBP, Graph);
|
UAnimationStateMachineGraph* SMGraph = WingUtils::FindStateMachineGraph(AnimBP, Graph);
|
||||||
if (!SMGraph)
|
if (!SMGraph)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: State machine graph '%s' not found in '%s'\n"), *Graph, *MCPUtils::FormatName(AnimBP));
|
UWingServer::Printf(TEXT("ERROR: State machine graph '%s' not found in '%s'\n"), *Graph, *WingUtils::FormatName(AnimBP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UAnimStateTransitionNode* TransNode = MCPUtils::FindTransition(SMGraph, FromState, ToState);
|
UAnimStateTransitionNode* TransNode = WingUtils::FindTransition(SMGraph, FromState, ToState);
|
||||||
if (!TransNode)
|
if (!TransNode)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Transition from '%s' to '%s' not found in graph '%s'\n"),
|
UWingServer::Printf(TEXT("ERROR: Transition from '%s' to '%s' not found in graph '%s'\n"),
|
||||||
*FromState, *ToState, *Graph);
|
*FromState, *ToState, *Graph);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -84,9 +84,9 @@ public:
|
|||||||
|
|
||||||
// Compile and save
|
// Compile and save
|
||||||
FKismetEditorUtilities::CompileBlueprint(AnimBP);
|
FKismetEditorUtilities::CompileBlueprint(AnimBP);
|
||||||
MCPUtils::SaveBlueprintPackage(AnimBP);
|
WingUtils::SaveBlueprintPackage(AnimBP);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Updated transition %s -> %s: %s\n"),
|
UWingServer::Printf(TEXT("Updated transition %s -> %s: %s\n"),
|
||||||
*FromState, *ToState, *MCPUtils::FormatName(TransNode));
|
*FromState, *ToState, *WingUtils::FormatName(TransNode));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "StructUtils/UserDefinedStruct.h"
|
#include "StructUtils/UserDefinedStruct.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
#include "UserDefinedStructure/UserDefinedStructEditorData.h"
|
#include "UserDefinedStructure/UserDefinedStructEditorData.h"
|
||||||
#include "Factories/StructureFactory.h"
|
#include "Factories/StructureFactory.h"
|
||||||
#include "MCPPackageMaker.h"
|
#include "WingPackageMaker.h"
|
||||||
#include "Struct_Create.generated.h"
|
#include "Struct_Create.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ struct FStructPropertyEntry
|
|||||||
};
|
};
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Struct_Create : public UObject, public IMCPHandler
|
class UWing_Struct_Create : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
FString AssetPath;
|
FString AssetPath;
|
||||||
|
|
||||||
UPROPERTY(meta=(Optional, Description="Array of initial properties, each with 'name' and 'type' fields"))
|
UPROPERTY(meta=(Optional, Description="Array of initial properties, each with 'name' and 'type' fields"))
|
||||||
FMCPJsonArray Properties;
|
FWingJsonArray Properties;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPPackageMaker Maker(AssetPath);
|
WingPackageMaker Maker(AssetPath);
|
||||||
if (!Maker.Ok()) return;
|
if (!Maker.Ok()) return;
|
||||||
|
|
||||||
// Create the struct using the AssetTools factory.
|
// Create the struct using the AssetTools factory.
|
||||||
@@ -61,11 +61,11 @@ public:
|
|||||||
for (const TSharedPtr<FJsonValue>& PropVal : Properties.Array)
|
for (const TSharedPtr<FJsonValue>& PropVal : Properties.Array)
|
||||||
{
|
{
|
||||||
FStructPropertyEntry Entry;
|
FStructPropertyEntry Entry;
|
||||||
if (!MCPJson::PopulateFromJson(FStructPropertyEntry::StaticStruct(), &Entry, PropVal)) return;
|
if (!WingJson::PopulateFromJson(FStructPropertyEntry::StaticStruct(), &Entry, PropVal)) return;
|
||||||
if (Entry.Name.IsEmpty() || Entry.Type.IsEmpty()) continue;
|
if (Entry.Name.IsEmpty() || Entry.Type.IsEmpty()) continue;
|
||||||
|
|
||||||
FEdGraphPinType PinType;
|
FEdGraphPinType PinType;
|
||||||
if (!UMCPTypes::TextToType(Entry.Type, PinType))
|
if (!UWingTypes::TextToType(Entry.Type, PinType))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Snapshot existing GUIDs so we can find the newly added one.
|
// Snapshot existing GUIDs so we can find the newly added one.
|
||||||
@@ -88,12 +88,12 @@ public:
|
|||||||
PropsAdded++;
|
PropsAdded++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bSaved = MCPUtils::SaveGenericPackage(NewStruct);
|
bool bSaved = WingUtils::SaveGenericPackage(NewStruct);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Created %s\n"), *NewStruct->GetPathName());
|
UWingServer::Printf(TEXT("Created %s\n"), *NewStruct->GetPathName());
|
||||||
if (PropsAdded > 0)
|
if (PropsAdded > 0)
|
||||||
UMCPServer::Printf(TEXT("Properties added: %d\n"), PropsAdded);
|
UWingServer::Printf(TEXT("Properties added: %d\n"), PropsAdded);
|
||||||
if (!bSaved)
|
if (!bSaved)
|
||||||
UMCPServer::Print(TEXT("WARNING: Package save failed\n"));
|
UWingServer::Print(TEXT("WARNING: Package save failed\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Misc/Paths.h"
|
#include "Misc/Paths.h"
|
||||||
#include "Misc/PackageName.h"
|
#include "Misc/PackageName.h"
|
||||||
#include "HAL/FileManager.h"
|
#include "HAL/FileManager.h"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Asset_Backup : public UObject, public IMCPHandler
|
class UWing_Asset_Backup : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
|
|
||||||
if (!IFileManager::Get().FileExists(*Filename))
|
if (!IFileManager::Get().FileExists(*Filename))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Asset file not found: %s\n"), *Filename);
|
UWingServer::Printf(TEXT("ERROR: Asset file not found: %s\n"), *Filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,10 +43,10 @@ public:
|
|||||||
uint32 CopyResult = IFileManager::Get().Copy(*BackupFilename, *Filename, true);
|
uint32 CopyResult = IFileManager::Get().Copy(*BackupFilename, *Filename, true);
|
||||||
if (CopyResult != COPY_OK)
|
if (CopyResult != COPY_OK)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Failed to copy %s to %s\n"), *Filename, *BackupFilename);
|
UWingServer::Printf(TEXT("ERROR: Failed to copy %s to %s\n"), *Filename, *BackupFilename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Backed up to %s\n"), *BackupFilename);
|
UWingServer::Printf(TEXT("Backed up to %s\n"), *BackupFilename);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Misc/PackageName.h"
|
#include "Misc/PackageName.h"
|
||||||
#include "AssetRegistry/AssetRegistryModule.h"
|
#include "AssetRegistry/AssetRegistryModule.h"
|
||||||
#include "AssetRegistry/IAssetRegistry.h"
|
#include "AssetRegistry/IAssetRegistry.h"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Asset_Delete : public UObject, public IMCPHandler
|
class UWing_Asset_Delete : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
|
|
||||||
if (!IFileManager::Get().FileExists(*PackageFilename))
|
if (!IFileManager::Get().FileExists(*PackageFilename))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Asset file not found on disk: %s\n"), *PackageFilename);
|
UWingServer::Printf(TEXT("ERROR: Asset file not found on disk: %s\n"), *PackageFilename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,22 +60,22 @@ public:
|
|||||||
|
|
||||||
if (Referencers.Num() > 0 && !Force)
|
if (Referencers.Num() > 0 && !Force)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Asset is still referenced by %d package(s):\n"), Referencers.Num());
|
UWingServer::Printf(TEXT("ERROR: Asset is still referenced by %d package(s):\n"), Referencers.Num());
|
||||||
for (const FName& Ref : Referencers)
|
for (const FName& Ref : Referencers)
|
||||||
{
|
{
|
||||||
FString RefStr = Ref.ToString();
|
FString RefStr = Ref.ToString();
|
||||||
UPackage* RefPackage = FindPackage(nullptr, *RefStr);
|
UPackage* RefPackage = FindPackage(nullptr, *RefStr);
|
||||||
UMCPServer::Printf(TEXT(" %s%s\n"), *RefStr,
|
UWingServer::Printf(TEXT(" %s%s\n"), *RefStr,
|
||||||
RefPackage ? TEXT(" (loaded)") : TEXT(" (on-disk only)"));
|
RefPackage ? TEXT(" (loaded)") : TEXT(" (on-disk only)"));
|
||||||
}
|
}
|
||||||
UMCPServer::Print(TEXT("Use force=true to skip the reference check.\n"));
|
UWingServer::Print(TEXT("Use force=true to skip the reference check.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force delete: unload the package from memory first
|
// Force delete: unload the package from memory first
|
||||||
if (Force && Referencers.Num() > 0)
|
if (Force && Referencers.Num() > 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("WARNING: Force-deleting despite %d referencer(s).\n"), Referencers.Num());
|
UWingServer::Printf(TEXT("WARNING: Force-deleting despite %d referencer(s).\n"), Referencers.Num());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark the package, and all the objects in it, as NOT
|
// Mark the package, and all the objects in it, as NOT
|
||||||
@@ -109,7 +109,7 @@ public:
|
|||||||
|
|
||||||
if (!bDeleted)
|
if (!bDeleted)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Failed to delete file from disk: %s\n"), *PackageFilename);
|
UWingServer::Printf(TEXT("ERROR: Failed to delete file from disk: %s\n"), *PackageFilename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,6 +122,6 @@ public:
|
|||||||
Registry.ScanPathsSynchronous({PackageDir}, true);
|
Registry.ScanPathsSynchronous({PackageDir}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Deleted %s\n"), *Asset);
|
UWingServer::Printf(TEXT("Deleted %s\n"), *Asset);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "AssetRegistry/AssetData.h"
|
#include "AssetRegistry/AssetData.h"
|
||||||
#include "AssetRegistry/IAssetRegistry.h"
|
#include "AssetRegistry/IAssetRegistry.h"
|
||||||
#include "Asset_FindReferences.generated.h"
|
#include "Asset_FindReferences.generated.h"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Asset_FindReferences : public UObject, public IMCPHandler
|
class UWing_Asset_FindReferences : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
FAssetData AssetData = Registry.GetAssetByObjectPath(FSoftObjectPath(Asset));
|
FAssetData AssetData = Registry.GetAssetByObjectPath(FSoftObjectPath(Asset));
|
||||||
if (!AssetData.IsValid())
|
if (!AssetData.IsValid())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Asset not found: %s\n"), *Asset);
|
UWingServer::Printf(TEXT("ERROR: Asset not found: %s\n"), *Asset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
|
|
||||||
if (Referencers.Num() == 0)
|
if (Referencers.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("No referencers found.\n"));
|
UWingServer::Print(TEXT("No referencers found.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,13 +56,13 @@ public:
|
|||||||
Registry.GetAssetsByPackageName(Ref, RefAssets);
|
Registry.GetAssetsByPackageName(Ref, RefAssets);
|
||||||
if (RefAssets.Num() > 0)
|
if (RefAssets.Num() > 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("%s %s\n"),
|
UWingServer::Printf(TEXT("%s %s\n"),
|
||||||
*MCPUtils::FormatName(RefAssets[0].GetClass()),
|
*WingUtils::FormatName(RefAssets[0].GetClass()),
|
||||||
*RefStr);
|
*RefStr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Unknown %s\n"), *RefStr);
|
UWingServer::Printf(TEXT("Unknown %s\n"), *RefStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "AssetToolsModule.h"
|
#include "AssetToolsModule.h"
|
||||||
#include "IAssetTools.h"
|
#include "IAssetTools.h"
|
||||||
#include "Asset_Rename.generated.h"
|
#include "Asset_Rename.generated.h"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Asset_Rename : public UObject, public IMCPHandler
|
class UWing_Asset_Rename : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Load the asset
|
// Load the asset
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UObject* AssetObj = F.Asset(Asset).GetObj();
|
UObject* AssetObj = F.Asset(Asset).GetObj();
|
||||||
if (!AssetObj) return;
|
if (!AssetObj) return;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
NewAssetName = NewPath;
|
NewAssetName = NewPath;
|
||||||
if (NewPackagePath.IsEmpty())
|
if (NewPackagePath.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Cannot determine directory from Asset '%s'\n"), *Asset);
|
UWingServer::Printf(TEXT("ERROR: Cannot determine directory from Asset '%s'\n"), *Asset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,10 +62,10 @@ public:
|
|||||||
|
|
||||||
if (!AssetTools.RenameAssets(RenameData))
|
if (!AssetTools.RenameAssets(RenameData))
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Rename failed. The target path may be invalid or a conflicting asset may exist.\n"));
|
UWingServer::Print(TEXT("ERROR: Rename failed. The target path may be invalid or a conflicting asset may exist.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Renamed to %s/%s\n"), *NewPackagePath, *NewAssetName);
|
UWingServer::Printf(TEXT("Renamed to %s/%s\n"), *NewPackagePath, *NewAssetName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Misc/PackageName.h"
|
#include "Misc/PackageName.h"
|
||||||
#include "FileHelpers.h"
|
#include "FileHelpers.h"
|
||||||
#include "HAL/FileManager.h"
|
#include "HAL/FileManager.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Asset_Restore : public UObject, public IMCPHandler
|
class UWing_Asset_Restore : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
|
|
||||||
if (!IFileManager::Get().FileExists(*BackupFilename))
|
if (!IFileManager::Get().FileExists(*BackupFilename))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Backup file not found: %s\n"), *BackupFilename);
|
UWingServer::Printf(TEXT("ERROR: Backup file not found: %s\n"), *BackupFilename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
uint32 CopyResult = IFileManager::Get().Copy(*Filename, *BackupFilename, true);
|
uint32 CopyResult = IFileManager::Get().Copy(*Filename, *BackupFilename, true);
|
||||||
if (CopyResult != COPY_OK)
|
if (CopyResult != COPY_OK)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Failed to copy backup over %s\n"), *Asset);
|
UWingServer::Printf(TEXT("ERROR: Failed to copy backup over %s\n"), *Asset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,12 +64,12 @@ public:
|
|||||||
UEditorLoadingAndSavingUtils::ReloadPackages({Package}, bReloaded, ErrorMessage, EReloadPackagesInteractionMode::AssumePositive);
|
UEditorLoadingAndSavingUtils::ReloadPackages({Package}, bReloaded, ErrorMessage, EReloadPackagesInteractionMode::AssumePositive);
|
||||||
if (!bReloaded)
|
if (!bReloaded)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("WARNING: Restored %s but reload failed: %s\n"),
|
UWingServer::Printf(TEXT("WARNING: Restored %s but reload failed: %s\n"),
|
||||||
*Asset, *ErrorMessage.ToString());
|
*Asset, *ErrorMessage.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Restored %s from backup\n"), *Asset);
|
UWingServer::Printf(TEXT("Restored %s from backup\n"), *Asset);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "AssetRegistry/AssetRegistryModule.h"
|
#include "AssetRegistry/AssetRegistryModule.h"
|
||||||
#include "AssetRegistry/IAssetRegistry.h"
|
#include "AssetRegistry/IAssetRegistry.h"
|
||||||
#include "Asset_Search.generated.h"
|
#include "Asset_Search.generated.h"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Asset_Search : public UObject, public IMCPHandler
|
class UWing_Asset_Search : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (Query.IsEmpty() && Type.IsEmpty())
|
if (Query.IsEmpty() && Type.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: At least one of Query or Type must be specified\n"));
|
UWingServer::Print(TEXT("ERROR: At least one of Query or Type must be specified\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,10 +49,10 @@ public:
|
|||||||
|
|
||||||
if (!Type.IsEmpty())
|
if (!Type.IsEmpty())
|
||||||
{
|
{
|
||||||
UClass* TypeClass = MCPUtils::FindClassByName(Type);
|
UClass* TypeClass = WingUtils::FindClassByName(Type);
|
||||||
if (!TypeClass)
|
if (!TypeClass)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Unknown asset type '%s'\n"), *Type);
|
UWingServer::Printf(TEXT("ERROR: Unknown asset type '%s'\n"), *Type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Filter.ClassPaths.Add(TypeClass->GetClassPathName());
|
Filter.ClassPaths.Add(TypeClass->GetClassPathName());
|
||||||
@@ -79,18 +79,18 @@ public:
|
|||||||
|
|
||||||
for (const FAssetData& Data : Results)
|
for (const FAssetData& Data : Results)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("%s %s\n"),
|
UWingServer::Printf(TEXT("%s %s\n"),
|
||||||
*MCPUtils::FormatName(Data.GetClass()),
|
*WingUtils::FormatName(Data.GetClass()),
|
||||||
*Data.PackageName.ToString());
|
*Data.PackageName.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Results.Num() == 0)
|
if (Results.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("No assets found.\n"));
|
UWingServer::Print(TEXT("No assets found.\n"));
|
||||||
}
|
}
|
||||||
else if (Results.Num() >= Limit)
|
else if (Results.Num() >= Limit)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("WARNING: You reached the limit of %d, to raise it, specify the Limit parameter.\n"), Limit);
|
UWingServer::Printf(TEXT("WARNING: You reached the limit of %d, to raise it, specify the Limit parameter.\n"), Limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPProperty.h"
|
#include "WingProperty.h"
|
||||||
#include "BPVarEditor.h"
|
#include "BPVarEditor.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraphSchema_K2.h"
|
#include "EdGraphSchema_K2.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_BlueprintVariable_Create : public UObject, public IMCPHandler
|
class UWing_BlueprintVariable_Create : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
FString Name;
|
FString Name;
|
||||||
|
|
||||||
UPROPERTY(meta=(Optional, Description="Variable configuration: VarType, Category, DefaultValue, InstanceEditable, BlueprintReadOnly, ExposeOnSpawn, Private, ExposeToCinematics, etc."))
|
UPROPERTY(meta=(Optional, Description="Variable configuration: VarType, Category, DefaultValue, InstanceEditable, BlueprintReadOnly, ExposeOnSpawn, Private, ExposeToCinematics, etc."))
|
||||||
FMCPJsonObject Config;
|
FWingJsonObject Config;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
FName VarFName(*Name);
|
FName VarFName(*Name);
|
||||||
if (FBlueprintEditorUtils::FindNewVariableIndex(BP, VarFName) != INDEX_NONE)
|
if (FBlueprintEditorUtils::FindNewVariableIndex(BP, VarFName) != INDEX_NONE)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Variable '%s' already exists in %s\n"), *Name, *MCPUtils::FormatName(BP));
|
UWingServer::Printf(TEXT("ERROR: Variable '%s' already exists in %s\n"), *Name, *WingUtils::FormatName(BP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
DefaultType.PinCategory = UEdGraphSchema_K2::PC_Int;
|
DefaultType.PinCategory = UEdGraphSchema_K2::PC_Int;
|
||||||
if (!FBlueprintEditorUtils::AddMemberVariable(BP, VarFName, DefaultType))
|
if (!FBlueprintEditorUtils::AddMemberVariable(BP, VarFName, DefaultType))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Failed to add variable '%s' to %s\n"), *Name, *MCPUtils::FormatName(BP));
|
UWingServer::Printf(TEXT("ERROR: Failed to add variable '%s' to %s\n"), *Name, *WingUtils::FormatName(BP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Created variable %s (%s) in %s\n"),
|
UWingServer::Printf(TEXT("Created variable %s (%s) in %s\n"),
|
||||||
*Name, *UMCPTypes::TypeToText(Editor.Desc->VarType), *MCPUtils::FormatName(BP));
|
*Name, *UWingTypes::TypeToText(Editor.Desc->VarType), *WingUtils::FormatName(BP));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "BPVarEditor.h"
|
#include "BPVarEditor.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_BlueprintVariable_Delete : public UObject, public IMCPHandler
|
class UWing_BlueprintVariable_Delete : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
|
|
||||||
FBlueprintEditorUtils::RemoveMemberVariable(BP, Editor.Desc->VarName);
|
FBlueprintEditorUtils::RemoveMemberVariable(BP, Editor.Desc->VarName);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Removed variable %s from %s\n"),
|
UWingServer::Printf(TEXT("Removed variable %s from %s\n"),
|
||||||
*Variable, *MCPUtils::FormatName(BP));
|
*Variable, *WingUtils::FormatName(BP));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "BPVarEditor.h"
|
#include "BPVarEditor.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_BlueprintVariable_Dump : public UObject, public IMCPHandler
|
class UWing_BlueprintVariable_Dump : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -34,14 +34,14 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
FBPVarEditor Editor(BP, Variable);
|
FBPVarEditor Editor(BP, Variable);
|
||||||
if (Editor.NotFound()) return;
|
if (Editor.NotFound()) return;
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Variable %s in %s:\n"), *Variable, *MCPUtils::FormatName(BP));
|
UWingServer::Printf(TEXT("Variable %s in %s:\n"), *Variable, *WingUtils::FormatName(BP));
|
||||||
Editor.Dump();
|
Editor.Dump();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPProperty.h"
|
#include "WingProperty.h"
|
||||||
#include "BPVarEditor.h"
|
#include "BPVarEditor.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
#include "BlueprintVariable_Modify.generated.h"
|
#include "BlueprintVariable_Modify.generated.h"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_BlueprintVariable_Modify : public UObject, public IMCPHandler
|
class UWing_BlueprintVariable_Modify : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
FString Variable;
|
FString Variable;
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Properties to change: VarType, Category, DefaultValue, InstanceEditable, BlueprintReadOnly, ExposeOnSpawn, Private, ExposeToCinematics, etc."))
|
UPROPERTY(meta=(Description="Properties to change: VarType, Category, DefaultValue, InstanceEditable, BlueprintReadOnly, ExposeOnSpawn, Private, ExposeToCinematics, etc."))
|
||||||
FMCPJsonObject Properties;
|
FWingJsonObject Properties;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
@@ -49,14 +49,14 @@ public:
|
|||||||
|
|
||||||
if (!Properties.Json || Properties.Json->Values.Num() == 0)
|
if (!Properties.Json || Properties.Json->Values.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: No properties specified\n"));
|
UWingServer::Print(TEXT("ERROR: No properties specified\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Editor.ApplyJson(Properties.Json.Get()))
|
if (!Editor.ApplyJson(Properties.Json.Get()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Modified variable %s (%s) in %s\n"),
|
UWingServer::Printf(TEXT("Modified variable %s (%s) in %s\n"),
|
||||||
*Variable, *UMCPTypes::TypeToText(Editor.Desc->VarType), *MCPUtils::FormatName(BP));
|
*Variable, *UWingTypes::TypeToText(Editor.Desc->VarType), *WingUtils::FormatName(BP));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPPackageMaker.h"
|
#include "WingPackageMaker.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||||
#include "Kismet2/KismetEditorUtilities.h"
|
#include "Kismet2/KismetEditorUtilities.h"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Blueprint_Create : public UObject, public IMCPHandler
|
class UWing_Blueprint_Create : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPPackageMaker Maker(AssetPath);
|
WingPackageMaker Maker(AssetPath);
|
||||||
if (!Maker.Ok()) return;
|
if (!Maker.Ok()) return;
|
||||||
|
|
||||||
// Resolve parent class based on blueprint type
|
// Resolve parent class based on blueprint type
|
||||||
@@ -47,11 +47,11 @@ public:
|
|||||||
switch (BlueprintType)
|
switch (BlueprintType)
|
||||||
{
|
{
|
||||||
case BPTYPE_Normal:
|
case BPTYPE_Normal:
|
||||||
ParentClassObj = UMCPTypes::TextToOneObjectType(ParentClass);
|
ParentClassObj = UWingTypes::TextToOneObjectType(ParentClass);
|
||||||
if (!ParentClassObj) return;
|
if (!ParentClassObj) return;
|
||||||
break;
|
break;
|
||||||
case BPTYPE_MacroLibrary:
|
case BPTYPE_MacroLibrary:
|
||||||
ParentClassObj = UMCPTypes::TextToOneObjectType(ParentClass);
|
ParentClassObj = UWingTypes::TextToOneObjectType(ParentClass);
|
||||||
if (!ParentClassObj) return;
|
if (!ParentClassObj) return;
|
||||||
break;
|
break;
|
||||||
case BPTYPE_Interface:
|
case BPTYPE_Interface:
|
||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
ParentClassObj = UBlueprintFunctionLibrary::StaticClass();
|
ParentClassObj = UBlueprintFunctionLibrary::StaticClass();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UMCPServer::Print(TEXT("ERROR: BlueprintType must be Normal, Interface, FunctionLibrary, or MacroLibrary\n"));
|
UWingServer::Print(TEXT("ERROR: BlueprintType must be Normal, Interface, FunctionLibrary, or MacroLibrary\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,16 +79,16 @@ public:
|
|||||||
|
|
||||||
if (!NewBP)
|
if (!NewBP)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: FKismetEditorUtilities::CreateBlueprint returned null\n"));
|
UWingServer::Print(TEXT("ERROR: FKismetEditorUtilities::CreateBlueprint returned null\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile and save
|
// Compile and save
|
||||||
FKismetEditorUtilities::CompileBlueprint(NewBP);
|
FKismetEditorUtilities::CompileBlueprint(NewBP);
|
||||||
bool bSaved = MCPUtils::SaveBlueprintPackage(NewBP);
|
bool bSaved = WingUtils::SaveBlueprintPackage(NewBP);
|
||||||
|
|
||||||
// Report result
|
// Report result
|
||||||
UMCPServer::Printf(TEXT("Created: %s\n"), *MCPUtils::FormatName(NewBP));
|
UWingServer::Printf(TEXT("Created: %s\n"), *WingUtils::FormatName(NewBP));
|
||||||
if (!bSaved) UMCPServer::Print(TEXT("Warning: save failed\n"));
|
if (!bSaved) UWingServer::Print(TEXT("Warning: save failed\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "Editor.h"
|
#include "Editor.h"
|
||||||
#include "Subsystems/AssetEditorSubsystem.h"
|
#include "Subsystems/AssetEditorSubsystem.h"
|
||||||
#include "Editor_ListOpenAssets.generated.h"
|
#include "Editor_ListOpenAssets.generated.h"
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Editor_ListOpenAssets : public UObject, public IMCPHandler
|
class UWing_Editor_ListOpenAssets : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -28,14 +28,14 @@ public:
|
|||||||
UAssetEditorSubsystem* Sub = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
|
UAssetEditorSubsystem* Sub = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
|
||||||
if (!Sub)
|
if (!Sub)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("Error: AssetEditorSubsystem not available\n"));
|
UWingServer::Print(TEXT("Error: AssetEditorSubsystem not available\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<UObject*> EditedAssets = Sub->GetAllEditedAssets();
|
TArray<UObject*> EditedAssets = Sub->GetAllEditedAssets();
|
||||||
if (EditedAssets.IsEmpty())
|
if (EditedAssets.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("No asset editors are open.\n"));
|
UWingServer::Print(TEXT("No asset editors are open.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
{
|
{
|
||||||
bool bDirty = Asset->GetOutermost()->IsDirty();
|
bool bDirty = Asset->GetOutermost()->IsDirty();
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT(" %s%s\n"),
|
UWingServer::Printf(TEXT(" %s%s\n"),
|
||||||
bDirty ? TEXT("[unsaved] ") : TEXT(""),
|
bDirty ? TEXT("[unsaved] ") : TEXT(""),
|
||||||
*Asset->GetPathName());
|
*Asset->GetPathName());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "Editor.h"
|
#include "Editor.h"
|
||||||
#include "Subsystems/AssetEditorSubsystem.h"
|
#include "Subsystems/AssetEditorSubsystem.h"
|
||||||
#include "Editor_OpenAsset.generated.h"
|
#include "Editor_OpenAsset.generated.h"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Editor_OpenAsset : public UObject, public IMCPHandler
|
class UWing_Editor_OpenAsset : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -29,20 +29,20 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UObject* Obj = F.Walk(Asset).Cast<UObject>();
|
UObject* Obj = F.Walk(Asset).Cast<UObject>();
|
||||||
if (!Obj) return;
|
if (!Obj) return;
|
||||||
|
|
||||||
UAssetEditorSubsystem* Sub = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
|
UAssetEditorSubsystem* Sub = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
|
||||||
if (!Sub)
|
if (!Sub)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("Error: AssetEditorSubsystem not available\n"));
|
UWingServer::Print(TEXT("Error: AssetEditorSubsystem not available\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Sub->OpenEditorForAsset(Obj))
|
if (Sub->OpenEditorForAsset(Obj))
|
||||||
UMCPServer::Printf(TEXT("Opened editor for %s\n"), *Obj->GetPathName());
|
UWingServer::Printf(TEXT("Opened editor for %s\n"), *Obj->GetPathName());
|
||||||
else
|
else
|
||||||
UMCPServer::Printf(TEXT("Error: Could not open editor for %s\n"), *Obj->GetPathName());
|
UWingServer::Printf(TEXT("Error: Could not open editor for %s\n"), *Obj->GetPathName());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPToolMenu.h"
|
#include "WingToolMenu.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "ToolMenus.h"
|
#include "ToolMenus.h"
|
||||||
#include "GraphNode_ChooseMenu.generated.h"
|
#include "GraphNode_ChooseMenu.generated.h"
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_ChooseMenu : public UObject, public IMCPHandler
|
class UWing_GraphNode_ChooseMenu : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -35,29 +35,29 @@ public:
|
|||||||
private:
|
private:
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraphNode* NodeObj = F.Walk(Node).Cast<UEdGraphNode>();
|
UEdGraphNode* NodeObj = F.Walk(Node).Cast<UEdGraphNode>();
|
||||||
if (!NodeObj) return;
|
if (!NodeObj) return;
|
||||||
|
|
||||||
FToolMenuContext Context;
|
FToolMenuContext Context;
|
||||||
TArray<FToolMenuEntry> Entries = MCPToolMenu::GetMenuItems(NodeObj, Context);
|
TArray<FToolMenuEntry> Entries = WingToolMenu::GetMenuItems(NodeObj, Context);
|
||||||
for (FToolMenuEntry &Entry : Entries)
|
for (FToolMenuEntry &Entry : Entries)
|
||||||
{
|
{
|
||||||
FString LabelText = Entry.Label.Get().ToString();
|
FString LabelText = Entry.Label.Get().ToString();
|
||||||
if (!LabelText.Equals(Item, ESearchCase::IgnoreCase))
|
if (!LabelText.Equals(Item, ESearchCase::IgnoreCase))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (MCPToolMenu::Execute(Entry, Context))
|
if (WingToolMenu::Execute(Entry, Context))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Executed: %s\n"), *LabelText);
|
UWingServer::Printf(TEXT("Executed: %s\n"), *LabelText);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Action '%s' cannot execute (greyed out)\n"), *LabelText);
|
UWingServer::Printf(TEXT("ERROR: Action '%s' cannot execute (greyed out)\n"), *LabelText);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("ERROR: Menu item '%s' not found. Use GraphNode_ShowMenu to see available items.\n"), *Item);
|
UWingServer::Printf(TEXT("ERROR: Menu item '%s' not found. Use GraphNode_ShowMenu to see available items.\n"), *Item);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
#include "EdGraph/EdGraphSchema.h"
|
#include "EdGraph/EdGraphSchema.h"
|
||||||
@@ -33,7 +33,7 @@ struct FSpawnNodeEntry
|
|||||||
|
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_Create : public UObject, public IMCPHandler
|
class UWing_GraphNode_Create : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
FString Graph;
|
FString Graph;
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Array of {Type, posX, posY} objects. Use GraphNode_SearchTypes to find types."))
|
UPROPERTY(meta=(Description="Array of {Type, posX, posY} objects. Use GraphNode_SearchTypes to find types."))
|
||||||
FMCPJsonArray Nodes;
|
FWingJsonArray Nodes;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraph* TargetGraph = F.Walk(Graph).Cast<UEdGraph>();
|
UEdGraph* TargetGraph = F.Walk(Graph).Cast<UEdGraph>();
|
||||||
if (!TargetGraph) return;
|
if (!TargetGraph) return;
|
||||||
|
|
||||||
@@ -62,20 +62,20 @@ public:
|
|||||||
for (const TSharedPtr<FJsonValue>& NodeVal : Nodes.Array)
|
for (const TSharedPtr<FJsonValue>& NodeVal : Nodes.Array)
|
||||||
{
|
{
|
||||||
FSpawnNodeEntry Entry;
|
FSpawnNodeEntry Entry;
|
||||||
if (!MCPJson::PopulateFromJson(FSpawnNodeEntry::StaticStruct(), &Entry, NodeVal))
|
if (!WingJson::PopulateFromJson(FSpawnNodeEntry::StaticStruct(), &Entry, NodeVal))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Find the action by exact full name
|
// Find the action by exact full name
|
||||||
TArray<TSharedPtr<FEdGraphSchemaAction>> Matches = MCPUtils::SearchGraphActions(TargetGraph, Entry.ActionName, 0, /*ExactMatch=*/true);
|
TArray<TSharedPtr<FEdGraphSchemaAction>> Matches = WingUtils::SearchGraphActions(TargetGraph, Entry.ActionName, 0, /*ExactMatch=*/true);
|
||||||
if (Matches.Num() == 0)
|
if (Matches.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: No action found matching '%s'. Use GraphNodeSearchTypes to find available actions.\n"),
|
UWingServer::Printf(TEXT("ERROR: No action found matching '%s'. Use GraphNodeSearchTypes to find available actions.\n"),
|
||||||
*Entry.ActionName);
|
*Entry.ActionName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Matches.Num() > 1)
|
if (Matches.Num() > 1)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Ambiguous: %d actions match '%s'.\n"),
|
UWingServer::Printf(TEXT("ERROR: Ambiguous: %d actions match '%s'.\n"),
|
||||||
Matches.Num(), *Entry.ActionName);
|
Matches.Num(), *Entry.ActionName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -85,18 +85,18 @@ public:
|
|||||||
UEdGraphNode* NewNode = Matches[0]->PerformAction(TargetGraph, nullptr, Location, /*bSelectNewNode=*/false);
|
UEdGraphNode* NewNode = Matches[0]->PerformAction(TargetGraph, nullptr, Location, /*bSelectNewNode=*/false);
|
||||||
if (!NewNode)
|
if (!NewNode)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: PerformAction returned null for '%s'.\n"), *Entry.ActionName);
|
UWingServer::Printf(TEXT("ERROR: PerformAction returned null for '%s'.\n"), *Entry.ActionName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NewNode->NodeGuid.IsValid())
|
if (!NewNode->NodeGuid.IsValid())
|
||||||
NewNode->CreateNewGuid();
|
NewNode->CreateNewGuid();
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Spawned: %s (%s)\n"),
|
UWingServer::Printf(TEXT("Spawned: %s (%s)\n"),
|
||||||
*MCPUtils::FormatName(NewNode), *MCPUtils::FormatName(NewNode->GetClass()));
|
*WingUtils::FormatName(NewNode), *WingUtils::FormatName(NewNode->GetClass()));
|
||||||
SuccessCount++;
|
SuccessCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Spawned %d/%d nodes.\n"), SuccessCount, TotalCount);
|
UWingServer::Printf(TEXT("Spawned %d/%d nodes.\n"), SuccessCount, TotalCount);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
#include "MaterialGraph/MaterialGraphNode.h"
|
#include "MaterialGraph/MaterialGraphNode.h"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_Delete : public UObject, public IMCPHandler
|
class UWing_GraphNode_Delete : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -34,17 +34,17 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraphNode* FoundNode = F.Walk(Node).Cast<UEdGraphNode>();
|
UEdGraphNode* FoundNode = F.Walk(Node).Cast<UEdGraphNode>();
|
||||||
if (!FoundNode) return;
|
if (!FoundNode) return;
|
||||||
|
|
||||||
UEdGraph* Graph = FoundNode->GetGraph();
|
UEdGraph* Graph = FoundNode->GetGraph();
|
||||||
FString NodeTitle = MCPUtils::FormatName(FoundNode);
|
FString NodeTitle = WingUtils::FormatName(FoundNode);
|
||||||
FString GraphName = MCPUtils::FormatName(Graph);
|
FString GraphName = WingUtils::FormatName(Graph);
|
||||||
|
|
||||||
if (!FoundNode->CanUserDeleteNode())
|
if (!FoundNode->CanUserDeleteNode())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Cannot delete node '%s' in graph '%s' — it is not deletable.\n"),
|
UWingServer::Printf(TEXT("ERROR: Cannot delete node '%s' in graph '%s' — it is not deletable.\n"),
|
||||||
*NodeTitle, *GraphName);
|
*NodeTitle, *GraphName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -63,6 +63,6 @@ public:
|
|||||||
Graph->RemoveNode(FoundNode);
|
Graph->RemoveNode(FoundNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Deleted node '%s' from graph '%s'.\n"), *NodeTitle, *GraphName);
|
UWingServer::Printf(TEXT("Deleted node '%s' from graph '%s'.\n"), *NodeTitle, *GraphName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "GraphExport.h"
|
#include "GraphExport.h"
|
||||||
#include "GraphNode_Dump.generated.h"
|
#include "GraphNode_Dump.generated.h"
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_Dump : public UObject, public IMCPHandler
|
class UWing_GraphNode_Dump : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -29,12 +29,12 @@ public:
|
|||||||
private:
|
private:
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraphNode* NodeObj = F.Walk(Node).Cast<UEdGraphNode>();
|
UEdGraphNode* NodeObj = F.Walk(Node).Cast<UEdGraphNode>();
|
||||||
if (!NodeObj) return;
|
if (!NodeObj) return;
|
||||||
|
|
||||||
MCPGraphExport Exporter(NodeObj);
|
WingGraphExport Exporter(NodeObj);
|
||||||
UMCPServer::Print(*Exporter.GetOutput());
|
UWingServer::Print(*Exporter.GetOutput());
|
||||||
UMCPServer::Print(Exporter.GetDetails());
|
UWingServer::Print(Exporter.GetDetails());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
#include "EdGraph/EdGraphPin.h"
|
#include "EdGraph/EdGraphPin.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_Duplicate : public UObject, public IMCPHandler
|
class UWing_GraphNode_Duplicate : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
FString Graph;
|
FString Graph;
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Array of node names to duplicate (as returned by FormatName)"))
|
UPROPERTY(meta=(Description="Array of node names to duplicate (as returned by FormatName)"))
|
||||||
FMCPJsonArray Nodes;
|
FWingJsonArray Nodes;
|
||||||
|
|
||||||
UPROPERTY(meta=(Optional, Description="X offset for duplicated nodes"))
|
UPROPERTY(meta=(Optional, Description="X offset for duplicated nodes"))
|
||||||
int32 OffsetX = 50;
|
int32 OffsetX = 50;
|
||||||
@@ -42,13 +42,13 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraph* TargetGraph = F.Walk(Graph).Cast<UEdGraph>();
|
UEdGraph* TargetGraph = F.Walk(Graph).Cast<UEdGraph>();
|
||||||
if (!TargetGraph) return;
|
if (!TargetGraph) return;
|
||||||
|
|
||||||
if (Nodes.Array.Num() == 0)
|
if (Nodes.Array.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Nodes array is empty\n"));
|
UWingServer::Print(TEXT("ERROR: Nodes array is empty\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
UEdGraphNode* Found = nullptr;
|
UEdGraphNode* Found = nullptr;
|
||||||
for (UEdGraphNode* Node : TargetGraph->Nodes)
|
for (UEdGraphNode* Node : TargetGraph->Nodes)
|
||||||
{
|
{
|
||||||
if (MCPUtils::Identifies(Name, Node))
|
if (WingUtils::Identifies(Name, Node))
|
||||||
{
|
{
|
||||||
Found = Node;
|
Found = Node;
|
||||||
break;
|
break;
|
||||||
@@ -68,7 +68,7 @@ public:
|
|||||||
}
|
}
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Node '%s' not found in graph\n"), *Name);
|
UWingServer::Printf(TEXT("ERROR: Node '%s' not found in graph\n"), *Name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
SourceNodes.Add(Found);
|
SourceNodes.Add(Found);
|
||||||
@@ -82,7 +82,7 @@ public:
|
|||||||
UEdGraphNode* NewNode = DuplicateObject<UEdGraphNode>(SourceNode, TargetGraph);
|
UEdGraphNode* NewNode = DuplicateObject<UEdGraphNode>(SourceNode, TargetGraph);
|
||||||
if (!NewNode)
|
if (!NewNode)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Failed to duplicate %s\n"), *MCPUtils::FormatName(SourceNode));
|
UWingServer::Printf(TEXT("ERROR: Failed to duplicate %s\n"), *WingUtils::FormatName(SourceNode));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
TargetGraph->AddNode(NewNode, false, false);
|
TargetGraph->AddNode(NewNode, false, false);
|
||||||
UMCPServer::Printf(TEXT("Duplicated: %s -> %s\n"), *MCPUtils::FormatName(SourceNode), *MCPUtils::FormatName(NewNode));
|
UWingServer::Printf(TEXT("Duplicated: %s -> %s\n"), *WingUtils::FormatName(SourceNode), *WingUtils::FormatName(NewNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
#include "GraphNode_GetComment.generated.h"
|
#include "GraphNode_GetComment.generated.h"
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_GetComment : public UObject, public IMCPHandler
|
class UWing_GraphNode_GetComment : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -29,12 +29,12 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraphNode* FoundNode = F.Walk(Node).Cast<UEdGraphNode>();
|
UEdGraphNode* FoundNode = F.Walk(Node).Cast<UEdGraphNode>();
|
||||||
if (!FoundNode) return;
|
if (!FoundNode) return;
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Node: %s\n"), *MCPUtils::FormatName(FoundNode));
|
UWingServer::Printf(TEXT("Node: %s\n"), *WingUtils::FormatName(FoundNode));
|
||||||
UMCPServer::Printf(TEXT("Comment: %s\n"), *FoundNode->NodeComment);
|
UWingServer::Printf(TEXT("Comment: %s\n"), *FoundNode->NodeComment);
|
||||||
UMCPServer::Printf(TEXT("BubbleVisible: %s\n"), FoundNode->bCommentBubbleVisible ? TEXT("true") : TEXT("false"));
|
UWingServer::Printf(TEXT("BubbleVisible: %s\n"), FoundNode->bCommentBubbleVisible ? TEXT("true") : TEXT("false"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphSchema.h"
|
#include "EdGraph/EdGraphSchema.h"
|
||||||
#include "GraphNode_SearchTypes.generated.h"
|
#include "GraphNode_SearchTypes.generated.h"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_SearchTypes : public UObject, public IMCPHandler
|
class UWing_GraphNode_SearchTypes : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -40,24 +40,24 @@ public:
|
|||||||
{
|
{
|
||||||
int32 ClampedMax = FMath::Clamp(MaxResults, 1, 500);
|
int32 ClampedMax = FMath::Clamp(MaxResults, 1, 500);
|
||||||
|
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraph* TargetGraph = F.Walk(Graph).Cast<UEdGraph>();
|
UEdGraph* TargetGraph = F.Walk(Graph).Cast<UEdGraph>();
|
||||||
if (!TargetGraph) return;
|
if (!TargetGraph) return;
|
||||||
|
|
||||||
TArray<TSharedPtr<FEdGraphSchemaAction>> Actions = MCPUtils::SearchGraphActions(TargetGraph, Query, ClampedMax, /*ExactMatch=*/false);
|
TArray<TSharedPtr<FEdGraphSchemaAction>> Actions = WingUtils::SearchGraphActions(TargetGraph, Query, ClampedMax, /*ExactMatch=*/false);
|
||||||
|
|
||||||
for (const TSharedPtr<FEdGraphSchemaAction>& Action : Actions)
|
for (const TSharedPtr<FEdGraphSchemaAction>& Action : Actions)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("%s\n"), *MCPUtils::ActionFullName(Action));
|
UWingServer::Printf(TEXT("%s\n"), *WingUtils::ActionFullName(Action));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Actions.Num() == 0)
|
if (Actions.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("No matching node types found.\n"));
|
UWingServer::Print(TEXT("No matching node types found.\n"));
|
||||||
}
|
}
|
||||||
else if (Actions.Num() >= ClampedMax)
|
else if (Actions.Num() >= ClampedMax)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("WARNING: Reached limit of %d results. Refine your query or increase MaxResults.\n"), ClampedMax);
|
UWingServer::Printf(TEXT("WARNING: Reached limit of %d results. Refine your query or increase MaxResults.\n"), ClampedMax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "FunctionArgs.h"
|
#include "FunctionArgs.h"
|
||||||
#include "GraphNode_SetArgs.generated.h"
|
#include "GraphNode_SetArgs.generated.h"
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_SetArgs : public UObject, public IMCPHandler
|
class UWing_GraphNode_SetArgs : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -27,18 +27,18 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraphNode* NodeObj = F.Walk(Node).Cast<UEdGraphNode>();
|
UEdGraphNode* NodeObj = F.Walk(Node).Cast<UEdGraphNode>();
|
||||||
if (!NodeObj) return;
|
if (!NodeObj) return;
|
||||||
|
|
||||||
if (!MCPFunctionArgs::HasArgs(NodeObj))
|
if (!WingFunctionArgs::HasArgs(NodeObj))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Node does not support editable args\n"));
|
UWingServer::Printf(TEXT("ERROR: Node does not support editable args\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MCPFunctionArgs::SetArgs(NodeObj, Args)) return;
|
if (!WingFunctionArgs::SetArgs(NodeObj, Args)) return;
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Args set to: %s\n"), *MCPFunctionArgs::GetArgs(NodeObj));
|
UWingServer::Printf(TEXT("Args set to: %s\n"), *WingFunctionArgs::GetArgs(NodeObj));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
#include "GraphNode_SetComment.generated.h"
|
#include "GraphNode_SetComment.generated.h"
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_SetComment : public UObject, public IMCPHandler
|
class UWing_GraphNode_SetComment : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraphNode* FoundNode = F.Walk(Node).Cast<UEdGraphNode>();
|
UEdGraphNode* FoundNode = F.Walk(Node).Cast<UEdGraphNode>();
|
||||||
if (!FoundNode) return;
|
if (!FoundNode) return;
|
||||||
|
|
||||||
@@ -41,6 +41,6 @@ public:
|
|||||||
FoundNode->bCommentBubbleVisible = !Comment.IsEmpty();
|
FoundNode->bCommentBubbleVisible = !Comment.IsEmpty();
|
||||||
FoundNode->bCommentBubblePinned = !Comment.IsEmpty();
|
FoundNode->bCommentBubblePinned = !Comment.IsEmpty();
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Comment set on %s\n"), *MCPUtils::FormatName(FoundNode));
|
UWingServer::Printf(TEXT("Comment set on %s\n"), *WingUtils::FormatName(FoundNode));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPProperty.h"
|
#include "WingProperty.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "EdGraph/EdGraphPin.h"
|
#include "EdGraph/EdGraphPin.h"
|
||||||
#include "EdGraphSchema_K2.h"
|
#include "EdGraphSchema_K2.h"
|
||||||
#include "MaterialGraph/MaterialGraphSchema.h"
|
#include "MaterialGraph/MaterialGraphSchema.h"
|
||||||
@@ -34,7 +34,7 @@ struct FSetNodeDefaultEntry
|
|||||||
|
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_SetDefaults : public UObject, public IMCPHandler
|
class UWing_GraphNode_SetDefaults : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
FString Graph;
|
FString Graph;
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Array of {node, name, value} objects"))
|
UPROPERTY(meta=(Description="Array of {node, name, value} objects"))
|
||||||
FMCPJsonArray Pins;
|
FWingJsonArray Pins;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
void HandleK2Entry(const FSetNodeDefaultEntry& Entry, UEdGraph* GraphObj, const UEdGraphSchema_K2* K2Schema)
|
void HandleK2Entry(const FSetNodeDefaultEntry& Entry, UEdGraph* GraphObj, const UEdGraphSchema_K2* K2Schema)
|
||||||
{
|
{
|
||||||
MCPFetcher F(GraphObj);
|
WingFetcher F(GraphObj);
|
||||||
UEdGraphPin* Pin = F.Node(Entry.Node).Pin(Entry.Name).Cast<UEdGraphPin>();
|
UEdGraphPin* Pin = F.Node(Entry.Node).Pin(Entry.Name).Cast<UEdGraphPin>();
|
||||||
if (!Pin) return;
|
if (!Pin) return;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
if (Pin->Direction != EGPD_Input)
|
if (Pin->Direction != EGPD_Input)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("error: %s is an output pin\n"), *MCPUtils::FormatName(Pin));
|
UWingServer::Printf(TEXT("error: %s is an output pin\n"), *WingUtils::FormatName(Pin));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,10 +77,10 @@ public:
|
|||||||
FString Error = K2Schema->IsPinDefaultValid(Pin, UseDefaultValue, UseDefaultObject, UseDefaultText);
|
FString Error = K2Schema->IsPinDefaultValid(Pin, UseDefaultValue, UseDefaultObject, UseDefaultText);
|
||||||
if (!Error.IsEmpty())
|
if (!Error.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("error: %s: %s\n"), *MCPUtils::FormatName(Pin), *Error);
|
UWingServer::Printf(TEXT("error: %s: %s\n"), *WingUtils::FormatName(Pin), *Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UMCPServer::AddTouchedObject(Node);
|
UWingServer::AddTouchedObject(Node);
|
||||||
K2Schema->TrySetDefaultValue(*Pin, Entry.Value);
|
K2Schema->TrySetDefaultValue(*Pin, Entry.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,15 +90,15 @@ public:
|
|||||||
|
|
||||||
void HandleMaterialEntry(const FSetNodeDefaultEntry& Entry, UEdGraph* GraphObj)
|
void HandleMaterialEntry(const FSetNodeDefaultEntry& Entry, UEdGraph* GraphObj)
|
||||||
{
|
{
|
||||||
MCPFetcher F(GraphObj);
|
WingFetcher F(GraphObj);
|
||||||
UEdGraphNode* Node = F.Node(Entry.Node).Cast<UEdGraphNode>();
|
UEdGraphNode* Node = F.Node(Entry.Node).Cast<UEdGraphNode>();
|
||||||
if (!Node) return;
|
if (!Node) return;
|
||||||
|
|
||||||
TArray<MCPProperty> All = MCPProperty::GetAll(Node, CPF_Edit);
|
TArray<WingProperty> All = WingProperty::GetAll(Node, CPF_Edit);
|
||||||
MCPProperty P = MCPProperty::FindOneExactMatch(All, Entry.Name);
|
WingProperty P = WingProperty::FindOneExactMatch(All, Entry.Name);
|
||||||
if (!P) return;
|
if (!P) return;
|
||||||
|
|
||||||
UMCPServer::AddTouchedObject(Node);
|
UWingServer::AddTouchedObject(Node);
|
||||||
|
|
||||||
if (!P.SetText(Entry.Value))
|
if (!P.SetText(Entry.Value))
|
||||||
return;
|
return;
|
||||||
@@ -109,7 +109,7 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Fetch the graph once.
|
// Fetch the graph once.
|
||||||
MCPFetcher GraphFetcher;
|
WingFetcher GraphFetcher;
|
||||||
UEdGraph* GraphObj = GraphFetcher.Walk(Graph).Cast<UEdGraph>();
|
UEdGraph* GraphObj = GraphFetcher.Walk(Graph).Cast<UEdGraph>();
|
||||||
if (!GraphObj) return;
|
if (!GraphObj) return;
|
||||||
|
|
||||||
@@ -119,14 +119,14 @@ public:
|
|||||||
|
|
||||||
if (!K2Schema && !MGSchema)
|
if (!K2Schema && !MGSchema)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("error: unsupported graph schema %s\n"), *Schema->GetClass()->GetName());
|
UWingServer::Printf(TEXT("error: unsupported graph schema %s\n"), *Schema->GetClass()->GetName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const TSharedPtr<FJsonValue>& PinVal : Pins.Array)
|
for (const TSharedPtr<FJsonValue>& PinVal : Pins.Array)
|
||||||
{
|
{
|
||||||
FSetNodeDefaultEntry Entry;
|
FSetNodeDefaultEntry Entry;
|
||||||
if (!MCPJson::PopulateFromJson(FSetNodeDefaultEntry::StaticStruct(), &Entry, PinVal))
|
if (!WingJson::PopulateFromJson(FSetNodeDefaultEntry::StaticStruct(), &Entry, PinVal))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (K2Schema)
|
if (K2Schema)
|
||||||
@@ -135,6 +135,6 @@ public:
|
|||||||
HandleMaterialEntry(Entry, GraphObj);
|
HandleMaterialEntry(Entry, GraphObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Done.\n"));
|
UWingServer::Printf(TEXT("Done.\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
#include "GraphNode_SetPositions.generated.h"
|
#include "GraphNode_SetPositions.generated.h"
|
||||||
@@ -32,7 +32,7 @@ struct FMoveNodeEntry
|
|||||||
|
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_SetPositions : public UObject, public IMCPHandler
|
class UWing_GraphNode_SetPositions : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
FString Graph;
|
FString Graph;
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Array of {node, x, y} objects"))
|
UPROPERTY(meta=(Description="Array of {node, x, y} objects"))
|
||||||
FMCPJsonArray Nodes;
|
FWingJsonArray Nodes;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraph* TargetGraph = F.Walk(Graph).Cast<UEdGraph>();
|
UEdGraph* TargetGraph = F.Walk(Graph).Cast<UEdGraph>();
|
||||||
if (!TargetGraph) return;
|
if (!TargetGraph) return;
|
||||||
|
|
||||||
@@ -59,9 +59,9 @@ public:
|
|||||||
for (const TSharedPtr<FJsonValue>& NodeVal : Nodes.Array)
|
for (const TSharedPtr<FJsonValue>& NodeVal : Nodes.Array)
|
||||||
{
|
{
|
||||||
FMoveNodeEntry Entry;
|
FMoveNodeEntry Entry;
|
||||||
if (!MCPJson::PopulateFromJson(FMoveNodeEntry::StaticStruct(), &Entry, NodeVal)) continue;
|
if (!WingJson::PopulateFromJson(FMoveNodeEntry::StaticStruct(), &Entry, NodeVal)) continue;
|
||||||
|
|
||||||
MCPFetcher FN(TargetGraph);
|
WingFetcher FN(TargetGraph);
|
||||||
UEdGraphNode* Node = FN.Node(Entry.Node).Cast<UEdGraphNode>();
|
UEdGraphNode* Node = FN.Node(Entry.Node).Cast<UEdGraphNode>();
|
||||||
if (!Node) continue;
|
if (!Node) continue;
|
||||||
|
|
||||||
@@ -70,6 +70,6 @@ public:
|
|||||||
SuccessCount++;
|
SuccessCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Moved %d/%d nodes.\n"), SuccessCount, Nodes.Array.Num());
|
UWingServer::Printf(TEXT("Moved %d/%d nodes.\n"), SuccessCount, Nodes.Array.Num());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPToolMenu.h"
|
#include "WingToolMenu.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "ToolMenus.h"
|
#include "ToolMenus.h"
|
||||||
#include "MaterialGraph/MaterialGraphNode.h"
|
#include "MaterialGraph/MaterialGraphNode.h"
|
||||||
#include "GraphNode_ShowMenu.generated.h"
|
#include "GraphNode_ShowMenu.generated.h"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphNode_ShowMenu : public UObject, public IMCPHandler
|
class UWing_GraphNode_ShowMenu : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -31,22 +31,22 @@ public:
|
|||||||
private:
|
private:
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraphNode* NodeObj = F.Walk(Node).Cast<UEdGraphNode>();
|
UEdGraphNode* NodeObj = F.Walk(Node).Cast<UEdGraphNode>();
|
||||||
if (!NodeObj) return;
|
if (!NodeObj) return;
|
||||||
|
|
||||||
if (Cast<UMaterialGraphNode>(NodeObj))
|
if (Cast<UMaterialGraphNode>(NodeObj))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Material graph nodes do not have usable context menus."));
|
UWingServer::Printf(TEXT("Material graph nodes do not have usable context menus."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FToolMenuContext Context;
|
FToolMenuContext Context;
|
||||||
TArray<FToolMenuEntry> Entries = MCPToolMenu::GetMenuItems(NodeObj, Context);
|
TArray<FToolMenuEntry> Entries = WingToolMenu::GetMenuItems(NodeObj, Context);
|
||||||
for (FToolMenuEntry &Entry : Entries)
|
for (FToolMenuEntry &Entry : Entries)
|
||||||
{
|
{
|
||||||
FString LabelText = Entry.Label.Get().ToString();
|
FString LabelText = Entry.Label.Get().ToString();
|
||||||
UMCPServer::Printf(TEXT("%s\n"), *LabelText);
|
UWingServer::Printf(TEXT("%s\n"), *LabelText);
|
||||||
}
|
}
|
||||||
if (Entries.IsEmpty()) UMCPServer::Printf(TEXT("No selectable menu entries right now.\n"));
|
if (Entries.IsEmpty()) UWingServer::Printf(TEXT("No selectable menu entries right now.\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphPin.h"
|
#include "EdGraph/EdGraphPin.h"
|
||||||
@@ -31,7 +31,7 @@ struct FConnectPinsEntry
|
|||||||
|
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphPin_Connect : public UObject, public IMCPHandler
|
class UWing_GraphPin_Connect : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
FString Graph;
|
FString Graph;
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Array of {sourcePin, targetPin} objects"))
|
UPROPERTY(meta=(Description="Array of {sourcePin, targetPin} objects"))
|
||||||
FMCPJsonArray Connections;
|
FWingJsonArray Connections;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraph* G = F.Walk(Graph).Cast<UEdGraph>();
|
UEdGraph* G = F.Walk(Graph).Cast<UEdGraph>();
|
||||||
if (!G) return;
|
if (!G) return;
|
||||||
|
|
||||||
@@ -59,14 +59,14 @@ public:
|
|||||||
for (const TSharedPtr<FJsonValue>& ConnVal : Connections.Array)
|
for (const TSharedPtr<FJsonValue>& ConnVal : Connections.Array)
|
||||||
{
|
{
|
||||||
FConnectPinsEntry Entry;
|
FConnectPinsEntry Entry;
|
||||||
if (!MCPJson::PopulateFromJson(FConnectPinsEntry::StaticStruct(), &Entry, ConnVal))
|
if (!WingJson::PopulateFromJson(FConnectPinsEntry::StaticStruct(), &Entry, ConnVal))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MCPFetcher FS(G);
|
WingFetcher FS(G);
|
||||||
UEdGraphPin* SourcePin = FS.Walk(Entry.SourcePin).Cast<UEdGraphPin>();
|
UEdGraphPin* SourcePin = FS.Walk(Entry.SourcePin).Cast<UEdGraphPin>();
|
||||||
if (!SourcePin) continue;
|
if (!SourcePin) continue;
|
||||||
|
|
||||||
MCPFetcher FT(G);
|
WingFetcher FT(G);
|
||||||
UEdGraphPin* TargetPin = FT.Walk(Entry.TargetPin).Cast<UEdGraphPin>();
|
UEdGraphPin* TargetPin = FT.Walk(Entry.TargetPin).Cast<UEdGraphPin>();
|
||||||
if (!TargetPin) continue;
|
if (!TargetPin) continue;
|
||||||
|
|
||||||
@@ -74,9 +74,9 @@ public:
|
|||||||
const FPinConnectionResponse Response = Schema->CanCreateConnection(SourcePin, TargetPin);
|
const FPinConnectionResponse Response = Schema->CanCreateConnection(SourcePin, TargetPin);
|
||||||
if (Response.Response == CONNECT_RESPONSE_DISALLOW)
|
if (Response.Response == CONNECT_RESPONSE_DISALLOW)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("error: Cannot connect %s.%s to %s.%s: %s\n"),
|
UWingServer::Printf(TEXT("error: Cannot connect %s.%s to %s.%s: %s\n"),
|
||||||
*MCPUtils::FormatName(SourcePin->GetOwningNode()), *MCPUtils::FormatName(SourcePin),
|
*WingUtils::FormatName(SourcePin->GetOwningNode()), *WingUtils::FormatName(SourcePin),
|
||||||
*MCPUtils::FormatName(TargetPin->GetOwningNode()), *MCPUtils::FormatName(TargetPin),
|
*WingUtils::FormatName(TargetPin->GetOwningNode()), *WingUtils::FormatName(TargetPin),
|
||||||
*Response.Message.ToString());
|
*Response.Message.ToString());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -85,6 +85,6 @@ public:
|
|||||||
SuccessCount++;
|
SuccessCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Connected %d/%d pins.\n"), SuccessCount, TotalCount);
|
UWingServer::Printf(TEXT("Connected %d/%d pins.\n"), SuccessCount, TotalCount);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphPin.h"
|
#include "EdGraph/EdGraphPin.h"
|
||||||
@@ -30,7 +30,7 @@ struct FDisconnectPinEntry
|
|||||||
|
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_GraphPin_Disconnect : public UObject, public IMCPHandler
|
class UWing_GraphPin_Disconnect : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
FString Graph;
|
FString Graph;
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Array of {pin, targetPin?} objects. If targetPin is omitted, all connections on the pin are broken."))
|
UPROPERTY(meta=(Description="Array of {pin, targetPin?} objects. If targetPin is omitted, all connections on the pin are broken."))
|
||||||
FMCPJsonArray Disconnections;
|
FWingJsonArray Disconnections;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraph* G = F.Walk(Graph).Cast<UEdGraph>();
|
UEdGraph* G = F.Walk(Graph).Cast<UEdGraph>();
|
||||||
if (!G) return;
|
if (!G) return;
|
||||||
|
|
||||||
@@ -59,9 +59,9 @@ public:
|
|||||||
for (const TSharedPtr<FJsonValue>& DiscVal : Disconnections.Array)
|
for (const TSharedPtr<FJsonValue>& DiscVal : Disconnections.Array)
|
||||||
{
|
{
|
||||||
FDisconnectPinEntry Entry;
|
FDisconnectPinEntry Entry;
|
||||||
if (!MCPJson::PopulateFromJson(FDisconnectPinEntry::StaticStruct(), &Entry, DiscVal)) continue;
|
if (!WingJson::PopulateFromJson(FDisconnectPinEntry::StaticStruct(), &Entry, DiscVal)) continue;
|
||||||
|
|
||||||
MCPFetcher FP(G);
|
WingFetcher FP(G);
|
||||||
UEdGraphPin* Pin = FP.Walk(Entry.Pin).Cast<UEdGraphPin>();
|
UEdGraphPin* Pin = FP.Walk(Entry.Pin).Cast<UEdGraphPin>();
|
||||||
if (!Pin) continue;
|
if (!Pin) continue;
|
||||||
|
|
||||||
@@ -69,15 +69,15 @@ public:
|
|||||||
|
|
||||||
if (!Entry.TargetPin.IsEmpty())
|
if (!Entry.TargetPin.IsEmpty())
|
||||||
{
|
{
|
||||||
MCPFetcher FT(G);
|
WingFetcher FT(G);
|
||||||
UEdGraphPin* Target = FT.Walk(Entry.TargetPin).Cast<UEdGraphPin>();
|
UEdGraphPin* Target = FT.Walk(Entry.TargetPin).Cast<UEdGraphPin>();
|
||||||
if (!Target) continue;
|
if (!Target) continue;
|
||||||
|
|
||||||
if (!Pin->LinkedTo.Contains(Target))
|
if (!Pin->LinkedTo.Contains(Target))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Error: %s.%s is not connected to %s.%s\n"),
|
UWingServer::Printf(TEXT("Error: %s.%s is not connected to %s.%s\n"),
|
||||||
*MCPUtils::FormatName(Pin->GetOwningNode()), *MCPUtils::FormatName(Pin),
|
*WingUtils::FormatName(Pin->GetOwningNode()), *WingUtils::FormatName(Pin),
|
||||||
*MCPUtils::FormatName(Target->GetOwningNode()), *MCPUtils::FormatName(Target));
|
*WingUtils::FormatName(Target->GetOwningNode()), *WingUtils::FormatName(Target));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,14 +93,14 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Disconnected %d link(s) from %s.%s\n"),
|
UWingServer::Printf(TEXT("Disconnected %d link(s) from %s.%s\n"),
|
||||||
DisconnectedCount,
|
DisconnectedCount,
|
||||||
*MCPUtils::FormatName(Pin->GetOwningNode()), *MCPUtils::FormatName(Pin));
|
*WingUtils::FormatName(Pin->GetOwningNode()), *WingUtils::FormatName(Pin));
|
||||||
SuccessCount++;
|
SuccessCount++;
|
||||||
TotalDisconnected += DisconnectedCount;
|
TotalDisconnected += DisconnectedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Done: %d/%d succeeded, %d links broken.\n"),
|
UWingServer::Printf(TEXT("Done: %d/%d succeeded, %d links broken.\n"),
|
||||||
SuccessCount, Disconnections.Array.Num(), TotalDisconnected);
|
SuccessCount, Disconnections.Array.Num(), TotalDisconnected);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "GraphExport.h"
|
#include "GraphExport.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Graph_Dump : public UObject, public IMCPHandler
|
class UWing_Graph_Dump : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -36,19 +36,19 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UEdGraph *G = F.Walk(Graph).Cast<UEdGraph>();
|
UEdGraph *G = F.Walk(Graph).Cast<UEdGraph>();
|
||||||
if (!G) return;
|
if (!G) return;
|
||||||
|
|
||||||
MCPGraphExport Exporter(G);
|
WingGraphExport Exporter(G);
|
||||||
UMCPServer::Print(*Exporter.GetOutput());
|
UWingServer::Print(*Exporter.GetOutput());
|
||||||
if (bDetails)
|
if (bDetails)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(Exporter.GetDetails());
|
UWingServer::Print(Exporter.GetDetails());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Note: use bDetails=true to see suppressed details."));
|
UWingServer::Printf(TEXT("Note: use bDetails=true to see suppressed details."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MaterialParameter.h"
|
#include "MaterialParameter.h"
|
||||||
#include "Materials/MaterialInstanceConstant.h"
|
#include "Materials/MaterialInstanceConstant.h"
|
||||||
#include "MaterialTypes.h"
|
#include "MaterialTypes.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_MaterialInstance_ClearParameter : public UObject, public IMCPHandler
|
class UWing_MaterialInstance_ClearParameter : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -40,13 +40,13 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UMaterialInstanceConstant* MI = F.Asset(MaterialInstance).Cast<UMaterialInstanceConstant>();
|
UMaterialInstanceConstant* MI = F.Asset(MaterialInstance).Cast<UMaterialInstanceConstant>();
|
||||||
if (!MI) return;
|
if (!MI) return;
|
||||||
|
|
||||||
// Parse the association string.
|
// Parse the association string.
|
||||||
EMaterialParameterAssociation Association;
|
EMaterialParameterAssociation Association;
|
||||||
if (!MCPMaterialParameter::ParseMaterialParameterAssociation(ParameterAssociation, Association))
|
if (!WingMaterialParameter::ParseMaterialParameterAssociation(ParameterAssociation, Association))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FMaterialParameterInfo ParamID(*Parameter, Association, ParameterLayer);
|
FMaterialParameterInfo ParamID(*Parameter, Association, ParameterLayer);
|
||||||
@@ -68,13 +68,13 @@ public:
|
|||||||
|
|
||||||
if (Removed == 0)
|
if (Removed == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("No override found for parameter '%s' (association=%s layer=%d) on %s"),
|
UWingServer::Printf(TEXT("No override found for parameter '%s' (association=%s layer=%d) on %s"),
|
||||||
*Parameter, *ParameterAssociation, ParameterLayer, *MCPUtils::FormatName(MI));
|
*Parameter, *ParameterAssociation, ParameterLayer, *WingUtils::FormatName(MI));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPUtils::SaveGenericPackage(MI);
|
WingUtils::SaveGenericPackage(MI);
|
||||||
UMCPServer::Printf(TEXT("Cleared override for '%s' on %s\n"),
|
UWingServer::Printf(TEXT("Cleared override for '%s' on %s\n"),
|
||||||
*Parameter, *MCPUtils::FormatName(MI));
|
*Parameter, *WingUtils::FormatName(MI));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Materials/Material.h"
|
#include "Materials/Material.h"
|
||||||
#include "Materials/MaterialInterface.h"
|
#include "Materials/MaterialInterface.h"
|
||||||
#include "Materials/MaterialInstanceConstant.h"
|
#include "Materials/MaterialInstanceConstant.h"
|
||||||
#include "Factories/MaterialInstanceConstantFactoryNew.h"
|
#include "Factories/MaterialInstanceConstantFactoryNew.h"
|
||||||
#include "MCPPackageMaker.h"
|
#include "WingPackageMaker.h"
|
||||||
#include "MaterialInstance_Create.generated.h"
|
#include "MaterialInstance_Create.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_MaterialInstance_Create : public UObject, public IMCPHandler
|
class UWing_MaterialInstance_Create : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -36,16 +36,16 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPPackageMaker Maker(AssetPath);
|
WingPackageMaker Maker(AssetPath);
|
||||||
if (!Maker.Ok()) return;
|
if (!Maker.Ok()) return;
|
||||||
|
|
||||||
// Load parent material by package path.
|
// Load parent material by package path.
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UObject* ParentObj = F.Asset(ParentMaterial).GetObj();
|
UObject* ParentObj = F.Asset(ParentMaterial).GetObj();
|
||||||
UMaterialInterface* ParentMaterialObj = ParentObj ? Cast<UMaterialInterface>(ParentObj) : nullptr;
|
UMaterialInterface* ParentMaterialObj = ParentObj ? Cast<UMaterialInterface>(ParentObj) : nullptr;
|
||||||
if (!ParentMaterialObj)
|
if (!ParentMaterialObj)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Parent material '%s' not found or not a material\n"), *ParentMaterial);
|
UWingServer::Printf(TEXT("ERROR: Parent material '%s' not found or not a material\n"), *ParentMaterial);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,16 +57,16 @@ public:
|
|||||||
MI->Parent = ParentMaterialObj;
|
MI->Parent = ParentMaterialObj;
|
||||||
|
|
||||||
// Save.
|
// Save.
|
||||||
bool bSaved = MCPUtils::SaveGenericPackage(MI);
|
bool bSaved = WingUtils::SaveGenericPackage(MI);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Created %s\n"), *MI->GetPathName());
|
UWingServer::Printf(TEXT("Created %s\n"), *MI->GetPathName());
|
||||||
if (UMaterialInstance* ParentMI = Cast<UMaterialInstance>(ParentMaterialObj))
|
if (UMaterialInstance* ParentMI = Cast<UMaterialInstance>(ParentMaterialObj))
|
||||||
UMCPServer::Printf(TEXT("Parent: %s\n"), *MCPUtils::FormatName(ParentMI));
|
UWingServer::Printf(TEXT("Parent: %s\n"), *WingUtils::FormatName(ParentMI));
|
||||||
else if (UMaterial* ParentMat = Cast<UMaterial>(ParentMaterialObj))
|
else if (UMaterial* ParentMat = Cast<UMaterial>(ParentMaterialObj))
|
||||||
UMCPServer::Printf(TEXT("Parent: %s\n"), *MCPUtils::FormatName(ParentMat));
|
UWingServer::Printf(TEXT("Parent: %s\n"), *WingUtils::FormatName(ParentMat));
|
||||||
else
|
else
|
||||||
UMCPServer::Printf(TEXT("Parent: %s\n"), *ParentMaterialObj->GetPathName());
|
UWingServer::Printf(TEXT("Parent: %s\n"), *ParentMaterialObj->GetPathName());
|
||||||
if (!bSaved)
|
if (!bSaved)
|
||||||
UMCPServer::Print(TEXT("WARNING: Package save failed\n"));
|
UWingServer::Print(TEXT("WARNING: Package save failed\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MaterialParameter.h"
|
#include "MaterialParameter.h"
|
||||||
#include "Materials/MaterialInstanceConstant.h"
|
#include "Materials/MaterialInstanceConstant.h"
|
||||||
#include "MaterialTypes.h"
|
#include "MaterialTypes.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_MaterialInstance_DumpParameters : public UObject, public IMCPHandler
|
class UWing_MaterialInstance_DumpParameters : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -31,19 +31,19 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UMaterialInstanceConstant* MI = F.Asset(MaterialInstance).Cast<UMaterialInstanceConstant>();
|
UMaterialInstanceConstant* MI = F.Asset(MaterialInstance).Cast<UMaterialInstanceConstant>();
|
||||||
if (!MI) return;
|
if (!MI) return;
|
||||||
|
|
||||||
auto AllParams = MCPMaterialParameter::GetMaterialParameters(MI);
|
auto AllParams = WingMaterialParameter::GetMaterialParameters(MI);
|
||||||
|
|
||||||
// Overridden parameters first.
|
// Overridden parameters first.
|
||||||
bool bHasOverrides = false;
|
bool bHasOverrides = false;
|
||||||
for (auto& [Info, Meta] : AllParams)
|
for (auto& [Info, Meta] : AllParams)
|
||||||
{
|
{
|
||||||
if (!Meta.bOverride) continue;
|
if (!Meta.bOverride) continue;
|
||||||
if (!bHasOverrides) { UMCPServer::Print(TEXT("\nOverridden Parameters:\n")); bHasOverrides = true; }
|
if (!bHasOverrides) { UWingServer::Print(TEXT("\nOverridden Parameters:\n")); bHasOverrides = true; }
|
||||||
MCPMaterialParameter::FormatMaterialParameter(Info, Meta);
|
WingMaterialParameter::FormatMaterialParameter(Info, Meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inherited (non-overridden) parameters.
|
// Inherited (non-overridden) parameters.
|
||||||
@@ -51,8 +51,8 @@ public:
|
|||||||
for (auto& [Info, Meta] : AllParams)
|
for (auto& [Info, Meta] : AllParams)
|
||||||
{
|
{
|
||||||
if (Meta.bOverride) continue;
|
if (Meta.bOverride) continue;
|
||||||
if (!bHasInherited) { UMCPServer::Print(TEXT("\nInherited Parameters (not overridden):\n")); bHasInherited = true; }
|
if (!bHasInherited) { UWingServer::Print(TEXT("\nInherited Parameters (not overridden):\n")); bHasInherited = true; }
|
||||||
MCPMaterialParameter::FormatMaterialParameter(Info, Meta);
|
WingMaterialParameter::FormatMaterialParameter(Info, Meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MaterialParameter.h"
|
#include "MaterialParameter.h"
|
||||||
#include "Materials/MaterialInstanceConstant.h"
|
#include "Materials/MaterialInstanceConstant.h"
|
||||||
#include "MaterialTypes.h"
|
#include "MaterialTypes.h"
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_MaterialInstance_SetParameter : public UObject, public IMCPHandler
|
class UWing_MaterialInstance_SetParameter : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -44,30 +44,30 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UMaterialInstanceConstant* MI = F.Asset(MaterialInstance).Cast<UMaterialInstanceConstant>();
|
UMaterialInstanceConstant* MI = F.Asset(MaterialInstance).Cast<UMaterialInstanceConstant>();
|
||||||
if (!MI) return;
|
if (!MI) return;
|
||||||
|
|
||||||
// Parse the association string.
|
// Parse the association string.
|
||||||
EMaterialParameterAssociation Association;
|
EMaterialParameterAssociation Association;
|
||||||
if (!MCPMaterialParameter::ParseMaterialParameterAssociation(ParameterAssociation, Association))
|
if (!WingMaterialParameter::ParseMaterialParameterAssociation(ParameterAssociation, Association))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Build the parameter ID to look up.
|
// Build the parameter ID to look up.
|
||||||
FMaterialParameterInfo ParamID(*Parameter, Association, ParameterLayer);
|
FMaterialParameterInfo ParamID(*Parameter, Association, ParameterLayer);
|
||||||
|
|
||||||
// Find it in the material's parameter map.
|
// Find it in the material's parameter map.
|
||||||
auto AllParams = MCPMaterialParameter::GetMaterialParameters(MI);
|
auto AllParams = WingMaterialParameter::GetMaterialParameters(MI);
|
||||||
FMaterialParameterMetadata* Found = AllParams.Find(ParamID);
|
FMaterialParameterMetadata* Found = AllParams.Find(ParamID);
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("No parameter named '%s' with association=%s layer=%d"),
|
UWingServer::Printf(TEXT("No parameter named '%s' with association=%s layer=%d"),
|
||||||
*Parameter, *ParameterAssociation, ParameterLayer);
|
*Parameter, *ParameterAssociation, ParameterLayer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Found->PrimitiveDataIndex != INDEX_NONE)
|
if (Found->PrimitiveDataIndex != INDEX_NONE)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Parameter '%s' uses custom primitive data and cannot be set on a material instance"), *Parameter);
|
UWingServer::Printf(TEXT("Parameter '%s' uses custom primitive data and cannot be set on a material instance"), *Parameter);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
float ScalarValue;
|
float ScalarValue;
|
||||||
if (!FDefaultValueHelper::ParseFloat(Value, ScalarValue))
|
if (!FDefaultValueHelper::ParseFloat(Value, ScalarValue))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Failed to parse '%s' as a float"), *Value);
|
UWingServer::Printf(TEXT("Failed to parse '%s' as a float"), *Value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MI->SetScalarParameterValueEditorOnly(ParamID, ScalarValue);
|
MI->SetScalarParameterValueEditorOnly(ParamID, ScalarValue);
|
||||||
@@ -91,19 +91,19 @@ public:
|
|||||||
FLinearColor Color;
|
FLinearColor Color;
|
||||||
if (!Color.InitFromString(Value))
|
if (!Color.InitFromString(Value))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Failed to parse '%s' as a color/vector (expected format: '(R=1,G=0,B=0,A=1)')"), *Value);
|
UWingServer::Printf(TEXT("Failed to parse '%s' as a color/vector (expected format: '(R=1,G=0,B=0,A=1)')"), *Value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MI->SetVectorParameterValueEditorOnly(ParamID, Color);
|
MI->SetVectorParameterValueEditorOnly(ParamID, Color);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
UMCPServer::Printf(TEXT("Parameters of type %d (see EMaterialParameterType) are not implemented"), (int)Type);
|
UWingServer::Printf(TEXT("Parameters of type %d (see EMaterialParameterType) are not implemented"), (int)Type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MCPUtils::SaveGenericPackage(MI);
|
WingUtils::SaveGenericPackage(MI);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Set '%s' = %s on %s\n"),
|
UWingServer::Printf(TEXT("Set '%s' = %s on %s\n"),
|
||||||
*Parameter, *Value, *MCPUtils::FormatName(MI));
|
*Parameter, *Value, *WingUtils::FormatName(MI));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Materials/Material.h"
|
#include "Materials/Material.h"
|
||||||
#include "Material_Compile.generated.h"
|
#include "Material_Compile.generated.h"
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Material_Compile : public UObject, public IMCPHandler
|
class UWing_Material_Compile : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Load material
|
// Load material
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UMaterial* MaterialObj = F.Asset(Material).Cast<UMaterial>();
|
UMaterial* MaterialObj = F.Asset(Material).Cast<UMaterial>();
|
||||||
if (!MaterialObj) return;
|
if (!MaterialObj) return;
|
||||||
|
|
||||||
@@ -48,14 +48,14 @@ public:
|
|||||||
|
|
||||||
if (Errors.IsEmpty())
|
if (Errors.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("%s compiled successfully.\n"), *MCPUtils::FormatName(MaterialObj));
|
UWingServer::Printf(TEXT("%s compiled successfully.\n"), *WingUtils::FormatName(MaterialObj));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("%s compiled with %d error(s):\n"), *MCPUtils::FormatName(MaterialObj), Errors.Num());
|
UWingServer::Printf(TEXT("%s compiled with %d error(s):\n"), *WingUtils::FormatName(MaterialObj), Errors.Num());
|
||||||
for (const FString& Err : Errors)
|
for (const FString& Err : Errors)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT(" %s\n"), *Err);
|
UWingServer::Printf(TEXT(" %s\n"), *Err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Materials/Material.h"
|
#include "Materials/Material.h"
|
||||||
#include "MaterialDomain.h"
|
#include "MaterialDomain.h"
|
||||||
#include "Factories/MaterialFactoryNew.h"
|
#include "Factories/MaterialFactoryNew.h"
|
||||||
#include "MCPPackageMaker.h"
|
#include "WingPackageMaker.h"
|
||||||
#include "Material_Create.generated.h"
|
#include "Material_Create.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Material_Create : public UObject, public IMCPHandler
|
class UWing_Material_Create : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -31,15 +31,15 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPPackageMaker Maker(Material);
|
WingPackageMaker Maker(Material);
|
||||||
if (!Maker.Ok()) return;
|
if (!Maker.Ok()) return;
|
||||||
|
|
||||||
// Create via IAssetTools + factory.
|
// Create via IAssetTools + factory.
|
||||||
UMaterial* MaterialObj = Maker.CreateAsset<UMaterial, UMaterialFactoryNew>();
|
UMaterial* MaterialObj = Maker.CreateAsset<UMaterial, UMaterialFactoryNew>();
|
||||||
if (!MaterialObj) return;
|
if (!MaterialObj) return;
|
||||||
|
|
||||||
bool bSaved = MCPUtils::SaveGenericPackage(MaterialObj);
|
bool bSaved = WingUtils::SaveGenericPackage(MaterialObj);
|
||||||
UMCPServer::Printf(TEXT("Created %s\n"), *MaterialObj->GetPathName());
|
UWingServer::Printf(TEXT("Created %s\n"), *MaterialObj->GetPathName());
|
||||||
if (!bSaved) UMCPServer::Print(TEXT("WARNING: Package save failed\n"));
|
if (!bSaved) UWingServer::Print(TEXT("WARNING: Package save failed\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MaterialParameter.h"
|
#include "MaterialParameter.h"
|
||||||
#include "MaterialTypes.h"
|
#include "MaterialTypes.h"
|
||||||
#include "Material_DumpParameters.generated.h"
|
#include "Material_DumpParameters.generated.h"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Material_DumpParameters : public UObject, public IMCPHandler
|
class UWing_Material_DumpParameters : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -30,16 +30,16 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UMaterial* Mat = F.Asset(Material).Cast<UMaterial>();
|
UMaterial* Mat = F.Asset(Material).Cast<UMaterial>();
|
||||||
if (!Mat) return;
|
if (!Mat) return;
|
||||||
|
|
||||||
auto AllParams = MCPMaterialParameter::GetMaterialParameters(Mat);
|
auto AllParams = WingMaterialParameter::GetMaterialParameters(Mat);
|
||||||
|
|
||||||
for (auto& [Info, Meta] : AllParams)
|
for (auto& [Info, Meta] : AllParams)
|
||||||
{
|
{
|
||||||
MCPMaterialParameter::FormatMaterialParameter(Info, Meta);
|
WingMaterialParameter::FormatMaterialParameter(Info, Meta);
|
||||||
}
|
}
|
||||||
if (AllParams.IsEmpty()) UMCPServer::Printf(TEXT("No material parameters.\n"));
|
if (AllParams.IsEmpty()) UWingServer::Printf(TEXT("No material parameters.\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPProperty.h"
|
#include "WingProperty.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Property_Dump.generated.h"
|
#include "Property_Dump.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Property_Dump : public UObject, public IMCPHandler
|
class UWing_Property_Dump : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -40,20 +40,20 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Resolve the path to an object and get its editable template.
|
// Resolve the path to an object and get its editable template.
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UObject* Template = F.Walk(Object).Cast<UObject>();
|
UObject* Template = F.Walk(Object).Cast<UObject>();
|
||||||
if (!Template) return;
|
if (!Template) return;
|
||||||
TArray<MCPProperty> AllProps = MCPProperty::GetAll(Template, CPF_Edit);
|
TArray<WingProperty> AllProps = WingProperty::GetAll(Template, CPF_Edit);
|
||||||
TArray<MCPProperty> Props = MCPProperty::FindAllSubstring(AllProps, Query);
|
TArray<WingProperty> Props = WingProperty::FindAllSubstring(AllProps, Query);
|
||||||
if (Local)
|
if (Local)
|
||||||
{
|
{
|
||||||
UClass* ObjClass = Template->GetClass();
|
UClass* ObjClass = Template->GetClass();
|
||||||
Props.RemoveAll([ObjClass](const MCPProperty& P) { return P->GetOwnerStruct() != ObjClass; });
|
Props.RemoveAll([ObjClass](const WingProperty& P) { return P->GetOwnerStruct() != ObjClass; });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group properties by category.
|
// Group properties by category.
|
||||||
TMap<FString, TArray<MCPProperty>> ByCategory;
|
TMap<FString, TArray<WingProperty>> ByCategory;
|
||||||
for (MCPProperty& P : Props)
|
for (WingProperty& P : Props)
|
||||||
{
|
{
|
||||||
FString Category = P->HasMetaData(TEXT("Category")) ? P->GetMetaData(TEXT("Category")) : FString();
|
FString Category = P->HasMetaData(TEXT("Category")) ? P->GetMetaData(TEXT("Category")) : FString();
|
||||||
ByCategory.FindOrAdd(Category).Add(P);
|
ByCategory.FindOrAdd(Category).Add(P);
|
||||||
@@ -71,28 +71,28 @@ public:
|
|||||||
for (const FString& Category : Categories)
|
for (const FString& Category : Categories)
|
||||||
{
|
{
|
||||||
if (Category.IsEmpty())
|
if (Category.IsEmpty())
|
||||||
UMCPServer::Print(TEXT("\nUncategorized:\n"));
|
UWingServer::Print(TEXT("\nUncategorized:\n"));
|
||||||
else
|
else
|
||||||
UMCPServer::Printf(TEXT("\n%s:\n"), *Category);
|
UWingServer::Printf(TEXT("\n%s:\n"), *Category);
|
||||||
|
|
||||||
for (MCPProperty& P : ByCategory[Category])
|
for (WingProperty& P : ByCategory[Category])
|
||||||
{
|
{
|
||||||
FString PropName = MCPUtils::FormatName(P.Prop);
|
FString PropName = WingUtils::FormatName(P.Prop);
|
||||||
FString ValueStr = P.GetText();
|
FString ValueStr = P.GetText();
|
||||||
|
|
||||||
if (Truncate && (ValueStr.Len() > 80))
|
if (Truncate && (ValueStr.Len() > 80))
|
||||||
ValueStr = ValueStr.Left(80) + TEXT("...");
|
ValueStr = ValueStr.Left(80) + TEXT("...");
|
||||||
|
|
||||||
bool bEditable = !P->HasAnyPropertyFlags(CPF_EditConst);
|
bool bEditable = !P->HasAnyPropertyFlags(CPF_EditConst);
|
||||||
UMCPServer::Printf(TEXT(" %s %s %s = %s\n"),
|
UWingServer::Printf(TEXT(" %s %s %s = %s\n"),
|
||||||
bEditable ? TEXT("editable") : TEXT("readonly"),
|
bEditable ? TEXT("editable") : TEXT("readonly"),
|
||||||
*UMCPTypes::TypeToText(P.Prop),
|
*UWingTypes::TypeToText(P.Prop),
|
||||||
*PropName,
|
*PropName,
|
||||||
*ValueStr);
|
*ValueStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Props.IsEmpty())
|
if (Props.IsEmpty())
|
||||||
UMCPServer::Print(TEXT(" (no blueprint-visible properties found)\n"));
|
UWingServer::Print(TEXT(" (no blueprint-visible properties found)\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPProperty.h"
|
#include "WingProperty.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Property_Get.generated.h"
|
#include "Property_Get.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Property_Get : public UObject, public IMCPHandler
|
class UWing_Property_Get : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -32,15 +32,15 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UObject* Obj = F.Walk(Object).Cast<UObject>();
|
UObject* Obj = F.Walk(Object).Cast<UObject>();
|
||||||
if (!Obj) return;
|
if (!Obj) return;
|
||||||
|
|
||||||
TArray<MCPProperty> All = MCPProperty::GetAll(Obj, CPF_Edit);
|
TArray<WingProperty> All = WingProperty::GetAll(Obj, CPF_Edit);
|
||||||
MCPProperty P = MCPProperty::FindOneExactMatch(All, Property);
|
WingProperty P = WingProperty::FindOneExactMatch(All, Property);
|
||||||
if (!P) return;
|
if (!P) return;
|
||||||
|
|
||||||
UMCPServer::Print(P.GetText());
|
UWingServer::Print(P.GetText());
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPProperty.h"
|
#include "WingProperty.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Property_Set.generated.h"
|
#include "Property_Set.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_Property_Set : public UObject, public IMCPHandler
|
class UWing_Property_Set : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ public:
|
|||||||
FString Object;
|
FString Object;
|
||||||
|
|
||||||
UPROPERTY(meta=(Description="Object mapping property names to new values in Unreal text format"))
|
UPROPERTY(meta=(Description="Object mapping property names to new values in Unreal text format"))
|
||||||
FMCPJsonObject Properties;
|
FWingJsonObject Properties;
|
||||||
|
|
||||||
virtual FString GetDescription() const override
|
virtual FString GetDescription() const override
|
||||||
{
|
{
|
||||||
@@ -33,28 +33,28 @@ public:
|
|||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
// Resolve the path to an object and get its editable template.
|
// Resolve the path to an object and get its editable template.
|
||||||
MCPFetcher F;
|
WingFetcher F;
|
||||||
UObject* Obj = F.Walk(Object).Cast<UObject>();
|
UObject* Obj = F.Walk(Object).Cast<UObject>();
|
||||||
if (!Obj) return;
|
if (!Obj) return;
|
||||||
|
|
||||||
if (!Properties.Json || Properties.Json->Values.Num() == 0)
|
if (!Properties.Json || Properties.Json->Values.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("Error: No properties specified\n"));
|
UWingServer::Print(TEXT("Error: No properties specified\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validation pass — resolve all properties and values before modifying anything.
|
// Validation pass — resolve all properties and values before modifying anything.
|
||||||
TArray<MCPProperty> All = MCPProperty::GetAll(Obj, CPF_Edit);
|
TArray<WingProperty> All = WingProperty::GetAll(Obj, CPF_Edit);
|
||||||
TArray<TPair<MCPProperty, FString>> Resolved;
|
TArray<TPair<WingProperty, FString>> Resolved;
|
||||||
for (const auto& Pair : Properties.Json->Values)
|
for (const auto& Pair : Properties.Json->Values)
|
||||||
{
|
{
|
||||||
MCPProperty P = MCPProperty::FindOneExactMatch(All, Pair.Key);
|
WingProperty P = WingProperty::FindOneExactMatch(All, Pair.Key);
|
||||||
if (!P) return;
|
if (!P) return;
|
||||||
|
|
||||||
FString ValueStr;
|
FString ValueStr;
|
||||||
if (!Pair.Value->TryGetString(ValueStr))
|
if (!Pair.Value->TryGetString(ValueStr))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Error: Value for '%s' must be a string\n"), *Pair.Key);
|
UWingServer::Printf(TEXT("Error: Value for '%s' must be a string\n"), *Pair.Key);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Resolved.Emplace(P, ValueStr);
|
Resolved.Emplace(P, ValueStr);
|
||||||
@@ -70,10 +70,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save.
|
// Save.
|
||||||
bool bSaved = MCPUtils::SaveGenericPackage(Obj);
|
bool bSaved = WingUtils::SaveGenericPackage(Obj);
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("Set %d/%d properties.\n"), SuccessCount, Properties.Json->Values.Num());
|
UWingServer::Printf(TEXT("Set %d/%d properties.\n"), SuccessCount, Properties.Json->Values.Num());
|
||||||
if (!bSaved)
|
if (!bSaved)
|
||||||
UMCPServer::Print(TEXT("Warning: Save failed\n"));
|
UWingServer::Print(TEXT("Warning: Save failed\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "ShowCommands.generated.h"
|
#include "ShowCommands.generated.h"
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_ShowCommands : public UObject, public IMCPHandler
|
class UWing_ShowCommands : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -30,20 +30,20 @@ public:
|
|||||||
{
|
{
|
||||||
if (Verbose)
|
if (Verbose)
|
||||||
{
|
{
|
||||||
MCPUtils::FormatCommandHelp(Class);
|
WingUtils::FormatCommandHelp(Class);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UMCPServer::Print(MCPUtils::GetHandlerName(Class));
|
UWingServer::Print(WingUtils::GetHandlerName(Class));
|
||||||
UMCPServer::Print(TEXT("("));
|
UWingServer::Print(TEXT("("));
|
||||||
bool bFirst = true;
|
bool bFirst = true;
|
||||||
for (TFieldIterator<FProperty> PropIt(Class, EFieldIterationFlags::None); PropIt; ++PropIt)
|
for (TFieldIterator<FProperty> PropIt(Class, EFieldIterationFlags::None); PropIt; ++PropIt)
|
||||||
{
|
{
|
||||||
if (!bFirst) UMCPServer::Print(TEXT(","));
|
if (!bFirst) UWingServer::Print(TEXT(","));
|
||||||
bFirst = false;
|
bFirst = false;
|
||||||
if (PropIt->HasMetaData(TEXT("Optional"))) UMCPServer::Print(TEXT("?"));
|
if (PropIt->HasMetaData(TEXT("Optional"))) UWingServer::Print(TEXT("?"));
|
||||||
UMCPServer::Print(PropIt->GetName());
|
UWingServer::Print(PropIt->GetName());
|
||||||
}
|
}
|
||||||
UMCPServer::Print(TEXT(")\n"));
|
UWingServer::Print(TEXT(")\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitCommandList(bool bHalfBaked)
|
void EmitCommandList(bool bHalfBaked)
|
||||||
@@ -51,22 +51,22 @@ public:
|
|||||||
FString QueryLower = Query.ToLower();
|
FString QueryLower = Query.ToLower();
|
||||||
FString PrevGroup;
|
FString PrevGroup;
|
||||||
|
|
||||||
for (UClass* Class : MCPUtils::CollectHandlerClasses())
|
for (UClass* Class : WingUtils::CollectHandlerClasses())
|
||||||
{
|
{
|
||||||
bool bIsHalfBaked = Class->GetMetaData(TEXT("ModuleRelativePath")).StartsWith(TEXT("HalfBaked/"));
|
bool bIsHalfBaked = Class->GetMetaData(TEXT("ModuleRelativePath")).StartsWith(TEXT("HalfBaked/"));
|
||||||
if (bIsHalfBaked != bHalfBaked)
|
if (bIsHalfBaked != bHalfBaked)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
FString ToolName = MCPUtils::GetHandlerName(Class);
|
FString ToolName = WingUtils::GetHandlerName(Class);
|
||||||
if (!ToolName.ToLower().Contains(QueryLower))
|
if (!ToolName.ToLower().Contains(QueryLower))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Blank line between groups
|
// Blank line between groups
|
||||||
FString Group = MCPUtils::GetHandlerGroup(Class);
|
FString Group = WingUtils::GetHandlerGroup(Class);
|
||||||
if (Group != PrevGroup)
|
if (Group != PrevGroup)
|
||||||
{
|
{
|
||||||
if (!PrevGroup.IsEmpty())
|
if (!PrevGroup.IsEmpty())
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
PrevGroup = Group;
|
PrevGroup = Group;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,10 +76,10 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("\n"));
|
UWingServer::Printf(TEXT("\n"));
|
||||||
EmitCommandList(false);
|
EmitCommandList(false);
|
||||||
// UMCPServer::Print(TEXT("\n--- Half-Baked (may have issues) ---\n\n"));
|
// UWingServer::Print(TEXT("\n--- Half-Baked (may have issues) ---\n\n"));
|
||||||
// EmitCommandList(true);
|
// EmitCommandList(true);
|
||||||
UMCPServer::Printf(TEXT("\n"));
|
UWingServer::Printf(TEXT("\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "AssetRegistry/AssetData.h"
|
#include "AssetRegistry/AssetData.h"
|
||||||
#include "AssetRegistry/IAssetRegistry.h"
|
#include "AssetRegistry/IAssetRegistry.h"
|
||||||
#include "UObject/UObjectIterator.h"
|
#include "UObject/UObjectIterator.h"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_TypeName_Search : public UObject, public IMCPHandler
|
class UWing_TypeName_Search : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -89,16 +89,16 @@ public:
|
|||||||
Kind = TEXT("Struct");
|
Kind = TEXT("Struct");
|
||||||
else if (const UClass* Class = Cast<UClass>(Obj))
|
else if (const UClass* Class = Cast<UClass>(Obj))
|
||||||
Kind = Class->IsChildOf(UInterface::StaticClass()) ? TEXT("Interface") : TEXT("Class");
|
Kind = Class->IsChildOf(UInterface::StaticClass()) ? TEXT("Interface") : TEXT("Class");
|
||||||
Results.Add(FString::Printf(TEXT("%s %s\n"), Kind, *UMCPTypes::TypeToText(Obj)));
|
Results.Add(FString::Printf(TEXT("%s %s\n"), Kind, *UWingTypes::TypeToText(Obj)));
|
||||||
}
|
}
|
||||||
Results.Sort();
|
Results.Sort();
|
||||||
for (const auto &Result : Results)
|
for (const auto &Result : Results)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(Result);
|
UWingServer::Print(Result);
|
||||||
}
|
}
|
||||||
if (Results.Num() == Limit)
|
if (Results.Num() == Limit)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Search limit reached, raise it with Limit=\n"));
|
UWingServer::Printf(TEXT("Search limit reached, raise it with Limit=\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "UserManual.generated.h"
|
#include "UserManual.generated.h"
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UMCP_UserManual : public UObject, public IMCPHandler
|
class UWing_UserManual : public UObject, public IWingHandler
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
|
|
||||||
virtual void Handle() override
|
virtual void Handle() override
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT(
|
UWingServer::Print(TEXT(
|
||||||
"\n PATHS:"
|
"\n PATHS:"
|
||||||
"\n"
|
"\n"
|
||||||
"\n Most commands require you to specify a path. A path starts"
|
"\n Most commands require you to specify a path. A path starts"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "BPVarEditor.h"
|
#include "BPVarEditor.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "EdGraphSchema_K2.h"
|
#include "EdGraphSchema_K2.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ FBPVarEditor::FBPVarEditor(UBlueprint* BP, const FString& VarName)
|
|||||||
int32 VarIndex = FBlueprintEditorUtils::FindNewVariableIndex(BP, VarFName);
|
int32 VarIndex = FBlueprintEditorUtils::FindNewVariableIndex(BP, VarFName);
|
||||||
if (VarIndex == INDEX_NONE)
|
if (VarIndex == INDEX_NONE)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Variable '%s' not found in %s\n"), *VarName, *MCPUtils::FormatName(BP));
|
UWingServer::Printf(TEXT("ERROR: Variable '%s' not found in %s\n"), *VarName, *WingUtils::FormatName(BP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Desc = &BP->NewVariables[VarIndex];
|
Desc = &BP->NewVariables[VarIndex];
|
||||||
@@ -23,7 +23,7 @@ FBPVarEditor::FBPVarEditor(UBlueprint* BP, const FString& VarName)
|
|||||||
UObject* CDO = BP->GeneratedClass->GetDefaultObject();
|
UObject* CDO = BP->GeneratedClass->GetDefaultObject();
|
||||||
FProperty* Prop = BP->GeneratedClass->FindPropertyByName(VarFName);
|
FProperty* Prop = BP->GeneratedClass->FindPropertyByName(VarFName);
|
||||||
if (CDO && Prop)
|
if (CDO && Prop)
|
||||||
DefaultValueProp = MCPProperty(Prop, CDO);
|
DefaultValueProp = WingProperty(Prop, CDO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,12 +31,12 @@ void FBPVarEditor::Dump()
|
|||||||
{
|
{
|
||||||
LoadFlags();
|
LoadFlags();
|
||||||
LoadDefault();
|
LoadDefault();
|
||||||
TArray<MCPProperty> Props = MergedProperties();
|
TArray<WingProperty> Props = MergedProperties();
|
||||||
for (MCPProperty& P : Props)
|
for (WingProperty& P : Props)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT(" %s %s = %s\n"),
|
UWingServer::Printf(TEXT(" %s %s = %s\n"),
|
||||||
*UMCPTypes::TypeToText(P.Prop),
|
*UWingTypes::TypeToText(P.Prop),
|
||||||
*MCPUtils::FormatName(P.Prop),
|
*WingUtils::FormatName(P.Prop),
|
||||||
*P.GetText());
|
*P.GetText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ bool FBPVarEditor::ApplyJson(const FJsonObject* Json)
|
|||||||
bool bHasType = Json->HasField(TEXT("VarType"));
|
bool bHasType = Json->HasField(TEXT("VarType"));
|
||||||
if (bHasDefault && bHasType)
|
if (bHasDefault && bHasType)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT(
|
UWingServer::Print(TEXT(
|
||||||
"ERROR: Cannot set VarType and DefaultValue in the same call.\n"
|
"ERROR: Cannot set VarType and DefaultValue in the same call.\n"
|
||||||
"Change the type first, then recompile the blueprint,\n"
|
"Change the type first, then recompile the blueprint,\n"
|
||||||
"then set the default.\n"));
|
"then set the default.\n"));
|
||||||
@@ -56,8 +56,8 @@ bool FBPVarEditor::ApplyJson(const FJsonObject* Json)
|
|||||||
|
|
||||||
LoadFlags();
|
LoadFlags();
|
||||||
|
|
||||||
TArray<MCPProperty> Props = MergedProperties();
|
TArray<WingProperty> Props = MergedProperties();
|
||||||
if (!MCPJson::PopulateFromJson(Props, Json, true))
|
if (!WingJson::PopulateFromJson(Props, Json, true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SaveFlags();
|
SaveFlags();
|
||||||
@@ -131,23 +131,23 @@ bool FBPVarEditor::SaveDefault()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<MCPProperty> FBPVarEditor::MergedProperties()
|
TArray<WingProperty> FBPVarEditor::MergedProperties()
|
||||||
{
|
{
|
||||||
TArray<MCPProperty> Props = MCPProperty::GetAll(
|
TArray<WingProperty> Props = WingProperty::GetAll(
|
||||||
FBPVariableDescription::StaticStruct(), Desc, CPF_Edit);
|
FBPVariableDescription::StaticStruct(), Desc, CPF_Edit);
|
||||||
|
|
||||||
MCPProperty::Remove(Props, TEXT("PropertyFlags"));
|
WingProperty::Remove(Props, TEXT("PropertyFlags"));
|
||||||
MCPProperty::Remove(Props, TEXT("MetaDataArray"));
|
WingProperty::Remove(Props, TEXT("MetaDataArray"));
|
||||||
MCPProperty::Remove(Props, TEXT("VarName"));
|
WingProperty::Remove(Props, TEXT("VarName"));
|
||||||
MCPProperty::Remove(Props, TEXT("VarGuid"));
|
WingProperty::Remove(Props, TEXT("VarGuid"));
|
||||||
MCPProperty::Remove(Props, TEXT("DefaultValue"));
|
WingProperty::Remove(Props, TEXT("DefaultValue"));
|
||||||
|
|
||||||
Props.Append(MCPProperty::GetAll(
|
Props.Append(WingProperty::GetAll(
|
||||||
FBPVarEditor::StaticStruct(), this, (EPropertyFlags)0));
|
FBPVarEditor::StaticStruct(), this, (EPropertyFlags)0));
|
||||||
|
|
||||||
// Remove DefaultValue if we don't have a CDO property to back it.
|
// Remove DefaultValue if we don't have a CDO property to back it.
|
||||||
if (!DefaultValueProp)
|
if (!DefaultValueProp)
|
||||||
MCPProperty::Remove(Props, TEXT("DefaultValue"));
|
WingProperty::Remove(Props, TEXT("DefaultValue"));
|
||||||
|
|
||||||
return Props;
|
return Props;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
#include "K2Node_EditablePinBase.h"
|
#include "K2Node_EditablePinBase.h"
|
||||||
#include "K2Node_FunctionResult.h"
|
#include "K2Node_FunctionResult.h"
|
||||||
#include "K2Node_Tunnel.h"
|
#include "K2Node_Tunnel.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
|
|
||||||
bool MCPFunctionArgs::HasArgs(UEdGraphNode* Node)
|
bool WingFunctionArgs::HasArgs(UEdGraphNode* Node)
|
||||||
{
|
{
|
||||||
UK2Node_EditablePinBase* Editable = Cast<UK2Node_EditablePinBase>(Node);
|
UK2Node_EditablePinBase* Editable = Cast<UK2Node_EditablePinBase>(Node);
|
||||||
if (!Editable) return false;
|
if (!Editable) return false;
|
||||||
return Editable->IsEditable();
|
return Editable->IsEditable();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPFunctionArgs::GetArgs(UEdGraphNode* Node)
|
FString WingFunctionArgs::GetArgs(UEdGraphNode* Node)
|
||||||
{
|
{
|
||||||
UK2Node_EditablePinBase* Editable = Cast<UK2Node_EditablePinBase>(Node);
|
UK2Node_EditablePinBase* Editable = Cast<UK2Node_EditablePinBase>(Node);
|
||||||
if (!Editable) return FString();
|
if (!Editable) return FString();
|
||||||
@@ -21,12 +21,12 @@ FString MCPFunctionArgs::GetArgs(UEdGraphNode* Node)
|
|||||||
for (const TSharedPtr<FUserPinInfo>& Pin : Editable->UserDefinedPins)
|
for (const TSharedPtr<FUserPinInfo>& Pin : Editable->UserDefinedPins)
|
||||||
{
|
{
|
||||||
if (SB.Len() > 0) SB << TEXT(", ");
|
if (SB.Len() > 0) SB << TEXT(", ");
|
||||||
SB << UMCPTypes::TypeToText(Pin->PinType) << TEXT(" ") << Pin->PinName.ToString();
|
SB << UWingTypes::TypeToText(Pin->PinType) << TEXT(" ") << Pin->PinName.ToString();
|
||||||
}
|
}
|
||||||
return FString(SB);
|
return FString(SB);
|
||||||
}
|
}
|
||||||
|
|
||||||
EEdGraphPinDirection MCPFunctionArgs::GetPinDirection(UK2Node_EditablePinBase* Node)
|
EEdGraphPinDirection WingFunctionArgs::GetPinDirection(UK2Node_EditablePinBase* Node)
|
||||||
{
|
{
|
||||||
// FunctionResult takes inputs; Tunnel depends on its flags; everything else outputs.
|
// FunctionResult takes inputs; Tunnel depends on its flags; everything else outputs.
|
||||||
if (Node->IsA<UK2Node_FunctionResult>())
|
if (Node->IsA<UK2Node_FunctionResult>())
|
||||||
@@ -36,7 +36,7 @@ EEdGraphPinDirection MCPFunctionArgs::GetPinDirection(UK2Node_EditablePinBase* N
|
|||||||
return EGPD_Output;
|
return EGPD_Output;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPFunctionArgs::ParseArgs(const FString& Args, TArray<FParsedArg>& OutArgs)
|
bool WingFunctionArgs::ParseArgs(const FString& Args, TArray<FParsedArg>& OutArgs)
|
||||||
{
|
{
|
||||||
FString Trimmed = Args.TrimStartAndEnd();
|
FString Trimmed = Args.TrimStartAndEnd();
|
||||||
if (Trimmed.IsEmpty()) return true;
|
if (Trimmed.IsEmpty()) return true;
|
||||||
@@ -53,7 +53,7 @@ bool MCPFunctionArgs::ParseArgs(const FString& Args, TArray<FParsedArg>& OutArgs
|
|||||||
int32 LastSpace;
|
int32 LastSpace;
|
||||||
if (!Token.FindLastChar(TEXT(' '), LastSpace))
|
if (!Token.FindLastChar(TEXT(' '), LastSpace))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Expected 'type name' but got '%s'\n"), *Token);
|
UWingServer::Printf(TEXT("ERROR: Expected 'type name' but got '%s'\n"), *Token);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,24 +62,24 @@ bool MCPFunctionArgs::ParseArgs(const FString& Args, TArray<FParsedArg>& OutArgs
|
|||||||
|
|
||||||
if (TypeStr.IsEmpty() || NameStr.IsEmpty())
|
if (TypeStr.IsEmpty() || NameStr.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Expected 'type name' but got '%s'\n"), *Token);
|
UWingServer::Printf(TEXT("ERROR: Expected 'type name' but got '%s'\n"), *Token);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FParsedArg Arg;
|
FParsedArg Arg;
|
||||||
if (!UMCPTypes::TextToType(TypeStr, Arg.PinType)) return false;
|
if (!UWingTypes::TextToType(TypeStr, Arg.PinType)) return false;
|
||||||
Arg.PinName = FName(*NameStr);
|
Arg.PinName = FName(*NameStr);
|
||||||
OutArgs.Add(MoveTemp(Arg));
|
OutArgs.Add(MoveTemp(Arg));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPFunctionArgs::SetArgs(UEdGraphNode* Node, const FString& Args)
|
bool WingFunctionArgs::SetArgs(UEdGraphNode* Node, const FString& Args)
|
||||||
{
|
{
|
||||||
UK2Node_EditablePinBase* Editable = Cast<UK2Node_EditablePinBase>(Node);
|
UK2Node_EditablePinBase* Editable = Cast<UK2Node_EditablePinBase>(Node);
|
||||||
if (!Editable || !Editable->IsEditable())
|
if (!Editable || !Editable->IsEditable())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Node does not support editable pins\n"));
|
UWingServer::Printf(TEXT("ERROR: Node does not support editable pins\n"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "GraphExport.h"
|
#include "GraphExport.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "FunctionArgs.h"
|
#include "FunctionArgs.h"
|
||||||
#include "MaterialGraph/MaterialGraphNode.h"
|
#include "MaterialGraph/MaterialGraphNode.h"
|
||||||
|
|
||||||
MCPGraphExport::MCPGraphExport(UEdGraph* InGraph)
|
WingGraphExport::WingGraphExport(UEdGraph* InGraph)
|
||||||
: Graph(InGraph)
|
: Graph(InGraph)
|
||||||
{
|
{
|
||||||
SortNodes();
|
SortNodes();
|
||||||
@@ -24,7 +24,7 @@ MCPGraphExport::MCPGraphExport(UEdGraph* InGraph)
|
|||||||
EmitComments();
|
EmitComments();
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPGraphExport::MCPGraphExport(UEdGraphNode* InNode)
|
WingGraphExport::WingGraphExport(UEdGraphNode* InNode)
|
||||||
: Graph(InNode->GetGraph())
|
: Graph(InNode->GetGraph())
|
||||||
{
|
{
|
||||||
SortedNodes.Add(InNode);
|
SortedNodes.Add(InNode);
|
||||||
@@ -41,7 +41,7 @@ MCPGraphExport::MCPGraphExport(UEdGraphNode* InNode)
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
|
||||||
UEdGraphPin* MCPGraphExport::GetLinkedTo(UEdGraphPin* Pin)
|
UEdGraphPin* WingGraphExport::GetLinkedTo(UEdGraphPin* Pin)
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -53,7 +53,7 @@ UEdGraphPin* MCPGraphExport::GetLinkedTo(UEdGraphPin* Pin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPGraphExport::IsDefaultToSelf(UEdGraphPin* Pin)
|
bool WingGraphExport::IsDefaultToSelf(UEdGraphPin* Pin)
|
||||||
{
|
{
|
||||||
// Only valid call-function nodes can have default-to-self.
|
// Only valid call-function nodes can have default-to-self.
|
||||||
UK2Node_CallFunction* CallNode = Cast<UK2Node_CallFunction>(Pin->GetOwningNode());
|
UK2Node_CallFunction* CallNode = Cast<UK2Node_CallFunction>(Pin->GetOwningNode());
|
||||||
@@ -72,7 +72,7 @@ bool MCPGraphExport::IsDefaultToSelf(UEdGraphPin* Pin)
|
|||||||
return Pin->PinName.ToString() == DefaultToSelfPinName;
|
return Pin->PinName.ToString() == DefaultToSelfPinName;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<UEdGraphPin*> MCPGraphExport::FilterPins(UEdGraphNode* Node, EEdGraphPinDirection Direction, FName Category)
|
TArray<UEdGraphPin*> WingGraphExport::FilterPins(UEdGraphNode* Node, EEdGraphPinDirection Direction, FName Category)
|
||||||
{
|
{
|
||||||
TArray<UEdGraphPin*> Result;
|
TArray<UEdGraphPin*> Result;
|
||||||
for (UEdGraphPin* Pin : Node->Pins)
|
for (UEdGraphPin* Pin : Node->Pins)
|
||||||
@@ -84,12 +84,12 @@ TArray<UEdGraphPin*> MCPGraphExport::FilterPins(UEdGraphNode* Node, EEdGraphPinD
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPGraphExport::HasExecPin(UEdGraphNode* Node, EEdGraphPinDirection Direction)
|
bool WingGraphExport::HasExecPin(UEdGraphNode* Node, EEdGraphPinDirection Direction)
|
||||||
{
|
{
|
||||||
return FilterPins(Node, Direction, UEdGraphSchema_K2::PC_Exec).Num() > 0;
|
return FilterPins(Node, Direction, UEdGraphSchema_K2::PC_Exec).Num() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UEdGraphPin* MCPGraphExport::FindFirstPin(UEdGraphNode* Node, EEdGraphPinDirection Direction)
|
UEdGraphPin* WingGraphExport::FindFirstPin(UEdGraphNode* Node, EEdGraphPinDirection Direction)
|
||||||
{
|
{
|
||||||
for (UEdGraphPin* Pin : Node->Pins)
|
for (UEdGraphPin* Pin : Node->Pins)
|
||||||
{
|
{
|
||||||
@@ -105,7 +105,7 @@ UEdGraphPin* MCPGraphExport::FindFirstPin(UEdGraphNode* Node, EEdGraphPinDirecti
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
|
||||||
FString MCPGraphExport::FormatPinSource(UEdGraphPin* Pin)
|
FString WingGraphExport::FormatPinSource(UEdGraphPin* Pin)
|
||||||
{
|
{
|
||||||
// If connected, show source node.pin
|
// If connected, show source node.pin
|
||||||
UEdGraphPin* LinkedTo = GetLinkedTo(Pin);
|
UEdGraphPin* LinkedTo = GetLinkedTo(Pin);
|
||||||
@@ -115,10 +115,10 @@ FString MCPGraphExport::FormatPinSource(UEdGraphPin* Pin)
|
|||||||
|
|
||||||
// For variable get nodes, just show the variable name.
|
// For variable get nodes, just show the variable name.
|
||||||
if (UK2Node_VariableGet* VarGet = Cast<UK2Node_VariableGet>(LinkedToNode))
|
if (UK2Node_VariableGet* VarGet = Cast<UK2Node_VariableGet>(LinkedToNode))
|
||||||
return MCPUtils::FormatName(VarGet->VariableReference);
|
return WingUtils::FormatName(VarGet->VariableReference);
|
||||||
|
|
||||||
FString PinLabel = MCPUtils::FormatName(LinkedTo);
|
FString PinLabel = WingUtils::FormatName(LinkedTo);
|
||||||
return FString::Printf(TEXT("%s.%s"), *MCPUtils::FormatName(LinkedToNode), *PinLabel);
|
return FString::Printf(TEXT("%s.%s"), *WingUtils::FormatName(LinkedToNode), *PinLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// String pins: always show in quotes (even if empty).
|
// String pins: always show in quotes (even if empty).
|
||||||
@@ -156,7 +156,7 @@ FString MCPGraphExport::FormatPinSource(UEdGraphPin* Pin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPGraphExport::Traverse(UEdGraphNode* Node)
|
void WingGraphExport::Traverse(UEdGraphNode* Node)
|
||||||
{
|
{
|
||||||
if (Visited.Contains(Node)) return;
|
if (Visited.Contains(Node)) return;
|
||||||
Visited.Add(Node);
|
Visited.Add(Node);
|
||||||
@@ -177,7 +177,7 @@ void MCPGraphExport::Traverse(UEdGraphNode* Node)
|
|||||||
Traverse(LinkedPin->GetOwningNode());
|
Traverse(LinkedPin->GetOwningNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPGraphExport::SortNodes()
|
void WingGraphExport::SortNodes()
|
||||||
{
|
{
|
||||||
// Find starter nodes: have exec output but no exec input.
|
// Find starter nodes: have exec output but no exec input.
|
||||||
TArray<UEdGraphNode*> Starters;
|
TArray<UEdGraphNode*> Starters;
|
||||||
@@ -208,15 +208,15 @@ void MCPGraphExport::SortNodes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPGraphExport::EmitNode(UEdGraphNode* Node)
|
void WingGraphExport::EmitNode(UEdGraphNode* Node)
|
||||||
{
|
{
|
||||||
if (Node->IsA<UEdGraphNode_Comment>()) return;
|
if (Node->IsA<UEdGraphNode_Comment>()) return;
|
||||||
|
|
||||||
Output.Appendf(TEXT("\nnode %s: %s\n"), *MCPUtils::FormatName(Node), *MCPUtils::FormatNodeTitle(Node));
|
Output.Appendf(TEXT("\nnode %s: %s\n"), *WingUtils::FormatName(Node), *WingUtils::FormatNodeTitle(Node));
|
||||||
|
|
||||||
// Emit function args (if applicable).
|
// Emit function args (if applicable).
|
||||||
if (MCPFunctionArgs::HasArgs(Node))
|
if (WingFunctionArgs::HasArgs(Node))
|
||||||
Output.Appendf(TEXT(" args %s\n"), *MCPFunctionArgs::GetArgs(Node));
|
Output.Appendf(TEXT(" args %s\n"), *WingFunctionArgs::GetArgs(Node));
|
||||||
|
|
||||||
// Emit material expression properties (if applicable).
|
// Emit material expression properties (if applicable).
|
||||||
EmitMaterialProperties(Node, Output, true);
|
EmitMaterialProperties(Node, Output, true);
|
||||||
@@ -228,8 +228,8 @@ void MCPGraphExport::EmitNode(UEdGraphNode* Node)
|
|||||||
if (Pin->bHidden) continue;
|
if (Pin->bHidden) continue;
|
||||||
|
|
||||||
Output.Appendf(TEXT(" input %s %s = %s\n"),
|
Output.Appendf(TEXT(" input %s %s = %s\n"),
|
||||||
*UMCPTypes::TypeToText(Pin->PinType),
|
*UWingTypes::TypeToText(Pin->PinType),
|
||||||
*MCPUtils::FormatName(Pin),
|
*WingUtils::FormatName(Pin),
|
||||||
*FormatPinSource(Pin));
|
*FormatPinSource(Pin));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ void MCPGraphExport::EmitNode(UEdGraphNode* Node)
|
|||||||
if (Pin->PinType.PinCategory == UEdGraphSchema_K2::PC_Exec) continue;
|
if (Pin->PinType.PinCategory == UEdGraphSchema_K2::PC_Exec) continue;
|
||||||
if (Pin->bHidden) continue;
|
if (Pin->bHidden) continue;
|
||||||
if (!ReturnPins.IsEmpty()) ReturnPins += TEXT(", ");
|
if (!ReturnPins.IsEmpty()) ReturnPins += TEXT(", ");
|
||||||
ReturnPins += MCPUtils::FormatName(Pin);
|
ReturnPins += WingUtils::FormatName(Pin);
|
||||||
}
|
}
|
||||||
if (!ReturnPins.IsEmpty())
|
if (!ReturnPins.IsEmpty())
|
||||||
{
|
{
|
||||||
@@ -254,18 +254,18 @@ void MCPGraphExport::EmitNode(UEdGraphNode* Node)
|
|||||||
UEdGraphPin* LinkedTo = GetLinkedTo(Pin);
|
UEdGraphPin* LinkedTo = GetLinkedTo(Pin);
|
||||||
if (!LinkedTo) continue;
|
if (!LinkedTo) continue;
|
||||||
|
|
||||||
FString Target = MCPUtils::FormatName(LinkedTo->GetOwningNode());
|
FString Target = WingUtils::FormatName(LinkedTo->GetOwningNode());
|
||||||
|
|
||||||
if (ExecOuts.Num() == 1)
|
if (ExecOuts.Num() == 1)
|
||||||
Output.Appendf(TEXT(" goto %s\n"), *Target);
|
Output.Appendf(TEXT(" goto %s\n"), *Target);
|
||||||
else
|
else
|
||||||
Output.Appendf(TEXT(" goto-if %s %s\n"), *MCPUtils::FormatName(Pin), *Target);
|
Output.Appendf(TEXT(" goto-if %s %s\n"), *WingUtils::FormatName(Pin), *Target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPGraphExport::EmitMaterialProperty(UMaterialExpression* Expression, FProperty* Prop, FStringBuilderBase& Out)
|
void WingGraphExport::EmitMaterialProperty(UMaterialExpression* Expression, FProperty* Prop, FStringBuilderBase& Out)
|
||||||
{
|
{
|
||||||
FString ValueStr = MCPUtils::GetPropertyValueText(Expression, Prop);
|
FString ValueStr = WingUtils::GetPropertyValueText(Expression, Prop);
|
||||||
ValueStr.ReplaceInline(TEXT("\r\n"), TEXT(" "));
|
ValueStr.ReplaceInline(TEXT("\r\n"), TEXT(" "));
|
||||||
ValueStr.ReplaceInline(TEXT("\n"), TEXT(" "));
|
ValueStr.ReplaceInline(TEXT("\n"), TEXT(" "));
|
||||||
if (ValueStr.Len() > 80)
|
if (ValueStr.Len() > 80)
|
||||||
@@ -274,19 +274,19 @@ void MCPGraphExport::EmitMaterialProperty(UMaterialExpression* Expression, FProp
|
|||||||
bool bEditable = !Prop->HasAnyPropertyFlags(CPF_EditConst);
|
bool bEditable = !Prop->HasAnyPropertyFlags(CPF_EditConst);
|
||||||
Out.Appendf(TEXT(" %s %s %s = %s\n"),
|
Out.Appendf(TEXT(" %s %s %s = %s\n"),
|
||||||
bEditable ? TEXT("mxeditable") : TEXT("mxreadonly"),
|
bEditable ? TEXT("mxeditable") : TEXT("mxreadonly"),
|
||||||
*UMCPTypes::TypeToText(Prop),
|
*UWingTypes::TypeToText(Prop),
|
||||||
*MCPUtils::FormatName(Prop),
|
*WingUtils::FormatName(Prop),
|
||||||
*ValueStr);
|
*ValueStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPGraphExport::EmitMaterialProperties(UEdGraphNode* Node, FStringBuilderBase& Out, bool bPrimary)
|
void WingGraphExport::EmitMaterialProperties(UEdGraphNode* Node, FStringBuilderBase& Out, bool bPrimary)
|
||||||
{
|
{
|
||||||
UMaterialGraphNode* MatNode = Cast<UMaterialGraphNode>(Node);
|
UMaterialGraphNode* MatNode = Cast<UMaterialGraphNode>(Node);
|
||||||
if (!MatNode || !MatNode->MaterialExpression) return;
|
if (!MatNode || !MatNode->MaterialExpression) return;
|
||||||
|
|
||||||
UMaterialExpression* Expression = MatNode->MaterialExpression;
|
UMaterialExpression* Expression = MatNode->MaterialExpression;
|
||||||
FString PrimaryCategory = Expression->GetClass()->GetName();
|
FString PrimaryCategory = Expression->GetClass()->GetName();
|
||||||
TArray<FProperty*> Props = MCPUtils::SearchProperties(Expression, FString(), CPF_Edit, false);
|
TArray<FProperty*> Props = WingUtils::SearchProperties(Expression, FString(), CPF_Edit, false);
|
||||||
|
|
||||||
for (FProperty* Prop : Props)
|
for (FProperty* Prop : Props)
|
||||||
{
|
{
|
||||||
@@ -296,7 +296,7 @@ void MCPGraphExport::EmitMaterialProperties(UEdGraphNode* Node, FStringBuilderBa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPGraphExport::EmitLocalVariables()
|
void WingGraphExport::EmitLocalVariables()
|
||||||
{
|
{
|
||||||
for (UEdGraphNode* Node : Graph->Nodes)
|
for (UEdGraphNode* Node : Graph->Nodes)
|
||||||
{
|
{
|
||||||
@@ -307,15 +307,15 @@ void MCPGraphExport::EmitLocalVariables()
|
|||||||
{
|
{
|
||||||
FString Default = Var.DefaultValue.IsEmpty() ? TEXT("<default>") : Var.DefaultValue;
|
FString Default = Var.DefaultValue.IsEmpty() ? TEXT("<default>") : Var.DefaultValue;
|
||||||
Output.Appendf(TEXT("local %s %s = %s\n"),
|
Output.Appendf(TEXT("local %s %s = %s\n"),
|
||||||
*UMCPTypes::TypeToText(Var.VarType),
|
*UWingTypes::TypeToText(Var.VarType),
|
||||||
*MCPUtils::FormatName(Var),
|
*WingUtils::FormatName(Var),
|
||||||
*Default);
|
*Default);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPGraphExport::EmitGraph()
|
void WingGraphExport::EmitGraph()
|
||||||
{
|
{
|
||||||
for (UEdGraphNode* Node : SortedNodes)
|
for (UEdGraphNode* Node : SortedNodes)
|
||||||
{
|
{
|
||||||
@@ -326,21 +326,21 @@ void MCPGraphExport::EmitGraph()
|
|||||||
Output.Append(TEXT("\n"));
|
Output.Append(TEXT("\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPGraphExport::EmitDetails()
|
void WingGraphExport::EmitDetails()
|
||||||
{
|
{
|
||||||
for (UEdGraphNode* Node : SortedNodes)
|
for (UEdGraphNode* Node : SortedNodes)
|
||||||
{
|
{
|
||||||
if (Node->IsA<UK2Node_Knot>()) continue;
|
if (Node->IsA<UK2Node_Knot>()) continue;
|
||||||
if (Node->IsA<UEdGraphNode_Comment>()) continue;
|
if (Node->IsA<UEdGraphNode_Comment>()) continue;
|
||||||
if (Node->IsA<UK2Node_VariableGet>()) continue;
|
if (Node->IsA<UK2Node_VariableGet>()) continue;
|
||||||
Details.Appendf(TEXT("\ndetails %s\n"), *MCPUtils::FormatName(Node));
|
Details.Appendf(TEXT("\ndetails %s\n"), *WingUtils::FormatName(Node));
|
||||||
Details.Appendf(TEXT(" pos %d, %d\n"), Node->NodePosX, Node->NodePosY);
|
Details.Appendf(TEXT(" pos %d, %d\n"), Node->NodePosX, Node->NodePosY);
|
||||||
|
|
||||||
EmitMaterialProperties(Node, Details, false);
|
EmitMaterialProperties(Node, Details, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPGraphExport::EmitComments()
|
void WingGraphExport::EmitComments()
|
||||||
{
|
{
|
||||||
for (UEdGraphNode* CommentNode : SortedNodes)
|
for (UEdGraphNode* CommentNode : SortedNodes)
|
||||||
{
|
{
|
||||||
@@ -352,10 +352,10 @@ void MCPGraphExport::EmitComments()
|
|||||||
int32 CH = CommentNode->NodeHeight;
|
int32 CH = CommentNode->NodeHeight;
|
||||||
|
|
||||||
// Emit header.
|
// Emit header.
|
||||||
Output.Appendf(TEXT("\ncomment %s:\n"), *MCPUtils::FormatName(CommentNode));
|
Output.Appendf(TEXT("\ncomment %s:\n"), *WingUtils::FormatName(CommentNode));
|
||||||
|
|
||||||
// Emit wrapped, indented body.
|
// Emit wrapped, indented body.
|
||||||
Output.Append(MCPUtils::WrapText(CommentNode->NodeComment, 70, TEXT(" - ")));
|
Output.Append(WingUtils::WrapText(CommentNode->NodeComment, 70, TEXT(" - ")));
|
||||||
Output.Append(TEXT("\n"));
|
Output.Append(TEXT("\n"));
|
||||||
|
|
||||||
// Find contained nodes.
|
// Find contained nodes.
|
||||||
@@ -366,7 +366,7 @@ void MCPGraphExport::EmitComments()
|
|||||||
int32 NX = Node->NodePosX;
|
int32 NX = Node->NodePosX;
|
||||||
int32 NY = Node->NodePosY;
|
int32 NY = Node->NodePosY;
|
||||||
if (NX >= CX && NY >= CY && NX <= CX + CW && NY <= CY + CH)
|
if (NX >= CX && NY >= CY && NX <= CX + CW && NY <= CY + CH)
|
||||||
ContainedNames.Add(MCPUtils::FormatName(Node));
|
ContainedNames.Add(WingUtils::FormatName(Node));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ContainedNames.Num() > 0)
|
if (ContainedNames.Num() > 0)
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
* Command-handlers are classes that implement the MCPHandler
|
* Command-handlers are classes that implement the WingHandler
|
||||||
interface. The command's json parameters automatically get
|
interface. The command's json parameters automatically get
|
||||||
injected into the handler's properties using reflection
|
injected into the handler's properties using reflection
|
||||||
code. Check out a few handlers to see how this works.
|
code. Check out a few handlers to see how this works.
|
||||||
|
|
||||||
* Class MCPFetcher can precisely and easily retrieve objects
|
* Class WingFetcher can precisely and easily retrieve objects
|
||||||
of all different kinds using a 'path'. Study the API
|
of all different kinds using a 'path'. Study the API
|
||||||
of this class, we use it everywhere. It is the best tool
|
of this class, we use it everywhere. It is the best tool
|
||||||
when you need the caller to specify a blueprint, or a
|
when you need the caller to specify a blueprint, or a
|
||||||
@@ -15,15 +15,15 @@
|
|||||||
in a convenient interface. Please study this API.
|
in a convenient interface. Please study this API.
|
||||||
|
|
||||||
* The only valid way to get a name for an object is using
|
* The only valid way to get a name for an object is using
|
||||||
MCPUtils::FormatName(obj). We don't allow the use of
|
WingUtils::FormatName(obj). We don't allow the use of
|
||||||
pin->GetName, or node->GetTitle, or any other name-fetching
|
pin->GetName, or node->GetTitle, or any other name-fetching
|
||||||
routine. Using only MCPUtils::FormatName guarantees
|
routine. Using only WingUtils::FormatName guarantees
|
||||||
consistency: that means, names output by one tool can
|
consistency: that means, names output by one tool can
|
||||||
be parsed by a different tool.
|
be parsed by a different tool.
|
||||||
|
|
||||||
* To check whether a string matches an object's name,
|
* To check whether a string matches an object's name,
|
||||||
there's only one valid way to do that as well: using
|
there's only one valid way to do that as well: using
|
||||||
bool MCPUtils::Identifies(Name, Obj).
|
bool WingUtils::Identifies(Name, Obj).
|
||||||
|
|
||||||
* Concise output is better. The output of these handlers
|
* Concise output is better. The output of these handlers
|
||||||
will primarily be consumed by LLMs with finite context
|
will primarily be consumed by LLMs with finite context
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
consume.
|
consume.
|
||||||
|
|
||||||
* You can pass the output StringBuilder directly into
|
* You can pass the output StringBuilder directly into
|
||||||
MCPFetcher and MCPAssets. If you do, these will automatically
|
WingFetcher and MCPAssets. If you do, these will automatically
|
||||||
generate good error messages. If either of these classes
|
generate good error messages. If either of these classes
|
||||||
returns 'false', you don't need to generate an error
|
returns 'false', you don't need to generate an error
|
||||||
message: it's already been done. Any other routine that
|
message: it's already been done. Any other routine that
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
* When you're going to edit something, it's important to
|
* When you're going to edit something, it's important to
|
||||||
mark things dirty. There's a very powerful tool for that:
|
mark things dirty. There's a very powerful tool for that:
|
||||||
MCPUtils::PreEdit and MCPUtils::PostEdit, which can also
|
WingUtils::PreEdit and WingUtils::PostEdit, which can also
|
||||||
be accessed through MCPFetcher::PreEdit and PostEdit.
|
be accessed through WingFetcher::PreEdit and PostEdit.
|
||||||
These routines are very careful about marking everything
|
These routines are very careful about marking everything
|
||||||
dirty, so you don't have to worry about it.
|
dirty, so you don't have to worry about it.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
## Breaking API Changes
|
## Breaking API Changes
|
||||||
|
|
||||||
Several handlers switched from GUID-based node matching to
|
Several handlers switched from GUID-based node matching to
|
||||||
`MCPUtils::Identifies()`. Since the only caller is our own MCP
|
`WingUtils::Identifies()`. Since the only caller is our own MCP
|
||||||
bridge (which uses `FormatName` output from dump commands), this
|
bridge (which uses `FormatName` output from dump commands), this
|
||||||
is actually fine — but it's a one-way door.
|
is actually fine — but it's a one-way door.
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ is actually fine — but it's a one-way door.
|
|||||||
DeleteMaterialExpression, DisconnectMaterialExpressionPin** —
|
DeleteMaterialExpression, DisconnectMaterialExpressionPin** —
|
||||||
node param now expects FormatName identifiers, not GUIDs
|
node param now expects FormatName identifiers, not GUIDs
|
||||||
- **RemoveStructField, AddStructField** — switched from
|
- **RemoveStructField, AddStructField** — switched from
|
||||||
MCPAssets (accepts bare names) to MCPFetcher (requires full
|
MCPAssets (accepts bare names) to WingFetcher (requires full
|
||||||
paths)
|
paths)
|
||||||
- **SetPinDefaultValues** — entry struct changed from
|
- **SetPinDefaultValues** — entry struct changed from
|
||||||
`{Blueprint, Node, PinName, Value}` to `{Pin, Value}` where
|
`{Blueprint, Node, PinName, Value}` to `{Pin, Value}` where
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#include "MCPModule.h"
|
|
||||||
#include "Modules/ModuleManager.h"
|
|
||||||
|
|
||||||
IMPLEMENT_MODULE(FBlueprintMCPModule, BlueprintMCP);
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "MaterialParameter.h"
|
#include "MaterialParameter.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
|
|
||||||
TMap<FMaterialParameterInfo, FMaterialParameterMetadata> MCPMaterialParameter::GetMaterialParameters(UMaterialInterface* Material)
|
TMap<FMaterialParameterInfo, FMaterialParameterMetadata> WingMaterialParameter::GetMaterialParameters(UMaterialInterface* Material)
|
||||||
{
|
{
|
||||||
TMap<FMaterialParameterInfo, FMaterialParameterMetadata> Result;
|
TMap<FMaterialParameterInfo, FMaterialParameterMetadata> Result;
|
||||||
if (!Material) return Result;
|
if (!Material) return Result;
|
||||||
@@ -15,7 +15,7 @@ TMap<FMaterialParameterInfo, FMaterialParameterMetadata> MCPMaterialParameter::G
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPMaterialParameter::ParseMaterialParameterAssociation(const FString& Str, EMaterialParameterAssociation& OutAssociation)
|
bool WingMaterialParameter::ParseMaterialParameterAssociation(const FString& Str, EMaterialParameterAssociation& OutAssociation)
|
||||||
{
|
{
|
||||||
if (Str.Equals(TEXT("Global"), ESearchCase::IgnoreCase))
|
if (Str.Equals(TEXT("Global"), ESearchCase::IgnoreCase))
|
||||||
OutAssociation = GlobalParameter;
|
OutAssociation = GlobalParameter;
|
||||||
@@ -25,13 +25,13 @@ bool MCPMaterialParameter::ParseMaterialParameterAssociation(const FString& Str,
|
|||||||
OutAssociation = BlendParameter;
|
OutAssociation = BlendParameter;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Invalid ParameterAssociation '%s' (expected 'Global', 'Layer', or 'Blend')\n"), *Str);
|
UWingServer::Printf(TEXT("ERROR: Invalid ParameterAssociation '%s' (expected 'Global', 'Layer', or 'Blend')\n"), *Str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPMaterialParameter::FormatMaterialParameter(const FMaterialParameterInfo& Info, const FMaterialParameterMetadata& Meta)
|
void WingMaterialParameter::FormatMaterialParameter(const FMaterialParameterInfo& Info, const FMaterialParameterMetadata& Meta)
|
||||||
{
|
{
|
||||||
// Association prefix for layer/blend parameters.
|
// Association prefix for layer/blend parameters.
|
||||||
FString Prefix;
|
FString Prefix;
|
||||||
@@ -43,35 +43,35 @@ void MCPMaterialParameter::FormatMaterialParameter(const FMaterialParameterInfo&
|
|||||||
switch (Meta.Value.Type)
|
switch (Meta.Value.Type)
|
||||||
{
|
{
|
||||||
case EMaterialParameterType::Scalar:
|
case EMaterialParameterType::Scalar:
|
||||||
UMCPServer::Printf(TEXT(" %sScalar \"%s\" = %g\n"), *Prefix, *Info.Name.ToString(), Meta.Value.AsScalar());
|
UWingServer::Printf(TEXT(" %sScalar \"%s\" = %g\n"), *Prefix, *Info.Name.ToString(), Meta.Value.AsScalar());
|
||||||
break;
|
break;
|
||||||
case EMaterialParameterType::Vector:
|
case EMaterialParameterType::Vector:
|
||||||
{
|
{
|
||||||
FLinearColor C = Meta.Value.AsLinearColor();
|
FLinearColor C = Meta.Value.AsLinearColor();
|
||||||
UMCPServer::Printf(TEXT(" %sVector \"%s\" = (R=%.3f, G=%.3f, B=%.3f, A=%.3f)\n"),
|
UWingServer::Printf(TEXT(" %sVector \"%s\" = (R=%.3f, G=%.3f, B=%.3f, A=%.3f)\n"),
|
||||||
*Prefix, *Info.Name.ToString(), C.R, C.G, C.B, C.A);
|
*Prefix, *Info.Name.ToString(), C.R, C.G, C.B, C.A);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EMaterialParameterType::DoubleVector:
|
case EMaterialParameterType::DoubleVector:
|
||||||
{
|
{
|
||||||
FVector4d V = Meta.Value.AsVector4d();
|
FVector4d V = Meta.Value.AsVector4d();
|
||||||
UMCPServer::Printf(TEXT(" %sDoubleVector \"%s\" = (%.3f, %.3f, %.3f, %.3f)\n"),
|
UWingServer::Printf(TEXT(" %sDoubleVector \"%s\" = (%.3f, %.3f, %.3f, %.3f)\n"),
|
||||||
*Prefix, *Info.Name.ToString(), V.X, V.Y, V.Z, V.W);
|
*Prefix, *Info.Name.ToString(), V.X, V.Y, V.Z, V.W);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EMaterialParameterType::Texture:
|
case EMaterialParameterType::Texture:
|
||||||
{
|
{
|
||||||
UTexture* Tex = Cast<UTexture>(Meta.Value.AsTextureObject());
|
UTexture* Tex = Cast<UTexture>(Meta.Value.AsTextureObject());
|
||||||
UMCPServer::Printf(TEXT(" %sTexture \"%s\" = %s\n"),
|
UWingServer::Printf(TEXT(" %sTexture \"%s\" = %s\n"),
|
||||||
*Prefix, *Info.Name.ToString(), Tex ? *MCPUtils::FormatName(Tex) : TEXT("None"));
|
*Prefix, *Info.Name.ToString(), Tex ? *WingUtils::FormatName(Tex) : TEXT("None"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EMaterialParameterType::StaticSwitch:
|
case EMaterialParameterType::StaticSwitch:
|
||||||
UMCPServer::Printf(TEXT(" %sStaticSwitch \"%s\" = %s\n"),
|
UWingServer::Printf(TEXT(" %sStaticSwitch \"%s\" = %s\n"),
|
||||||
*Prefix, *Info.Name.ToString(), Meta.Value.AsStaticSwitch() ? TEXT("true") : TEXT("false"));
|
*Prefix, *Info.Name.ToString(), Meta.Value.AsStaticSwitch() ? TEXT("true") : TEXT("false"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UMCPServer::Printf(TEXT(" %sType%d \"%s\"\n"), *Prefix, (int)Meta.Value.Type, *Info.Name.ToString());
|
UWingServer::Printf(TEXT(" %sType%d \"%s\"\n"), *Prefix, (int)Meta.Value.Type, *Info.Name.ToString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "MCPFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
@@ -15,30 +15,30 @@
|
|||||||
#include "Engine/LevelScriptBlueprint.h"
|
#include "Engine/LevelScriptBlueprint.h"
|
||||||
#include "Subsystems/AssetEditorSubsystem.h"
|
#include "Subsystems/AssetEditorSubsystem.h"
|
||||||
|
|
||||||
MCPFetcher::WalkFunc MCPFetcher::GetWalker(const FString& Step)
|
WingFetcher::WalkFunc WingFetcher::GetWalker(const FString& Step)
|
||||||
{
|
{
|
||||||
if (Step.Equals(TEXT("graph"), ESearchCase::IgnoreCase)) return &MCPFetcher::Graph;
|
if (Step.Equals(TEXT("graph"), ESearchCase::IgnoreCase)) return &WingFetcher::Graph;
|
||||||
if (Step.Equals(TEXT("node"), ESearchCase::IgnoreCase)) return &MCPFetcher::Node;
|
if (Step.Equals(TEXT("node"), ESearchCase::IgnoreCase)) return &WingFetcher::Node;
|
||||||
if (Step.Equals(TEXT("pin"), ESearchCase::IgnoreCase)) return &MCPFetcher::Pin;
|
if (Step.Equals(TEXT("pin"), ESearchCase::IgnoreCase)) return &WingFetcher::Pin;
|
||||||
if (Step.Equals(TEXT("component"), ESearchCase::IgnoreCase)) return &MCPFetcher::Component;
|
if (Step.Equals(TEXT("component"), ESearchCase::IgnoreCase)) return &WingFetcher::Component;
|
||||||
if (Step.Equals(TEXT("levelblueprint"), ESearchCase::IgnoreCase)) return &MCPFetcher::LevelBlueprint;
|
if (Step.Equals(TEXT("levelblueprint"), ESearchCase::IgnoreCase)) return &WingFetcher::LevelBlueprint;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPFetcher::SetObj(UObject* InObj)
|
void WingFetcher::SetObj(UObject* InObj)
|
||||||
{
|
{
|
||||||
UMCPServer::AddTouchedObject(InObj);
|
UWingServer::AddTouchedObject(InObj);
|
||||||
Obj = InObj;
|
Obj = InObj;
|
||||||
ResultPin = nullptr;
|
ResultPin = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPFetcher::SetPin(UEdGraphPin* InPin)
|
void WingFetcher::SetPin(UEdGraphPin* InPin)
|
||||||
{
|
{
|
||||||
ResultPin = InPin;
|
ResultPin = InPin;
|
||||||
Obj = nullptr;
|
Obj = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPFetcher& MCPFetcher::SetError()
|
WingFetcher& WingFetcher::SetError()
|
||||||
{
|
{
|
||||||
bError = true;
|
bError = true;
|
||||||
Obj = nullptr;
|
Obj = nullptr;
|
||||||
@@ -48,30 +48,30 @@ MCPFetcher& MCPFetcher::SetError()
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPFetcher::PathFailed(const TCHAR* Expected)
|
void WingFetcher::PathFailed(const TCHAR* Expected)
|
||||||
{
|
{
|
||||||
SetError();
|
SetError();
|
||||||
if (ResultPin)
|
if (ResultPin)
|
||||||
UMCPServer::Printf(TEXT("ERROR: Path specifies a pin, but expected %s\n"), Expected);
|
UWingServer::Printf(TEXT("ERROR: Path specifies a pin, but expected %s\n"), Expected);
|
||||||
else if (Obj)
|
else if (Obj)
|
||||||
UMCPServer::Printf(TEXT("ERROR: Path specifies a %s, but expected %s\n"), *Obj->GetClass()->GetName(), Expected);
|
UWingServer::Printf(TEXT("ERROR: Path specifies a %s, but expected %s\n"), *Obj->GetClass()->GetName(), Expected);
|
||||||
else
|
else
|
||||||
UMCPServer::Printf(TEXT("ERROR: Path led to a null pointer\n"));
|
UWingServer::Printf(TEXT("ERROR: Path led to a null pointer\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPFetcher& MCPFetcher::TypeMismatch(const TCHAR* Walker, const TCHAR* Expected)
|
WingFetcher& WingFetcher::TypeMismatch(const TCHAR* Walker, const TCHAR* Expected)
|
||||||
{
|
{
|
||||||
SetError();
|
SetError();
|
||||||
if (ResultPin)
|
if (ResultPin)
|
||||||
UMCPServer::Printf(TEXT("ERROR: Input to '%s' is a pin, but expected %s\n"), Walker, Expected);
|
UWingServer::Printf(TEXT("ERROR: Input to '%s' is a pin, but expected %s\n"), Walker, Expected);
|
||||||
else if (Obj)
|
else if (Obj)
|
||||||
UMCPServer::Printf(TEXT("ERROR: Input to '%s' is %s, but expected %s\n"), Walker, *Obj->GetClass()->GetName(), Expected);
|
UWingServer::Printf(TEXT("ERROR: Input to '%s' is %s, but expected %s\n"), Walker, *Obj->GetClass()->GetName(), Expected);
|
||||||
else
|
else
|
||||||
UMCPServer::Printf(TEXT("ERROR: Path led to a null pointer\n"));
|
UWingServer::Printf(TEXT("ERROR: Path led to a null pointer\n"));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPFetcher& MCPFetcher::Walk(const FString& Path)
|
WingFetcher& WingFetcher::Walk(const FString& Path)
|
||||||
{
|
{
|
||||||
if (bError) return *this;
|
if (bError) return *this;
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ MCPFetcher& MCPFetcher::Walk(const FString& Path)
|
|||||||
Path.ParseIntoArray(Segments, TEXT(","));
|
Path.ParseIntoArray(Segments, TEXT(","));
|
||||||
if (Segments.Num() == 0)
|
if (Segments.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Empty path\n"));
|
UWingServer::Print(TEXT("ERROR: Empty path\n"));
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ MCPFetcher& MCPFetcher::Walk(const FString& Path)
|
|||||||
WalkFunc Func = GetWalker(Key);
|
WalkFunc Func = GetWalker(Key);
|
||||||
if (!Func)
|
if (!Func)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Unknown path step '%s'\n"), *Key);
|
UWingServer::Printf(TEXT("ERROR: Unknown path step '%s'\n"), *Key);
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
(this->*Func)(Value);
|
(this->*Func)(Value);
|
||||||
@@ -109,14 +109,14 @@ MCPFetcher& MCPFetcher::Walk(const FString& Path)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPFetcher& MCPFetcher::Asset(const FString& PackagePath)
|
WingFetcher& WingFetcher::Asset(const FString& PackagePath)
|
||||||
{
|
{
|
||||||
if (bError) return *this;
|
if (bError) return *this;
|
||||||
|
|
||||||
SetObj(LoadObject<UObject>(nullptr, *PackagePath));
|
SetObj(LoadObject<UObject>(nullptr, *PackagePath));
|
||||||
if (!Obj)
|
if (!Obj)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Could not load asset '%s'\n"), *PackagePath);
|
UWingServer::Printf(TEXT("ERROR: Could not load asset '%s'\n"), *PackagePath);
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,13 +126,13 @@ MCPFetcher& MCPFetcher::Asset(const FString& PackagePath)
|
|||||||
UAssetEditorSubsystem* Sub = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
|
UAssetEditorSubsystem* Sub = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
|
||||||
if (!Sub || !Sub->OpenEditorForAsset(Obj))
|
if (!Sub || !Sub->OpenEditorForAsset(Obj))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Could not open editor for '%s'\n"), *PackagePath);
|
UWingServer::Printf(TEXT("ERROR: Could not open editor for '%s'\n"), *PackagePath);
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
Editor = Sub->FindEditorForAsset(OriginalAsset, false);
|
Editor = Sub->FindEditorForAsset(OriginalAsset, false);
|
||||||
if (!Editor)
|
if (!Editor)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Could not find editor instance for '%s'\n"), *PackagePath);
|
UWingServer::Printf(TEXT("ERROR: Could not find editor instance for '%s'\n"), *PackagePath);
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,12 +145,12 @@ MCPFetcher& MCPFetcher::Asset(const FString& PackagePath)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPFetcher::CheckAssetIsA(UClass* StaticClass)
|
bool WingFetcher::CheckAssetIsA(UClass* StaticClass)
|
||||||
{
|
{
|
||||||
if (bError) return false;
|
if (bError) return false;
|
||||||
if (!OriginalAsset || !OriginalAsset->IsA(StaticClass))
|
if (!OriginalAsset || !OriginalAsset->IsA(StaticClass))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Asset is %s, expected %s\n"),
|
UWingServer::Printf(TEXT("ERROR: Asset is %s, expected %s\n"),
|
||||||
OriginalAsset ? *OriginalAsset->GetClass()->GetName() : TEXT("null"),
|
OriginalAsset ? *OriginalAsset->GetClass()->GetName() : TEXT("null"),
|
||||||
*StaticClass->GetName());
|
*StaticClass->GetName());
|
||||||
SetError();
|
SetError();
|
||||||
@@ -159,7 +159,7 @@ bool MCPFetcher::CheckAssetIsA(UClass* StaticClass)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPFetcher& MCPFetcher::Graph(const FString& Value)
|
WingFetcher& WingFetcher::Graph(const FString& Value)
|
||||||
{
|
{
|
||||||
if (bError) return *this;
|
if (bError) return *this;
|
||||||
|
|
||||||
@@ -168,13 +168,13 @@ MCPFetcher& MCPFetcher::Graph(const FString& Value)
|
|||||||
{
|
{
|
||||||
if (!Value.IsEmpty())
|
if (!Value.IsEmpty())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Materials do not have named graphs (got '%s')\n"), *Value);
|
UWingServer::Printf(TEXT("ERROR: Materials do not have named graphs (got '%s')\n"), *Value);
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
MCPUtils::EnsureMaterialGraph(Mat);
|
WingUtils::EnsureMaterialGraph(Mat);
|
||||||
if (!Mat->MaterialGraph)
|
if (!Mat->MaterialGraph)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Material '%s' has no material graph\n"), *Mat->GetName());
|
UWingServer::Printf(TEXT("ERROR: Material '%s' has no material graph\n"), *Mat->GetName());
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
SetObj(Mat->MaterialGraph);
|
SetObj(Mat->MaterialGraph);
|
||||||
@@ -185,15 +185,15 @@ MCPFetcher& MCPFetcher::Graph(const FString& Value)
|
|||||||
if (!BP)
|
if (!BP)
|
||||||
return TypeMismatch(TEXT("graph"), TEXT("Blueprint or Material"));
|
return TypeMismatch(TEXT("graph"), TEXT("Blueprint or Material"));
|
||||||
|
|
||||||
TArray<UEdGraph*> Matches = MCPUtils::AllGraphsNamed(BP, Value);
|
TArray<UEdGraph*> Matches = WingUtils::AllGraphsNamed(BP, Value);
|
||||||
if (Matches.Num() == 0)
|
if (Matches.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Graph '%s' not found in %s\n"), *Value, *BP->GetName());
|
UWingServer::Printf(TEXT("ERROR: Graph '%s' not found in %s\n"), *Value, *BP->GetName());
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
if (Matches.Num() > 1)
|
if (Matches.Num() > 1)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Ambiguous graph '%s' in %s — %d matches\n"), *Value, *BP->GetName(), Matches.Num());
|
UWingServer::Printf(TEXT("ERROR: Ambiguous graph '%s' in %s — %d matches\n"), *Value, *BP->GetName(), Matches.Num());
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ MCPFetcher& MCPFetcher::Graph(const FString& Value)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPFetcher& MCPFetcher::Node(const FString& Value)
|
WingFetcher& WingFetcher::Node(const FString& Value)
|
||||||
{
|
{
|
||||||
if (bError) return *this;
|
if (bError) return *this;
|
||||||
|
|
||||||
@@ -211,18 +211,18 @@ MCPFetcher& MCPFetcher::Node(const FString& Value)
|
|||||||
UEdGraphNode* Found = nullptr;
|
UEdGraphNode* Found = nullptr;
|
||||||
for (UEdGraphNode* N : G->Nodes)
|
for (UEdGraphNode* N : G->Nodes)
|
||||||
{
|
{
|
||||||
if (!N || !MCPUtils::Identifies(Value, N))
|
if (!N || !WingUtils::Identifies(Value, N))
|
||||||
continue;
|
continue;
|
||||||
if (Found)
|
if (Found)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Ambiguous node '%s' in graph %s\n"), *Value, *G->GetName());
|
UWingServer::Printf(TEXT("ERROR: Ambiguous node '%s' in graph %s\n"), *Value, *G->GetName());
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
Found = N;
|
Found = N;
|
||||||
}
|
}
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Node '%s' not found in graph %s\n"), *Value, *G->GetName());
|
UWingServer::Printf(TEXT("ERROR: Node '%s' not found in graph %s\n"), *Value, *G->GetName());
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
SetObj(Found);
|
SetObj(Found);
|
||||||
@@ -233,15 +233,15 @@ MCPFetcher& MCPFetcher::Node(const FString& Value)
|
|||||||
if (UBlueprint* BP = ::Cast<UBlueprint>(Obj))
|
if (UBlueprint* BP = ::Cast<UBlueprint>(Obj))
|
||||||
{
|
{
|
||||||
UEdGraphNode* Found = nullptr;
|
UEdGraphNode* Found = nullptr;
|
||||||
for (UEdGraph* G : MCPUtils::AllGraphs(BP))
|
for (UEdGraph* G : WingUtils::AllGraphs(BP))
|
||||||
{
|
{
|
||||||
for (UEdGraphNode* N : G->Nodes)
|
for (UEdGraphNode* N : G->Nodes)
|
||||||
{
|
{
|
||||||
if (!N || !MCPUtils::Identifies(Value, N))
|
if (!N || !WingUtils::Identifies(Value, N))
|
||||||
continue;
|
continue;
|
||||||
if (Found)
|
if (Found)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Ambiguous node '%s' in %s\n"), *Value, *BP->GetName());
|
UWingServer::Printf(TEXT("ERROR: Ambiguous node '%s' in %s\n"), *Value, *BP->GetName());
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
Found = N;
|
Found = N;
|
||||||
@@ -249,7 +249,7 @@ MCPFetcher& MCPFetcher::Node(const FString& Value)
|
|||||||
}
|
}
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Node '%s' not found in %s\n"), *Value, *BP->GetName());
|
UWingServer::Printf(TEXT("ERROR: Node '%s' not found in %s\n"), *Value, *BP->GetName());
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
SetObj(Found);
|
SetObj(Found);
|
||||||
@@ -259,7 +259,7 @@ MCPFetcher& MCPFetcher::Node(const FString& Value)
|
|||||||
return TypeMismatch(TEXT("node"), TEXT("graph or Blueprint"));
|
return TypeMismatch(TEXT("node"), TEXT("graph or Blueprint"));
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPFetcher& MCPFetcher::Pin(const FString& Value)
|
WingFetcher& WingFetcher::Pin(const FString& Value)
|
||||||
{
|
{
|
||||||
if (bError) return *this;
|
if (bError) return *this;
|
||||||
|
|
||||||
@@ -269,20 +269,20 @@ MCPFetcher& MCPFetcher::Pin(const FString& Value)
|
|||||||
UEdGraphPin* Found = nullptr;
|
UEdGraphPin* Found = nullptr;
|
||||||
for (UEdGraphPin *P : N->Pins)
|
for (UEdGraphPin *P : N->Pins)
|
||||||
{
|
{
|
||||||
if (!MCPUtils::Identifies(Value, P))
|
if (!WingUtils::Identifies(Value, P))
|
||||||
continue;
|
continue;
|
||||||
if (Found)
|
if (Found)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Ambiguous pin '%s' on node %s\n"),
|
UWingServer::Printf(TEXT("ERROR: Ambiguous pin '%s' on node %s\n"),
|
||||||
*Value, *MCPUtils::FormatName(N));
|
*Value, *WingUtils::FormatName(N));
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
Found = P;
|
Found = P;
|
||||||
}
|
}
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Pin '%s' not found on node %s\n"),
|
UWingServer::Printf(TEXT("ERROR: Pin '%s' not found on node %s\n"),
|
||||||
*Value, *MCPUtils::FormatName(N));
|
*Value, *WingUtils::FormatName(N));
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +290,7 @@ MCPFetcher& MCPFetcher::Pin(const FString& Value)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPFetcher& MCPFetcher::Component(const FString& Value)
|
WingFetcher& WingFetcher::Component(const FString& Value)
|
||||||
{
|
{
|
||||||
if (bError) return *this;
|
if (bError) return *this;
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ MCPFetcher& MCPFetcher::Component(const FString& Value)
|
|||||||
USimpleConstructionScript* SCS = BP->SimpleConstructionScript;
|
USimpleConstructionScript* SCS = BP->SimpleConstructionScript;
|
||||||
if (!SCS)
|
if (!SCS)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Blueprint %s has no SimpleConstructionScript (not an Actor Blueprint)\n"), *BP->GetName());
|
UWingServer::Printf(TEXT("ERROR: Blueprint %s has no SimpleConstructionScript (not an Actor Blueprint)\n"), *BP->GetName());
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,11 +315,11 @@ MCPFetcher& MCPFetcher::Component(const FString& Value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("ERROR: Component '%s' not found in %s\n"), *Value, *BP->GetName());
|
UWingServer::Printf(TEXT("ERROR: Component '%s' not found in %s\n"), *Value, *BP->GetName());
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPFetcher& MCPFetcher::LevelBlueprint(const FString& Value)
|
WingFetcher& WingFetcher::LevelBlueprint(const FString& Value)
|
||||||
{
|
{
|
||||||
if (bError) return *this;
|
if (bError) return *this;
|
||||||
|
|
||||||
@@ -329,14 +329,14 @@ MCPFetcher& MCPFetcher::LevelBlueprint(const FString& Value)
|
|||||||
|
|
||||||
if (!World->PersistentLevel)
|
if (!World->PersistentLevel)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: World has no PersistentLevel\n"));
|
UWingServer::Print(TEXT("ERROR: World has no PersistentLevel\n"));
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
ULevelScriptBlueprint* LevelBP = World->PersistentLevel->GetLevelScriptBlueprint(true);
|
ULevelScriptBlueprint* LevelBP = World->PersistentLevel->GetLevelScriptBlueprint(true);
|
||||||
if (!LevelBP)
|
if (!LevelBP)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: World has no level blueprint\n"));
|
UWingServer::Print(TEXT("ERROR: World has no level blueprint\n"));
|
||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "UObject/UnrealType.h"
|
#include "UObject/UnrealType.h"
|
||||||
#include "UObject/EnumProperty.h"
|
#include "UObject/EnumProperty.h"
|
||||||
#include "Dom/JsonValue.h"
|
#include "Dom/JsonValue.h"
|
||||||
|
|
||||||
|
|
||||||
bool MCPJson::PopulateFromJson(MCPProperty& P, const FJsonObject* Json, bool AllOptional)
|
bool WingJson::PopulateFromJson(WingProperty& P, const FJsonObject* Json, bool AllOptional)
|
||||||
{
|
{
|
||||||
FString JsonKey = P.Prop->GetName();
|
FString JsonKey = P.Prop->GetName();
|
||||||
bool bOptional = AllOptional || P.Prop->HasMetaData(TEXT("Optional"));
|
bool bOptional = AllOptional || P.Prop->HasMetaData(TEXT("Optional"));
|
||||||
@@ -15,7 +15,7 @@ bool MCPJson::PopulateFromJson(MCPProperty& P, const FJsonObject* Json, bool All
|
|||||||
{
|
{
|
||||||
if (!bOptional)
|
if (!bOptional)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Missing required parameter '%s'\n"), *JsonKey);
|
UWingServer::Printf(TEXT("ERROR: Missing required parameter '%s'\n"), *JsonKey);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -23,28 +23,28 @@ bool MCPJson::PopulateFromJson(MCPProperty& P, const FJsonObject* Json, bool All
|
|||||||
|
|
||||||
void* ValuePtr = P.Prop->ContainerPtrToValuePtr<void>(P.Container);
|
void* ValuePtr = P.Prop->ContainerPtrToValuePtr<void>(P.Container);
|
||||||
|
|
||||||
// Special handling for FMCPJsonObject and FMCPJsonArray
|
// Special handling for FWingJsonObject and FWingJsonArray
|
||||||
if (FStructProperty* StructProp = CastField<FStructProperty>(P.Prop))
|
if (FStructProperty* StructProp = CastField<FStructProperty>(P.Prop))
|
||||||
{
|
{
|
||||||
if (StructProp->Struct == FMCPJsonObject::StaticStruct())
|
if (StructProp->Struct == FWingJsonObject::StaticStruct())
|
||||||
{
|
{
|
||||||
if (!Json->HasTypedField<EJson::Object>(JsonKey))
|
if (!Json->HasTypedField<EJson::Object>(JsonKey))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: '%s' must be an object\n"), *JsonKey);
|
UWingServer::Printf(TEXT("ERROR: '%s' must be an object\n"), *JsonKey);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
static_cast<FMCPJsonObject*>(ValuePtr)->Json = Json->GetObjectField(JsonKey);
|
static_cast<FWingJsonObject*>(ValuePtr)->Json = Json->GetObjectField(JsonKey);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StructProp->Struct == FMCPJsonArray::StaticStruct())
|
if (StructProp->Struct == FWingJsonArray::StaticStruct())
|
||||||
{
|
{
|
||||||
if (!Json->HasTypedField<EJson::Array>(JsonKey))
|
if (!Json->HasTypedField<EJson::Array>(JsonKey))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: '%s' must be an array\n"), *JsonKey);
|
UWingServer::Printf(TEXT("ERROR: '%s' must be an array\n"), *JsonKey);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
static_cast<FMCPJsonArray*>(ValuePtr)->Array = Json->GetArrayField(JsonKey);
|
static_cast<FWingJsonArray*>(ValuePtr)->Array = Json->GetArrayField(JsonKey);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ bool MCPJson::PopulateFromJson(MCPProperty& P, const FJsonObject* Json, bool All
|
|||||||
{ DoubleProp->SetPropertyValue(ValuePtr, D); return true; }
|
{ DoubleProp->SetPropertyValue(ValuePtr, D); return true; }
|
||||||
if (FByteProperty* ByteProp = CastField<FByteProperty>(P.Prop))
|
if (FByteProperty* ByteProp = CastField<FByteProperty>(P.Prop))
|
||||||
{ ByteProp->SetPropertyValue(ValuePtr, (uint8)D); return true; }
|
{ ByteProp->SetPropertyValue(ValuePtr, (uint8)D); return true; }
|
||||||
UMCPServer::Printf(TEXT("ERROR: '%s' received a number but expects %s\n"), *JsonKey, *P.Prop->GetCPPType());
|
UWingServer::Printf(TEXT("ERROR: '%s' received a number but expects %s\n"), *JsonKey, *P.Prop->GetCPPType());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ bool MCPJson::PopulateFromJson(MCPProperty& P, const FJsonObject* Json, bool All
|
|||||||
{
|
{
|
||||||
if (FBoolProperty* BoolProp = CastField<FBoolProperty>(P.Prop))
|
if (FBoolProperty* BoolProp = CastField<FBoolProperty>(P.Prop))
|
||||||
{ BoolProp->SetPropertyValue(ValuePtr, JsonValue->AsBool()); return true; }
|
{ BoolProp->SetPropertyValue(ValuePtr, JsonValue->AsBool()); return true; }
|
||||||
UMCPServer::Printf(TEXT("ERROR: '%s' received a boolean but expects %s\n"), *JsonKey, *P.Prop->GetCPPType());
|
UWingServer::Printf(TEXT("ERROR: '%s' received a boolean but expects %s\n"), *JsonKey, *P.Prop->GetCPPType());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,18 +80,18 @@ bool MCPJson::PopulateFromJson(MCPProperty& P, const FJsonObject* Json, bool All
|
|||||||
return P.SetText(JsonValue->AsString());
|
return P.SetText(JsonValue->AsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT("ERROR: '%s' must be a string, number, or boolean\n"), *JsonKey);
|
UWingServer::Printf(TEXT("ERROR: '%s' must be a string, number, or boolean\n"), *JsonKey);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPJson::PopulateFromJson(
|
bool WingJson::PopulateFromJson(
|
||||||
TArray<MCPProperty>& Props, const FJsonObject* Json, bool AllOptional)
|
TArray<WingProperty>& Props, const FJsonObject* Json, bool AllOptional)
|
||||||
{
|
{
|
||||||
bool Ok = true;
|
bool Ok = true;
|
||||||
|
|
||||||
// Build a set of known property names for the unknown-field check.
|
// Build a set of known property names for the unknown-field check.
|
||||||
TSet<FString> KnownKeys;
|
TSet<FString> KnownKeys;
|
||||||
for (const MCPProperty& P : Props)
|
for (const WingProperty& P : Props)
|
||||||
KnownKeys.Add(P.Prop->GetName());
|
KnownKeys.Add(P.Prop->GetName());
|
||||||
|
|
||||||
// Check for unknown fields in the JSON
|
// Check for unknown fields in the JSON
|
||||||
@@ -99,33 +99,33 @@ bool MCPJson::PopulateFromJson(
|
|||||||
{
|
{
|
||||||
if (!KnownKeys.Contains(KV.Key))
|
if (!KnownKeys.Contains(KV.Key))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Unknown parameter '%s'\n"), *KV.Key);
|
UWingServer::Printf(TEXT("ERROR: Unknown parameter '%s'\n"), *KV.Key);
|
||||||
Ok = false;
|
Ok = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate each property from JSON
|
// Populate each property from JSON
|
||||||
for (MCPProperty& P : Props)
|
for (WingProperty& P : Props)
|
||||||
{
|
{
|
||||||
if (!PopulateFromJson(P, Json, AllOptional)) Ok = false;
|
if (!PopulateFromJson(P, Json, AllOptional)) Ok = false;
|
||||||
}
|
}
|
||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPJson::PopulateFromJson(
|
bool WingJson::PopulateFromJson(
|
||||||
UStruct* StructType, void* Container, const FJsonObject* Json)
|
UStruct* StructType, void* Container, const FJsonObject* Json)
|
||||||
{
|
{
|
||||||
TArray<MCPProperty> Props = MCPProperty::GetAll(StructType, Container, (EPropertyFlags)0);
|
TArray<WingProperty> Props = WingProperty::GetAll(StructType, Container, (EPropertyFlags)0);
|
||||||
return PopulateFromJson(Props, Json);
|
return PopulateFromJson(Props, Json);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPJson::PopulateFromJson(
|
bool WingJson::PopulateFromJson(
|
||||||
UStruct* StructType, void* Container,
|
UStruct* StructType, void* Container,
|
||||||
const TSharedPtr<FJsonValue>& JsonValue)
|
const TSharedPtr<FJsonValue>& JsonValue)
|
||||||
{
|
{
|
||||||
if (!JsonValue.IsValid() || (JsonValue->Type != EJson::Object))
|
if (!JsonValue.IsValid() || (JsonValue->Type != EJson::Object))
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Expected a JSON object\n"));
|
UWingServer::Print(TEXT("ERROR: Expected a JSON object\n"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return PopulateFromJson(StructType, Container, JsonValue->AsObject().Get());
|
return PopulateFromJson(StructType, Container, JsonValue->AsObject().Get());
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "MCPNotifier.h"
|
#include "WingNotifier.h"
|
||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
#include "MaterialEditingLibrary.h"
|
#include "MaterialEditingLibrary.h"
|
||||||
|
|
||||||
void MCPNotifier::AddTouchedObject(UObject* Obj)
|
void WingNotifier::AddTouchedObject(UObject* Obj)
|
||||||
{
|
{
|
||||||
if (!Obj) return;
|
if (!Obj) return;
|
||||||
bool bAlreadyInSet = false;
|
bool bAlreadyInSet = false;
|
||||||
@@ -16,7 +16,7 @@ void MCPNotifier::AddTouchedObject(UObject* Obj)
|
|||||||
Obj->PreEditChange(nullptr);
|
Obj->PreEditChange(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPNotifier::SendNotifications()
|
void WingNotifier::SendNotifications()
|
||||||
{
|
{
|
||||||
TSet<UEdGraphNode*> Nodes;
|
TSet<UEdGraphNode*> Nodes;
|
||||||
TSet<UEdGraph*> Graphs;
|
TSet<UEdGraph*> Graphs;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "MCPProperty.h"
|
#include "WingProperty.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Materials/MaterialExpression.h"
|
#include "Materials/MaterialExpression.h"
|
||||||
#include "MaterialGraph/MaterialGraphNode.h"
|
#include "MaterialGraph/MaterialGraphNode.h"
|
||||||
@@ -14,20 +14,20 @@ static bool IsPinTypeProperty(FProperty* Prop)
|
|||||||
return StructProp && StructProp->Struct == FEdGraphPinType::StaticStruct();
|
return StructProp && StructProp->Struct == FEdGraphPinType::StaticStruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPProperty::MCPProperty(FProperty* InProp, void* InContainer)
|
WingProperty::WingProperty(FProperty* InProp, void* InContainer)
|
||||||
: Prop(InProp), Container(InContainer) {}
|
: Prop(InProp), Container(InContainer) {}
|
||||||
|
|
||||||
FString MCPProperty::GetText() const
|
FString WingProperty::GetText() const
|
||||||
{
|
{
|
||||||
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(Container);
|
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(Container);
|
||||||
if (IsPinTypeProperty(Prop))
|
if (IsPinTypeProperty(Prop))
|
||||||
return UMCPTypes::TypeToText(*static_cast<FEdGraphPinType*>(ValuePtr));
|
return UWingTypes::TypeToText(*static_cast<FEdGraphPinType*>(ValuePtr));
|
||||||
FString Result;
|
FString Result;
|
||||||
Prop->ExportTextItem_Direct(Result, ValuePtr, nullptr, nullptr, PPF_None);
|
Prop->ExportTextItem_Direct(Result, ValuePtr, nullptr, nullptr, PPF_None);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPProperty::TryParseEnum(UEnum* Enum, const FString& Text, int64 &OutValue)
|
bool WingProperty::TryParseEnum(UEnum* Enum, const FString& Text, int64 &OutValue)
|
||||||
{
|
{
|
||||||
int Index = Enum->GetIndexByNameString(Text);
|
int Index = Enum->GetIndexByNameString(Text);
|
||||||
if (Index == INDEX_NONE)
|
if (Index == INDEX_NONE)
|
||||||
@@ -40,7 +40,7 @@ bool MCPProperty::TryParseEnum(UEnum* Enum, const FString& Text, int64 &OutValue
|
|||||||
}
|
}
|
||||||
if (Index == INDEX_NONE)
|
if (Index == INDEX_NONE)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: '%s' is not a valid value for %s\n"),
|
UWingServer::Printf(TEXT("ERROR: '%s' is not a valid value for %s\n"),
|
||||||
*Text, *Enum->GetName());
|
*Text, *Enum->GetName());
|
||||||
OutValue = 0;
|
OutValue = 0;
|
||||||
return false;
|
return false;
|
||||||
@@ -52,13 +52,13 @@ bool MCPProperty::TryParseEnum(UEnum* Enum, const FString& Text, int64 &OutValue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPProperty::TrySetText(const FString &Value)
|
bool WingProperty::TrySetText(const FString &Value)
|
||||||
{
|
{
|
||||||
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(Container);
|
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(Container);
|
||||||
|
|
||||||
// Pin types get parsed by UMCPTypes.
|
// Pin types get parsed by UWingTypes.
|
||||||
if (IsPinTypeProperty(Prop))
|
if (IsPinTypeProperty(Prop))
|
||||||
return UMCPTypes::TextToType(Value, *static_cast<FEdGraphPinType*>(ValuePtr));
|
return UWingTypes::TextToType(Value, *static_cast<FEdGraphPinType*>(ValuePtr));
|
||||||
|
|
||||||
// Byte Enum types get parsed by TryParseEnum, above.
|
// Byte Enum types get parsed by TryParseEnum, above.
|
||||||
if (FByteProperty* ByteProp = CastField<FByteProperty>(Prop))
|
if (FByteProperty* ByteProp = CastField<FByteProperty>(Prop))
|
||||||
@@ -85,14 +85,14 @@ bool MCPProperty::TrySetText(const FString &Value)
|
|||||||
const TCHAR* Result = Prop->ImportText_Direct(*Value, ValuePtr, nullptr, PPF_None);
|
const TCHAR* Result = Prop->ImportText_Direct(*Value, ValuePtr, nullptr, PPF_None);
|
||||||
if (!Result)
|
if (!Result)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Failed to parse '%s' for property '%s' (type: %s)\n"),
|
UWingServer::Printf(TEXT("ERROR: Failed to parse '%s' for property '%s' (type: %s)\n"),
|
||||||
*Value, *MCPUtils::FormatName(Prop), *Prop->GetCPPType());
|
*Value, *WingUtils::FormatName(Prop), *Prop->GetCPPType());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPProperty::SetText(const FString& Value)
|
bool WingProperty::SetText(const FString& Value)
|
||||||
{
|
{
|
||||||
if (!TrySetText(Value)) return false;
|
if (!TrySetText(Value)) return false;
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ bool MCPProperty::SetText(const FString& Value)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPProperty::Collect(UStruct* StructType, void* Container, TArray<MCPProperty> &Props, EPropertyFlags Flags)
|
void WingProperty::Collect(UStruct* StructType, void* Container, TArray<WingProperty> &Props, EPropertyFlags Flags)
|
||||||
{
|
{
|
||||||
for (TFieldIterator<FProperty> It(StructType); It; ++It)
|
for (TFieldIterator<FProperty> It(StructType); It; ++It)
|
||||||
{
|
{
|
||||||
@@ -114,15 +114,15 @@ void MCPProperty::Collect(UStruct* StructType, void* Container, TArray<MCPProper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPProperty::Remove(TArray<MCPProperty>& Props, const FString& Name)
|
void WingProperty::Remove(TArray<WingProperty>& Props, const FString& Name)
|
||||||
{
|
{
|
||||||
Props.RemoveAll([&](const MCPProperty& P) { return P.Prop->GetName() == Name; });
|
Props.RemoveAll([&](const WingProperty& P) { return P.Prop->GetName() == Name; });
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<MCPProperty> MCPProperty::GetAll(UObject* Obj, EPropertyFlags Flags)
|
TArray<WingProperty> WingProperty::GetAll(UObject* Obj, EPropertyFlags Flags)
|
||||||
{
|
{
|
||||||
if (!Obj) return {};
|
if (!Obj) return {};
|
||||||
TArray<MCPProperty> Result;
|
TArray<WingProperty> Result;
|
||||||
|
|
||||||
// Blueprints don't have editable properties. So
|
// Blueprints don't have editable properties. So
|
||||||
// instead, we fetch properties from the generated CDO,
|
// instead, we fetch properties from the generated CDO,
|
||||||
@@ -132,7 +132,7 @@ TArray<MCPProperty> MCPProperty::GetAll(UObject* Obj, EPropertyFlags Flags)
|
|||||||
{
|
{
|
||||||
if (BP->GeneratedClass == nullptr)
|
if (BP->GeneratedClass == nullptr)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Blueprint '%s' has no GeneratedClass\n"), *Obj->GetName());
|
UWingServer::Printf(TEXT("ERROR: Blueprint '%s' has no GeneratedClass\n"), *Obj->GetName());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
Obj = BP->GeneratedClass->GetDefaultObject();
|
Obj = BP->GeneratedClass->GetDefaultObject();
|
||||||
@@ -153,42 +153,42 @@ TArray<MCPProperty> MCPProperty::GetAll(UObject* Obj, EPropertyFlags Flags)
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<MCPProperty> MCPProperty::GetAll(UStruct* StructType, void* Container, EPropertyFlags Flags)
|
TArray<WingProperty> WingProperty::GetAll(UStruct* StructType, void* Container, EPropertyFlags Flags)
|
||||||
{
|
{
|
||||||
TArray<MCPProperty> Result;
|
TArray<WingProperty> Result;
|
||||||
Collect(StructType, Container, Result, Flags);
|
Collect(StructType, Container, Result, Flags);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<MCPProperty> MCPProperty::FindAllSubstring(const TArray<MCPProperty>& Props, const FString& Substring)
|
TArray<WingProperty> WingProperty::FindAllSubstring(const TArray<WingProperty>& Props, const FString& Substring)
|
||||||
{
|
{
|
||||||
if (Substring.IsEmpty()) return Props;
|
if (Substring.IsEmpty()) return Props;
|
||||||
TArray<MCPProperty> Result;
|
TArray<WingProperty> Result;
|
||||||
for (const MCPProperty& P : Props)
|
for (const WingProperty& P : Props)
|
||||||
{
|
{
|
||||||
if (MCPUtils::FormatName(P.Prop).Contains(Substring, ESearchCase::IgnoreCase))
|
if (WingUtils::FormatName(P.Prop).Contains(Substring, ESearchCase::IgnoreCase))
|
||||||
Result.Add(P);
|
Result.Add(P);
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCPProperty MCPProperty::FindOneExactMatch(const TArray<MCPProperty>& Props, const FString& Name)
|
WingProperty WingProperty::FindOneExactMatch(const TArray<WingProperty>& Props, const FString& Name)
|
||||||
{
|
{
|
||||||
TArray<MCPProperty> Matches;
|
TArray<WingProperty> Matches;
|
||||||
for (const MCPProperty& P : Props)
|
for (const WingProperty& P : Props)
|
||||||
{
|
{
|
||||||
if (MCPUtils::Identifies(Name, P.Prop))
|
if (WingUtils::Identifies(Name, P.Prop))
|
||||||
Matches.Add(P);
|
Matches.Add(P);
|
||||||
}
|
}
|
||||||
if (Matches.Num() == 0)
|
if (Matches.Num() == 0)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Property '%s' not found\n"), *Name);
|
UWingServer::Printf(TEXT("ERROR: Property '%s' not found\n"), *Name);
|
||||||
return MCPProperty();
|
return WingProperty();
|
||||||
}
|
}
|
||||||
if (Matches.Num() > 1)
|
if (Matches.Num() > 1)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Ambiguous property '%s'\n"), *Name);
|
UWingServer::Printf(TEXT("ERROR: Ambiguous property '%s'\n"), *Name);
|
||||||
return MCPProperty();
|
return WingProperty();
|
||||||
}
|
}
|
||||||
return Matches[0];
|
return Matches[0];
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "LogCapture.h"
|
#include "LogCapture.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "UObject/StrongObjectPtr.h"
|
#include "UObject/StrongObjectPtr.h"
|
||||||
#include "Materials/MaterialExpression.h"
|
#include "Materials/MaterialExpression.h"
|
||||||
#include "AssetRegistry/AssetRegistryModule.h"
|
#include "AssetRegistry/AssetRegistryModule.h"
|
||||||
@@ -100,20 +100,20 @@
|
|||||||
#include "AnimationGraph.h"
|
#include "AnimationGraph.h"
|
||||||
#include "AnimationTransitionGraph.h"
|
#include "AnimationTransitionGraph.h"
|
||||||
|
|
||||||
UMCPServer* UMCPServer::GMCPServer = nullptr;
|
UWingServer* UWingServer::GWingServer = nullptr;
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// Initialization and Shutdown
|
// Initialization and Shutdown
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
void UMCPServer::Initialize(FSubsystemCollectionBase& Collection)
|
void UWingServer::Initialize(FSubsystemCollectionBase& Collection)
|
||||||
{
|
{
|
||||||
Super::Initialize(Collection);
|
Super::Initialize(Collection);
|
||||||
GMCPServer = this;
|
GWingServer = this;
|
||||||
|
|
||||||
// Create TCP listen socket
|
// Create TCP listen socket
|
||||||
ISocketSubsystem* SocketSub = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM);
|
ISocketSubsystem* SocketSub = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM);
|
||||||
ListenSocket = SocketSub->CreateSocket(NAME_Stream, TEXT("MCPServer"), false);
|
ListenSocket = SocketSub->CreateSocket(NAME_Stream, TEXT("WingServer"), false);
|
||||||
if (!ListenSocket)
|
if (!ListenSocket)
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Error, TEXT("BlueprintMCP: Failed to create listen socket"));
|
UE_LOG(LogTemp, Error, TEXT("BlueprintMCP: Failed to create listen socket"));
|
||||||
@@ -144,14 +144,14 @@ void UMCPServer::Initialize(FSubsystemCollectionBase& Collection)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildMCPHandlerRegistry();
|
BuildWingHandlerRegistry();
|
||||||
LogCapture.bEnabled = false;
|
LogCapture.bEnabled = false;
|
||||||
LogCapture.Install();
|
LogCapture.Install();
|
||||||
bRunning = true;
|
bRunning = true;
|
||||||
UE_LOG(LogTemp, Display, TEXT("BlueprintMCP: MCP server listening on tcp://localhost:%d"), Port);
|
UE_LOG(LogTemp, Display, TEXT("BlueprintMCP: MCP server listening on tcp://localhost:%d"), Port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMCPServer::Deinitialize()
|
void UWingServer::Deinitialize()
|
||||||
{
|
{
|
||||||
if (!bRunning)
|
if (!bRunning)
|
||||||
{
|
{
|
||||||
@@ -203,7 +203,7 @@ void UMCPServer::Deinitialize()
|
|||||||
LogCapture.Uninstall();
|
LogCapture.Uninstall();
|
||||||
bRunning = false;
|
bRunning = false;
|
||||||
bShuttingDown = false;
|
bShuttingDown = false;
|
||||||
GMCPServer = nullptr;
|
GWingServer = nullptr;
|
||||||
UE_LOG(LogTemp, Display, TEXT("BlueprintMCP: Server stopped."));
|
UE_LOG(LogTemp, Display, TEXT("BlueprintMCP: Server stopped."));
|
||||||
Super::Deinitialize();
|
Super::Deinitialize();
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ void UMCPServer::Deinitialize()
|
|||||||
// FTickableEditorObject interface
|
// FTickableEditorObject interface
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
void UMCPServer::Tick(float DeltaTime)
|
void UWingServer::Tick(float DeltaTime)
|
||||||
{
|
{
|
||||||
// Accept new connections (non-blocking)
|
// Accept new connections (non-blocking)
|
||||||
AcceptNewConnections();
|
AcceptNewConnections();
|
||||||
@@ -239,26 +239,26 @@ void UMCPServer::Tick(float DeltaTime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMCPServer::TickServer(float DeltaTime)
|
void UWingServer::TickServer(float DeltaTime)
|
||||||
{
|
{
|
||||||
if (GMCPServer) GMCPServer->Tick(DeltaTime);
|
if (GWingServer) GWingServer->Tick(DeltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPServer::IsTickable() const
|
bool UWingServer::IsTickable() const
|
||||||
{
|
{
|
||||||
return bRunning;
|
return bRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
TStatId UMCPServer::GetStatId() const
|
TStatId UWingServer::GetStatId() const
|
||||||
{
|
{
|
||||||
RETURN_QUICK_DECLARE_CYCLE_STAT(UMCPServer, STATGROUP_Tickables);
|
RETURN_QUICK_DECLARE_CYCLE_STAT(UWingServer, STATGROUP_Tickables);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// HandleRequest — Given a command, execute it.
|
// HandleRequest — Given a command, execute it.
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
FString UMCPServer::HandleRequest(const FString& Line)
|
FString UWingServer::HandleRequest(const FString& Line)
|
||||||
{
|
{
|
||||||
LogCapture.CapturedErrors.Empty();
|
LogCapture.CapturedErrors.Empty();
|
||||||
LogCapture.bEnabled = true;
|
LogCapture.bEnabled = true;
|
||||||
@@ -270,7 +270,7 @@ FString UMCPServer::HandleRequest(const FString& Line)
|
|||||||
LogCapture.bEnabled = false;
|
LogCapture.bEnabled = false;
|
||||||
for (const FString& Msg : LogCapture.CapturedErrors)
|
for (const FString& Msg : LogCapture.CapturedErrors)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("UE_LOG: %s\n"), *Msg);
|
UWingServer::Printf(TEXT("UE_LOG: %s\n"), *Msg);
|
||||||
}
|
}
|
||||||
LogCapture.CapturedErrors.Empty();
|
LogCapture.CapturedErrors.Empty();
|
||||||
FString Result = HandlerOutput.ToString();
|
FString Result = HandlerOutput.ToString();
|
||||||
@@ -282,7 +282,7 @@ FString UMCPServer::HandleRequest(const FString& Line)
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMCPServer::TryCallHandler(const FString &Line)
|
void UWingServer::TryCallHandler(const FString &Line)
|
||||||
{
|
{
|
||||||
// Turn the request string into a JSON tree.
|
// Turn the request string into a JSON tree.
|
||||||
TSharedPtr<FJsonObject> Request;
|
TSharedPtr<FJsonObject> Request;
|
||||||
@@ -290,7 +290,7 @@ void UMCPServer::TryCallHandler(const FString &Line)
|
|||||||
FJsonSerializer::Deserialize(Reader, Request);
|
FJsonSerializer::Deserialize(Reader, Request);
|
||||||
if (!Request.IsValid())
|
if (!Request.IsValid())
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Request is not valid JSON"));
|
UWingServer::Printf(TEXT("Request is not valid JSON"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,28 +298,28 @@ void UMCPServer::TryCallHandler(const FString &Line)
|
|||||||
FString Command;
|
FString Command;
|
||||||
if (!Request->TryGetStringField(TEXT("command"), Command))
|
if (!Request->TryGetStringField(TEXT("command"), Command))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Request does not contain 'command' parameter"));
|
UWingServer::Printf(TEXT("Request does not contain 'command' parameter"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Request->RemoveField(TEXT("command"));
|
Request->RemoveField(TEXT("command"));
|
||||||
|
|
||||||
// Find the handler UClass for the specified command.
|
// Find the handler UClass for the specified command.
|
||||||
UClass** HandlerClass = MCPHandlerRegistry.Find(Command);
|
UClass** HandlerClass = WingHandlerRegistry.Find(Command);
|
||||||
if (!HandlerClass)
|
if (!HandlerClass)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("Unknown command: %s"), *Command);
|
UWingServer::Printf(TEXT("Unknown command: %s"), *Command);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make an object of the handler class.
|
// Make an object of the handler class.
|
||||||
TStrongObjectPtr<UObject> HandlerObj(NewObject<UObject>(GetTransientPackage(), *HandlerClass));
|
TStrongObjectPtr<UObject> HandlerObj(NewObject<UObject>(GetTransientPackage(), *HandlerClass));
|
||||||
IMCPHandler* Handler = Cast<IMCPHandler>(HandlerObj.Get());
|
IWingHandler* Handler = Cast<IWingHandler>(HandlerObj.Get());
|
||||||
|
|
||||||
// Populate the handler object with the request parameters.
|
// Populate the handler object with the request parameters.
|
||||||
if (!MCPJson::PopulateFromJson(HandlerObj->GetClass(), HandlerObj.Get(), &*Request))
|
if (!WingJson::PopulateFromJson(HandlerObj->GetClass(), HandlerObj.Get(), &*Request))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("\nUsage:\n\n"));
|
UWingServer::Printf(TEXT("\nUsage:\n\n"));
|
||||||
MCPUtils::FormatCommandHelp(*HandlerClass);
|
WingUtils::FormatCommandHelp(*HandlerClass);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ void UMCPServer::TryCallHandler(const FString &Line)
|
|||||||
// Connection Maintenance
|
// Connection Maintenance
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
void UMCPServer::AcceptNewConnections()
|
void UWingServer::AcceptNewConnections()
|
||||||
{
|
{
|
||||||
if (!ListenSocket) return;
|
if (!ListenSocket) return;
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ void UMCPServer::AcceptNewConnections()
|
|||||||
UE_LOG(LogTemp, Display, TEXT("BlueprintMCP: Client connected."));
|
UE_LOG(LogTemp, Display, TEXT("BlueprintMCP: Client connected."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMCPServer::CleanupFinishedClients()
|
void UWingServer::CleanupFinishedClients()
|
||||||
{
|
{
|
||||||
ISocketSubsystem* SocketSub = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM);
|
ISocketSubsystem* SocketSub = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM);
|
||||||
|
|
||||||
@@ -368,7 +368,7 @@ void UMCPServer::CleanupFinishedClients()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMCPServer::ClientThreadFunc(UMCPServer* Server, TSharedPtr<FClientConnection> Client)
|
void UWingServer::ClientThreadFunc(UWingServer* Server, TSharedPtr<FClientConnection> Client)
|
||||||
{
|
{
|
||||||
FSocket* Socket = Client->Socket;
|
FSocket* Socket = Client->Socket;
|
||||||
FString LineBuffer;
|
FString LineBuffer;
|
||||||
@@ -405,7 +405,7 @@ void UMCPServer::ClientThreadFunc(UMCPServer* Server, TSharedPtr<FClientConnecti
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enqueue the line for game-thread processing
|
// Enqueue the line for game-thread processing
|
||||||
TSharedPtr<UMCPServer::FPendingMessage> Msg = MakeShared<UMCPServer::FPendingMessage>();
|
TSharedPtr<UWingServer::FPendingMessage> Msg = MakeShared<UWingServer::FPendingMessage>();
|
||||||
Msg->Line = Line;
|
Msg->Line = Line;
|
||||||
TFuture<FString> Future = Msg->Response.GetFuture();
|
TFuture<FString> Future = Msg->Response.GetFuture();
|
||||||
|
|
||||||
@@ -435,13 +435,13 @@ void UMCPServer::ClientThreadFunc(UMCPServer* Server, TSharedPtr<FClientConnecti
|
|||||||
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// BuildMCPHandlerRegistry
|
// BuildWingHandlerRegistry
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
void UMCPServer::BuildMCPHandlerRegistry()
|
void UWingServer::BuildWingHandlerRegistry()
|
||||||
{
|
{
|
||||||
for (UClass* Class : MCPUtils::CollectHandlerClasses())
|
for (UClass* Class : WingUtils::CollectHandlerClasses())
|
||||||
{
|
{
|
||||||
MCPHandlerRegistry.FindOrAdd(MCPUtils::GetHandlerName(Class)) = Class;
|
WingHandlerRegistry.FindOrAdd(WingUtils::GetHandlerName(Class)) = Class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "MCPToolMenu.h"
|
#include "WingToolMenu.h"
|
||||||
#include "ToolMenuEntry.h"
|
#include "ToolMenuEntry.h"
|
||||||
#include "ToolMenuDelegates.h"
|
#include "ToolMenuDelegates.h"
|
||||||
#include "ToolMenuContext.h"
|
#include "ToolMenuContext.h"
|
||||||
#include "ToolMenus.h"
|
#include "ToolMenus.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "EdGraph/EdGraphSchema.h"
|
#include "EdGraph/EdGraphSchema.h"
|
||||||
#include "EdGraphSchema_K2.h"
|
#include "EdGraphSchema_K2.h"
|
||||||
#include "Framework/Commands/UIAction.h"
|
#include "Framework/Commands/UIAction.h"
|
||||||
@@ -16,14 +16,14 @@
|
|||||||
// &FToolMenuEntry::Action is legal as a template argument in an
|
// &FToolMenuEntry::Action is legal as a template argument in an
|
||||||
// explicit instantiation, even though Action is private.
|
// explicit instantiation, even though Action is private.
|
||||||
//
|
//
|
||||||
// The MCPPrivateAccessor template captures the member pointer and exposes it
|
// The WingPrivateAccessor template captures the member pointer and exposes it
|
||||||
// through a friend function that we can call from normal code.
|
// through a friend function that we can call from normal code.
|
||||||
//
|
//
|
||||||
// See: https://bloglitb.blogspot.com/2011/12/access-to-private-members-safer.html
|
// See: https://bloglitb.blogspot.com/2011/12/access-to-private-members-safer.html
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
template<typename Tag, typename Tag::type M>
|
template<typename Tag, typename Tag::type M>
|
||||||
struct MCPPrivateAccessor
|
struct WingPrivateAccessor
|
||||||
{
|
{
|
||||||
friend typename Tag::type GetPtr(Tag) { return M; }
|
friend typename Tag::type GetPtr(Tag) { return M; }
|
||||||
};
|
};
|
||||||
@@ -35,7 +35,7 @@ struct Tag_FToolMenuEntry_Action
|
|||||||
using type = FToolUIActionChoice FToolMenuEntry::*;
|
using type = FToolUIActionChoice FToolMenuEntry::*;
|
||||||
friend type GetPtr(Tag_FToolMenuEntry_Action);
|
friend type GetPtr(Tag_FToolMenuEntry_Action);
|
||||||
};
|
};
|
||||||
template struct MCPPrivateAccessor<Tag_FToolMenuEntry_Action, &FToolMenuEntry::Action>;
|
template struct WingPrivateAccessor<Tag_FToolMenuEntry_Action, &FToolMenuEntry::Action>;
|
||||||
|
|
||||||
static const FToolUIActionChoice& GetAction(const FToolMenuEntry& Entry)
|
static const FToolUIActionChoice& GetAction(const FToolMenuEntry& Entry)
|
||||||
{
|
{
|
||||||
@@ -49,7 +49,7 @@ struct Tag_FToolMenuEntry_Command
|
|||||||
using type = TSharedPtr<const FUICommandInfo> FToolMenuEntry::*;
|
using type = TSharedPtr<const FUICommandInfo> FToolMenuEntry::*;
|
||||||
friend type GetPtr(Tag_FToolMenuEntry_Command);
|
friend type GetPtr(Tag_FToolMenuEntry_Command);
|
||||||
};
|
};
|
||||||
template struct MCPPrivateAccessor<Tag_FToolMenuEntry_Command, &FToolMenuEntry::Command>;
|
template struct WingPrivateAccessor<Tag_FToolMenuEntry_Command, &FToolMenuEntry::Command>;
|
||||||
|
|
||||||
static bool HasCommand(const FToolMenuEntry& Entry)
|
static bool HasCommand(const FToolMenuEntry& Entry)
|
||||||
{
|
{
|
||||||
@@ -63,7 +63,7 @@ static bool HasCommand(const FToolMenuEntry& Entry)
|
|||||||
// the LLM can easily remember what to type.
|
// the LLM can easily remember what to type.
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
FText MCPToolMenu::MakeBetterLabel(const UEdGraphPin *Pin, const FText &EntryLabel)
|
FText WingToolMenu::MakeBetterLabel(const UEdGraphPin *Pin, const FText &EntryLabel)
|
||||||
{
|
{
|
||||||
FString Sanitized = EntryLabel.ToString();
|
FString Sanitized = EntryLabel.ToString();
|
||||||
int32 Dst = 0;
|
int32 Dst = 0;
|
||||||
@@ -88,7 +88,7 @@ FText MCPToolMenu::MakeBetterLabel(const UEdGraphPin *Pin, const FText &EntryLab
|
|||||||
Sanitized.LeftInline(Dst);
|
Sanitized.LeftInline(Dst);
|
||||||
if (Pin)
|
if (Pin)
|
||||||
{
|
{
|
||||||
Sanitized = FString::Printf(TEXT("Pin:%s:%s"), *MCPUtils::FormatName(Pin), *Sanitized);
|
Sanitized = FString::Printf(TEXT("Pin:%s:%s"), *WingUtils::FormatName(Pin), *Sanitized);
|
||||||
}
|
}
|
||||||
return FText::FromString(Sanitized);
|
return FText::FromString(Sanitized);
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ FText MCPToolMenu::MakeBetterLabel(const UEdGraphPin *Pin, const FText &EntryLab
|
|||||||
// Check if an array of entries contains a specific label.
|
// Check if an array of entries contains a specific label.
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
bool MCPToolMenu::ContainsText(const TArray<FText> &Texts, const FText &Value)
|
bool WingToolMenu::ContainsText(const TArray<FText> &Texts, const FText &Value)
|
||||||
{
|
{
|
||||||
for (const FText &Text : Texts)
|
for (const FText &Text : Texts)
|
||||||
{
|
{
|
||||||
@@ -113,7 +113,7 @@ bool MCPToolMenu::ContainsText(const TArray<FText> &Texts, const FText &Value)
|
|||||||
// AddEntry — create a synthetic menu entry with a direct action.
|
// AddEntry — create a synthetic menu entry with a direct action.
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
void MCPToolMenu::AddEntry(TArray<FToolMenuEntry>& Entries, UEdGraphPin* Pin,
|
void WingToolMenu::AddEntry(TArray<FToolMenuEntry>& Entries, UEdGraphPin* Pin,
|
||||||
const TCHAR* Label, FCanExecuteAction CanExec, FExecuteAction Exec)
|
const TCHAR* Label, FCanExecuteAction CanExec, FExecuteAction Exec)
|
||||||
{
|
{
|
||||||
if (!CanExec.Execute())
|
if (!CanExec.Execute())
|
||||||
@@ -127,7 +127,7 @@ void MCPToolMenu::AddEntry(TArray<FToolMenuEntry>& Entries, UEdGraphPin* Pin,
|
|||||||
Entries.Add(MoveTemp(Entry));
|
Entries.Add(MoveTemp(Entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPToolMenu::AddSyntheticEntries(TArray<FToolMenuEntry> &Entries, UEdGraphNode *NodePtr)
|
void WingToolMenu::AddSyntheticEntries(TArray<FToolMenuEntry> &Entries, UEdGraphNode *NodePtr)
|
||||||
{
|
{
|
||||||
const UEdGraphSchema_K2 *K2Schema = Cast<UEdGraphSchema_K2>(NodePtr->GetSchema());
|
const UEdGraphSchema_K2 *K2Schema = Cast<UEdGraphSchema_K2>(NodePtr->GetSchema());
|
||||||
if (K2Schema == nullptr) return;
|
if (K2Schema == nullptr) return;
|
||||||
@@ -150,7 +150,7 @@ void MCPToolMenu::AddSyntheticEntries(TArray<FToolMenuEntry> &Entries, UEdGraphN
|
|||||||
// do anything with the labels yet.
|
// do anything with the labels yet.
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
TArray<FToolMenuEntry> MCPToolMenu::GetMenuItems(
|
TArray<FToolMenuEntry> WingToolMenu::GetMenuItems(
|
||||||
UGraphNodeContextMenuContext* GNC, const FToolMenuContext &TMC)
|
UGraphNodeContextMenuContext* GNC, const FToolMenuContext &TMC)
|
||||||
{
|
{
|
||||||
TArray<FToolMenuEntry> Result;
|
TArray<FToolMenuEntry> Result;
|
||||||
@@ -164,7 +164,7 @@ TArray<FToolMenuEntry> MCPToolMenu::GetMenuItems(
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<FToolMenuEntry> MCPToolMenu::GetMenuItems(UEdGraphNode *Node, const FToolMenuContext &Context)
|
TArray<FToolMenuEntry> WingToolMenu::GetMenuItems(UEdGraphNode *Node, const FToolMenuContext &Context)
|
||||||
{
|
{
|
||||||
// Create the two context objects.
|
// Create the two context objects.
|
||||||
TArray<FToolMenuEntry> Result;
|
TArray<FToolMenuEntry> Result;
|
||||||
@@ -192,7 +192,7 @@ TArray<FToolMenuEntry> MCPToolMenu::GetMenuItems(UEdGraphNode *Node, const FTool
|
|||||||
for (const UEdGraphPin *Pin : Node->Pins)
|
for (const UEdGraphPin *Pin : Node->Pins)
|
||||||
{
|
{
|
||||||
if (Pin->bHidden) continue;
|
if (Pin->bHidden) continue;
|
||||||
FString PinName = MCPUtils::FormatName(Pin);
|
FString PinName = WingUtils::FormatName(Pin);
|
||||||
GNC->Init(Node->GetGraph(), Node, Pin, false);
|
GNC->Init(Node->GetGraph(), Node, Pin, false);
|
||||||
TArray<FToolMenuEntry> PinEntries = GetMenuItems(GNC, Context);
|
TArray<FToolMenuEntry> PinEntries = GetMenuItems(GNC, Context);
|
||||||
for (FToolMenuEntry &PinEntry : PinEntries)
|
for (FToolMenuEntry &PinEntry : PinEntries)
|
||||||
@@ -225,7 +225,7 @@ TArray<FToolMenuEntry> MCPToolMenu::GetMenuItems(UEdGraphNode *Node, const FTool
|
|||||||
// selection/focus state which we can't reliably provide.
|
// selection/focus state which we can't reliably provide.
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
bool MCPToolMenu::CanExecute(const FToolMenuEntry& Entry, const FToolMenuContext& Context)
|
bool WingToolMenu::CanExecute(const FToolMenuEntry& Entry, const FToolMenuContext& Context)
|
||||||
{
|
{
|
||||||
if (HasCommand(Entry))
|
if (HasCommand(Entry))
|
||||||
return false;
|
return false;
|
||||||
@@ -252,7 +252,7 @@ bool MCPToolMenu::CanExecute(const FToolMenuEntry& Entry, const FToolMenuContext
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPToolMenu::Execute(const FToolMenuEntry& Entry, const FToolMenuContext& Context)
|
bool WingToolMenu::Execute(const FToolMenuEntry& Entry, const FToolMenuContext& Context)
|
||||||
{
|
{
|
||||||
if (HasCommand(Entry))
|
if (HasCommand(Entry))
|
||||||
return false;
|
return false;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "Editor.h"
|
#include "Editor.h"
|
||||||
#include "EdGraphSchema_K2.h"
|
#include "EdGraphSchema_K2.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// Choose Short Name
|
// Choose Short Name
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
FString UMCPTypes::GetNameWithoutUnderscoreC(const UObject *Obj)
|
FString UWingTypes::GetNameWithoutUnderscoreC(const UObject *Obj)
|
||||||
{
|
{
|
||||||
FString Name = Obj->GetName();
|
FString Name = Obj->GetName();
|
||||||
if (Name.EndsWith(TEXT("_C")))
|
if (Name.EndsWith(TEXT("_C")))
|
||||||
@@ -23,13 +23,13 @@ FString UMCPTypes::GetNameWithoutUnderscoreC(const UObject *Obj)
|
|||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMCPTypes::ReserveShortName(FName Name)
|
void UWingTypes::ReserveShortName(FName Name)
|
||||||
{
|
{
|
||||||
FString NameStr = Name.ToString();
|
FString NameStr = Name.ToString();
|
||||||
ShortToPath.Add(NameStr.ToLower(), FString(TEXT("PRIMITIVE")));
|
ShortToPath.Add(NameStr.ToLower(), FString(TEXT("PRIMITIVE")));
|
||||||
}
|
}
|
||||||
|
|
||||||
FString UMCPTypes::ChooseShortName(const UObject* Obj)
|
FString UWingTypes::ChooseShortName(const UObject* Obj)
|
||||||
{
|
{
|
||||||
if (!Cast<UScriptStruct>(Obj) && !Cast<UClass>(Obj) && !Cast<UEnum>(Obj))
|
if (!Cast<UScriptStruct>(Obj) && !Cast<UClass>(Obj) && !Cast<UEnum>(Obj))
|
||||||
return FString();
|
return FString();
|
||||||
@@ -61,7 +61,7 @@ FString UMCPTypes::ChooseShortName(const UObject* Obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMCPTypes::ChooseShortNames(UPackage* Package)
|
void UWingTypes::ChooseShortNames(UPackage* Package)
|
||||||
{
|
{
|
||||||
if (Package == nullptr) return;
|
if (Package == nullptr) return;
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ void UMCPTypes::ChooseShortNames(UPackage* Package)
|
|||||||
// TypeToText
|
// TypeToText
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
FString UMCPTypes::TypeToTextInner(FName Category, FName SubCategory, UObject* SubCategoryObject)
|
FString UWingTypes::TypeToTextInner(FName Category, FName SubCategory, UObject* SubCategoryObject)
|
||||||
{
|
{
|
||||||
if ((Category == UEdGraphSchema_K2::PC_Boolean) ||
|
if ((Category == UEdGraphSchema_K2::PC_Boolean) ||
|
||||||
(Category == UEdGraphSchema_K2::PC_Int) ||
|
(Category == UEdGraphSchema_K2::PC_Int) ||
|
||||||
@@ -131,9 +131,9 @@ FString UMCPTypes::TypeToTextInner(FName Category, FName SubCategory, UObject* S
|
|||||||
return FString();
|
return FString();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString UMCPTypes::TypeToText(const FEdGraphPinType& PinType)
|
FString UWingTypes::TypeToText(const FEdGraphPinType& PinType)
|
||||||
{
|
{
|
||||||
UMCPTypes* Types = GEditor->GetEditorSubsystem<UMCPTypes>();
|
UWingTypes* Types = GEditor->GetEditorSubsystem<UWingTypes>();
|
||||||
if (!Types) return FString();
|
if (!Types) return FString();
|
||||||
|
|
||||||
FString Inner = Types->TypeToTextInner(PinType.PinCategory, PinType.PinSubCategory, PinType.PinSubCategoryObject.Get());
|
FString Inner = Types->TypeToTextInner(PinType.PinCategory, PinType.PinSubCategory, PinType.PinSubCategoryObject.Get());
|
||||||
@@ -158,7 +158,7 @@ FString UMCPTypes::TypeToText(const FEdGraphPinType& PinType)
|
|||||||
return Inner;
|
return Inner;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString UMCPTypes::TypeToText(const FProperty *Property)
|
FString UWingTypes::TypeToText(const FProperty *Property)
|
||||||
{
|
{
|
||||||
FEdGraphPinType PinType;
|
FEdGraphPinType PinType;
|
||||||
if (!GetDefault<UEdGraphSchema_K2>()->ConvertPropertyToPinType(Property, PinType))
|
if (!GetDefault<UEdGraphSchema_K2>()->ConvertPropertyToPinType(Property, PinType))
|
||||||
@@ -171,9 +171,9 @@ FString UMCPTypes::TypeToText(const FProperty *Property)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FString UMCPTypes::TypeToText(const UObject* Obj)
|
FString UWingTypes::TypeToText(const UObject* Obj)
|
||||||
{
|
{
|
||||||
UMCPTypes* Types = GEditor->GetEditorSubsystem<UMCPTypes>();
|
UWingTypes* Types = GEditor->GetEditorSubsystem<UWingTypes>();
|
||||||
if (!Types) return FString();
|
if (!Types) return FString();
|
||||||
return Types->ChooseShortName(Obj);
|
return Types->ChooseShortName(Obj);
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ FString UMCPTypes::TypeToText(const UObject* Obj)
|
|||||||
// Subsystem lifecycle
|
// Subsystem lifecycle
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
void UMCPTypes::Initialize(FSubsystemCollectionBase& Collection)
|
void UWingTypes::Initialize(FSubsystemCollectionBase& Collection)
|
||||||
{
|
{
|
||||||
Super::Initialize(Collection);
|
Super::Initialize(Collection);
|
||||||
|
|
||||||
@@ -212,10 +212,10 @@ void UMCPTypes::Initialize(FSubsystemCollectionBase& Collection)
|
|||||||
for (UPackage* Pkg : Packages)
|
for (UPackage* Pkg : Packages)
|
||||||
ChooseShortNames(Pkg);
|
ChooseShortNames(Pkg);
|
||||||
|
|
||||||
UE_LOG(LogTemp, Display, TEXT("MCPTypes: Registered %d types"), ShortToPath.Num());
|
UE_LOG(LogTemp, Display, TEXT("WingTypes: Registered %d types"), ShortToPath.Num());
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMCPTypes::Deinitialize()
|
void UWingTypes::Deinitialize()
|
||||||
{
|
{
|
||||||
Super::Deinitialize();
|
Super::Deinitialize();
|
||||||
}
|
}
|
||||||
@@ -224,7 +224,7 @@ void UMCPTypes::Deinitialize()
|
|||||||
// Tokenizer
|
// Tokenizer
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
void UMCPTypes::Tokenize(const FString& Input)
|
void UWingTypes::Tokenize(const FString& Input)
|
||||||
{
|
{
|
||||||
Tokens.Empty();
|
Tokens.Empty();
|
||||||
Cursor = 0;
|
Cursor = 0;
|
||||||
@@ -262,7 +262,7 @@ void UMCPTypes::Tokenize(const FString& Input)
|
|||||||
// Path to Object Conversion
|
// Path to Object Conversion
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool UMCPTypes::ResolvePath(const FString &Name, const FString &Path, FEdGraphPinType &OutType)
|
bool UWingTypes::ResolvePath(const FString &Name, const FString &Path, FEdGraphPinType &OutType)
|
||||||
{
|
{
|
||||||
// Load the object.
|
// Load the object.
|
||||||
UObject* Obj = LoadObject<UObject>(nullptr, *Path);
|
UObject* Obj = LoadObject<UObject>(nullptr, *Path);
|
||||||
@@ -314,13 +314,13 @@ bool UMCPTypes::ResolvePath(const FString &Name, const FString &Path, FEdGraphPi
|
|||||||
// Parsing Types
|
// Parsing Types
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool UMCPTypes::TokenIs(const TCHAR* Text) const
|
bool UWingTypes::TokenIs(const TCHAR* Text) const
|
||||||
{
|
{
|
||||||
if (Cursor >= Tokens.Num()) return false;
|
if (Cursor >= Tokens.Num()) return false;
|
||||||
return Tokens[Cursor].Equals(Text, ESearchCase::IgnoreCase);
|
return Tokens[Cursor].Equals(Text, ESearchCase::IgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::TokenIs(const TCHAR* Text, TCHAR Next) const
|
bool UWingTypes::TokenIs(const TCHAR* Text, TCHAR Next) const
|
||||||
{
|
{
|
||||||
if (Cursor >= Tokens.Num() - 1) return false;
|
if (Cursor >= Tokens.Num() - 1) return false;
|
||||||
return (Tokens[Cursor].Equals(Text, ESearchCase::IgnoreCase)) &&
|
return (Tokens[Cursor].Equals(Text, ESearchCase::IgnoreCase)) &&
|
||||||
@@ -328,20 +328,20 @@ bool UMCPTypes::TokenIs(const TCHAR* Text, TCHAR Next) const
|
|||||||
(Tokens[Cursor+1][0] == Next);
|
(Tokens[Cursor+1][0] == Next);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::TokenIs(TCHAR Next) const
|
bool UWingTypes::TokenIs(TCHAR Next) const
|
||||||
{
|
{
|
||||||
if (Cursor >= Tokens.Num()) return false;
|
if (Cursor >= Tokens.Num()) return false;
|
||||||
return (Tokens[Cursor].Len() == 1) &&
|
return (Tokens[Cursor].Len() == 1) &&
|
||||||
(Tokens[Cursor][0] == Next);
|
(Tokens[Cursor][0] == Next);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::TokenIsID() const
|
bool UWingTypes::TokenIsID() const
|
||||||
{
|
{
|
||||||
if (Cursor >= Tokens.Num()) return false;
|
if (Cursor >= Tokens.Num()) return false;
|
||||||
return FChar::IsAlnum(Tokens[Cursor][0]);
|
return FChar::IsAlnum(Tokens[Cursor][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::ParseEOF()
|
bool UWingTypes::ParseEOF()
|
||||||
{
|
{
|
||||||
if (Cursor != Tokens.Num())
|
if (Cursor != Tokens.Num())
|
||||||
{
|
{
|
||||||
@@ -351,7 +351,7 @@ bool UMCPTypes::ParseEOF()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::ParseChar(TCHAR c)
|
bool UWingTypes::ParseChar(TCHAR c)
|
||||||
{
|
{
|
||||||
if (!TokenIs(c))
|
if (!TokenIs(c))
|
||||||
{
|
{
|
||||||
@@ -362,7 +362,7 @@ bool UMCPTypes::ParseChar(TCHAR c)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::ParsePlainIdentifier(FEdGraphPinType& OutType)
|
bool UWingTypes::ParsePlainIdentifier(FEdGraphPinType& OutType)
|
||||||
{
|
{
|
||||||
if (!TokenIsID())
|
if (!TokenIsID())
|
||||||
{
|
{
|
||||||
@@ -394,7 +394,7 @@ bool UMCPTypes::ParsePlainIdentifier(FEdGraphPinType& OutType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::ParseWrapped(FName Wrapper, FEdGraphPinType& OutType)
|
bool UWingTypes::ParseWrapped(FName Wrapper, FEdGraphPinType& OutType)
|
||||||
{
|
{
|
||||||
Cursor++;
|
Cursor++;
|
||||||
if (!ParseChar('<')) return false;
|
if (!ParseChar('<')) return false;
|
||||||
@@ -409,7 +409,7 @@ bool UMCPTypes::ParseWrapped(FName Wrapper, FEdGraphPinType& OutType)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::ParseMaybeWrapped(FEdGraphPinType& OutType)
|
bool UWingTypes::ParseMaybeWrapped(FEdGraphPinType& OutType)
|
||||||
{
|
{
|
||||||
if (TokenIs(TEXT("Soft"), '<'))
|
if (TokenIs(TEXT("Soft"), '<'))
|
||||||
{
|
{
|
||||||
@@ -426,7 +426,7 @@ bool UMCPTypes::ParseMaybeWrapped(FEdGraphPinType& OutType)
|
|||||||
else return ParsePlainIdentifier(OutType);
|
else return ParsePlainIdentifier(OutType);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::ParseArrayOrSet(FEdGraphPinType& OutType)
|
bool UWingTypes::ParseArrayOrSet(FEdGraphPinType& OutType)
|
||||||
{
|
{
|
||||||
Cursor++;
|
Cursor++;
|
||||||
if (!ParseChar('<')) return false;
|
if (!ParseChar('<')) return false;
|
||||||
@@ -435,7 +435,7 @@ bool UMCPTypes::ParseArrayOrSet(FEdGraphPinType& OutType)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::ParseMap(FEdGraphPinType& OutType)
|
bool UWingTypes::ParseMap(FEdGraphPinType& OutType)
|
||||||
{
|
{
|
||||||
Cursor++;
|
Cursor++;
|
||||||
if (!ParseChar('<')) return false;
|
if (!ParseChar('<')) return false;
|
||||||
@@ -450,7 +450,7 @@ bool UMCPTypes::ParseMap(FEdGraphPinType& OutType)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::ParseType(FEdGraphPinType& OutType)
|
bool UWingTypes::ParseType(FEdGraphPinType& OutType)
|
||||||
{
|
{
|
||||||
if (TokenIs(TEXT("Array"), '<'))
|
if (TokenIs(TEXT("Array"), '<'))
|
||||||
{
|
{
|
||||||
@@ -475,9 +475,9 @@ bool UMCPTypes::ParseType(FEdGraphPinType& OutType)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString UMCPTypes::TryTextToType(const FString& Text, FEdGraphPinType& OutPinType)
|
FString UWingTypes::TryTextToType(const FString& Text, FEdGraphPinType& OutPinType)
|
||||||
{
|
{
|
||||||
UMCPTypes* Types = GEditor->GetEditorSubsystem<UMCPTypes>();
|
UWingTypes* Types = GEditor->GetEditorSubsystem<UWingTypes>();
|
||||||
check(Types);
|
check(Types);
|
||||||
Types->Error.Empty();
|
Types->Error.Empty();
|
||||||
Types->Tokenize(Text);
|
Types->Tokenize(Text);
|
||||||
@@ -486,15 +486,15 @@ FString UMCPTypes::TryTextToType(const FString& Text, FEdGraphPinType& OutPinTyp
|
|||||||
return FString();
|
return FString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMCPTypes::TextToType(const FString& Text, FEdGraphPinType& OutPinType)
|
bool UWingTypes::TextToType(const FString& Text, FEdGraphPinType& OutPinType)
|
||||||
{
|
{
|
||||||
FString Error = TryTextToType(Text, OutPinType);
|
FString Error = TryTextToType(Text, OutPinType);
|
||||||
if (Error.IsEmpty()) return true;
|
if (Error.IsEmpty()) return true;
|
||||||
UMCPServer::Print(Error);
|
UWingServer::Print(Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UClass* UMCPTypes::TextToOneObjectType(const FString& Text)
|
UClass* UWingTypes::TextToOneObjectType(const FString& Text)
|
||||||
{
|
{
|
||||||
FEdGraphPinType PinType;
|
FEdGraphPinType PinType;
|
||||||
if (!TextToType(Text, PinType)) return nullptr;
|
if (!TextToType(Text, PinType)) return nullptr;
|
||||||
@@ -502,13 +502,13 @@ UClass* UMCPTypes::TextToOneObjectType(const FString& Text)
|
|||||||
if ((!Class) || (PinType.PinCategory != UEdGraphSchema_K2::PC_Object) ||
|
if ((!Class) || (PinType.PinCategory != UEdGraphSchema_K2::PC_Object) ||
|
||||||
(PinType.IsContainer()))
|
(PinType.IsContainer()))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: '%s' is not a plain object class\n"), *Text);
|
UWingServer::Printf(TEXT("ERROR: '%s' is not a plain object class\n"), *Text);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return Class;
|
return Class;
|
||||||
}
|
}
|
||||||
|
|
||||||
UClass* UMCPTypes::TextToOneInterfaceType(const FString& Text)
|
UClass* UWingTypes::TextToOneInterfaceType(const FString& Text)
|
||||||
{
|
{
|
||||||
FEdGraphPinType PinType;
|
FEdGraphPinType PinType;
|
||||||
if (!TextToType(Text, PinType)) return nullptr;
|
if (!TextToType(Text, PinType)) return nullptr;
|
||||||
@@ -516,7 +516,7 @@ UClass* UMCPTypes::TextToOneInterfaceType(const FString& Text)
|
|||||||
if ((!Class) || (PinType.PinCategory != UEdGraphSchema_K2::PC_Interface) ||
|
if ((!Class) || (PinType.PinCategory != UEdGraphSchema_K2::PC_Interface) ||
|
||||||
(PinType.IsContainer()))
|
(PinType.IsContainer()))
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: '%s' is not an interface class\n"), *Text);
|
UWingServer::Printf(TEXT("ERROR: '%s' is not an interface class\n"), *Text);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return Class;
|
return Class;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "MCPJson.h"
|
#include "WingJson.h"
|
||||||
#include "MCPTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "MCPHandler.h"
|
#include "WingHandler.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Engine/MemberReference.h"
|
#include "Engine/MemberReference.h"
|
||||||
#include "Engine/World.h"
|
#include "Engine/World.h"
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
#include "Animation/BlendSpace.h"
|
#include "Animation/BlendSpace.h"
|
||||||
#include "Engine/Texture.h"
|
#include "Engine/Texture.h"
|
||||||
|
|
||||||
// SEH support (Windows only) — defined in BlueprintMCPServer.cpp
|
// SEH support (Windows only) — defined in BlueprintWingServer.cpp
|
||||||
#if PLATFORM_WINDOWS
|
#if PLATFORM_WINDOWS
|
||||||
extern int32 TryCompileBlueprintSEH(UBlueprint* BP, EBlueprintCompileOptions Opts);
|
extern int32 TryCompileBlueprintSEH(UBlueprint* BP, EBlueprintCompileOptions Opts);
|
||||||
extern int32 TrySavePackageSEH(
|
extern int32 TrySavePackageSEH(
|
||||||
@@ -53,7 +53,7 @@ extern int32 TrySavePackageSEH(
|
|||||||
// Name Formatting
|
// Name Formatting
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
void MCPUtils::SanitizeNameInPlace(FString &Name)
|
void WingUtils::SanitizeNameInPlace(FString &Name)
|
||||||
{
|
{
|
||||||
int32 Dst = 0;
|
int32 Dst = 0;
|
||||||
for (int32 Src = 0; Src < Name.Len(); Src++)
|
for (int32 Src = 0; Src < Name.Len(); Src++)
|
||||||
@@ -70,123 +70,123 @@ void MCPUtils::SanitizeNameInPlace(FString &Name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UWorld *World)
|
FString WingUtils::FormatName(const UWorld *World)
|
||||||
{
|
{
|
||||||
return World->GetPathName();
|
return World->GetPathName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UBlueprint *BP)
|
FString WingUtils::FormatName(const UBlueprint *BP)
|
||||||
{
|
{
|
||||||
return BP->GetPathName();
|
return BP->GetPathName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UActorComponent *C)
|
FString WingUtils::FormatName(const UActorComponent *C)
|
||||||
{
|
{
|
||||||
return C->GetName();
|
return C->GetName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UEdGraph *Graph)
|
FString WingUtils::FormatName(const UEdGraph *Graph)
|
||||||
{
|
{
|
||||||
FString Name = Graph->GetName();
|
FString Name = Graph->GetName();
|
||||||
SanitizeNameInPlace(Name);
|
SanitizeNameInPlace(Name);
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UEdGraphNode* Node)
|
FString WingUtils::FormatName(const UEdGraphNode* Node)
|
||||||
{
|
{
|
||||||
return Node->GetName();
|
return Node->GetName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UEdGraphPin *Pin)
|
FString WingUtils::FormatName(const UEdGraphPin *Pin)
|
||||||
{
|
{
|
||||||
FString Name = Pin->PinName.ToString();
|
FString Name = Pin->PinName.ToString();
|
||||||
SanitizeNameInPlace(Name);
|
SanitizeNameInPlace(Name);
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const FMemberReference &Ref)
|
FString WingUtils::FormatName(const FMemberReference &Ref)
|
||||||
{
|
{
|
||||||
FString Name = Ref.GetMemberName().ToString();
|
FString Name = Ref.GetMemberName().ToString();
|
||||||
SanitizeNameInPlace(Name);
|
SanitizeNameInPlace(Name);
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const FBPVariableDescription &Var)
|
FString WingUtils::FormatName(const FBPVariableDescription &Var)
|
||||||
{
|
{
|
||||||
FString Name = Var.VarName.ToString();
|
FString Name = Var.VarName.ToString();
|
||||||
SanitizeNameInPlace(Name);
|
SanitizeNameInPlace(Name);
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UStruct *Struct)
|
FString WingUtils::FormatName(const UStruct *Struct)
|
||||||
{
|
{
|
||||||
FString Name = Struct->GetName();
|
FString Name = Struct->GetName();
|
||||||
SanitizeNameInPlace(Name);
|
SanitizeNameInPlace(Name);
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UMaterial *Material)
|
FString WingUtils::FormatName(const UMaterial *Material)
|
||||||
{
|
{
|
||||||
return Material->GetPathName();
|
return Material->GetPathName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UMaterialInstance *MaterialInstance)
|
FString WingUtils::FormatName(const UMaterialInstance *MaterialInstance)
|
||||||
{
|
{
|
||||||
return MaterialInstance->GetPathName();
|
return MaterialInstance->GetPathName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UMaterialFunction *MaterialFunction)
|
FString WingUtils::FormatName(const UMaterialFunction *MaterialFunction)
|
||||||
{
|
{
|
||||||
return MaterialFunction->GetPathName();
|
return MaterialFunction->GetPathName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UMaterialExpression *Expression)
|
FString WingUtils::FormatName(const UMaterialExpression *Expression)
|
||||||
{
|
{
|
||||||
FString Name = Expression->GetName();
|
FString Name = Expression->GetName();
|
||||||
SanitizeNameInPlace(Name);
|
SanitizeNameInPlace(Name);
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UStaticMesh *Mesh)
|
FString WingUtils::FormatName(const UStaticMesh *Mesh)
|
||||||
{
|
{
|
||||||
return Mesh->GetPathName();
|
return Mesh->GetPathName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const USkeletalMesh *Mesh)
|
FString WingUtils::FormatName(const USkeletalMesh *Mesh)
|
||||||
{
|
{
|
||||||
return Mesh->GetPathName();
|
return Mesh->GetPathName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UAnimSequence *Anim)
|
FString WingUtils::FormatName(const UAnimSequence *Anim)
|
||||||
{
|
{
|
||||||
return Anim->GetPathName();
|
return Anim->GetPathName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UBlendSpace *BlendSpace)
|
FString WingUtils::FormatName(const UBlendSpace *BlendSpace)
|
||||||
{
|
{
|
||||||
return BlendSpace->GetPathName();
|
return BlendSpace->GetPathName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UTexture *Texture)
|
FString WingUtils::FormatName(const UTexture *Texture)
|
||||||
{
|
{
|
||||||
return Texture->GetPathName();
|
return Texture->GetPathName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UScriptStruct *Struct)
|
FString WingUtils::FormatName(const UScriptStruct *Struct)
|
||||||
{
|
{
|
||||||
FString Name = Struct->GetName();
|
FString Name = Struct->GetName();
|
||||||
SanitizeNameInPlace(Name);
|
SanitizeNameInPlace(Name);
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const UEnum *Enum)
|
FString WingUtils::FormatName(const UEnum *Enum)
|
||||||
{
|
{
|
||||||
FString Name = Enum->GetName();
|
FString Name = Enum->GetName();
|
||||||
SanitizeNameInPlace(Name);
|
SanitizeNameInPlace(Name);
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MCPUtils::FormatName(const FProperty *Prop)
|
FString WingUtils::FormatName(const FProperty *Prop)
|
||||||
{
|
{
|
||||||
return Prop->GetName();
|
return Prop->GetName();
|
||||||
}
|
}
|
||||||
@@ -195,10 +195,10 @@ FString MCPUtils::FormatName(const FProperty *Prop)
|
|||||||
// Identifies
|
// Identifies
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
// Most types are handled by the template in MCPUtils.h.
|
// Most types are handled by the template in WingUtils.h.
|
||||||
// UEdGraphNode also matches by GUID:
|
// UEdGraphNode also matches by GUID:
|
||||||
|
|
||||||
bool MCPUtils::Identifies(const FString &Name, const UEdGraphNode* Node)
|
bool WingUtils::Identifies(const FString &Name, const UEdGraphNode* Node)
|
||||||
{
|
{
|
||||||
if (Node->NodeGuid.ToString().Equals(Name, ESearchCase::IgnoreCase))
|
if (Node->NodeGuid.ToString().Equals(Name, ESearchCase::IgnoreCase))
|
||||||
return true;
|
return true;
|
||||||
@@ -210,7 +210,7 @@ bool MCPUtils::Identifies(const FString &Name, const UEdGraphNode* Node)
|
|||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
|
|
||||||
FString MCPUtils::FormatNodeTitle(const UEdGraphNode *Node)
|
FString WingUtils::FormatNodeTitle(const UEdGraphNode *Node)
|
||||||
{
|
{
|
||||||
FString Title = Node->GetNodeTitle(ENodeTitleType::FullTitle).ToString();
|
FString Title = Node->GetNodeTitle(ENodeTitleType::FullTitle).ToString();
|
||||||
int32 NewlineIdx;
|
int32 NewlineIdx;
|
||||||
@@ -227,7 +227,7 @@ FString MCPUtils::FormatNodeTitle(const UEdGraphNode *Node)
|
|||||||
// Text formatting
|
// Text formatting
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
FString MCPUtils::WrapText(const FString& Text, int32 ColLimit, const FString& Prefix)
|
FString WingUtils::WrapText(const FString& Text, int32 ColLimit, const FString& Prefix)
|
||||||
{
|
{
|
||||||
FString Clean = Text;
|
FString Clean = Text;
|
||||||
Clean.ReplaceInline(TEXT("\r\n"), TEXT("\n"));
|
Clean.ReplaceInline(TEXT("\r\n"), TEXT("\n"));
|
||||||
@@ -263,7 +263,7 @@ FString MCPUtils::WrapText(const FString& Text, int32 ColLimit, const FString& P
|
|||||||
// Enum helpers
|
// Enum helpers
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
FString MCPUtils::EnumToString(UEnum* Enum, int64 Value, const FString& Prefix)
|
FString WingUtils::EnumToString(UEnum* Enum, int64 Value, const FString& Prefix)
|
||||||
{
|
{
|
||||||
FString Full = Enum->GetNameStringByValue(Value);
|
FString Full = Enum->GetNameStringByValue(Value);
|
||||||
if (!Prefix.IsEmpty() && Full.StartsWith(Prefix))
|
if (!Prefix.IsEmpty() && Full.StartsWith(Prefix))
|
||||||
@@ -271,12 +271,12 @@ FString MCPUtils::EnumToString(UEnum* Enum, int64 Value, const FString& Prefix)
|
|||||||
return Full;
|
return Full;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPUtils::StringToEnum(UEnum* Enum, const FString& Str, int64& OutValue, const FString& Prefix)
|
bool WingUtils::StringToEnum(UEnum* Enum, const FString& Str, int64& OutValue, const FString& Prefix)
|
||||||
{
|
{
|
||||||
OutValue = Enum->GetValueByNameString(Prefix + Str);
|
OutValue = Enum->GetValueByNameString(Prefix + Str);
|
||||||
if (OutValue == INDEX_NONE)
|
if (OutValue == INDEX_NONE)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Invalid value '%s' for %s\n"), *Str, *Enum->GetName());
|
UWingServer::Printf(TEXT("ERROR: Invalid value '%s' for %s\n"), *Str, *Enum->GetName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -286,14 +286,14 @@ bool MCPUtils::StringToEnum(UEnum* Enum, const FString& Str, int64& OutValue, co
|
|||||||
// Blueprint helpers
|
// Blueprint helpers
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
TArray<UEdGraph*> MCPUtils::AllGraphs(UBlueprint* BP)
|
TArray<UEdGraph*> WingUtils::AllGraphs(UBlueprint* BP)
|
||||||
{
|
{
|
||||||
TArray<UEdGraph*> Graphs;
|
TArray<UEdGraph*> Graphs;
|
||||||
BP->GetAllGraphs(Graphs);
|
BP->GetAllGraphs(Graphs);
|
||||||
return Graphs;
|
return Graphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<UEdGraph*> MCPUtils::AllGraphsNamed(UBlueprint* BP, const FString& Name)
|
TArray<UEdGraph*> WingUtils::AllGraphsNamed(UBlueprint* BP, const FString& Name)
|
||||||
{
|
{
|
||||||
TArray<UEdGraph*> Result;
|
TArray<UEdGraph*> Result;
|
||||||
for (UEdGraph* Graph : AllGraphs(BP))
|
for (UEdGraph* Graph : AllGraphs(BP))
|
||||||
@@ -302,7 +302,7 @@ TArray<UEdGraph*> MCPUtils::AllGraphsNamed(UBlueprint* BP, const FString& Name)
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<UEdGraphNode*> MCPUtils::AllNodes(UBlueprint* BP)
|
TArray<UEdGraphNode*> WingUtils::AllNodes(UBlueprint* BP)
|
||||||
{
|
{
|
||||||
TArray<UEdGraphNode*> Nodes;
|
TArray<UEdGraphNode*> Nodes;
|
||||||
for (UEdGraph* Graph : AllGraphs(BP))
|
for (UEdGraph* Graph : AllGraphs(BP))
|
||||||
@@ -310,7 +310,7 @@ TArray<UEdGraphNode*> MCPUtils::AllNodes(UBlueprint* BP)
|
|||||||
return Nodes;
|
return Nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPUtils::SaveBlueprintPackage(UBlueprint* BP)
|
bool WingUtils::SaveBlueprintPackage(UBlueprint* BP)
|
||||||
{
|
{
|
||||||
UPackage* Package = BP->GetPackage();
|
UPackage* Package = BP->GetPackage();
|
||||||
UE_LOG(LogTemp, Display, TEXT("BlueprintMCP: SaveBlueprintPackage — begin for '%s'"), *BP->GetName());
|
UE_LOG(LogTemp, Display, TEXT("BlueprintMCP: SaveBlueprintPackage — begin for '%s'"), *BP->GetName());
|
||||||
@@ -440,7 +440,7 @@ bool MCPUtils::SaveBlueprintPackage(UBlueprint* BP)
|
|||||||
// FindClassByName
|
// FindClassByName
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
UClass* MCPUtils::FindClassByName(const FString& ClassName)
|
UClass* WingUtils::FindClassByName(const FString& ClassName)
|
||||||
{
|
{
|
||||||
// Exact match first (handles both C++ classes and Blueprint _C classes)
|
// Exact match first (handles both C++ classes and Blueprint _C classes)
|
||||||
for (TObjectIterator<UClass> It; It; ++It)
|
for (TObjectIterator<UClass> It; It; ++It)
|
||||||
@@ -469,7 +469,7 @@ UClass* MCPUtils::FindClassByName(const FString& ClassName)
|
|||||||
// Material helpers
|
// Material helpers
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
void MCPUtils::EnsureMaterialGraph(UMaterial* Material)
|
void WingUtils::EnsureMaterialGraph(UMaterial* Material)
|
||||||
{
|
{
|
||||||
if (!Material) return;
|
if (!Material) return;
|
||||||
if (!Material->MaterialGraph)
|
if (!Material->MaterialGraph)
|
||||||
@@ -486,7 +486,7 @@ void MCPUtils::EnsureMaterialGraph(UMaterial* Material)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UMaterial* MCPUtils::ReplaceMaterialWithTransientCopy(UMaterial* Material)
|
UMaterial* WingUtils::ReplaceMaterialWithTransientCopy(UMaterial* Material)
|
||||||
{
|
{
|
||||||
if (!Material) return nullptr;
|
if (!Material) return nullptr;
|
||||||
|
|
||||||
@@ -514,7 +514,7 @@ UMaterial* MCPUtils::ReplaceMaterialWithTransientCopy(UMaterial* Material)
|
|||||||
return Material;
|
return Material;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPUtils::SaveGenericPackage(UObject* Asset)
|
bool WingUtils::SaveGenericPackage(UObject* Asset)
|
||||||
{
|
{
|
||||||
if (!Asset) return false;
|
if (!Asset) return false;
|
||||||
UPackage* Package = Asset->GetPackage();
|
UPackage* Package = Asset->GetPackage();
|
||||||
@@ -556,7 +556,7 @@ bool MCPUtils::SaveGenericPackage(UObject* Asset)
|
|||||||
// Anim blueprint helpers
|
// Anim blueprint helpers
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
UAnimationStateMachineGraph* MCPUtils::FindStateMachineGraph(UBlueprint* BP, const FString& GraphName)
|
UAnimationStateMachineGraph* WingUtils::FindStateMachineGraph(UBlueprint* BP, const FString& GraphName)
|
||||||
{
|
{
|
||||||
TArray<UEdGraph*> AllGraphs;
|
TArray<UEdGraph*> AllGraphs;
|
||||||
BP->GetAllGraphs(AllGraphs);
|
BP->GetAllGraphs(AllGraphs);
|
||||||
@@ -573,7 +573,7 @@ UAnimationStateMachineGraph* MCPUtils::FindStateMachineGraph(UBlueprint* BP, con
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
UAnimStateNode* MCPUtils::FindStateByName(UAnimationStateMachineGraph* SMGraph, const FString& StateName)
|
UAnimStateNode* WingUtils::FindStateByName(UAnimationStateMachineGraph* SMGraph, const FString& StateName)
|
||||||
{
|
{
|
||||||
for (UEdGraphNode* Node : SMGraph->Nodes)
|
for (UEdGraphNode* Node : SMGraph->Nodes)
|
||||||
{
|
{
|
||||||
@@ -585,11 +585,11 @@ UAnimStateNode* MCPUtils::FindStateByName(UAnimationStateMachineGraph* SMGraph,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UMCPServer::Printf(TEXT("ERROR: State '%s' not found in graph '%s'\n"), *StateName, *SMGraph->GetName());
|
UWingServer::Printf(TEXT("ERROR: State '%s' not found in graph '%s'\n"), *StateName, *SMGraph->GetName());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
UAnimStateTransitionNode* MCPUtils::FindTransition(UAnimationStateMachineGraph* SMGraph,
|
UAnimStateTransitionNode* WingUtils::FindTransition(UAnimationStateMachineGraph* SMGraph,
|
||||||
const FString& FromStateName, const FString& ToStateName)
|
const FString& FromStateName, const FString& ToStateName)
|
||||||
{
|
{
|
||||||
for (UEdGraphNode* Node : SMGraph->Nodes)
|
for (UEdGraphNode* Node : SMGraph->Nodes)
|
||||||
@@ -613,7 +613,7 @@ UAnimStateTransitionNode* MCPUtils::FindTransition(UAnimationStateMachineGraph*
|
|||||||
// Graph actions (node spawning)
|
// Graph actions (node spawning)
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
FString MCPUtils::ActionFullName(const TSharedPtr<FEdGraphSchemaAction>& Action)
|
FString WingUtils::ActionFullName(const TSharedPtr<FEdGraphSchemaAction>& Action)
|
||||||
{
|
{
|
||||||
FString Category = Action->GetCategory().ToString();
|
FString Category = Action->GetCategory().ToString();
|
||||||
FString MenuName = Action->GetMenuDescription().ToString();
|
FString MenuName = Action->GetMenuDescription().ToString();
|
||||||
@@ -622,7 +622,7 @@ FString MCPUtils::ActionFullName(const TSharedPtr<FEdGraphSchemaAction>& Action)
|
|||||||
return Category + TEXT("|") + MenuName;
|
return Category + TEXT("|") + MenuName;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<TSharedPtr<FEdGraphSchemaAction>> MCPUtils::SearchGraphActions(UEdGraph* Graph, const FString& Query, int32 MaxResults, bool ExactMatch)
|
TArray<TSharedPtr<FEdGraphSchemaAction>> WingUtils::SearchGraphActions(UEdGraph* Graph, const FString& Query, int32 MaxResults, bool ExactMatch)
|
||||||
{
|
{
|
||||||
FString QueryLower = Query.ToLower();
|
FString QueryLower = Query.ToLower();
|
||||||
TArray<TSharedPtr<FEdGraphSchemaAction>> Result;
|
TArray<TSharedPtr<FEdGraphSchemaAction>> Result;
|
||||||
@@ -663,17 +663,17 @@ TArray<TSharedPtr<FEdGraphSchemaAction>> MCPUtils::SearchGraphActions(UEdGraph*
|
|||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// CollectHandlerClasses — find all concrete IMCPHandler classes
|
// CollectHandlerClasses — find all concrete IWingHandler classes
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
TArray<UClass*> MCPUtils::CollectHandlerClasses()
|
TArray<UClass*> WingUtils::CollectHandlerClasses()
|
||||||
{
|
{
|
||||||
TArray<UClass*> Result;
|
TArray<UClass*> Result;
|
||||||
for (TObjectIterator<UClass> It; It; ++It)
|
for (TObjectIterator<UClass> It; It; ++It)
|
||||||
{
|
{
|
||||||
UClass* Class = *It;
|
UClass* Class = *It;
|
||||||
if (Class->HasAnyClassFlags(CLASS_Abstract)) continue;
|
if (Class->HasAnyClassFlags(CLASS_Abstract)) continue;
|
||||||
if (!Class->ImplementsInterface(UMCPHandler::StaticClass())) continue;
|
if (!Class->ImplementsInterface(UWingHandler::StaticClass())) continue;
|
||||||
Result.Add(Class);
|
Result.Add(Class);
|
||||||
}
|
}
|
||||||
Result.Sort([](UClass& A, UClass& B) { return GetHandlerName(&A) < GetHandlerName(&B); });
|
Result.Sort([](UClass& A, UClass& B) { return GetHandlerName(&A) < GetHandlerName(&B); });
|
||||||
@@ -684,11 +684,11 @@ TArray<UClass*> MCPUtils::CollectHandlerClasses()
|
|||||||
// GetHandlerName — derive tool name from handler class name
|
// GetHandlerName — derive tool name from handler class name
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
FString MCPUtils::GetHandlerName(UClass* HandlerClass)
|
FString WingUtils::GetHandlerName(UClass* HandlerClass)
|
||||||
{
|
{
|
||||||
FString Name = HandlerClass->GetName();
|
FString Name = HandlerClass->GetName();
|
||||||
// Strip "MCP_" prefix
|
// Strip "Wing_" prefix
|
||||||
if (Name.StartsWith(TEXT("MCP_")))
|
if (Name.StartsWith(TEXT("Wing_")))
|
||||||
Name = Name.Mid(4);
|
Name = Name.Mid(4);
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
@@ -697,11 +697,11 @@ FString MCPUtils::GetHandlerName(UClass* HandlerClass)
|
|||||||
// GetHandlerGroup — derive group name from handler class name
|
// GetHandlerGroup — derive group name from handler class name
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
FString MCPUtils::GetHandlerGroup(UClass* HandlerClass)
|
FString WingUtils::GetHandlerGroup(UClass* HandlerClass)
|
||||||
{
|
{
|
||||||
FString Name = HandlerClass->GetName();
|
FString Name = HandlerClass->GetName();
|
||||||
// Strip "MCP_" prefix
|
// Strip "Wing_" prefix
|
||||||
if (Name.StartsWith(TEXT("MCP_")))
|
if (Name.StartsWith(TEXT("Wing_")))
|
||||||
Name = Name.Mid(4);
|
Name = Name.Mid(4);
|
||||||
// Everything before the underscore is the group
|
// Everything before the underscore is the group
|
||||||
int32 UnderscoreIdx;
|
int32 UnderscoreIdx;
|
||||||
@@ -718,11 +718,11 @@ FString MCPUtils::GetHandlerGroup(UClass* HandlerClass)
|
|||||||
// FindPropertyByName
|
// FindPropertyByName
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
FProperty* MCPUtils::FindPropertyByName(UObject* Obj, const FString& Name)
|
FProperty* WingUtils::FindPropertyByName(UObject* Obj, const FString& Name)
|
||||||
{
|
{
|
||||||
if (!Obj)
|
if (!Obj)
|
||||||
{
|
{
|
||||||
UMCPServer::Print(TEXT("ERROR: Object is null\n"));
|
UWingServer::Print(TEXT("ERROR: Object is null\n"));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -732,14 +732,14 @@ FProperty* MCPUtils::FindPropertyByName(UObject* Obj, const FString& Name)
|
|||||||
if (!Identifies(Name, *PropIt)) continue;
|
if (!Identifies(Name, *PropIt)) continue;
|
||||||
if (Found)
|
if (Found)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Ambiguous property '%s' on %s\n"), *Name, *FormatName(Obj->GetClass()));
|
UWingServer::Printf(TEXT("ERROR: Ambiguous property '%s' on %s\n"), *Name, *FormatName(Obj->GetClass()));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
Found = *PropIt;
|
Found = *PropIt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Found)
|
if (!Found)
|
||||||
UMCPServer::Printf(TEXT("ERROR: Property '%s' not found on %s\n"), *Name, *FormatName(Obj->GetClass()));
|
UWingServer::Printf(TEXT("ERROR: Property '%s' not found on %s\n"), *Name, *FormatName(Obj->GetClass()));
|
||||||
|
|
||||||
return Found;
|
return Found;
|
||||||
}
|
}
|
||||||
@@ -748,7 +748,7 @@ FProperty* MCPUtils::FindPropertyByName(UObject* Obj, const FString& Name)
|
|||||||
// GetPropertyValueText
|
// GetPropertyValueText
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
FString MCPUtils::GetPropertyValueText(UObject* Container, FProperty* Prop)
|
FString WingUtils::GetPropertyValueText(UObject* Container, FProperty* Prop)
|
||||||
{
|
{
|
||||||
FString Result;
|
FString Result;
|
||||||
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(Container);
|
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(Container);
|
||||||
@@ -760,26 +760,26 @@ FString MCPUtils::GetPropertyValueText(UObject* Container, FProperty* Prop)
|
|||||||
// SetPropertyValueText
|
// SetPropertyValueText
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
bool MCPUtils::SetPropertyValueText(UObject* Container, FProperty* Prop, const FString& Value)
|
bool WingUtils::SetPropertyValueText(UObject* Container, FProperty* Prop, const FString& Value)
|
||||||
{
|
{
|
||||||
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(Container);
|
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(Container);
|
||||||
const TCHAR* ImportResult = Prop->ImportText_Direct(*Value, ValuePtr, Container, PPF_None);
|
const TCHAR* ImportResult = Prop->ImportText_Direct(*Value, ValuePtr, Container, PPF_None);
|
||||||
if (!ImportResult)
|
if (!ImportResult)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Failed to parse '%s' for property '%s' (type: %s)\n"),
|
UWingServer::Printf(TEXT("ERROR: Failed to parse '%s' for property '%s' (type: %s)\n"),
|
||||||
*Value, *FormatName(Prop), *Prop->GetCPPType());
|
*Value, *FormatName(Prop), *Prop->GetCPPType());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCPUtils::SetPropertyValueText(void* Container, FProperty* Prop, const FString& Value, UObject* Owner)
|
bool WingUtils::SetPropertyValueText(void* Container, FProperty* Prop, const FString& Value, UObject* Owner)
|
||||||
{
|
{
|
||||||
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(Container);
|
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(Container);
|
||||||
const TCHAR* ImportResult = Prop->ImportText_Direct(*Value, ValuePtr, Owner, PPF_None);
|
const TCHAR* ImportResult = Prop->ImportText_Direct(*Value, ValuePtr, Owner, PPF_None);
|
||||||
if (!ImportResult)
|
if (!ImportResult)
|
||||||
{
|
{
|
||||||
UMCPServer::Printf(TEXT("ERROR: Failed to parse '%s' for property '%s' (type: %s)\n"),
|
UWingServer::Printf(TEXT("ERROR: Failed to parse '%s' for property '%s' (type: %s)\n"),
|
||||||
*Value, *FormatName(Prop), *Prop->GetCPPType());
|
*Value, *FormatName(Prop), *Prop->GetCPPType());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -790,7 +790,7 @@ bool MCPUtils::SetPropertyValueText(void* Container, FProperty* Prop, const FStr
|
|||||||
// SearchProperties
|
// SearchProperties
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
TArray<FProperty*> MCPUtils::SearchProperties(UObject* Obj, const FString& Query, EPropertyFlags Flags, bool bLocal)
|
TArray<FProperty*> WingUtils::SearchProperties(UObject* Obj, const FString& Query, EPropertyFlags Flags, bool bLocal)
|
||||||
{
|
{
|
||||||
TArray<FProperty*> Result;
|
TArray<FProperty*> Result;
|
||||||
if (!Obj) return Result;
|
if (!Obj) return Result;
|
||||||
@@ -812,43 +812,43 @@ TArray<FProperty*> MCPUtils::SearchProperties(UObject* Obj, const FString& Query
|
|||||||
// FormatCommandHelp — verbose description of one handler command
|
// FormatCommandHelp — verbose description of one handler command
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
void MCPUtils::FormatCommandHelp(UClass* HandlerClass)
|
void WingUtils::FormatCommandHelp(UClass* HandlerClass)
|
||||||
{
|
{
|
||||||
const IMCPHandler* Handler = Cast<IMCPHandler>(HandlerClass->GetDefaultObject());
|
const IWingHandler* Handler = Cast<IWingHandler>(HandlerClass->GetDefaultObject());
|
||||||
if (!Handler) return;
|
if (!Handler) return;
|
||||||
|
|
||||||
FString ToolName = GetHandlerName(HandlerClass);
|
FString ToolName = GetHandlerName(HandlerClass);
|
||||||
|
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
UMCPServer::Print(WrapText(Handler->GetDescription(), 80, TEXT("// ")));
|
UWingServer::Print(WrapText(Handler->GetDescription(), 80, TEXT("// ")));
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
|
|
||||||
// Command signature line
|
// Command signature line
|
||||||
UMCPServer::Print(ToolName);
|
UWingServer::Print(ToolName);
|
||||||
UMCPServer::Print(TEXT("("));
|
UWingServer::Print(TEXT("("));
|
||||||
bool bFirst = true;
|
bool bFirst = true;
|
||||||
for (TFieldIterator<FProperty> PropIt(HandlerClass, EFieldIterationFlags::None); PropIt; ++PropIt)
|
for (TFieldIterator<FProperty> PropIt(HandlerClass, EFieldIterationFlags::None); PropIt; ++PropIt)
|
||||||
{
|
{
|
||||||
if (!bFirst) UMCPServer::Print(TEXT(","));
|
if (!bFirst) UWingServer::Print(TEXT(","));
|
||||||
bFirst = false;
|
bFirst = false;
|
||||||
if (PropIt->HasMetaData(TEXT("Optional"))) UMCPServer::Print(TEXT("?"));
|
if (PropIt->HasMetaData(TEXT("Optional"))) UWingServer::Print(TEXT("?"));
|
||||||
UMCPServer::Print(PropIt->GetName());
|
UWingServer::Print(PropIt->GetName());
|
||||||
}
|
}
|
||||||
UMCPServer::Print(TEXT(")\n"));
|
UWingServer::Print(TEXT(")\n"));
|
||||||
|
|
||||||
// parameter details
|
// parameter details
|
||||||
for (TFieldIterator<FProperty> PropIt(HandlerClass, EFieldIterationFlags::None); PropIt; ++PropIt)
|
for (TFieldIterator<FProperty> PropIt(HandlerClass, EFieldIterationFlags::None); PropIt; ++PropIt)
|
||||||
{
|
{
|
||||||
FProperty* Prop = *PropIt;
|
FProperty* Prop = *PropIt;
|
||||||
FString Name = Prop->GetName();
|
FString Name = Prop->GetName();
|
||||||
FString Type = UMCPTypes::TypeToText(Prop);
|
FString Type = UWingTypes::TypeToText(Prop);
|
||||||
bool bOptional = Prop->HasMetaData(TEXT("Optional"));
|
bool bOptional = Prop->HasMetaData(TEXT("Optional"));
|
||||||
const FString& Desc = Prop->GetMetaData(TEXT("Description"));
|
const FString& Desc = Prop->GetMetaData(TEXT("Description"));
|
||||||
|
|
||||||
UMCPServer::Printf(TEXT(" %s %s%s"),
|
UWingServer::Printf(TEXT(" %s %s%s"),
|
||||||
*Type, *Name, bOptional ? TEXT(" (optional)") : TEXT(""));
|
*Type, *Name, bOptional ? TEXT(" (optional)") : TEXT(""));
|
||||||
if (!Desc.IsEmpty())
|
if (!Desc.IsEmpty())
|
||||||
UMCPServer::Printf(TEXT(" — %s"), *Desc);
|
UWingServer::Printf(TEXT(" — %s"), *Desc);
|
||||||
UMCPServer::Print(TEXT("\n"));
|
UWingServer::Print(TEXT("\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "MCPCommandlet.h"
|
#include "WingmanCommandlet.h"
|
||||||
#include "MCPServer.h"
|
#include "WingServer.h"
|
||||||
#include "Containers/Ticker.h"
|
#include "Containers/Ticker.h"
|
||||||
|
|
||||||
UBlueprintMCPCommandlet::UBlueprintMCPCommandlet()
|
UWingmanCommandlet::UWingmanCommandlet()
|
||||||
{
|
{
|
||||||
IsClient = false;
|
IsClient = false;
|
||||||
IsEditor = true;
|
IsEditor = true;
|
||||||
@@ -10,9 +10,9 @@ UBlueprintMCPCommandlet::UBlueprintMCPCommandlet()
|
|||||||
LogToConsole = true;
|
LogToConsole = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 UBlueprintMCPCommandlet::Main(const FString& Params)
|
int32 UWingmanCommandlet::Main(const FString& Params)
|
||||||
{
|
{
|
||||||
// The UMCPServer editor subsystem starts the server automatically.
|
// The UWingServer editor subsystem starts the server automatically.
|
||||||
// We just need to tick it, since FTickableEditorObject doesn't tick in commandlet mode.
|
// We just need to tick it, since FTickableEditorObject doesn't tick in commandlet mode.
|
||||||
double LastTime = FPlatformTime::Seconds();
|
double LastTime = FPlatformTime::Seconds();
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ int32 UBlueprintMCPCommandlet::Main(const FString& Params)
|
|||||||
double DeltaTime = CurrentTime - LastTime;
|
double DeltaTime = CurrentTime - LastTime;
|
||||||
LastTime = CurrentTime;
|
LastTime = CurrentTime;
|
||||||
FTSTicker::GetCoreTicker().Tick(DeltaTime);
|
FTSTicker::GetCoreTicker().Tick(DeltaTime);
|
||||||
UMCPServer::TickServer(DeltaTime);
|
UWingServer::TickServer(DeltaTime);
|
||||||
FPlatformProcess::Sleep(0.01f);
|
FPlatformProcess::Sleep(0.01f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#include "WingmanModule.h"
|
||||||
|
#include "Modules/ModuleManager.h"
|
||||||
|
|
||||||
|
IMPLEMENT_MODULE(FWingmanModule, BlueprintMCP);
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Modules/ModuleInterface.h"
|
#include "Modules/ModuleInterface.h"
|
||||||
|
|
||||||
class FBlueprintMCPModule : public IModuleInterface
|
class FWingmanModule : public IModuleInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void StartupModule() override {}
|
virtual void StartupModule() override {}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPProperty.h"
|
#include "WingProperty.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "BPVarEditor.generated.h"
|
#include "BPVarEditor.generated.h"
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ struct FBPVarEditor
|
|||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
FBPVariableDescription* Desc = nullptr;
|
FBPVariableDescription* Desc = nullptr;
|
||||||
MCPProperty DefaultValueProp;
|
WingProperty DefaultValueProp;
|
||||||
|
|
||||||
FBPVarEditor() = default;
|
FBPVarEditor() = default;
|
||||||
FBPVarEditor(UBlueprint* BP, const FString& VarName);
|
FBPVarEditor(UBlueprint* BP, const FString& VarName);
|
||||||
@@ -54,5 +54,5 @@ private:
|
|||||||
void LoadDefault();
|
void LoadDefault();
|
||||||
void SaveFlags();
|
void SaveFlags();
|
||||||
bool SaveDefault();
|
bool SaveDefault();
|
||||||
TArray<MCPProperty> MergedProperties();
|
TArray<WingProperty> MergedProperties();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class UEdGraphNode;
|
|||||||
class UK2Node_EditablePinBase;
|
class UK2Node_EditablePinBase;
|
||||||
struct FEdGraphPinType;
|
struct FEdGraphPinType;
|
||||||
|
|
||||||
struct MCPFunctionArgs
|
struct WingFunctionArgs
|
||||||
{
|
{
|
||||||
// Returns true if the node is an EditablePinBase subclass that
|
// Returns true if the node is an EditablePinBase subclass that
|
||||||
// actually supports user-defined pins (FunctionEntry, FunctionResult,
|
// actually supports user-defined pins (FunctionEntry, FunctionResult,
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
class UMaterialExpression;
|
class UMaterialExpression;
|
||||||
|
|
||||||
class MCPGraphExport
|
class WingGraphExport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MCPGraphExport(UEdGraph* InGraph);
|
WingGraphExport(UEdGraph* InGraph);
|
||||||
MCPGraphExport(UEdGraphNode* InNode);
|
WingGraphExport(UEdGraphNode* InNode);
|
||||||
|
|
||||||
const FString GetOutput() { return Output.ToString(); }
|
const FString GetOutput() { return Output.ToString(); }
|
||||||
const FString GetDetails() { return Details.ToString(); }
|
const FString GetDetails() { return Details.ToString(); }
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "MCPUtils.h"
|
|
||||||
|
|
||||||
// A resolved property: the FProperty descriptor plus a pointer to
|
|
||||||
// the value's storage. operator-> forwards to the FProperty.
|
|
||||||
struct MCPProperty
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FProperty* Prop = nullptr;
|
|
||||||
void* Container = nullptr;
|
|
||||||
|
|
||||||
MCPProperty() = default;
|
|
||||||
MCPProperty(FProperty* InProp, void* Container);
|
|
||||||
|
|
||||||
FString GetText() const;
|
|
||||||
bool SetText(const FString& Value);
|
|
||||||
|
|
||||||
explicit operator bool() const { return Prop != nullptr; }
|
|
||||||
FProperty* operator->() const { return Prop; }
|
|
||||||
|
|
||||||
static void Remove(TArray<MCPProperty>& Props, const FString& Name);
|
|
||||||
static TArray<MCPProperty> GetAll(UObject* Obj, EPropertyFlags Flags);
|
|
||||||
static TArray<MCPProperty> GetAll(UStruct* StructType, void* Container, EPropertyFlags Flags);
|
|
||||||
static TArray<MCPProperty> FindAllSubstring(const TArray<MCPProperty>& Props, const FString& Substring);
|
|
||||||
static MCPProperty FindOneExactMatch(const TArray<MCPProperty>& Props, const FString& Name);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool TryParseEnum(UEnum* Enum, const FString& Text, int64 &OutValue);
|
|
||||||
bool TrySetText(const FString &Text);
|
|
||||||
static void Collect(UStruct* StructType, void* Container, TArray<MCPProperty> &Props, EPropertyFlags Flags);
|
|
||||||
};
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Materials/Material.h"
|
#include "Materials/Material.h"
|
||||||
|
|
||||||
class MCPMaterialParameter
|
class WingMaterialParameter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TMap<FMaterialParameterInfo, FMaterialParameterMetadata> GetMaterialParameters(UMaterialInterface* Material);
|
static TMap<FMaterialParameterInfo, FMaterialParameterMetadata> GetMaterialParameters(UMaterialInterface* Material);
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "MCPUtils.h"
|
#include "WingUtils.h"
|
||||||
|
|
||||||
class UEdGraphPin;
|
class UEdGraphPin;
|
||||||
class IAssetEditorInstance;
|
class IAssetEditorInstance;
|
||||||
struct FWalker;
|
struct FWalker;
|
||||||
|
|
||||||
// MCPFetcher: Load an Asset and find an object within it.
|
// WingFetcher: Load an Asset and find an object within it.
|
||||||
// To find an object, you use a path. This is typical:
|
// To find an object, you use a path. This is typical:
|
||||||
//
|
//
|
||||||
// F.Walk(TEXT("/Game/Mat/M_Test,graph,node:Param_1"))
|
// F.Walk(TEXT("/Game/Mat/M_Test,graph,node:Param_1"))
|
||||||
@@ -27,36 +27,36 @@ struct FWalker;
|
|||||||
// When you're finally at the object you want, you usually
|
// When you're finally at the object you want, you usually
|
||||||
// use the Cast method to get a pointer to the object.
|
// use the Cast method to get a pointer to the object.
|
||||||
//
|
//
|
||||||
// If any step fails, the MCPFetcher will print an error
|
// If any step fails, the WingFetcher will print an error
|
||||||
// message that can be seen by the MCP's caller. It will
|
// message that can be seen by the MCP's caller. It will
|
||||||
// also set an error flag. Once the error flag is set, all
|
// also set an error flag. Once the error flag is set, all
|
||||||
// further ops become no-ops. After that point, fetching
|
// further ops become no-ops. After that point, fetching
|
||||||
// any data will return nullptr.
|
// any data will return nullptr.
|
||||||
//
|
//
|
||||||
|
|
||||||
class MCPFetcher
|
class WingFetcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Walk a path from an asset to an object
|
// Walk a path from an asset to an object
|
||||||
// within that asset. If you call walk a
|
// within that asset. If you call walk a
|
||||||
// second time, it will walk additional steps.
|
// second time, it will walk additional steps.
|
||||||
//
|
//
|
||||||
MCPFetcher& Walk(const FString& Path);
|
WingFetcher& Walk(const FString& Path);
|
||||||
|
|
||||||
// Walk a path using individual path
|
// Walk a path using individual path
|
||||||
// steps instead of a path. All these steps generate
|
// steps instead of a path. All these steps generate
|
||||||
// errors if they cannot find the desired element.
|
// errors if they cannot find the desired element.
|
||||||
//
|
//
|
||||||
MCPFetcher& Asset(const FString& PackagePath);
|
WingFetcher& Asset(const FString& PackagePath);
|
||||||
MCPFetcher& Graph(const FString& Value);
|
WingFetcher& Graph(const FString& Value);
|
||||||
MCPFetcher& Node(const FString& Value);
|
WingFetcher& Node(const FString& Value);
|
||||||
MCPFetcher& Pin(const FString& Value);
|
WingFetcher& Pin(const FString& Value);
|
||||||
MCPFetcher& Component(const FString& Value);
|
WingFetcher& Component(const FString& Value);
|
||||||
MCPFetcher& LevelBlueprint(const FString& Value);
|
WingFetcher& LevelBlueprint(const FString& Value);
|
||||||
|
|
||||||
// Return true if there haven't been any errors.
|
// Return true if there haven't been any errors.
|
||||||
// Note that errors always automatically generate
|
// Note that errors always automatically generate
|
||||||
// output to MCPServer::Printf.
|
// output to WingServer::Printf.
|
||||||
//
|
//
|
||||||
bool Ok() const { return !bError; }
|
bool Ok() const { return !bError; }
|
||||||
|
|
||||||
@@ -108,12 +108,12 @@ public:
|
|||||||
// Initialize empty. You need to call Asset, or walk
|
// Initialize empty. You need to call Asset, or walk
|
||||||
// a path that starts with an asset.
|
// a path that starts with an asset.
|
||||||
//
|
//
|
||||||
MCPFetcher() {}
|
WingFetcher() {}
|
||||||
|
|
||||||
// Initialize with an object. From there, you can walk
|
// Initialize with an object. From there, you can walk
|
||||||
// to sub-objects.
|
// to sub-objects.
|
||||||
//
|
//
|
||||||
MCPFetcher(UObject* O) : Obj(O) {}
|
WingFetcher(UObject* O) : Obj(O) {}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -130,17 +130,17 @@ private:
|
|||||||
bool bError = false;
|
bool bError = false;
|
||||||
|
|
||||||
// Internal methods.
|
// Internal methods.
|
||||||
using WalkFunc = MCPFetcher& (MCPFetcher::*)(const FString&);
|
using WalkFunc = WingFetcher& (WingFetcher::*)(const FString&);
|
||||||
void SetObj(UObject* InObj);
|
void SetObj(UObject* InObj);
|
||||||
void SetPin(UEdGraphPin* InPin);
|
void SetPin(UEdGraphPin* InPin);
|
||||||
MCPFetcher& SetError();
|
WingFetcher& SetError();
|
||||||
void PathFailed(const TCHAR *Kind);
|
void PathFailed(const TCHAR *Kind);
|
||||||
MCPFetcher& TypeMismatch(const TCHAR* Walker, const TCHAR* Expected);
|
WingFetcher& TypeMismatch(const TCHAR* Walker, const TCHAR* Expected);
|
||||||
bool CheckAssetIsA(UClass* StaticClass);
|
bool CheckAssetIsA(UClass* StaticClass);
|
||||||
WalkFunc GetWalker(const FString &Step);
|
WalkFunc GetWalker(const FString &Step);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> inline UEdGraphPin* MCPFetcher::Cast<UEdGraphPin>()
|
template<> inline UEdGraphPin* WingFetcher::Cast<UEdGraphPin>()
|
||||||
{
|
{
|
||||||
if (bError) return nullptr;
|
if (bError) return nullptr;
|
||||||
if (!ResultPin) PathFailed(TEXT("UEdGraphPin"));
|
if (!ResultPin) PathFailed(TEXT("UEdGraphPin"));
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user