Classify some handlers as half-baked

This commit is contained in:
2026-03-15 17:47:42 -04:00
parent acf6bd3335
commit 4b811cd7ee
50 changed files with 75 additions and 67 deletions

View File

@@ -0,0 +1,69 @@
#pragma once
#include "CoreMinimal.h"
#include "MCPServer.h"
#include "MCPHandler.h"
#include "MCPUtils.h"
#include "AssetRegistry/AssetData.h"
#include "AssetRegistry/IAssetRegistry.h"
#include "Asset_FindReferences.generated.h"
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
UCLASS(meta=(HalfBaked))
class UMCP_Asset_FindReferences : public UObject, public IMCPHandler
{
GENERATED_BODY()
public:
UPROPERTY(meta=(Description="Asset package path to find references for, e.g. /Game/Tangibles/TAN_Tree"))
FString Asset;
virtual FString GetDescription() const override
{
return TEXT("Find all assets that reference a given asset.");
}
virtual void Handle() override
{
IAssetRegistry& Registry = *IAssetRegistry::Get();
// Verify the asset exists
FAssetData AssetData = Registry.GetAssetByObjectPath(FSoftObjectPath(Asset));
if (!AssetData.IsValid())
{
UMCPServer::Printf(TEXT("ERROR: Asset not found: %s\n"), *Asset);
return;
}
TArray<FName> Referencers;
Registry.GetReferencers(FName(*Asset), Referencers);
if (Referencers.Num() == 0)
{
UMCPServer::Print(TEXT("No referencers found.\n"));
return;
}
// Classify referencers by looking up their asset class
for (const FName& Ref : Referencers)
{
FString RefStr = Ref.ToString();
TArray<FAssetData> RefAssets;
Registry.GetAssetsByPackageName(Ref, RefAssets);
if (RefAssets.Num() > 0)
{
UMCPServer::Printf(TEXT("%s %s\n"),
*MCPUtils::FormatName(RefAssets[0].GetClass()),
*RefStr);
}
else
{
UMCPServer::Printf(TEXT("Unknown %s\n"), *RefStr);
}
}
}
};