Split WingComponentReference into a static helper class and a simple data class
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
#include "WingUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "WingTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "WingServer.h"
|
#include "WingServer.h"
|
||||||
#include "WingActorComponent.h"
|
#include "WingComponent.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"
|
||||||
@@ -64,15 +64,15 @@ public:
|
|||||||
if (!UWingTypes::TextToType(Class, PinType, Req, WingOut::Stdout)) return;
|
if (!UWingTypes::TextToType(Class, PinType, Req, WingOut::Stdout)) return;
|
||||||
UClass* ComponentClass = Cast<UClass>(PinType.PinSubCategoryObject.Get());
|
UClass* ComponentClass = Cast<UClass>(PinType.PinSubCategoryObject.Get());
|
||||||
check(ComponentClass);
|
check(ComponentClass);
|
||||||
if (!UWingComponentReference::CheckValidComponentClass(ComponentClass, WingOut::Stdout)) return;
|
if (!UWingComponent::CheckValidComponentClass(ComponentClass, WingOut::Stdout)) return;
|
||||||
|
|
||||||
// Find the specified parent component
|
// Find the specified parent component
|
||||||
TArray<UWingComponentReference*> AllComponents = UWingComponentReference::GetAll(BP);
|
TArray<UWingComponentReference*> AllComponents = UWingComponent::GetAll(BP);
|
||||||
UWingComponentReference* ParentComp = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout);
|
UWingComponentReference* ParentComp = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout);
|
||||||
if (!ParentComp) return;
|
if (!ParentComp) return;
|
||||||
|
|
||||||
// Create the SCS node
|
// Create the SCS node
|
||||||
if (!UWingComponentReference::AddComponent(BP, ComponentClass, ParentComp, InternalID, WingOut::Stdout)) return;
|
if (!UWingComponent::AddComponent(BP, ComponentClass, ParentComp, InternalID, WingOut::Stdout)) return;
|
||||||
|
|
||||||
WingOut::Stdout.Printf(TEXT("Component Added.\n"));
|
WingOut::Stdout.Printf(TEXT("Component Added.\n"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "WingBasics.h"
|
#include "WingBasics.h"
|
||||||
#include "WingFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "WingServer.h"
|
#include "WingServer.h"
|
||||||
#include "WingActorComponent.h"
|
#include "WingComponent.h"
|
||||||
#include "ActorComponent_Remove.generated.h"
|
#include "ActorComponent_Remove.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
UWingComponentReference* CompRef = F.Walk(Component).Cast<UWingComponentReference>();
|
UWingComponentReference* CompRef = F.Walk(Component).Cast<UWingComponentReference>();
|
||||||
if (!CompRef) return;
|
if (!CompRef) return;
|
||||||
|
|
||||||
if (!CompRef->DeleteComponent(WingOut::Stdout)) return;
|
if (!UWingComponent::DeleteComponent(CompRef, WingOut::Stdout)) return;
|
||||||
|
|
||||||
WingOut::Stdout.Printf(TEXT("Removed component.\n"));
|
WingOut::Stdout.Printf(TEXT("Removed component.\n"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "WingFetcher.h"
|
#include "WingFetcher.h"
|
||||||
#include "WingUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "WingServer.h"
|
#include "WingServer.h"
|
||||||
#include "WingActorComponent.h"
|
#include "WingComponent.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"
|
||||||
@@ -41,11 +41,11 @@ public:
|
|||||||
|
|
||||||
// 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<UWingComponentReference*> AllComponents = UWingComponentReference::GetAll(BP);
|
TArray<UWingComponentReference*> AllComponents = UWingComponent::GetAll(BP);
|
||||||
UWingComponentReference* NewParent = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout);
|
UWingComponentReference* NewParent = WingUtils::FindOneWithExternalID(Parent, AllComponents, TEXT("Component"), WingOut::Stdout);
|
||||||
if (!NewParent) return;
|
if (!NewParent) return;
|
||||||
|
|
||||||
if (!CompRef->ReparentComponent(NewParent, WingOut::Stdout)) return;
|
if (!UWingComponent::ReparentComponent(CompRef, NewParent, WingOut::Stdout)) return;
|
||||||
|
|
||||||
WingOut::Stdout.Printf(TEXT("Reparented component."));
|
WingOut::Stdout.Printf(TEXT("Reparented component."));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "Animation/AnimBlueprint.h"
|
#include "Animation/AnimBlueprint.h"
|
||||||
#include "Animation/Skeleton.h"
|
#include "Animation/Skeleton.h"
|
||||||
#include "WingActorComponent.h"
|
#include "WingComponent.h"
|
||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
#include "AnimationGraph.h"
|
#include "AnimationGraph.h"
|
||||||
#include "AnimationGraphSchema.h"
|
#include "AnimationGraphSchema.h"
|
||||||
@@ -71,9 +71,9 @@ public:
|
|||||||
BlueprintVars.Print(WingOut::StdoutBuffer);
|
BlueprintVars.Print(WingOut::StdoutBuffer);
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
TArray<UWingComponentReference*> Components = UWingComponentReference::GetAll(BP);
|
TArray<UWingComponentReference*> Components = UWingComponent::GetAll(BP);
|
||||||
if (!Components.IsEmpty()) WingOut::Stdout.Print(TEXT("\nComponents:\n"));
|
if (!Components.IsEmpty()) WingOut::Stdout.Print(TEXT("\nComponents:\n"));
|
||||||
UWingComponentReference::PrintAll(BP, WingOut::Stdout);
|
UWingComponent::PrintAll(BP, WingOut::Stdout);
|
||||||
|
|
||||||
// Widget Tree
|
// Widget Tree
|
||||||
if (UWidgetBlueprint* WidgetBP = Cast<UWidgetBlueprint>(BP))
|
if (UWidgetBlueprint* WidgetBP = Cast<UWidgetBlueprint>(BP))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "WingActorComponent.h"
|
#include "WingComponent.h"
|
||||||
#include "WingServer.h"
|
#include "WingServer.h"
|
||||||
#include "WingTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "WingUtils.h"
|
#include "WingUtils.h"
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "Kismet2/BlueprintEditorUtils.h"
|
#include "Kismet2/BlueprintEditorUtils.h"
|
||||||
#include "Engine/InheritableComponentHandler.h"
|
#include "Engine/InheritableComponentHandler.h"
|
||||||
|
|
||||||
UActorComponent *UWingComponentReference::FindComponentInCDO(UClass *Class, FName Name)
|
UActorComponent *UWingComponent::FindComponentInCDO(UClass *Class, FName Name)
|
||||||
{
|
{
|
||||||
if (!Class) return nullptr;
|
if (!Class) return nullptr;
|
||||||
AActor* CDO = Cast<AActor>(Class->GetDefaultObject());
|
AActor* CDO = Cast<AActor>(Class->GetDefaultObject());
|
||||||
@@ -19,7 +19,7 @@ UActorComponent *UWingComponentReference::FindComponentInCDO(UClass *Class, FNam
|
|||||||
return FindObjectFast<UActorComponent>(CDO, Name);
|
return FindObjectFast<UActorComponent>(CDO, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
USCS_Node* UWingComponentReference::FindSCSNodeByName(UBlueprint *BP, FName Name)
|
USCS_Node* UWingComponent::FindSCSNodeByName(UBlueprint *BP, FName Name)
|
||||||
{
|
{
|
||||||
for (UBlueprint *WalkBP : WingUtils::GetAncestorBlueprints(BP))
|
for (UBlueprint *WalkBP : WingUtils::GetAncestorBlueprints(BP))
|
||||||
{
|
{
|
||||||
@@ -30,7 +30,7 @@ USCS_Node* UWingComponentReference::FindSCSNodeByName(UBlueprint *BP, FName Name
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
UWingComponentReference::FoundComponent UWingComponentReference::FindComponent(UBlueprint *BP, FName Name)
|
UWingComponent::FoundComponent UWingComponent::FindComponent(UBlueprint *BP, FName Name)
|
||||||
{
|
{
|
||||||
UClass* NativeClass = FBlueprintEditorUtils::FindFirstNativeClass(BP->ParentClass);
|
UClass* NativeClass = FBlueprintEditorUtils::FindFirstNativeClass(BP->ParentClass);
|
||||||
FoundComponent Result;
|
FoundComponent Result;
|
||||||
@@ -40,7 +40,7 @@ UWingComponentReference::FoundComponent UWingComponentReference::FindComponent(U
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UWingComponentReference::CheckExists(UWingComponentReference::FoundComponent FC, WingOut Errors)
|
bool UWingComponent::CheckExists(UWingComponent::FoundComponent FC, WingOut Errors)
|
||||||
{
|
{
|
||||||
if ((FC.SCS == nullptr) && (FC.Native == nullptr))
|
if ((FC.SCS == nullptr) && (FC.Native == nullptr))
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,7 @@ bool UWingComponentReference::CheckExists(UWingComponentReference::FoundComponen
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UWingComponentReference::CheckValidParent(UWingComponentReference::FoundComponent FC, WingOut Errors)
|
bool UWingComponent::CheckValidParent(UWingComponent::FoundComponent FC, WingOut Errors)
|
||||||
{
|
{
|
||||||
if (FC.SCS && FC.Native)
|
if (FC.SCS && FC.Native)
|
||||||
{
|
{
|
||||||
@@ -73,7 +73,7 @@ bool UWingComponentReference::CheckValidParent(UWingComponentReference::FoundCom
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UWingComponentReference::CheckNoSuchComponent(FoundComponent FC, WingOut Errors)
|
bool UWingComponent::CheckNoSuchComponent(FoundComponent FC, WingOut Errors)
|
||||||
{
|
{
|
||||||
if (FC.SCS || FC.Native)
|
if (FC.SCS || FC.Native)
|
||||||
{
|
{
|
||||||
@@ -84,7 +84,7 @@ bool UWingComponentReference::CheckNoSuchComponent(FoundComponent FC, WingOut Er
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UWingComponentReference::CheckNotNative(FoundComponent FC, const TCHAR *Action, WingOut Errors)
|
bool UWingComponent::CheckNotNative(FoundComponent FC, const TCHAR *Action, WingOut Errors)
|
||||||
{
|
{
|
||||||
if (FC.Native != nullptr)
|
if (FC.Native != nullptr)
|
||||||
{
|
{
|
||||||
@@ -95,7 +95,7 @@ bool UWingComponentReference::CheckNotNative(FoundComponent FC, const TCHAR *Act
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UWingComponentReference::CheckOwnedByBlueprint(FoundComponent FC, UBlueprint *BP, WingOut Errors)
|
bool UWingComponent::CheckOwnedByBlueprint(FoundComponent FC, UBlueprint *BP, WingOut Errors)
|
||||||
{
|
{
|
||||||
if ((FC.SCS == nullptr) || (FC.SCS->GetSCS() != BP->SimpleConstructionScript))
|
if ((FC.SCS == nullptr) || (FC.SCS->GetSCS() != BP->SimpleConstructionScript))
|
||||||
{
|
{
|
||||||
@@ -106,7 +106,7 @@ bool UWingComponentReference::CheckOwnedByBlueprint(FoundComponent FC, UBlueprin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UWingComponentReference::CheckValidComponentClass(UClass *Class, WingOut Errors)
|
bool UWingComponent::CheckValidComponentClass(UClass *Class, WingOut Errors)
|
||||||
{
|
{
|
||||||
if (!Class->IsChildOf(UActorComponent::StaticClass()))
|
if (!Class->IsChildOf(UActorComponent::StaticClass()))
|
||||||
{
|
{
|
||||||
@@ -118,7 +118,7 @@ bool UWingComponentReference::CheckValidComponentClass(UClass *Class, WingOut Er
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UWingComponentReference::AddChildNode(UBlueprint *BP, USCS_Node *NewNode, FoundComponent Parent)
|
void UWingComponent::AddChildNode(UBlueprint *BP, USCS_Node *NewNode, FoundComponent Parent)
|
||||||
{
|
{
|
||||||
if (Parent.SCS)
|
if (Parent.SCS)
|
||||||
{
|
{
|
||||||
@@ -139,7 +139,7 @@ void UWingComponentReference::AddChildNode(UBlueprint *BP, USCS_Node *NewNode, F
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UWingComponentReference::AddComponent(UBlueprint *BP, UClass *Class, UWingComponentReference *Parent, FName Name, WingOut Errors)
|
bool UWingComponent::AddComponent(UBlueprint *BP, UClass *Class, UWingComponentReference *Parent, FName Name, WingOut Errors)
|
||||||
{
|
{
|
||||||
TSet<FName> Names;
|
TSet<FName> Names;
|
||||||
FBlueprintEditorUtils::GetClassVariableList(BP, Names);
|
FBlueprintEditorUtils::GetClassVariableList(BP, Names);
|
||||||
@@ -167,14 +167,14 @@ bool UWingComponentReference::AddComponent(UBlueprint *BP, UClass *Class, UWingC
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UWingComponentReference::ReparentComponent(UWingComponentReference *Parent, WingOut Errors)
|
bool UWingComponent::ReparentComponent(UWingComponentReference *Ref, UWingComponentReference *Parent, WingOut Errors)
|
||||||
{
|
{
|
||||||
FoundComponent ParentComponent = FindComponent(BP, Parent->VariableName);
|
FoundComponent ParentComponent = FindComponent(Ref->BP, Parent->VariableName);
|
||||||
if (!CheckValidParent(ParentComponent, Errors)) return false;
|
if (!CheckValidParent(ParentComponent, Errors)) return false;
|
||||||
FoundComponent ThisComponent = FindComponent(BP, VariableName);
|
FoundComponent ThisComponent = FindComponent(Ref->BP, Ref->VariableName);
|
||||||
if (!CheckExists(ThisComponent, Errors)) return false;
|
if (!CheckExists(ThisComponent, Errors)) return false;
|
||||||
if (!CheckNotNative(ThisComponent, TEXT("reparent"), Errors)) return false;
|
if (!CheckNotNative(ThisComponent, TEXT("reparent"), Errors)) return false;
|
||||||
if (!CheckOwnedByBlueprint(ThisComponent, BP, Errors)) return false;
|
if (!CheckOwnedByBlueprint(ThisComponent, Ref->BP, Errors)) return false;
|
||||||
|
|
||||||
if (ParentComponent.SCS && ParentComponent.SCS->IsChildOf(ThisComponent.SCS))
|
if (ParentComponent.SCS && ParentComponent.SCS->IsChildOf(ThisComponent.SCS))
|
||||||
{
|
{
|
||||||
@@ -182,22 +182,22 @@ bool UWingComponentReference::ReparentComponent(UWingComponentReference *Parent,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BP->SimpleConstructionScript->RemoveNode(ThisComponent.SCS);
|
Ref->BP->SimpleConstructionScript->RemoveNode(ThisComponent.SCS);
|
||||||
AddChildNode(BP, ThisComponent.SCS, ParentComponent);
|
AddChildNode(Ref->BP, ThisComponent.SCS, ParentComponent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UWingComponentReference::DeleteComponent(WingOut Errors)
|
bool UWingComponent::DeleteComponent(UWingComponentReference *Ref, WingOut Errors)
|
||||||
{
|
{
|
||||||
FoundComponent ThisComponent = FindComponent(BP, VariableName);
|
FoundComponent ThisComponent = FindComponent(Ref->BP, Ref->VariableName);
|
||||||
if (!CheckExists(ThisComponent, Errors)) return false;
|
if (!CheckExists(ThisComponent, Errors)) return false;
|
||||||
if (!CheckNotNative(ThisComponent, TEXT("delete"), Errors)) return false;
|
if (!CheckNotNative(ThisComponent, TEXT("delete"), Errors)) return false;
|
||||||
if (!CheckOwnedByBlueprint(ThisComponent, BP, Errors)) return false;
|
if (!CheckOwnedByBlueprint(ThisComponent, Ref->BP, Errors)) return false;
|
||||||
BP->SimpleConstructionScript->RemoveNodeAndPromoteChildren(ThisComponent.SCS);
|
Ref->BP->SimpleConstructionScript->RemoveNodeAndPromoteChildren(ThisComponent.SCS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TMap<FName, FName> UWingComponentReference::CalculateParentNames(USimpleConstructionScript *Script)
|
TMap<FName, FName> UWingComponent::CalculateParentNames(USimpleConstructionScript *Script)
|
||||||
{
|
{
|
||||||
TMap<FName, FName> ParentNames;
|
TMap<FName, FName> ParentNames;
|
||||||
for (USCS_Node* Node : Script->GetAllNodes())
|
for (USCS_Node* Node : Script->GetAllNodes())
|
||||||
@@ -214,14 +214,14 @@ TMap<FName, FName> UWingComponentReference::CalculateParentNames(USimpleConstruc
|
|||||||
return ParentNames;
|
return ParentNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
UActorComponent* UWingComponentReference::GetImmutableTemplate() const
|
UActorComponent* UWingComponent::GetImmutableTemplate(const UWingComponentReference *Ref)
|
||||||
{
|
{
|
||||||
FoundComponent FC = FindComponent(BP, VariableName);
|
FoundComponent FC = FindComponent(Ref->BP, Ref->VariableName);
|
||||||
if (FC.Native) return FC.Native;
|
if (FC.Native) return FC.Native;
|
||||||
if (FC.SCS == nullptr) return nullptr;
|
if (FC.SCS == nullptr) return nullptr;
|
||||||
FComponentKey Key(FC.SCS);
|
FComponentKey Key(FC.SCS);
|
||||||
|
|
||||||
for (UBlueprint *WalkBP : WingUtils::GetAncestorBlueprints(BP, false))
|
for (UBlueprint *WalkBP : WingUtils::GetAncestorBlueprints(Ref->BP, false))
|
||||||
{
|
{
|
||||||
if (FC.SCS->GetSCS()->GetBlueprint() == WalkBP) return FC.SCS->ComponentTemplate;
|
if (FC.SCS->GetSCS()->GetBlueprint() == WalkBP) return FC.SCS->ComponentTemplate;
|
||||||
UInheritableComponentHandler* ICH = WalkBP->GetInheritableComponentHandler(/*bCreateIfNecessary=*/ false);
|
UInheritableComponentHandler* ICH = WalkBP->GetInheritableComponentHandler(/*bCreateIfNecessary=*/ false);
|
||||||
@@ -232,22 +232,22 @@ UActorComponent* UWingComponentReference::GetImmutableTemplate() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
UActorComponent* UWingComponentReference::GetMutableTemplate() const
|
UActorComponent* UWingComponent::GetMutableTemplate(const UWingComponentReference *Ref)
|
||||||
{
|
{
|
||||||
FoundComponent FC = FindComponent(BP, VariableName);
|
FoundComponent FC = FindComponent(Ref->BP, Ref->VariableName);
|
||||||
if (FC.Native) return FC.Native;
|
if (FC.Native) return FC.Native;
|
||||||
if (!FC.SCS) return nullptr;
|
if (!FC.SCS) return nullptr;
|
||||||
if (FC.SCS->GetSCS()->GetBlueprint() == BP) return FC.SCS->ComponentTemplate;
|
if (FC.SCS->GetSCS()->GetBlueprint() == Ref->BP) return FC.SCS->ComponentTemplate;
|
||||||
|
|
||||||
FComponentKey Key(FC.SCS);
|
FComponentKey Key(FC.SCS);
|
||||||
UInheritableComponentHandler* ICH = BP->GetInheritableComponentHandler(/*bCreateIfNecessary=*/ true);
|
UInheritableComponentHandler* ICH = Ref->BP->GetInheritableComponentHandler(/*bCreateIfNecessary=*/ true);
|
||||||
if (!ICH) return nullptr;
|
if (!ICH) return nullptr;
|
||||||
UActorComponent* Override = ICH->GetOverridenComponentTemplate(Key);
|
UActorComponent* Override = ICH->GetOverridenComponentTemplate(Key);
|
||||||
if (!Override) Override = ICH->CreateOverridenComponentTemplate(Key);
|
if (!Override) Override = ICH->CreateOverridenComponentTemplate(Key);
|
||||||
return Override;
|
return Override;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<UWingComponentReference*> UWingComponentReference::GetAll(UBlueprint* BP)
|
TArray<UWingComponentReference*> UWingComponent::GetAll(UBlueprint* BP)
|
||||||
{
|
{
|
||||||
TArray<UWingComponentReference*> Result;
|
TArray<UWingComponentReference*> Result;
|
||||||
if (!BP) return Result;
|
if (!BP) return Result;
|
||||||
@@ -288,7 +288,7 @@ TArray<UWingComponentReference*> UWingComponentReference::GetAll(UBlueprint* BP)
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UWingComponentReference::PrintComponentInfo(const FString& TypeName, const FString& VarName, const FString& ParentName, bool Inherited, WingOut Out)
|
void UWingComponent::PrintComponentInfo(const FString& TypeName, const FString& VarName, const FString& ParentName, bool Inherited, WingOut Out)
|
||||||
{
|
{
|
||||||
Out.Printf(TEXT(" %s %s"), *TypeName, *VarName);
|
Out.Printf(TEXT(" %s %s"), *TypeName, *VarName);
|
||||||
if (!ParentName.IsEmpty())
|
if (!ParentName.IsEmpty())
|
||||||
@@ -298,7 +298,7 @@ void UWingComponentReference::PrintComponentInfo(const FString& TypeName, const
|
|||||||
Out.Print(TEXT("\n"));
|
Out.Print(TEXT("\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UWingComponentReference::PrintAll(UBlueprint* BP, WingOut Out)
|
void UWingComponent::PrintAll(UBlueprint* BP, WingOut Out)
|
||||||
{
|
{
|
||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "WingServer.h"
|
#include "WingServer.h"
|
||||||
#include "WingBasics.h"
|
#include "WingBasics.h"
|
||||||
#include "WingUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "WingActorComponent.h"
|
#include "WingComponent.h"
|
||||||
#include "WingReferences.h"
|
#include "WingReferences.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "EdGraph/EdGraph.h"
|
#include "EdGraph/EdGraph.h"
|
||||||
@@ -286,7 +286,7 @@ WingFetcher& WingFetcher::Component(const FString& Value)
|
|||||||
return SetError();
|
return SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<UWingComponentReference*> AllComponents = UWingComponentReference::GetAll(BP);
|
TArray<UWingComponentReference*> AllComponents = UWingComponent::GetAll(BP);
|
||||||
UWingComponentReference* Found = WingUtils::FindOneWithExternalID(Value, AllComponents, TEXT("component"), Errors);
|
UWingComponentReference* Found = WingUtils::FindOneWithExternalID(Value, AllComponents, TEXT("component"), Errors);
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "WingProperty.h"
|
#include "WingProperty.h"
|
||||||
#include "WingActorComponent.h"
|
#include "WingComponent.h"
|
||||||
#include "WingUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "WingBasics.h"
|
#include "WingBasics.h"
|
||||||
#include "WingReferences.h"
|
#include "WingReferences.h"
|
||||||
@@ -455,7 +455,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 (UWingComponentReference* Ref = ::Cast<UWingComponentReference>(Obj))
|
||||||
{
|
{
|
||||||
Obj = Mutable ? Ref->GetMutableTemplate() : Ref->GetImmutableTemplate();
|
Obj = Mutable ? UWingComponent::GetMutableTemplate(Ref) : UWingComponent::GetImmutableTemplate(Ref);
|
||||||
if (!Obj)
|
if (!Obj)
|
||||||
{
|
{
|
||||||
WingOut::Stdout.Printf(TEXT("ERROR: Component '%s' has no template\n"), *Ref->VariableName.ToString());
|
WingOut::Stdout.Printf(TEXT("ERROR: Component '%s' has no template\n"), *Ref->VariableName.ToString());
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "WingUtils.h"
|
#include "WingUtils.h"
|
||||||
#include "WingActorComponent.h"
|
#include "WingComponent.h"
|
||||||
#include "WingProperty.h"
|
#include "WingProperty.h"
|
||||||
#include "WingTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "WingServer.h"
|
#include "WingServer.h"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "WingBasics.h"
|
#include "WingBasics.h"
|
||||||
#include "WingActorComponent.generated.h"
|
#include "WingComponent.generated.h"
|
||||||
|
|
||||||
class UBlueprint;
|
class UBlueprint;
|
||||||
class USCS_Node;
|
class USCS_Node;
|
||||||
@@ -24,12 +24,16 @@ public:
|
|||||||
|
|
||||||
// The component name.
|
// The component name.
|
||||||
FName VariableName;
|
FName VariableName;
|
||||||
|
};
|
||||||
|
|
||||||
UActorComponent* GetImmutableTemplate() const;
|
struct UWingComponent
|
||||||
UActorComponent* GetMutableTemplate() const;
|
{
|
||||||
|
public:
|
||||||
|
static UActorComponent* GetImmutableTemplate(const UWingComponentReference *Ref);
|
||||||
|
static UActorComponent* GetMutableTemplate(const UWingComponentReference *Ref);
|
||||||
|
|
||||||
bool ReparentComponent(UWingComponentReference *Parent, WingOut Errors);
|
static bool ReparentComponent(UWingComponentReference *Ref, UWingComponentReference *Parent, WingOut Errors);
|
||||||
bool DeleteComponent(WingOut Errors);
|
static bool DeleteComponent(UWingComponentReference *Ref, WingOut Errors);
|
||||||
static bool AddComponent(UBlueprint *BP, UClass *Class,
|
static bool AddComponent(UBlueprint *BP, UClass *Class,
|
||||||
UWingComponentReference *Parent, FName Name, WingOut Errors);
|
UWingComponentReference *Parent, FName Name, WingOut Errors);
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
#include "K2Node_EditablePinBase.h"
|
#include "K2Node_EditablePinBase.h"
|
||||||
#include "Components/Widget.h"
|
#include "Components/Widget.h"
|
||||||
#include "WingActorComponent.h"
|
#include "WingComponent.h"
|
||||||
#include "WingVariables.h"
|
#include "WingVariables.h"
|
||||||
#include "WingBasics.h"
|
#include "WingBasics.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user