Massive overhaul of the WingActorComponent system, can now edit component properties better, lots of bug fixes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "WingProperty.h"
|
||||
#include "WingActorComponent.h"
|
||||
#include "WingUtils.h"
|
||||
#include "WingHandler.h"
|
||||
#include "WingServer.h"
|
||||
@@ -256,14 +257,12 @@ void FWingProperty::Move(TArray<FWingProperty> &Out, TArray<FWingProperty> &In,
|
||||
In.SetNum(Dst);
|
||||
}
|
||||
|
||||
TArray<FWingProperty> FWingProperty::GetAll(UObject* Obj, EPropertyFlags Flags)
|
||||
TArray<FWingProperty> FWingProperty::GetDetailsGeneral(UObject* Obj, EPropertyFlags Flags, bool Mutable)
|
||||
{
|
||||
if (!Obj) return {};
|
||||
|
||||
// Blueprints don't have editable properties. So
|
||||
// instead, we fetch properties from the generated CDO,
|
||||
// which is probably what the user intended.
|
||||
//
|
||||
// instead, we fetch properties from the generated CDO.
|
||||
if (UBlueprint *BP = ::Cast<UBlueprint>(Obj))
|
||||
{
|
||||
if (BP->GeneratedClass == nullptr)
|
||||
@@ -274,17 +273,15 @@ TArray<FWingProperty> FWingProperty::GetAll(UObject* Obj, EPropertyFlags Flags)
|
||||
Obj = BP->GeneratedClass->GetDefaultObject();
|
||||
}
|
||||
|
||||
// SCS nodes don't have useful editable properties.
|
||||
// Redirect to the component template instead.
|
||||
//
|
||||
if (USCS_Node* Node = ::Cast<USCS_Node>(Obj))
|
||||
// Component references: get the proper template.
|
||||
if (UWingComponentReference* Ref = ::Cast<UWingComponentReference>(Obj))
|
||||
{
|
||||
if (!Node->ComponentTemplate)
|
||||
Obj = Mutable ? Ref->GetMutableTemplate() : Ref->GetImmutableTemplate();
|
||||
if (!Obj)
|
||||
{
|
||||
UWingServer::Printf(TEXT("ERROR: SCS node '%s' has no component template\n"), *Obj->GetName());
|
||||
UWingServer::Printf(TEXT("ERROR: Component '%s' has no template\n"), *Ref->VariableName.ToString());
|
||||
return {};
|
||||
}
|
||||
Obj = Node->ComponentTemplate;
|
||||
}
|
||||
|
||||
TArray<FWingProperty> Result;
|
||||
@@ -315,6 +312,11 @@ TArray<FWingProperty> FWingProperty::GetAll(UObject* Obj, EPropertyFlags Flags)
|
||||
return Result;
|
||||
}
|
||||
|
||||
TArray<FWingProperty> FWingProperty::GetAll(UObject* Object, EPropertyFlags Flags)
|
||||
{
|
||||
return GetAll(Object->GetClass(), Object, Flags);
|
||||
}
|
||||
|
||||
TArray<FWingProperty> FWingProperty::GetAll(UStruct* StructType, void* Container, EPropertyFlags Flags)
|
||||
{
|
||||
TArray<FWingProperty> Result;
|
||||
|
||||
Reference in New Issue
Block a user