This commit is contained in:
2026-04-08 03:40:59 -04:00
parent f4286faeb1
commit 73f84c1681
15 changed files with 46 additions and 46 deletions

View File

@@ -65,8 +65,8 @@ public:
if (!UWingComponent::CheckValidComponentClass(ComponentClass, WingOut::Stdout)) return; if (!UWingComponent::CheckValidComponentClass(ComponentClass, WingOut::Stdout)) return;
// Find the specified parent component // Find the specified parent component
TArray<TStrongObjectPtr<UWingComponentReference>> AllComponents = UWingComponent::GetAll(BP); TArray<TStrongObjectPtr<UWingComponentRef>> AllComponents = UWingComponent::GetAll(BP);
TStrongObjectPtr<UWingComponentReference> ParentComp = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout); TStrongObjectPtr<UWingComponentRef> ParentComp = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout);
if (!ParentComp) return; if (!ParentComp) return;
// Create the SCS node // Create the SCS node

View File

@@ -29,7 +29,7 @@ public:
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F(WingOut::Stdout); WingFetcher F(WingOut::Stdout);
UWingComponentReference* CompRef = F.Walk(Component).Cast<UWingComponentReference>(); UWingComponentRef* CompRef = F.Walk(Component).Cast<UWingComponentRef>();
if (!CompRef) return; if (!CompRef) return;
if (!UWingComponent::DeleteComponent(CompRef, WingOut::Stdout)) return; if (!UWingComponent::DeleteComponent(CompRef, WingOut::Stdout)) return;

View File

@@ -34,13 +34,13 @@ public:
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F(WingOut::Stdout); WingFetcher F(WingOut::Stdout);
UWingComponentReference* CompRef = F.Walk(Component).Cast<UWingComponentReference>(); UWingComponentRef* CompRef = F.Walk(Component).Cast<UWingComponentRef>();
if (!CompRef) return; if (!CompRef) return;
// Find the new parent among all components (if specified) // Find the new parent among all components (if specified)
UBlueprint *BP = CompRef->BP; UBlueprint *BP = CompRef->BP;
TArray<TStrongObjectPtr<UWingComponentReference>> AllComponents = UWingComponent::GetAll(BP); TArray<TStrongObjectPtr<UWingComponentRef>> AllComponents = UWingComponent::GetAll(BP);
TStrongObjectPtr<UWingComponentReference> NewParent = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout); TStrongObjectPtr<UWingComponentRef> NewParent = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout);
if (!NewParent) return; if (!NewParent) return;
if (!UWingComponent::ReparentComponent(CompRef, NewParent.Get(), WingOut::Stdout)) return; if (!UWingComponent::ReparentComponent(CompRef, NewParent.Get(), WingOut::Stdout)) return;

View File

@@ -69,7 +69,7 @@ public:
BlueprintVars.Print(WingOut::StdoutBuffer); BlueprintVars.Print(WingOut::StdoutBuffer);
// Components // Components
TArray<TStrongObjectPtr<UWingComponentReference>> Components = UWingComponent::GetAll(BP); TArray<TStrongObjectPtr<UWingComponentRef>> Components = UWingComponent::GetAll(BP);
if (!Components.IsEmpty()) WingOut::Stdout.Print(TEXT("\nComponents:\n")); if (!Components.IsEmpty()) WingOut::Stdout.Print(TEXT("\nComponents:\n"));
UWingComponent::PrintAll(BP, WingOut::Stdout); UWingComponent::PrintAll(BP, WingOut::Stdout);

View File

