More work on properties of components
This commit is contained in:
@@ -79,7 +79,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the SCS node
|
// Create the SCS node
|
||||||
USCS_Node* NewNode = SCS->CreateNode(ComponentClassObj, FName(*Component));
|
USCS_Node* NewNode = SCS->CreateNode(ComponentClassObj, FName(*WingUtils::UnsanitizeName(Component)));
|
||||||
if (!NewNode)
|
if (!NewNode)
|
||||||
{
|
{
|
||||||
UWingServer::Printf(TEXT("ERROR: Failed to create SCS node for component '%s' with class '%s'\n"),
|
UWingServer::Printf(TEXT("ERROR: Failed to create SCS node for component '%s' with class '%s'\n"),
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
if (!BP) return;
|
if (!BP) return;
|
||||||
|
|
||||||
// Check for duplicate variable name
|
// Check for duplicate variable name
|
||||||
FName VarFName(*Name);
|
FName VarFName(*WingUtils::UnsanitizeName(Name));
|
||||||
if (FBlueprintEditorUtils::FindNewVariableIndex(BP, VarFName) != INDEX_NONE)
|
if (FBlueprintEditorUtils::FindNewVariableIndex(BP, VarFName) != INDEX_NONE)
|
||||||
{
|
{
|
||||||
UWingServer::Printf(TEXT("ERROR: Variable '%s' already exists in %s\n"), *Name, *WingUtils::FormatName(BP));
|
UWingServer::Printf(TEXT("ERROR: Variable '%s' already exists in %s\n"), *Name, *WingUtils::FormatName(BP));
|
||||||
|
|||||||
@@ -115,7 +115,20 @@ WingFetcher& WingFetcher::Asset(const FString& PackagePath)
|
|||||||
{
|
{
|
||||||
if (bError) return *this;
|
if (bError) return *this;
|
||||||
|
|
||||||
|
// Try to find the object in memory first (silent), then load if needed.
|
||||||
|
// LoadObject logs its own errors when the package doesn't exist, so
|
||||||
|
// we check DoesPackageExist first to avoid redundant log spam.
|
||||||
|
SetObj(FindObject<UObject>(nullptr, *PackagePath));
|
||||||
|
if (!Obj)
|
||||||
|
{
|
||||||
|
FString PackageName = FPackageName::ObjectPathToPackageName(PackagePath);
|
||||||
|
if (!FPackageName::DoesPackageExist(PackageName))
|
||||||
|
{
|
||||||
|
UWingServer::Printf(TEXT("ERROR: Asset '%s' does not exist.\n"), *PackagePath);
|
||||||
|
return SetError();
|
||||||
|
}
|
||||||
SetObj(LoadObject<UObject>(nullptr, *PackagePath));
|
SetObj(LoadObject<UObject>(nullptr, *PackagePath));
|
||||||
|
}
|
||||||
if (!Obj)
|
if (!Obj)
|
||||||
{
|
{
|
||||||
UWingServer::Printf(TEXT("ERROR: Could not load asset '%s'\n"), *PackagePath);
|
UWingServer::Printf(TEXT("ERROR: Could not load asset '%s'\n"), *PackagePath);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "WingServer.h"
|
#include "WingServer.h"
|
||||||
#include "WingTypes.h"
|
#include "WingTypes.h"
|
||||||
#include "Engine/Blueprint.h"
|
#include "Engine/Blueprint.h"
|
||||||
|
#include "Engine/SCS_Node.h"
|
||||||
#include "MaterialGraph/MaterialGraphNode.h"
|
#include "MaterialGraph/MaterialGraphNode.h"
|
||||||
#include "EdGraph/EdGraphPin.h"
|
#include "EdGraph/EdGraphPin.h"
|
||||||
#include "UObject/EnumProperty.h"
|
#include "UObject/EnumProperty.h"
|
||||||
@@ -138,6 +139,19 @@ TArray<FWingProperty> FWingProperty::GetAll(UObject* Obj, EPropertyFlags Flags)
|
|||||||
Obj = BP->GeneratedClass->GetDefaultObject();
|
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))
|
||||||
|
{
|
||||||
|
if (!Node->ComponentTemplate)
|
||||||
|
{
|
||||||
|
UWingServer::Printf(TEXT("ERROR: SCS node '%s' has no component template\n"), *Obj->GetName());
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
Obj = Node->ComponentTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
TArray<FWingProperty> Result;
|
TArray<FWingProperty> Result;
|
||||||
Collect(Obj->GetClass(), Obj, Result, Flags);
|
Collect(Obj->GetClass(), Obj, Result, Flags);
|
||||||
|
|
||||||
|
|||||||
@@ -166,15 +166,15 @@ public:
|
|||||||
static FString SanitizeName(FName Name);
|
static FString SanitizeName(FName Name);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// Our name sanitization routine, above, will turn
|
// Our name sanitization routine, above, will turn names
|
||||||
// names with spaces into names like "Post·Initiate·Action"
|
// with spaces into names like "Post·Initiate·Action"
|
||||||
// containing middle dots instead. There is a risk that the
|
// containing middle dots instead. When the LLM creates
|
||||||
// LLM will see these dotted names and think it is supposed to
|
// new nodes, graphs, variables, or the like, it might
|
||||||
// do that. So, we have an 'Unsanitize' routine to convert
|
// suggest a name containing middle dots. In places
|
||||||
// the middle dots back into spaces. Of course, next time the
|
// like that, where the LLM is naming something new, we
|
||||||
// name is output, it will be sanitized again, so the LLM will
|
// run this Unsanitize routine first. This is *not*
|
||||||
// always see the version with dots. This creates consistency
|
// used for lookups: Lookups are done by comparing
|
||||||
// for both the LLM and the human user (who is expecting whitespace).
|
// sanitized names.
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
static FString UnsanitizeName(const FString& Name);
|
static FString UnsanitizeName(const FString& Name);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user