Start cleaning WingReferences to be *just* the reference type and no methods
This commit is contained in:
@@ -59,7 +59,7 @@ public:
|
|||||||
WingFetcher F(GraphObj, WingOut::Stdout);
|
WingFetcher F(GraphObj, WingOut::Stdout);
|
||||||
UWingPinReference* PinRef = F.Node(Entry.Node).Pin(Entry.Name).Cast<UWingPinReference>();
|
UWingPinReference* PinRef = F.Node(Entry.Node).Pin(Entry.Name).Cast<UWingPinReference>();
|
||||||
if (!PinRef) return;
|
if (!PinRef) return;
|
||||||
UEdGraphPin* Pin = PinRef->CheckGetPin(WingOut::Stdout);
|
UEdGraphPin* Pin = WingUtils::CheckGetPin(PinRef->Node, PinRef->PinName, WingOut::Stdout);
|
||||||
if (!Pin) return;
|
if (!Pin) return;
|
||||||
|
|
||||||
UEdGraphNode* Node = Pin->GetOwningNode();
|
UEdGraphNode* Node = Pin->GetOwningNode();
|
||||||
|
|||||||
@@ -67,13 +67,13 @@ public:
|
|||||||
WingFetcher FS(G, WingOut::Stdout);
|
WingFetcher FS(G, WingOut::Stdout);
|
||||||
UWingPinReference* SourcePinRef = FS.Walk(Entry.SourcePin).Cast<UWingPinReference>();
|
UWingPinReference* SourcePinRef = FS.Walk(Entry.SourcePin).Cast<UWingPinReference>();
|
||||||
if (!SourcePinRef) continue;
|
if (!SourcePinRef) continue;
|
||||||
UEdGraphPin* SourcePin = SourcePinRef->CheckGetPin(WingOut::Stdout);
|
UEdGraphPin* SourcePin = WingUtils::CheckGetPin(SourcePinRef->Node, SourcePinRef->PinName, WingOut::Stdout);
|
||||||
if (!SourcePin) continue;
|
if (!SourcePin) continue;
|
||||||
|
|
||||||
WingFetcher FT(G, WingOut::Stdout);
|
WingFetcher FT(G, WingOut::Stdout);
|
||||||
UWingPinReference* TargetPinRef = FT.Walk(Entry.TargetPin).Cast<UWingPinReference>();
|
UWingPinReference* TargetPinRef = FT.Walk(Entry.TargetPin).Cast<UWingPinReference>();
|
||||||
if (!TargetPinRef) continue;
|
if (!TargetPinRef) continue;
|
||||||
UEdGraphPin* TargetPin = TargetPinRef->CheckGetPin(WingOut::Stdout);
|
UEdGraphPin* TargetPin = WingUtils::CheckGetPin(TargetPinRef->Node, TargetPinRef->PinName, WingOut::Stdout);
|
||||||
if (!TargetPin) continue;
|
if (!TargetPin) continue;
|
||||||
|
|
||||||
const UEdGraphSchema* Schema = G->GetSchema();
|
const UEdGraphSchema* Schema = G->GetSchema();
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
WingFetcher FP(G, WingOut::Stdout);
|
WingFetcher FP(G, WingOut::Stdout);
|
||||||
UWingPinReference* PinRef = FP.Walk(Entry.Pin).Cast<UWingPinReference>();
|
UWingPinReference* PinRef = FP.Walk(Entry.Pin).Cast<UWingPinReference>();
|
||||||
if (!PinRef) continue;
|
if (!PinRef) continue;
|
||||||
UEdGraphPin* Pin = PinRef->CheckGetPin(WingOut::Stdout);
|
UEdGraphPin* Pin = WingUtils::CheckGetPin(PinRef->Node, PinRef->PinName, WingOut::Stdout);
|
||||||
if (!Pin) continue;
|
if (!Pin) continue;
|
||||||
|
|
||||||
int32 DisconnectedCount = 0;
|
int32 DisconnectedCount = 0;
|
||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
WingFetcher FT(G, WingOut::Stdout);
|
WingFetcher FT(G, WingOut::Stdout);
|
||||||
UWingPinReference* TargetRef = FT.Walk(Entry.TargetPin).Cast<UWingPinReference>();
|
UWingPinReference* TargetRef = FT.Walk(Entry.TargetPin).Cast<UWingPinReference>();
|
||||||
if (!TargetRef) continue;
|
if (!TargetRef) continue;
|
||||||
UEdGraphPin* Target = TargetRef->CheckGetPin(WingOut::Stdout);
|
UEdGraphPin* Target = WingUtils::CheckGetPin(TargetRef->Node, TargetRef->PinName, WingOut::Stdout);
|
||||||
if (!Target) continue;
|
if (!Target) continue;
|
||||||
|
|
||||||
if (!Pin->LinkedTo.Contains(Target))
|
if (!Pin->LinkedTo.Contains(Target))
|
||||||
|
|||||||
@@ -3,31 +3,4 @@
|
|||||||
#include "EdGraph/EdGraphNode.h"
|
#include "EdGraph/EdGraphNode.h"
|
||||||
#include "EdGraph/EdGraphPin.h"
|
#include "EdGraph/EdGraphPin.h"
|
||||||
|
|
||||||
UEdGraphPin* UWingPinReference::GetPin() const
|
|
||||||
{
|
|
||||||
if (!Node) return nullptr;
|
|
||||||
for (UEdGraphPin* Pin : Node->Pins)
|
|
||||||
{
|
|
||||||
if (Pin && Pin->GetFName() == PinName) return Pin;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
UEdGraphPin* UWingPinReference::CheckGetPin(WingOut Errors) const
|
|
||||||
{
|
|
||||||
if (!Node)
|
|
||||||
{
|
|
||||||
Errors.Print(TEXT("ERROR: Pin reference has no node\n"));
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
UEdGraphPin* Pin = GetPin();
|
|
||||||
if (!Pin)
|
|
||||||
{
|
|
||||||
Errors.Printf(TEXT("ERROR: Pin '%s' no longer exists on node '%s'\n"),
|
|
||||||
*WingUtils::ExternalizeID(PinName), *WingUtils::FormatName(Node));
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Pin;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -490,6 +490,24 @@ UObject *WingUtils::GetGeneratedCDO(UBlueprint *BP)
|
|||||||
return BP->GeneratedClass->GetDefaultObject();
|
return BP->GeneratedClass->GetDefaultObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// Graph Pin Helpers
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
UEdGraphPin* WingUtils::CheckGetPin(UEdGraphNode* Node, FName PinName, WingOut Errors)
|
||||||
|
{
|
||||||
|
for (UEdGraphPin* Pin : Node->Pins)
|
||||||
|
{
|
||||||
|
if (Pin && Pin->GetFName() == PinName)
|
||||||
|
{
|
||||||
|
return Pin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Errors.Printf(TEXT("ERROR: Pin '%s' no longer exists on node '%s'\n"),
|
||||||
|
*WingUtils::ExternalizeID(PinName), *WingUtils::FormatName(Node));
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// Editor helpers
|
// Editor helpers
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|||||||
@@ -9,10 +9,8 @@ class USCS_Node;
|
|||||||
class UActorComponent;
|
class UActorComponent;
|
||||||
class USimpleConstructionScript;
|
class USimpleConstructionScript;
|
||||||
|
|
||||||
// a 'Component Reference' is basically just a pointer to a
|
// a 'Component Reference' is just a pointer to a
|
||||||
// blueprint plus a component name. The other fields in here
|
// blueprint plus a component name.
|
||||||
// are purely for convenience of printing things out, they
|
|
||||||
// are *never* used for any analysis.
|
|
||||||
//
|
//
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UWingComponentReference : public UObject
|
class UWingComponentReference : public UObject
|
||||||
@@ -37,8 +35,6 @@ public:
|
|||||||
|
|
||||||
static TArray<UWingComponentReference*> GetAll(UBlueprint* BP);
|
static TArray<UWingComponentReference*> GetAll(UBlueprint* BP);
|
||||||
static void PrintAll(UBlueprint* BP, WingOut Out);
|
static void PrintAll(UBlueprint* BP, WingOut Out);
|
||||||
static void PrintComponentInfo(const FString& TypeName, const FString& VarName,
|
|
||||||
const FString& ParentName, bool Inherited, WingOut Out);
|
|
||||||
|
|
||||||
static bool CheckValidComponentClass(UClass *Class, WingOut Errors);
|
static bool CheckValidComponentClass(UClass *Class, WingOut Errors);
|
||||||
private:
|
private:
|
||||||
@@ -59,4 +55,6 @@ private:
|
|||||||
static bool CheckOwnedByBlueprint(FoundComponent FC, UBlueprint *BP, WingOut Errors);
|
static bool CheckOwnedByBlueprint(FoundComponent FC, UBlueprint *BP, WingOut Errors);
|
||||||
static void AddChildNode(UBlueprint *BP, USCS_Node *Node, FoundComponent Parent);
|
static void AddChildNode(UBlueprint *BP, USCS_Node *Node, FoundComponent Parent);
|
||||||
static TMap<FName, FName> CalculateParentNames(USimpleConstructionScript *Script);
|
static TMap<FName, FName> CalculateParentNames(USimpleConstructionScript *Script);
|
||||||
|
static void PrintComponentInfo(const FString& TypeName, const FString& VarName,
|
||||||
|
const FString& ParentName, bool Inherited, WingOut Out);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,7 +63,4 @@ public:
|
|||||||
UEdGraphNode* Node = nullptr;
|
UEdGraphNode* Node = nullptr;
|
||||||
|
|
||||||
FName PinName;
|
FName PinName;
|
||||||
|
|
||||||
UEdGraphPin* GetPin() const;
|
|
||||||
UEdGraphPin* CheckGetPin(WingOut Errors) const;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -195,7 +195,6 @@ public:
|
|||||||
static FString FormatName(const UWingComponentReference *Ref);
|
static FString FormatName(const UWingComponentReference *Ref);
|
||||||
static FString FormatName(const UWidget *Widget);
|
static FString FormatName(const UWidget *Widget);
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// static FString ExternalizeID(const FString& InternalID);
|
// static FString ExternalizeID(const FString& InternalID);
|
||||||
static FString ExternalizeID(FName Name);
|
static FString ExternalizeID(FName Name);
|
||||||
@@ -248,6 +247,9 @@ public:
|
|||||||
static TArray<UBlueprint*> GetAncestorBlueprints(UBlueprint *BP, bool OldestFirst = false);
|
static TArray<UBlueprint*> GetAncestorBlueprints(UBlueprint *BP, bool OldestFirst = false);
|
||||||
static UObject *GetGeneratedCDO(UBlueprint *BP);
|
static UObject *GetGeneratedCDO(UBlueprint *BP);
|
||||||
|
|
||||||
|
// ----- Graph pin helpers -----
|
||||||
|
static UEdGraphPin* CheckGetPin(UEdGraphNode* Node, FName PinName, WingOut Errors);
|
||||||
|
|
||||||
// ----- Editor helpers -----
|
// ----- Editor helpers -----
|
||||||
static IAssetEditorInstance* CheckOpenEditorForAsset(UObject* Asset, WingOut Errors);
|
static IAssetEditorInstance* CheckOpenEditorForAsset(UObject* Asset, WingOut Errors);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user