@@ -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)
{ {
WingFetcher F(GraphObj, WingOut::Stdout); WingFetcher F(GraphObj, WingOut::Stdout);
UWingPinReference* PinRef = F.Node(Entry.Node).Pin(Entry.Name).Cast<UWingPinReference>(); UWingGraphPinRef* PinRef = F.Node(Entry.Node).Pin(Entry.Name).Cast<UWingGraphPinRef>();
if (!PinRef) return; if (!PinRef) return;
UEdGraphPin* Pin = WingUtils::CheckGetPin(PinRef->Node, PinRef->PinName, WingOut::Stdout); UEdGraphPin* Pin = WingUtils::CheckGetPin(PinRef->Node, PinRef->PinName, WingOut::Stdout);
if (!Pin) return; if (!Pin) return;

View File

@@ -63,13 +63,13 @@ public:
continue; continue;
WingFetcher FS(G, WingOut::Stdout); WingFetcher FS(G, WingOut::Stdout);
UWingPinReference* SourcePinRef = FS.Walk(Entry.SourcePin).Cast<UWingPinReference>(); UWingGraphPinRef* SourcePinRef = FS.Walk(Entry.SourcePin).Cast<UWingGraphPinRef>();
if (!SourcePinRef) continue; if (!SourcePinRef) continue;
UEdGraphPin* SourcePin = WingUtils::CheckGetPin(SourcePinRef->Node, SourcePinRef->PinName, 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>(); UWingGraphPinRef* TargetPinRef = FT.Walk(Entry.TargetPin).Cast<UWingGraphPinRef>();
if (!TargetPinRef) continue; if (!TargetPinRef) continue;
UEdGraphPin* TargetPin = WingUtils::CheckGetPin(TargetPinRef->Node, TargetPinRef->PinName, WingOut::Stdout); UEdGraphPin* TargetPin = WingUtils::CheckGetPin(TargetPinRef->Node, TargetPinRef->PinName, WingOut::Stdout);
if (!TargetPin) continue; if (!TargetPin) continue;

View File

@@ -62,7 +62,7 @@ public:
if (!FWingProperty::PopulateFromJson(EntryProps, *DiscVal, false, WingOut::Stdout)) continue; if (!FWingProperty::PopulateFromJson(EntryProps, *DiscVal, false, WingOut::Stdout)) continue;
WingFetcher FP(G, WingOut::Stdout); WingFetcher FP(G, WingOut::Stdout);
UWingPinReference* PinRef = FP.Walk(Entry.Pin).Cast<UWingPinReference>(); UWingGraphPinRef* PinRef = FP.Walk(Entry.Pin).Cast<UWingGraphPinRef>();
if (!PinRef) continue; if (!PinRef) continue;
UEdGraphPin* Pin = WingUtils::CheckGetPin(PinRef->Node, PinRef->PinName, WingOut::Stdout); UEdGraphPin* Pin = WingUtils::CheckGetPin(PinRef->Node, PinRef->PinName, WingOut::Stdout);
if (!Pin) continue; if (!Pin) continue;
@@ -72,7 +72,7 @@ public:
if (!Entry.TargetPin.IsEmpty()) if (!Entry.TargetPin.IsEmpty())
{ {
WingFetcher FT(G, WingOut::Stdout); WingFetcher FT(G, WingOut::Stdout);
UWingPinReference* TargetRef = FT.Walk(Entry.TargetPin).Cast<UWingPinReference>(); UWingGraphPinRef* TargetRef = FT.Walk(Entry.TargetPin).Cast<UWingGraphPinRef>();
if (!TargetRef) continue; if (!TargetRef) continue;
UEdGraphPin* Target = WingUtils::CheckGetPin(TargetRef->Node, TargetRef->PinName, WingOut::Stdout); UEdGraphPin* Target = WingUtils::CheckGetPin(TargetRef->Node, TargetRef->PinName, WingOut::Stdout);
if (!Target) continue; if (!Target) continue;

View File

@@ -136,7 +136,7 @@ void UWingComponent::AddChildNode(UBlueprint *BP, USCS_Node *NewNode, FoundCompo
} }
} }
bool UWingComponent::AddComponent(UBlueprint *BP, UClass *Class, UWingComponentReference *Parent, FName Name, WingOut Errors) bool UWingComponent::AddComponent(UBlueprint *BP, UClass *Class, UWingComponentRef *Parent, FName Name, WingOut Errors)
{ {
TSet<FName> Names; TSet<FName> Names;
FBlueprintEditorUtils::GetClassVariableList(BP, Names); FBlueprintEditorUtils::GetClassVariableList(BP, Names);
@@ -164,7 +164,7 @@ bool UWingComponent::AddComponent(UBlueprint *BP, UClass *Class, UWingComponentR
return true; return true;
} }
bool UWingComponent::ReparentComponent(UWingComponentReference *Ref, UWingComponentReference *Parent, WingOut Errors) bool UWingComponent::ReparentComponent(UWingComponentRef *Ref, UWingComponentRef *Parent, WingOut Errors)
{ {
FoundComponent ParentComponent = FindComponent(Ref->BP, Parent->VariableName); FoundComponent ParentComponent = FindComponent(Ref->BP, Parent->VariableName);
if (!CheckValidParent(ParentComponent, Errors)) return false; if (!CheckValidParent(ParentComponent, Errors)) return false;
@@ -184,7 +184,7 @@ bool UWingComponent::ReparentComponent(UWingComponentReference *Ref, UWingCompon
return true; return true;
} }
bool UWingComponent::DeleteComponent(UWingComponentReference *Ref, WingOut Errors) bool UWingComponent::DeleteComponent(UWingComponentRef *Ref, WingOut Errors)
{ {
FoundComponent ThisComponent = FindComponent(Ref->BP, Ref->VariableName); FoundComponent ThisComponent = FindComponent(Ref->BP, Ref->VariableName);
if (!CheckExists(ThisComponent, Errors)) return false; if (!CheckExists(ThisComponent, Errors)) return false;
@@ -211,7 +211,7 @@ TMap<FName, FName> UWingComponent::CalculateParentNames(USimpleConstructionScrip
return ParentNames; return ParentNames;
} }
UActorComponent* UWingComponent::GetImmutableTemplate(const UWingComponentReference *Ref) UActorComponent* UWingComponent::GetImmutableTemplate(const UWingComponentRef *Ref)
{ {
FoundComponent FC = FindComponent(Ref->BP, Ref->VariableName); FoundComponent FC = FindComponent(Ref->BP, Ref->VariableName);
if (FC.Native) return FC.Native; if (FC.Native) return FC.Native;
@@ -229,7 +229,7 @@ UActorComponent* UWingComponent::GetImmutableTemplate(const UWingComponentRefere
return nullptr; return nullptr;
} }
UActorComponent* UWingComponent::GetMutableTemplate(const UWingComponentReference *Ref) UActorComponent* UWingComponent::GetMutableTemplate(const UWingComponentRef *Ref)
{ {
FoundComponent FC = FindComponent(Ref->BP, Ref->VariableName); FoundComponent FC = FindComponent(Ref->BP, Ref->VariableName);
if (FC.Native) return FC.Native; if (FC.Native) return FC.Native;
@@ -244,9 +244,9 @@ UActorComponent* UWingComponent::GetMutableTemplate(const UWingComponentReferenc
return Override; return Override;
} }
TArray<TStrongObjectPtr<UWingComponentReference>> UWingComponent::GetAll(UBlueprint* BP) TArray<TStrongObjectPtr<UWingComponentRef>> UWingComponent::GetAll(UBlueprint* BP)
{ {
TArray<TStrongObjectPtr<UWingComponentReference>> Result; TArray<TStrongObjectPtr<UWingComponentRef>> Result;
if (!BP) return Result; if (!BP) return Result;
// Find the native ancestor class // Find the native ancestor class
@@ -261,7 +261,7 @@ TArray<TStrongObjectPtr<UWingComponentReference>> UWingComponent::GetAll(UBluepr
CDO->GetComponents(NativeComponents); CDO->GetComponents(NativeComponents);
for (UActorComponent* Comp : NativeComponents) for (UActorComponent* Comp : NativeComponents)
{ {
UWingComponentReference* Ref = NewObject<UWingComponentReference>(); UWingComponentRef* Ref = NewObject<UWingComponentRef>();
Ref->BP = BP; Ref->BP = BP;
Ref->VariableName = Comp->GetFName(); Ref->VariableName = Comp->GetFName();
Result.Emplace(Ref); Result.Emplace(Ref);
@@ -275,7 +275,7 @@ TArray<TStrongObjectPtr<UWingComponentReference>> UWingComponent::GetAll(UBluepr
if (WalkBP->SimpleConstructionScript == nullptr) continue; if (WalkBP->SimpleConstructionScript == nullptr) continue;
for (USCS_Node* Node : WalkBP->SimpleConstructionScript->GetAllNodes()) for (USCS_Node* Node : WalkBP->SimpleConstructionScript->GetAllNodes())
{ {
UWingComponentReference* Ref = NewObject<UWingComponentReference>(); UWingComponentRef* Ref = NewObject<UWingComponentRef>();
Ref->BP = BP; Ref->BP = BP;
Ref->VariableName = Node->GetVariableName(); Ref->VariableName = Node->GetVariableName();
Result.Emplace(Ref); Result.Emplace(Ref);

View File

@@ -266,7 +266,7 @@ WingFetcher& WingFetcher::Pin(const FString& Value)
} }
return SetError(); return SetError();
} }
UWingPinReference* Ref = NewObject<UWingPinReference>(); UWingGraphPinRef* Ref = NewObject<UWingGraphPinRef>();
Ref->Node = N; Ref->Node = N;
Ref->PinName = Found->GetFName(); Ref->PinName = Found->GetFName();
SetObj(Ref); SetObj(Ref);
@@ -284,12 +284,12 @@ WingFetcher& WingFetcher::Component(const FString& Value)
return SetError(); return SetError();
} }
TArray<TStrongObjectPtr<UWingComponentReference>> AllComponents = UWingComponent::GetAll(BP); TArray<TStrongObjectPtr<UWingComponentRef>> AllComponents = UWingComponent::GetAll(BP);
TStrongObjectPtr<UWingComponentReference> Found = WingUtils::FindOneWithExternalID(Value, AllComponents, TEXT("component"), Errors); TStrongObjectPtr<UWingComponentRef> Found = WingUtils::FindOneWithExternalID(Value, AllComponents, TEXT("component"), Errors);
if (!Found) if (!Found)
{ {
Errors.Printf(TEXT("Components that exist in the blueprint:\n")); Errors.Printf(TEXT("Components that exist in the blueprint:\n"));
for (const TStrongObjectPtr<UWingComponentReference>& C : AllComponents) for (const TStrongObjectPtr<UWingComponentRef>& C : AllComponents)
{ {
Errors.Printf(TEXT(" %s\n"), *WingUtils::FormatName(C.Get())); Errors.Printf(TEXT(" %s\n"), *WingUtils::FormatName(C.Get()));
} }
@@ -376,9 +376,9 @@ WingFetcher& WingFetcher::StructProp(const FString& Value)
UStruct *HostType = Obj.Get()->GetClass(); UStruct *HostType = Obj.Get()->GetClass();
bool HostEditable = true; bool HostEditable = true;
// If we are *already* inside a UWingStructPointer, update the host // If we are *already* inside a UWingStructRef, update the host
// fields, to make it possible to navigate even further inside. // fields, to make it possible to navigate even further inside.
if (UWingStructPointer *SPtr = ::Cast<UWingStructPointer>(Obj.Get())) if (UWingStructRef *SPtr = ::Cast<UWingStructRef>(Obj.Get()))
{ {
HostObject = SPtr->Object; HostObject = SPtr->Object;
HostBase = SPtr->StructBase; HostBase = SPtr->StructBase;
@@ -393,7 +393,7 @@ WingFetcher& WingFetcher::StructProp(const FString& Value)
return SetError(); return SetError();
} }
UWingStructPointer* Ptr = NewObject<UWingStructPointer>(); UWingStructRef* Ptr = NewObject<UWingStructRef>();
Ptr->Object = HostObject; Ptr->Object = HostObject;
Ptr->StructType = StructProp->Struct; Ptr->StructType = StructProp->Struct;
Ptr->StructBase = StructProp->ContainerPtrToValuePtr<void>(HostBase); Ptr->StructBase = StructProp->ContainerPtrToValuePtr<void>(HostBase);

View File

@@ -427,9 +427,9 @@ TArray<FWingProperty> FWingProperty::GetDetails(UObject* Obj, bool Mutable)
{ {
if (!Obj) return {}; if (!Obj) return {};
// If it's a UWingStructPointer, return the properties // If it's a UWingStructRef, return the properties
// of the struct instead. Propagate editability of the host. // of the struct instead. Propagate editability of the host.
if (UWingStructPointer *SP = Cast<UWingStructPointer>(Obj)) if (UWingStructRef *SP = Cast<UWingStructRef>(Obj))
{ {
TArray<FWingProperty> Result = TArray<FWingProperty> Result =
GetVisible(FWingStructAndUStruct(SP->StructBase, SP->StructType)); GetVisible(FWingStructAndUStruct(SP->StructBase, SP->StructType));
@@ -450,7 +450,7 @@ TArray<FWingProperty> FWingProperty::GetDetails(UObject* Obj, bool Mutable)
} }
// Component references: get the proper template. // Component references: get the proper template.
if (UWingComponentReference* Ref = ::Cast<UWingComponentReference>(Obj)) if (UWingComponentRef* Ref = ::Cast<UWingComponentRef>(Obj))
{ {
Obj = Mutable ? UWingComponent::GetMutableTemplate(Ref) : UWingComponent::GetImmutableTemplate(Ref); Obj = Mutable ? UWingComponent::GetMutableTemplate(Ref) : UWingComponent::GetImmutableTemplate(Ref);
if (!Obj) if (!Obj)

View File

@@ -245,7 +245,7 @@ FString WingUtils::FormatName(const FBPInterfaceDescription &IFace)
return FormatName(IFace.Interface); return FormatName(IFace.Interface);
} }
FString WingUtils::FormatName(const UWingComponentReference *Ref) FString WingUtils::FormatName(const UWingComponentRef *Ref)
{ {
return ExternalizeID(Ref->VariableName); return ExternalizeID(Ref->VariableName);
} }

View File

@@ -187,7 +187,7 @@ struct FWingStructAndUStruct
// Pin Ref: A pointer to a graph node, plus a pin name. // Pin Ref: A pointer to a graph node, plus a pin name.
UCLASS() UCLASS()
class UWingPinReference : public UObject class UWingGraphPinRef : public UObject
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -202,7 +202,7 @@ public:
// name. The component can be an inherited component, as // name. The component can be an inherited component, as
// opposed to one that is defined in the blueprint itself. // opposed to one that is defined in the blueprint itself.
UCLASS() UCLASS()
class UWingComponentReference : public UObject class UWingComponentRef : public UObject
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
@@ -218,7 +218,7 @@ public:
// struct is marked CPF_Edit. If not, then the intent is // struct is marked CPF_Edit. If not, then the intent is
// that this struct is for viewing only. // that this struct is for viewing only.
UCLASS() UCLASS()
class UWingStructPointer : public UObject class UWingStructRef : public UObject
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:

View File

@@ -8,22 +8,22 @@ class USCS_Node;
class UActorComponent; class UActorComponent;
class USimpleConstructionScript; class USimpleConstructionScript;
class UClass; class UClass;
class UWingComponentReference; class UWingComponentRef;
class WingOut; class WingOut;
struct UWingComponent struct UWingComponent
{ {
public: public:
static UActorComponent* GetImmutableTemplate(const UWingComponentReference *Ref); static UActorComponent* GetImmutableTemplate(const UWingComponentRef *Ref);
static UActorComponent* GetMutableTemplate(const UWingComponentReference *Ref); static UActorComponent* GetMutableTemplate(const UWingComponentRef *Ref);
static bool ReparentComponent(UWingComponentReference *Ref, UWingComponentReference *Parent, WingOut Errors); static bool ReparentComponent(UWingComponentRef *Ref, UWingComponentRef *Parent, WingOut Errors);
static bool DeleteComponent(UWingComponentReference *Ref, WingOut Errors); static bool DeleteComponent(UWingComponentRef *Ref, WingOut Errors);
static bool AddComponent(UBlueprint *BP, UClass *Class, static bool AddComponent(UBlueprint *BP, UClass *Class,
UWingComponentReference *Parent, FName Name, WingOut Errors); UWingComponentRef *Parent, FName Name, WingOut Errors);
static TArray<TStrongObjectPtr<UWingComponentReference>> GetAll(UBlueprint* BP); static TArray<TStrongObjectPtr<UWingComponentRef>> GetAll(UBlueprint* BP);
static void PrintAll(UBlueprint* BP, WingOut Out); static void PrintAll(UBlueprint* BP, WingOut Out);
static bool CheckValidComponentClass(UClass *Class, WingOut Errors); static bool CheckValidComponentClass(UClass *Class, WingOut Errors);

View File

@@ -7,7 +7,7 @@ class FLogCaptureOutputDevice : public FOutputDevice
{ {
public: public:
TArray<FString> CapturedErrors; TArray<FString> CapturedErrors;
bool bEnabled = true; bool bEnabled = false;
void Install() { GLog->AddOutputDevice(this); } void Install() { GLog->AddOutputDevice(this); }
void Uninstall() { GLog->RemoveOutputDevice(this); } void Uninstall() { GLog->RemoveOutputDevice(this); }

View File

@@ -63,8 +63,8 @@ public:
static FName GetFName(const FWingProperty &Prop); static FName GetFName(const FWingProperty &Prop);
static FName GetFName(const FUserPinInfo &Pin) { return Pin.PinName; } static FName GetFName(const FUserPinInfo &Pin) { return Pin.PinName; }
static FName GetFName(const TSharedPtr<FUserPinInfo> &Pin) { return Pin->PinName; } static FName GetFName(const TSharedPtr<FUserPinInfo> &Pin) { return Pin->PinName; }
static FName GetFName(const UWingComponentReference *Ref) { return Ref->VariableName; } static FName GetFName(const UWingComponentRef *Ref) { return Ref->VariableName; }
static FName GetFName(const TStrongObjectPtr<UWingComponentReference> &Ref) { return Ref->VariableName; } static FName GetFName(const TStrongObjectPtr<UWingComponentRef> &Ref) { return Ref->VariableName; }
static FName GetFName(const UWidget *Widget) { return Widget->GetFName(); } static FName GetFName(const UWidget *Widget) { return Widget->GetFName(); }
static FName GetFName(const WingVariables::Var &Var) { return Var.Name; } static FName GetFName(const WingVariables::Var &Var) { return Var.Name; }
@@ -190,7 +190,7 @@ public:
static FString FormatName(const TSharedPtr<IPropertyHandle> &Handle); static FString FormatName(const TSharedPtr<IPropertyHandle> &Handle);
static FString FormatName(const FUserPinInfo &Pin); static FString FormatName(const FUserPinInfo &Pin);
static FString FormatName(const FBPInterfaceDescription &IFace); static FString FormatName(const FBPInterfaceDescription &IFace);
static FString FormatName(const UWingComponentReference *Ref); static FString FormatName(const UWingComponentRef *Ref);
static FString FormatName(const UWidget *Widget); static FString FormatName(const UWidget *Widget);
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////