diff --git a/Plugins/UEWingman/Source/UEWingman/Handlers/ActorComponent_Add.h b/Plugins/UEWingman/Source/UEWingman/Handlers/ActorComponent_Add.h index 60d643b2..4622b18f 100644 --- a/Plugins/UEWingman/Source/UEWingman/Handlers/ActorComponent_Add.h +++ b/Plugins/UEWingman/Source/UEWingman/Handlers/ActorComponent_Add.h @@ -65,12 +65,12 @@ public: if (!UWingComponent::CheckValidComponentClass(ComponentClass, WingOut::Stdout)) return; // Find the specified parent component - TArray AllComponents = UWingComponent::GetAll(BP); - UWingComponentReference* ParentComp = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout); + TArray> AllComponents = UWingComponent::GetAll(BP); + TStrongObjectPtr ParentComp = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout); if (!ParentComp) return; // Create the SCS node - if (!UWingComponent::AddComponent(BP, ComponentClass, ParentComp, InternalID, WingOut::Stdout)) return; + if (!UWingComponent::AddComponent(BP, ComponentClass, ParentComp.Get(), InternalID, WingOut::Stdout)) return; WingOut::Stdout.Printf(TEXT("Component Added.\n")); } diff --git a/Plugins/UEWingman/Source/UEWingman/Handlers/ActorComponent_Reparent.h b/Plugins/UEWingman/Source/UEWingman/Handlers/ActorComponent_Reparent.h index 63ec7dbd..72d81321 100644 --- a/Plugins/UEWingman/Source/UEWingman/Handlers/ActorComponent_Reparent.h +++ b/Plugins/UEWingman/Source/UEWingman/Handlers/ActorComponent_Reparent.h @@ -39,11 +39,11 @@ public: // Find the new parent among all components (if specified) UBlueprint *BP = CompRef->BP; - TArray AllComponents = UWingComponent::GetAll(BP); - UWingComponentReference* NewParent = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout); + TArray> AllComponents = UWingComponent::GetAll(BP); + TStrongObjectPtr NewParent = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout); if (!NewParent) return; - if (!UWingComponent::ReparentComponent(CompRef, NewParent, WingOut::Stdout)) return; + if (!UWingComponent::ReparentComponent(CompRef, NewParent.Get(), WingOut::Stdout)) return; WingOut::Stdout.Printf(TEXT("Reparented component.")); } diff --git a/Plugins/UEWingman/Source/UEWingman/Handlers/Blueprint_Dump.h b/Plugins/UEWingman/Source/UEWingman/Handlers/Blueprint_Dump.h index 20cd1f91..47166861 100644 --- a/Plugins/UEWingman/Source/UEWingman/Handlers/Blueprint_Dump.h +++ b/Plugins/UEWingman/Source/UEWingman/Handlers/Blueprint_Dump.h @@ -69,7 +69,7 @@ public: BlueprintVars.Print(WingOut::StdoutBuffer); // Components - TArray Components = UWingComponent::GetAll(BP); + TArray> Components = UWingComponent::GetAll(BP); if (!Components.IsEmpty()) WingOut::Stdout.Print(TEXT("\nComponents:\n")); UWingComponent::PrintAll(BP, WingOut::Stdout); diff --git a/Plugins/UEWingman/Source/UEWingman/Private/WingComponent.cpp b/Plugins/UEWingman/Source/UEWingman/Private/WingComponent.cpp index b2296154..7d139f25 100644 --- a/Plugins/UEWingman/Source/UEWingman/Private/WingComponent.cpp +++ b/Plugins/UEWingman/Source/UEWingman/Private/WingComponent.cpp @@ -244,9 +244,9 @@ UActorComponent* UWingComponent::GetMutableTemplate(const UWingComponentReferenc return Override; } -TArray UWingComponent::GetAll(UBlueprint* BP) +TArray> UWingComponent::GetAll(UBlueprint* BP) { - TArray Result; + TArray> Result; if (!BP) return Result; // Find the native ancestor class @@ -264,7 +264,7 @@ TArray UWingComponent::GetAll(UBlueprint* BP) UWingComponentReference* Ref = NewObject(); Ref->BP = BP; Ref->VariableName = Comp->GetFName(); - Result.Add(Ref); + Result.Emplace(Ref); } } } @@ -278,7 +278,7 @@ TArray UWingComponent::GetAll(UBlueprint* BP) UWingComponentReference* Ref = NewObject(); Ref->BP = BP; Ref->VariableName = Node->GetVariableName(); - Result.Add(Ref); + Result.Emplace(Ref); } } diff --git a/Plugins/UEWingman/Source/UEWingman/Private/WingFetcher.cpp b/Plugins/UEWingman/Source/UEWingman/Private/WingFetcher.cpp index 9211d072..b739f6d3 100644 --- a/Plugins/UEWingman/Source/UEWingman/Private/WingFetcher.cpp +++ b/Plugins/UEWingman/Source/UEWingman/Private/WingFetcher.cpp @@ -284,19 +284,19 @@ WingFetcher& WingFetcher::Component(const FString& Value) return SetError(); } - TArray AllComponents = UWingComponent::GetAll(BP); - UWingComponentReference* Found = WingUtils::FindOneWithExternalID(Value, AllComponents, TEXT("component"), Errors); + TArray> AllComponents = UWingComponent::GetAll(BP); + TStrongObjectPtr Found = WingUtils::FindOneWithExternalID(Value, AllComponents, TEXT("component"), Errors); if (!Found) { Errors.Printf(TEXT("Components that exist in the blueprint:\n")); - for (const UWingComponentReference* C : AllComponents) + for (const TStrongObjectPtr& C : AllComponents) { - Errors.Printf(TEXT(" %s\n"), *WingUtils::FormatName(C)); + Errors.Printf(TEXT(" %s\n"), *WingUtils::FormatName(C.Get())); } return SetError(); } - SetObj(Found); + SetObj(Found.Get()); return *this; } diff --git a/Plugins/UEWingman/Source/UEWingman/Public/WingComponent.h b/Plugins/UEWingman/Source/UEWingman/Public/WingComponent.h index 59bafaf4..1d3437f2 100644 --- a/Plugins/UEWingman/Source/UEWingman/Public/WingComponent.h +++ b/Plugins/UEWingman/Source/UEWingman/Public/WingComponent.h @@ -1,6 +1,7 @@ #pragma once #include "CoreMinimal.h" +#include "UObject/StrongObjectPtr.h" class UBlueprint; class USCS_Node; @@ -22,7 +23,7 @@ public: static bool AddComponent(UBlueprint *BP, UClass *Class, UWingComponentReference *Parent, FName Name, WingOut Errors); - static TArray GetAll(UBlueprint* BP); + static TArray> GetAll(UBlueprint* BP); static void PrintAll(UBlueprint* BP, WingOut Out); static bool CheckValidComponentClass(UClass *Class, WingOut Errors); diff --git a/Plugins/UEWingman/Source/UEWingman/Public/WingServer.h b/Plugins/UEWingman/Source/UEWingman/Public/WingServer.h index 33fef135..497f256b 100644 --- a/Plugins/UEWingman/Source/UEWingman/Public/WingServer.h +++ b/Plugins/UEWingman/Source/UEWingman/Public/WingServer.h @@ -104,7 +104,7 @@ private: const FString& Request, FString& Response); static void WaitForAssetRegistry(); - // ----- Thread-safe message queue ----- + // ----- The Critical Section ----- struct FPendingMessage { FString Line; diff --git a/Plugins/UEWingman/Source/UEWingman/Public/WingUtils.h b/Plugins/UEWingman/Source/UEWingman/Public/WingUtils.h index d882e9bb..3b78e151 100644 --- a/Plugins/UEWingman/Source/UEWingman/Public/WingUtils.h +++ b/Plugins/UEWingman/Source/UEWingman/Public/WingUtils.h @@ -64,6 +64,7 @@ public: static FName GetFName(const FUserPinInfo &Pin) { return Pin.PinName; } static FName GetFName(const TSharedPtr &Pin) { return Pin->PinName; } static FName GetFName(const UWingComponentReference *Ref) { return Ref->VariableName; } + static FName GetFName(const TStrongObjectPtr &Ref) { return Ref->VariableName; } static FName GetFName(const UWidget *Widget) { return Widget->GetFName(); } static FName GetFName(const WingVariables::Var &Var) { return Var.Name; }