Parameter renaming for handlers

This commit is contained in:
2026-03-15 17:20:31 -04:00
parent 7c9419f79e
commit acf6bd3335
22 changed files with 58 additions and 58 deletions

View File

@@ -21,7 +21,7 @@ class UMCP_AnimBlueprint_ListSyncGroups : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Path to an Animation Blueprint, e.g. /Game/Foo/ABP_Character"))
FString Path;
FString Blueprint;
virtual FString GetDescription() const override
{
@@ -31,7 +31,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
UAnimBlueprint* AnimBP = F.Walk(Path).Cast<UAnimBlueprint>();
UAnimBlueprint* AnimBP = F.Walk(Blueprint).Cast<UAnimBlueprint>();
if (!AnimBP) return;
// Walk all anim nodes to collect sync group names

View File

@@ -21,7 +21,7 @@ class UMCP_Asset_Backup : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Full package path of the asset (e.g. /Game/Widgets/WB_Hotkeys)"))
FString AssetPath;
FString Asset;
virtual FString GetDescription() const override
{
@@ -31,7 +31,7 @@ public:
virtual void Handle() override
{
FString Filename = FPaths::ConvertRelativePathToFull(
FPackageName::LongPackageNameToFilename(AssetPath, FPackageName::GetAssetPackageExtension()));
FPackageName::LongPackageNameToFilename(Asset, FPackageName::GetAssetPackageExtension()));
if (!IFileManager::Get().FileExists(*Filename))
{

View File

@@ -23,7 +23,7 @@ class UMCP_Asset_Delete : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Package path of the asset to delete, e.g. /Game/Foo/Bar"))
FString AssetPath;
FString Asset;
UPROPERTY(meta=(Optional, Description="If true, skip reference check and force delete"))
bool Force = false;
@@ -38,7 +38,7 @@ public:
{
// Verify the asset file exists on disk
FString PackageFilename = FPackageName::LongPackageNameToFilename(
AssetPath, FPackageName::GetAssetPackageExtension());
Asset, FPackageName::GetAssetPackageExtension());
PackageFilename = FPaths::ConvertRelativePathToFull(PackageFilename);
if (!IFileManager::Get().FileExists(*PackageFilename))
@@ -50,11 +50,11 @@ public:
// Check references
IAssetRegistry& Registry = *IAssetRegistry::Get();
TArray<FName> Referencers;
Registry.GetReferencers(FName(*AssetPath), Referencers);
Registry.GetReferencers(FName(*Asset), Referencers);
// Filter out self-references
Referencers.RemoveAll([this](const FName& Ref) {
return Ref.ToString() == AssetPath;
return Ref.ToString() == Asset;
});
if (Referencers.Num() > 0 && !Force)
@@ -79,7 +79,7 @@ public:
if (Force)
{
UPackage* Package = FindPackage(nullptr, *AssetPath);
UPackage* Package = FindPackage(nullptr, *Asset);
if (Package)
{
// Collect all objects in this package
@@ -117,12 +117,12 @@ public:
// Trigger an asset registry rescan so it notices the deletion
FString PackageDir;
int32 LastSlash;
if (AssetPath.FindLastChar(TEXT('/'), LastSlash))
if (Asset.FindLastChar(TEXT('/'), LastSlash))
{
PackageDir = AssetPath.Left(LastSlash);
PackageDir = Asset.Left(LastSlash);
Registry.ScanPathsSynchronous({PackageDir}, true);
}
UMCPServer::Printf(TEXT("Deleted %s\n"), *AssetPath);
UMCPServer::Printf(TEXT("Deleted %s\n"), *Asset);
}
};

View File

@@ -20,7 +20,7 @@ class UMCP_Asset_FindReferences : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Asset package path to find references for, e.g. /Game/Tangibles/TAN_Tree"))
FString AssetPath;
FString Asset;
virtual FString GetDescription() const override
{
@@ -32,15 +32,15 @@ public:
IAssetRegistry& Registry = *IAssetRegistry::Get();
// Verify the asset exists
FAssetData AssetData = Registry.GetAssetByObjectPath(FSoftObjectPath(AssetPath));
FAssetData AssetData = Registry.GetAssetByObjectPath(FSoftObjectPath(Asset));
if (!AssetData.IsValid())
{
UMCPServer::Printf(TEXT("ERROR: Asset not found: %s\n"), *AssetPath);
UMCPServer::Printf(TEXT("ERROR: Asset not found: %s\n"), *Asset);
return;
}
TArray<FName> Referencers;
Registry.GetReferencers(FName(*AssetPath), Referencers);
Registry.GetReferencers(FName(*Asset), Referencers);
if (Referencers.Num() == 0)
{

View File

@@ -21,7 +21,7 @@ class UMCP_Asset_Rename : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Current package path of the asset, e.g. /Game/Widgets/WB_Hotkeys"))
FString AssetPath;
FString Asset;
UPROPERTY(meta=(Description="New package path (e.g. /Game/Widgets/WB_NewName) or just a new asset name (e.g. WB_NewName)"))
FString NewPath;
@@ -35,7 +35,7 @@ public:
{
// Load the asset
MCPFetcher F;
UObject* AssetObj = F.Asset(AssetPath).GetObj();
UObject* AssetObj = F.Asset(Asset).GetObj();
if (!AssetObj) return;
// Parse new path into package path and asset name
@@ -44,11 +44,11 @@ public:
if (NewPackagePath.IsEmpty())
{
// No slash — just a new name, keep the same directory
NewPackagePath = FPackageName::GetLongPackagePath(AssetPath);
NewPackagePath = FPackageName::GetLongPackagePath(Asset);
NewAssetName = NewPath;
if (NewPackagePath.IsEmpty())
{
UMCPServer::Printf(TEXT("ERROR: Cannot determine directory from AssetPath '%s'\n"), *AssetPath);
UMCPServer::Printf(TEXT("ERROR: Cannot determine directory from Asset '%s'\n"), *Asset);
return;
}
}

View File

@@ -22,7 +22,7 @@ class UMCP_Asset_Restore : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Full package path of the asset (e.g. /Game/Widgets/WB_Hotkeys)"))
FString AssetPath;
FString Asset;
virtual FString GetDescription() const override
{
@@ -32,7 +32,7 @@ public:
virtual void Handle() override
{
FString Filename = FPaths::ConvertRelativePathToFull(
FPackageName::LongPackageNameToFilename(AssetPath, FPackageName::GetAssetPackageExtension()));
FPackageName::LongPackageNameToFilename(Asset, FPackageName::GetAssetPackageExtension()));
FString BackupFilename = Filename + TEXT(".bak");
if (!IFileManager::Get().FileExists(*BackupFilename))
@@ -42,7 +42,7 @@ public:
}
// Release file handles if the package is loaded
UPackage* Package = FindPackage(nullptr, *AssetPath);
UPackage* Package = FindPackage(nullptr, *Asset);
if (Package)
{
ResetLoaders(Package);
@@ -52,7 +52,7 @@ public:
uint32 CopyResult = IFileManager::Get().Copy(*Filename, *BackupFilename, true);
if (CopyResult != COPY_OK)
{
UMCPServer::Printf(TEXT("ERROR: Failed to copy backup over %s\n"), *AssetPath);
UMCPServer::Printf(TEXT("ERROR: Failed to copy backup over %s\n"), *Asset);
return;
}
@@ -65,11 +65,11 @@ public:
if (!bReloaded)
{
UMCPServer::Printf(TEXT("WARNING: Restored %s but reload failed: %s\n"),
*AssetPath, *ErrorMessage.ToString());
*Asset, *ErrorMessage.ToString());
return;
}
}
UMCPServer::Printf(TEXT("Restored %s from backup\n"), *AssetPath);
UMCPServer::Printf(TEXT("Restored %s from backup\n"), *Asset);
}
};

View File

@@ -22,7 +22,7 @@ class UMCP_BlueprintGraph_Delete : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Path to a blueprint, e.g. /Game/Foo/Bar"))
FString Path;
FString Blueprint;
UPROPERTY(meta=(Description="Name of the graph to delete"))
FString Graph;
@@ -35,7 +35,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
F.Walk(Path);
F.Walk(Blueprint);
if (!F.Ok()) return;
UBlueprint* BP = F.Cast<UBlueprint>();

View File

@@ -38,7 +38,7 @@ class UMCP_Blueprint_AddEventDispatcher : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Path to a blueprint, e.g. /Game/Foo/MyBlueprint"))
FString Path;
FString Blueprint;
UPROPERTY(meta=(Description="Name for the new event dispatcher"))
FString DispatcherName;
@@ -54,7 +54,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
UBlueprint* BP = F.Walk(Path).Cast<UBlueprint>();
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
if (!BP) return;
FName DispatcherFName(*DispatcherName);

View File

@@ -21,7 +21,7 @@ class UMCP_Blueprint_Compile : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Optional, Description="Path of the blueprint."))
FString Path;
FString Blueprint;
virtual FString GetDescription() const override
{
@@ -31,7 +31,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
UBlueprint *BP = F.Walk(Path).Cast<UBlueprint>();
UBlueprint *BP = F.Walk(Blueprint).Cast<UBlueprint>();
EBlueprintCompileOptions CompileOpts =
EBlueprintCompileOptions::SkipSave |

View File

@@ -22,7 +22,7 @@ class UMCP_Blueprint_ListComponents : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Path to a blueprint, e.g. /Game/Tangibles/TAN_Tree"))
FString Path;
FString Blueprint;
virtual FString GetDescription() const override
{
@@ -33,7 +33,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
F.Walk(Path);
F.Walk(Blueprint);
if (!F.Ok()) return;
UBlueprint* BP = F.Cast<UBlueprint>();

View File

@@ -26,7 +26,7 @@ class UMCP_Blueprint_ListEventDispatchers : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Path to a blueprint, e.g. /Game/Foo/MyBlueprint"))
FString Path;
FString Blueprint;
virtual FString GetDescription() const override
{
@@ -36,7 +36,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
UBlueprint* BP = F.Walk(Path).Cast<UBlueprint>();
UBlueprint* BP = F.Walk(Blueprint).Cast<UBlueprint>();
if (!BP) return;
TSet<FName> DelegateNameSet;

View File

@@ -20,7 +20,7 @@ class UMCP_Blueprint_ListInterfaces : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Path to a blueprint, e.g. /Game/Foo/MyBlueprint"))
FString Path;
FString Blueprint;
virtual FString GetDescription() const override
{
@@ -31,7 +31,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
F.Walk(Path);
F.Walk(Blueprint);
if (!F.Ok()) return;
UBlueprint* BP = F.Cast<UBlueprint>();
if (!BP) return;

View File

@@ -20,7 +20,7 @@ class UMCP_Editor_OpenAsset : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="MCPFetcher path to the asset to open (e.g. /Game/Materials/M_Gold)"))
FString Path;
FString Asset;
virtual FString GetDescription() const override
{
@@ -30,7 +30,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
UObject* Obj = F.Walk(Path).Cast<UObject>();
UObject* Obj = F.Walk(Asset).Cast<UObject>();
if (!Obj) return;
UAssetEditorSubsystem* Sub = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();

View File

@@ -24,7 +24,7 @@ class UMCP_Graph_Dump : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Path to a blueprint, material, or graph, e.g. /Game/Foo or /Game/Foo,graph:EventGraph"))
FString Path;
FString Object;
virtual FString GetDescription() const override
{
@@ -35,7 +35,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
F.Walk(Path);
F.Walk(Object);
if (!F.Ok()) return;
if (UEdGraph* Graph = Cast<UEdGraph>(F.GetObj()))

View File

@@ -21,7 +21,7 @@ class UMCP_MaterialInstance_ClearParameter : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Material Instance path"))
FString Path;
FString MaterialInstance;
UPROPERTY(meta=(Description="Parameter name to clear"))
FString Parameter;
@@ -40,7 +40,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
UMaterialInstanceConstant* MI = F.Asset(Path).Cast<UMaterialInstanceConstant>();
UMaterialInstanceConstant* MI = F.Asset(MaterialInstance).Cast<UMaterialInstanceConstant>();
if (!MI) return;
// Parse the association string.

View File

@@ -21,7 +21,7 @@ class UMCP_MaterialInstance_DumpParameters : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Material Instance path"))
FString Path;
FString MaterialInstance;
virtual FString GetDescription() const override
{
@@ -31,7 +31,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
UMaterialInstanceConstant* MI = F.Asset(Path).Cast<UMaterialInstanceConstant>();
UMaterialInstanceConstant* MI = F.Asset(MaterialInstance).Cast<UMaterialInstanceConstant>();
if (!MI) return;
auto AllParams = MCPUtils::GetMaterialParameters(MI);

View File

@@ -22,7 +22,7 @@ class UMCP_MaterialInstance_SetParameter : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Material Instance path"))
FString Path;
FString MaterialInstance;
UPROPERTY(meta=(Description="Parameter name to set"))
FString Parameter;
@@ -44,7 +44,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
UMaterialInstanceConstant* MI = F.Asset(Path).Cast<UMaterialInstanceConstant>();
UMaterialInstanceConstant* MI = F.Asset(MaterialInstance).Cast<UMaterialInstanceConstant>();
if (!MI) return;
// Parse the association string.

View File

@@ -20,7 +20,7 @@ class UMCP_Material_DumpParameters : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Material path"))
FString Path;
FString Material;
virtual FString GetDescription() const override
{
@@ -30,7 +30,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
UMaterial* Mat = F.Asset(Path).Cast<UMaterial>();
UMaterial* Mat = F.Asset(Material).Cast<UMaterial>();
if (!Mat) return;
auto AllParams = MCPUtils::GetMaterialParameters(Mat);

View File

@@ -21,7 +21,7 @@ class UMCP_Property_Dump : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="MCPFetcher path to the object (e.g. /Game/Materials/M_Gold or /Game/Tangibles/TAN_Char,component:Mesh0)"))
FString Path;
FString Object;
UPROPERTY(meta=(Optional, Description="Substring filter for property names"))
FString Query;
@@ -42,7 +42,7 @@ public:
{
// Resolve the path to an object and get its editable template.
MCPFetcher F;
UObject* Template = F.Walk(Path).Cast<UObject>();
UObject* Template = F.Walk(Object).Cast<UObject>();
if (!Template) return;
TArray<MCPProperty> Props = MCPProperty::GetAllSubstring(Template, CPF_Edit, Query);

View File

@@ -20,7 +20,7 @@ class UMCP_Property_Get : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="MCPFetcher path to the object (e.g. /Game/Materials/M_Gold or /Game/Tangibles/TAN_Char,component:Mesh0)"))
FString Path;
FString Object;
UPROPERTY(meta=(Description="Property name"))
FString Property;
@@ -33,7 +33,7 @@ public:
virtual void Handle() override
{
MCPFetcher F;
UObject* Obj = F.Walk(Path).Cast<UObject>();
UObject* Obj = F.Walk(Object).Cast<UObject>();
if (!Obj) return;
MCPProperty P = MCPProperty::GetOneExactMatch(Obj, CPF_Edit, Property);

View File

@@ -20,7 +20,7 @@ class UMCP_Property_Set : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="MCPFetcher path to the object (e.g. /Game/Materials/M_Gold or /Game/Tangibles/TAN_Char,component:Mesh0)"))
FString Path;
FString Object;
UPROPERTY(meta=(Description="Object mapping property names to new values in Unreal text format"))
FMCPJsonObject Properties;
@@ -35,7 +35,7 @@ public:
{
// Resolve the path to an object and get its editable template.
MCPFetcher F;
UObject* Obj = F.Walk(Path).Cast<UObject>();
UObject* Obj = F.Walk(Object).Cast<UObject>();
if (!Obj) return;
if (!Properties.Json || Properties.Json->Values.Num() == 0)

View File

@@ -24,7 +24,7 @@ class UMCP_StateMachine_RemoveState : public UObject, public IMCPHandler
public:
UPROPERTY(meta=(Description="Path to the state machine graph, e.g. /Game/MyAnimBP,graph:StateMachine"))
FString Path;
FString Graph;
UPROPERTY(meta=(Description="Name of the state to remove"))
FString StateName;
@@ -38,7 +38,7 @@ public:
{
// Fetch the state machine graph via MCPFetcher
MCPFetcher F;
F.Walk(Path);
F.Walk(Graph);
if (!F.Ok()) return;
UAnimationStateMachineGraph* SMGraph = F.Cast<UAnimationStateMachineGraph>();