Another registration overhaul

This commit is contained in:
2026-04-01 18:12:54 -04:00
parent 483b3b75ff
commit 7865818e69
67 changed files with 224 additions and 232 deletions

View File

@@ -37,12 +37,12 @@ public:
UPROPERTY(meta=(Description="Name of the parent component to attach to")) UPROPERTY(meta=(Description="Name of the parent component to attach to"))
FString Parent; FString Parent;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Add a component to a Blueprint's SimpleConstructionScript. " UWingServer::AddHandler(this,
"Optionally attach it to an existing parent component."); TEXT("Add a component to a Blueprint's SimpleConstructionScript. "
"Optionally attach it to an existing parent component."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -21,11 +21,11 @@ public:
UPROPERTY(meta=(Description="Path to the component (e.g. '/Game/MyBP,component:MyComp')")) UPROPERTY(meta=(Description="Path to the component (e.g. '/Game/MyBP,component:MyComp')"))
FString Component; FString Component;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Remove a component from a Blueprint's SimpleConstructionScript."); UWingServer::AddHandler(this,
TEXT("Remove a component from a Blueprint's SimpleConstructionScript."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -28,11 +28,11 @@ public:
UPROPERTY(meta=(Description="New parent component name.")) UPROPERTY(meta=(Description="New parent component name."))
FString Parent; FString Parent;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Change the parent of a component in a Blueprint's SimpleConstructionScript."); UWingServer::AddHandler(this,
TEXT("Change the parent of a component in a Blueprint's SimpleConstructionScript."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -23,11 +23,11 @@ public:
UPROPERTY(meta=(Description="Asset to back up")) UPROPERTY(meta=(Description="Asset to back up"))
FString Asset; FString Asset;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Copy an asset's .uasset file to a .uasset.bak backup."); UWingServer::AddHandler(this,
TEXT("Copy an asset's .uasset file to a .uasset.bak backup."));
} }
virtual void Handle() override virtual void Handle() override
{ {
FString Filename = FPaths::ConvertRelativePathToFull( FString Filename = FPaths::ConvertRelativePathToFull(

View File

@@ -23,11 +23,11 @@ public:
UPROPERTY(meta=(Description="Content browser path to list, e.g. /Game or /Game/Maps")) UPROPERTY(meta=(Description="Content browser path to list, e.g. /Game or /Game/Maps"))
FString Path; FString Path;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("List the subfolders and assets inside a content browser folder."); UWingServer::AddHandler(this,
TEXT("List the subfolders and assets inside a content browser folder."));
} }
static FString GetExtraInfoString(const FAssetData& Data) static FString GetExtraInfoString(const FAssetData& Data)
{ {
FString ParentClassName; FString ParentClassName;

View File

@@ -29,12 +29,12 @@ public:
UPROPERTY(meta=(Optional, Description="If true, skip reference check and force delete")) UPROPERTY(meta=(Optional, Description="If true, skip reference check and force delete"))
bool Force = false; bool Force = false;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Delete a .uasset after verifying no references. " UWingServer::AddHandler(this,
"Use force=true to skip the reference check."); TEXT("Delete a .uasset after verifying no references. "
"Use force=true to skip the reference check."));
} }
virtual void Handle() override virtual void Handle() override
{ {
// Verify the asset file exists on disk // Verify the asset file exists on disk

View File

@@ -22,11 +22,11 @@ public:
UPROPERTY(meta=(Description="Asset to find references for")) UPROPERTY(meta=(Description="Asset to find references for"))
FString Asset; FString Asset;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Find all assets that reference a given asset."); UWingServer::AddHandler(this,
TEXT("Find all assets that reference a given asset."));
} }
virtual void Handle() override virtual void Handle() override
{ {
IAssetRegistry& Registry = *IAssetRegistry::Get(); IAssetRegistry& Registry = *IAssetRegistry::Get();

View File

@@ -26,11 +26,11 @@ public:
UPROPERTY(meta=(Description="New package path or just a new name")) UPROPERTY(meta=(Description="New package path or just a new name"))
FString NewPath; FString NewPath;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Rename or move an asset with reference fixup."); UWingServer::AddHandler(this,
TEXT("Rename or move an asset with reference fixup."));
} }
virtual void Handle() override virtual void Handle() override
{ {
// Load the asset // Load the asset

View File

@@ -24,11 +24,11 @@ public:
UPROPERTY(meta=(Description="Asset to restore")) UPROPERTY(meta=(Description="Asset to restore"))
FString Asset; FString Asset;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Restore a .uasset file from its .uasset.bak backup, reloading it in the editor."); UWingServer::AddHandler(this,
TEXT("Restore a .uasset file from its .uasset.bak backup, reloading it in the editor."));
} }
virtual void Handle() override virtual void Handle() override
{ {
FString Filename = FPaths::ConvertRelativePathToFull( FString Filename = FPaths::ConvertRelativePathToFull(

View File

@@ -30,11 +30,11 @@ public:
UPROPERTY(meta=(Optional, Description="Maximum number of results (default 50)")) UPROPERTY(meta=(Optional, Description="Maximum number of results (default 50)"))
int32 Limit = 50; int32 Limit = 50;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Search for assets by name and/or type. At least one of Query or Type must be specified."); UWingServer::AddHandler(this,
TEXT("Search for assets by name and/or type. At least one of Query or Type must be specified."));
} }
virtual void Handle() override virtual void Handle() override
{ {
if (Query.IsEmpty() && Type.IsEmpty()) if (Query.IsEmpty() && Type.IsEmpty())

View File

@@ -38,11 +38,11 @@ public:
UPROPERTY(meta=(Optional, Description="Output variables, one per line")) UPROPERTY(meta=(Optional, Description="Output variables, one per line"))
FString OutputVariables; FString OutputVariables;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Create a new function or macro graph in a Blueprint."); UWingServer::AddHandler(this,
TEXT("Create a new function or macro graph in a Blueprint."));
} }
virtual void Handle() override virtual void Handle() override
{ {
if (GraphType != TEXT("function") && GraphType != TEXT("macro")) if (GraphType != TEXT("function") && GraphType != TEXT("macro"))

View File

@@ -24,11 +24,11 @@ public:
UPROPERTY(meta=(Description="Path to the graph, e.g. /Game/MyBP,graph:MyFunction")) UPROPERTY(meta=(Description="Path to the graph, e.g. /Game/MyBP,graph:MyFunction"))
FString Graph; FString Graph;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Delete a function or macro graph from a Blueprint."); UWingServer::AddHandler(this,
TEXT("Delete a function or macro graph from a Blueprint."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -27,11 +27,11 @@ public:
UPROPERTY(meta=(Description="Native UInterface class name or Blueprint Interface package path")) UPROPERTY(meta=(Description="Native UInterface class name or Blueprint Interface package path"))
FString Interface; FString Interface;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Add an interface to a blueprint"); UWingServer::AddHandler(this,
TEXT("Add an interface to a blueprint"));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -30,12 +30,12 @@ public:
UPROPERTY(meta=(Optional, Description="If true, keep the function graphs as regular functions")) UPROPERTY(meta=(Optional, Description="If true, keep the function graphs as regular functions"))
bool PreserveFunctions = false; bool PreserveFunctions = false;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Remove a Blueprint Interface implementation from a Blueprint. " UWingServer::AddHandler(this,
"Optionally preserve the function graphs as regular functions."); TEXT("Remove a Blueprint Interface implementation from a Blueprint. "
"Optionally preserve the function graphs as regular functions."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -24,12 +24,12 @@ public:
UPROPERTY(meta=(Description="Blueprint to compile")) UPROPERTY(meta=(Description="Blueprint to compile"))
FString Blueprint; FString Blueprint;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Compile a blueprint. " UWingServer::AddHandler(this,
"Reports compiler warnings and errors."); TEXT("Compile a blueprint. "
"Reports compiler warnings and errors."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -32,11 +32,11 @@ public:
UPROPERTY(meta=(Optional, Description="Normal, Interface, FunctionLibrary, or MacroLibrary")) UPROPERTY(meta=(Optional, Description="Normal, Interface, FunctionLibrary, or MacroLibrary"))
TEnumAsByte<EBlueprintType> BlueprintType = BPTYPE_Normal; TEnumAsByte<EBlueprintType> BlueprintType = BPTYPE_Normal;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Create a new Blueprint asset with a specified parent class and type."); UWingServer::AddHandler(this,
TEXT("Create a new Blueprint asset with a specified parent class and type."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingPackageMaker Maker(AssetPath); WingPackageMaker Maker(AssetPath);

View File

@@ -34,12 +34,12 @@ public:
UPROPERTY(meta=(Description="Blueprint path")) UPROPERTY(meta=(Description="Blueprint path"))
FString Blueprint; FString Blueprint;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Dump a Blueprint's structure: variables, interfaces, components, " UWingServer::AddHandler(this,
"and graph names. Does not include graph contents (use Graph_Dump for that)."); TEXT("Dump a Blueprint's structure: variables, interfaces, components, "
"and graph names. Does not include graph contents (use Graph_Dump for that)."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -28,11 +28,11 @@ public:
UPROPERTY(meta=(Description="New parent class")) UPROPERTY(meta=(Description="New parent class"))
FString Parent; FString Parent;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Change a Blueprint's parent class."); UWingServer::AddHandler(this,
TEXT("Change a Blueprint's parent class."));
} }
virtual void Handle() override virtual void Handle() override
{ {
// Load Blueprint // Load Blueprint

View File

@@ -17,12 +17,7 @@ public:
UPROPERTY(meta=(Description="Full asset path for the new asset (e.g. '/Game/MyFolder/MyAsset')")) UPROPERTY(meta=(Description="Full asset path for the new asset (e.g. '/Game/MyFolder/MyAsset')"))
FString AssetPath; FString AssetPath;
virtual FString GetDescription() const override virtual void Register() override
{
return TEXT("Create a new asset using a factory.");
}
virtual void Register(UWingServer* Server) override
{ {
TArray<UClass*> FactoryClasses; TArray<UClass*> FactoryClasses;
GetDerivedClasses(UFactory::StaticClass(), FactoryClasses); GetDerivedClasses(UFactory::StaticClass(), FactoryClasses);
@@ -37,8 +32,10 @@ public:
TArray<FName> ConfigProps = FWingProperty::GetNames(Class, CPF_Edit); TArray<FName> ConfigProps = FWingProperty::GetNames(Class, CPF_Edit);
if (ConfigProps.Num() > 0) continue; if (ConfigProps.Num() > 0) continue;
FString CommandName = FString::Printf(TEXT("Create_%s"), *UWingFactories::DeriveFactoryName(Class)); FString FactoryName = UWingFactories::DeriveFactoryName(Class);
Server->AddHandler(CommandName, GetClass(), Class, EWingHandlerKind::Create); FString CommandName = FString::Printf(TEXT("Create_%s"), *FactoryName);
FString Doc = FString::Printf(TEXT("Create a new %s asset."), *FactoryName);
UWingServer::AddHandler(this, CommandName, Doc, Class, EWingHandlerKind::Create);
} }
} }

View File

@@ -18,11 +18,11 @@ class UWing_Editor_ListOpenAssets : public UWingHandler
GENERATED_BODY() GENERATED_BODY()
public: public:
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("List all currently open asset editors, showing which has focus and whether they have unsaved changes."); UWingServer::AddHandler(this,
TEXT("List all currently open asset editors, showing which has focus and whether they have unsaved changes."));
} }
virtual void Handle() override virtual void Handle() override
{ {
UAssetEditorSubsystem* Sub = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>(); UAssetEditorSubsystem* Sub = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();

View File

@@ -22,11 +22,11 @@ public:
UPROPERTY(meta=(Description="Asset to open")) UPROPERTY(meta=(Description="Asset to open"))
FString Asset; FString Asset;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Open an asset in its editor and bring it to focus."); UWingServer::AddHandler(this,
TEXT("Open an asset in its editor and bring it to focus."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -30,11 +30,11 @@ public:
UPROPERTY(meta=(Description="Input Variables, one per line, expressed as: type var = value")) UPROPERTY(meta=(Description="Input Variables, one per line, expressed as: type var = value"))
FString InputVariables; FString InputVariables;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Add a new event dispatcher to a Blueprint."); UWingServer::AddHandler(this,
TEXT("Add a new event dispatcher to a Blueprint."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -26,11 +26,11 @@ public:
UPROPERTY(meta=(Description="Name of the event dispatcher to delete")) UPROPERTY(meta=(Description="Name of the event dispatcher to delete"))
FString Dispatcher; FString Dispatcher;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Delete an event dispatcher from a Blueprint."); UWingServer::AddHandler(this,
TEXT("Delete an event dispatcher from a Blueprint."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -25,13 +25,13 @@ public:
UPROPERTY(meta=(Description="Menu item as shown by GraphNode_ShowMenu")) UPROPERTY(meta=(Description="Menu item as shown by GraphNode_ShowMenu"))
FString Item; FString Item;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Execute a context menu action on a node or pin. " UWingServer::AddHandler(this,
TEXT("Execute a context menu action on a node or pin. "
"Supports SplitStructPin, AddPin, AddArrayElementPin, etc. " "Supports SplitStructPin, AddPin, AddArrayElementPin, etc. "
"Use GraphNode_ShowMenu to see available actions. "); "Use GraphNode_ShowMenu to see available actions. "));
} }
private: private:
virtual void Handle() override virtual void Handle() override
{ {

View File

@@ -45,12 +45,12 @@ public:
UPROPERTY(meta=(Description="Array of {Type, posX, posY} objects. Use GraphNode_SearchTypes to find types.")) UPROPERTY(meta=(Description="Array of {Type, posX, posY} objects. Use GraphNode_SearchTypes to find types."))
FWingJsonArray Nodes; FWingJsonArray Nodes;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Create nodes using the editor's action database. " UWingServer::AddHandler(this,
"Use GraphNode_SearchTypes to find types."); TEXT("Create nodes using the editor's action database. "
"Use GraphNode_SearchTypes to find types."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -26,12 +26,12 @@ public:
UPROPERTY(meta=(Description="Node to delete")) UPROPERTY(meta=(Description="Node to delete"))
FString Node; FString Node;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Delete a node from a graph. " UWingServer::AddHandler(this,
"Cannot delete undeletable nodes (entry points, root nodes, etc)."); TEXT("Delete a node from a graph. "
"Cannot delete undeletable nodes (entry points, root nodes, etc)."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -21,11 +21,11 @@ public:
UPROPERTY(meta=(Description="Target node")) UPROPERTY(meta=(Description="Target node"))
FString Node; FString Node;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Dump a single node as readable text, including all pins and connections."); UWingServer::AddHandler(this,
TEXT("Dump a single node as readable text, including all pins and connections."));
} }
private: private:
virtual void Handle() override virtual void Handle() override
{ {

View File

@@ -22,11 +22,11 @@ public:
UPROPERTY(meta=(Description="Target node")) UPROPERTY(meta=(Description="Target node"))
FString Node; FString Node;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Get the comment text and bubble visibility of a node."); UWingServer::AddHandler(this,
TEXT("Get the comment text and bubble visibility of a node."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -25,12 +25,12 @@ public:
UPROPERTY(meta=(Description="New name for the node")) UPROPERTY(meta=(Description="New name for the node"))
FString Name; FString Name;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Rename a graph node. Works on custom events, timelines, " UWingServer::AddHandler(this,
"composite nodes, comment nodes, and other renameable node types."); TEXT("Rename a graph node. Works on custom events, timelines, "
"composite nodes, comment nodes, and other renameable node types."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -30,13 +30,13 @@ public:
UPROPERTY(meta=(Description="Target graph")) UPROPERTY(meta=(Description="Target graph"))
FString Graph; FString Graph;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Search the action database for node types that can be spawned in a graph. " UWingServer::AddHandler(this,
TEXT("Search the action database for node types that can be spawned in a graph. "
"Works with any graph type (Blueprint, Material, etc.). " "Works with any graph type (Blueprint, Material, etc.). "
"Returns full action names for use with GraphNode_Create."); "Returns full action names for use with GraphNode_Create."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -25,12 +25,12 @@ public:
UPROPERTY(meta=(Description="Comment text to set")) UPROPERTY(meta=(Description="Comment text to set"))
FString Comment; FString Comment;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Set a node's comment text, and make the comment visible. " UWingServer::AddHandler(this,
"Setting empty text will cause the comment to vanish."); TEXT("Set a node's comment text, and make the comment visible. "
"Setting empty text will cause the comment to vanish."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -44,11 +44,11 @@ public:
UPROPERTY(meta=(Description="Array of {node, name, value} objects")) UPROPERTY(meta=(Description="Array of {node, name, value} objects"))
FWingJsonArray Pins; FWingJsonArray Pins;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Set the default value of input pins or material expression properties on nodes."); UWingServer::AddHandler(this,
TEXT("Set the default value of input pins or material expression properties on nodes."));
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// K2 graphs: set pin default values. // K2 graphs: set pin default values.
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View File

@@ -42,11 +42,11 @@ public:
UPROPERTY(meta=(Description="Array of {node, x, y} objects")) UPROPERTY(meta=(Description="Array of {node, x, y} objects"))
FWingJsonArray Nodes; FWingJsonArray Nodes;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Reposition one or more nodes in a Blueprint graph."); UWingServer::AddHandler(this,
TEXT("Reposition one or more nodes in a Blueprint graph."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -23,11 +23,11 @@ public:
UPROPERTY(meta=(Description="Target node")) UPROPERTY(meta=(Description="Target node"))
FString Node; FString Node;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Show context menu actions available for a node and its pins."); UWingServer::AddHandler(this,
TEXT("Show context menu actions available for a node and its pins."));
} }
private: private:
virtual void Handle() override virtual void Handle() override
{ {

View File

@@ -42,11 +42,11 @@ public:
UPROPERTY(meta=(Description="Array of {sourcePin, targetPin} objects")) UPROPERTY(meta=(Description="Array of {sourcePin, targetPin} objects"))
FWingJsonArray Connections; FWingJsonArray Connections;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Connect pins between nodes in a graph (Blueprint or Material)."); UWingServer::AddHandler(this,
TEXT("Connect pins between nodes in a graph (Blueprint or Material)."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -41,12 +41,12 @@ public:
UPROPERTY(meta=(Description="Array of {pin, targetPin?} objects. If targetPin is omitted, all connections on the pin are broken.")) UPROPERTY(meta=(Description="Array of {pin, targetPin?} objects. If targetPin is omitted, all connections on the pin are broken."))
FWingJsonArray Disconnections; FWingJsonArray Disconnections;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Disconnect pins in a graph (Blueprint or Material). " UWingServer::AddHandler(this,
"Can disconnect a specific link or all links on a pin."); TEXT("Disconnect pins in a graph (Blueprint or Material). "
"Can disconnect a specific link or all links on a pin."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -29,11 +29,11 @@ public:
UPROPERTY(meta=(Optional, Description="True to include less-significant details")) UPROPERTY(meta=(Optional, Description="True to include less-significant details"))
bool IncludeDetails; bool IncludeDetails;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Dump blueprint or material graphs as readable text. "); UWingServer::AddHandler(this,
TEXT("Dump blueprint or material graphs as readable text. "));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -33,11 +33,11 @@ public:
UPROPERTY(meta=(Description="Layer/blend index (0-based). Only used when ParameterAssociation is 'Layer' or 'Blend'", Optional)) UPROPERTY(meta=(Description="Layer/blend index (0-based). Only used when ParameterAssociation is 'Layer' or 'Blend'", Optional))
int32 ParameterLayer = INDEX_NONE; int32 ParameterLayer = INDEX_NONE;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Remove a parameter override from a Material Instance, reverting it to the parent material's value."); UWingServer::AddHandler(this,
TEXT("Remove a parameter override from a Material Instance, reverting it to the parent material's value."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -29,11 +29,11 @@ public:
UPROPERTY(meta=(Description="Parent material package path (Material or Material Instance)")) UPROPERTY(meta=(Description="Parent material package path (Material or Material Instance)"))
FString ParentMaterial; FString ParentMaterial;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Create a new Material Instance Constant asset with a specified parent material."); UWingServer::AddHandler(this,
TEXT("Create a new Material Instance Constant asset with a specified parent material."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingPackageMaker Maker(AssetPath); WingPackageMaker Maker(AssetPath);

View File

@@ -24,11 +24,11 @@ public:
UPROPERTY(meta=(Description="Target material instance")) UPROPERTY(meta=(Description="Target material instance"))
FString MaterialInstance; FString MaterialInstance;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("List all parameters on a Material Instance, showing current values and which are overridden."); UWingServer::AddHandler(this,
TEXT("List all parameters on a Material Instance, showing current values and which are overridden."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -37,11 +37,11 @@ public:
UPROPERTY(meta=(Description="Value to set (uses Unreal text format, e.g. '0.5' for scalar, '(R=1,G=0,B=0,A=1)' for vector)")) UPROPERTY(meta=(Description="Value to set (uses Unreal text format, e.g. '0.5' for scalar, '(R=1,G=0,B=0,A=1)' for vector)"))
FString Value; FString Value;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Set a parameter override on a Material Instance."); UWingServer::AddHandler(this,
TEXT("Set a parameter override on a Material Instance."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -22,11 +22,11 @@ public:
UPROPERTY(meta=(Description="Material name or package path")) UPROPERTY(meta=(Description="Material name or package path"))
FString Material; FString Material;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Force recompile a material and check for compilation errors."); UWingServer::AddHandler(this,
TEXT("Force recompile a material and check for compilation errors."));
} }
virtual void Handle() override virtual void Handle() override
{ {
// Load material // Load material

View File

@@ -24,11 +24,11 @@ public:
UPROPERTY(meta=(Description="Full asset path for the new material")) UPROPERTY(meta=(Description="Full asset path for the new material"))
FString Material; FString Material;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Create a new UMaterial asset"); UWingServer::AddHandler(this,
TEXT("Create a new UMaterial asset"));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingPackageMaker Maker(Material); WingPackageMaker Maker(Material);

View File

@@ -23,11 +23,11 @@ public:
UPROPERTY(meta=(Description="Material path")) UPROPERTY(meta=(Description="Material path"))
FString Material; FString Material;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("List all parameters on a Material, showing their default values."); UWingServer::AddHandler(this,
TEXT("List all parameters on a Material, showing their default values."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -29,11 +29,11 @@ public:
UPROPERTY(meta=(Optional, Description="Only show properties declared on the object's own class, not inherited ones")) UPROPERTY(meta=(Optional, Description="Only show properties declared on the object's own class, not inherited ones"))
bool Local = false; bool Local = false;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("List all blueprint-visible properties, showing current values and which are editable."); UWingServer::AddHandler(this,
TEXT("List all blueprint-visible properties, showing current values and which are editable."));
} }
virtual void Handle() override virtual void Handle() override
{ {
// Resolve the path to an object and get its editable template. // Resolve the path to an object and get its editable template.

View File

@@ -25,11 +25,11 @@ public:
UPROPERTY(meta=(Description="Property name")) UPROPERTY(meta=(Description="Property name"))
FString Property; FString Property;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Get the value of a single property."); UWingServer::AddHandler(this,
TEXT("Get the value of a single property."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -25,11 +25,11 @@ public:
UPROPERTY(meta=(Description="Object mapping property names to new values in Unreal text format")) UPROPERTY(meta=(Description="Object mapping property names to new values in Unreal text format"))
FWingJsonObject Properties; FWingJsonObject Properties;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Set one or more editable properties. Values use Unreal text format."); UWingServer::AddHandler(this,
TEXT("Set one or more editable properties. Values use Unreal text format."));
} }
virtual void Handle() override virtual void Handle() override
{ {
// Resolve the path to an object and get its editable template. // Resolve the path to an object and get its editable template.

View File

@@ -24,11 +24,11 @@ public:
UPROPERTY(meta=(Optional, Description="Kind of command: Normal, or Create")) UPROPERTY(meta=(Optional, Description="Kind of command: Normal, or Create"))
EWingHandlerKind Kind = EWingHandlerKind::Normal; EWingHandlerKind Kind = EWingHandlerKind::Normal;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("List all available commands with their descriptions."); UWingServer::AddHandler(this,
TEXT("List all available commands with their descriptions."));
} }
virtual void Handle() override virtual void Handle() override
{ {
FString QueryLower = Query.ToLower(); FString QueryLower = Query.ToLower();
@@ -64,8 +64,7 @@ public:
{ {
UWingServer::Printf(TEXT( UWingServer::Printf(TEXT(
"\n" "\n"
"You can also use ShowCommands with Kind=Create to see\n" "You can also use ShowCommands with Kind=Create to see commands that create new assets.\n"
"commands that create new assets.\n"
"\n")); "\n"));
} }
} }

View File

@@ -17,13 +17,13 @@ class UWing_SysInfo_Factories : public UWingHandler
GENERATED_BODY() GENERATED_BODY()
public: public:
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Sysinfo commands are intended for the human who " UWingServer::AddHandler(this,
TEXT("Sysinfo commands are intended for the human who "
"is developing this plugin, they help him to understand. " "is developing this plugin, they help him to understand. "
"unreal's internals better."); "unreal's internals better."));
} }
virtual void Handle() override virtual void Handle() override
{ {
const TArray<UWingFactories::Info>& All = UWingFactories::AllFactories(); const TArray<UWingFactories::Info>& All = UWingFactories::AllFactories();

View File

@@ -20,11 +20,11 @@ public:
UPROPERTY(meta=(Description="The string to sanitize")) UPROPERTY(meta=(Description="The string to sanitize"))
FString Input; FString Input;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Test the sanitizer by sanitizing a string and printing the result."); UWingServer::AddHandler(this,
TEXT("Test the sanitizer by sanitizing a string and printing the result."));
} }
virtual void Handle() override virtual void Handle() override
{ {
UWingServer::Printf(TEXT("%s\n"), *WingTokenizer::ExternalizeID(FName(Input))); UWingServer::Printf(TEXT("%s\n"), *WingTokenizer::ExternalizeID(FName(Input)));

View File

@@ -20,11 +20,11 @@ public:
UPROPERTY(meta=(Description="The string to tokenize")) UPROPERTY(meta=(Description="The string to tokenize"))
FString Input; FString Input;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Test the tokenizer by tokenizing a string and printing the result."); UWingServer::AddHandler(this,
TEXT("Test the tokenizer by tokenizing a string and printing the result."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingTokenizer T(Input); WingTokenizer T(Input);

View File

@@ -20,11 +20,11 @@ public:
UPROPERTY(meta=(Description="The type name to parse, e.g. 'Array<Vector>'")) UPROPERTY(meta=(Description="The type name to parse, e.g. 'Array<Vector>'"))
FString Input; FString Input;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Test the type parser by parsing a type name and dumping the resulting FEdGraphPinType."); UWingServer::AddHandler(this,
TEXT("Test the type parser by parsing a type name and dumping the resulting FEdGraphPinType."));
} }
virtual void Handle() override virtual void Handle() override
{ {
FEdGraphPinType PinType; FEdGraphPinType PinType;

View File

@@ -20,11 +20,11 @@ public:
UPROPERTY(meta=(Description="The sanitized identifier to unsanitize")) UPROPERTY(meta=(Description="The sanitized identifier to unsanitize"))
FString Input; FString Input;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Test the unsanitizer by unsanitizing a string and printing the result."); UWingServer::AddHandler(this,
TEXT("Test the unsanitizer by unsanitizing a string and printing the result."));
} }
virtual void Handle() override virtual void Handle() override
{ {
FString Error; FString Error;

View File

@@ -32,12 +32,12 @@ public:
UPROPERTY(meta=(Optional, Description="If true, include all types, not just BlueprintType/Blueprintable ones")) UPROPERTY(meta=(Optional, Description="If true, include all types, not just BlueprintType/Blueprintable ones"))
bool Exhaustive = false; bool Exhaustive = false;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Search for type names usable in pin type specifications. " UWingServer::AddHandler(this,
"Returns short names that can be used with commands like Blueprint_ChangeVariableType."); TEXT("Search for type names usable in pin type specifications. "
"Returns short names that can be used with commands like Blueprint_ChangeVariableType."));
} }
static bool IsProjectDefined(const UWingTypes::Info& Info) static bool IsProjectDefined(const UWingTypes::Info& Info)
{ {
return Info.IsUserDefined && Info.PinSubCategoryObject.StartsWith(TEXT("/Game/")); return Info.IsUserDefined && Info.PinSubCategoryObject.StartsWith(TEXT("/Game/"));

View File

@@ -11,11 +11,11 @@ class UWing_UserManual : public UWingHandler
GENERATED_BODY() GENERATED_BODY()
public: public:
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Print the user manual."); UWingServer::AddHandler(this,
TEXT("Print the user manual."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingManual::PrintManual({WingManual::Section::All}, nullptr, false); WingManual::PrintManual({WingManual::Section::All}, nullptr, false);

View File

@@ -33,11 +33,11 @@ public:
UPROPERTY(meta=(Optional, Description="Local variables, one per line")) UPROPERTY(meta=(Optional, Description="Local variables, one per line"))
FString LocalVariables; FString LocalVariables;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Add new variables. Format: 'type name (flags) = default', one per line."); UWingServer::AddHandler(this,
TEXT("Add new variables. Format: 'type name (flags) = default', one per line."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -21,12 +21,12 @@ public:
UPROPERTY(meta=(Description="Path to a blueprint, graph, or custom event node")) UPROPERTY(meta=(Description="Path to a blueprint, graph, or custom event node"))
FString Object; FString Object;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("List all variables of a blueprint, function graph," UWingServer::AddHandler(this,
"macro graph, event dispatcher graph, or custom event node"); TEXT("List all variables of a blueprint, function graph,"
"macro graph, event dispatcher graph, or custom event node"));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -33,12 +33,12 @@ public:
UPROPERTY(meta=(Optional, Description="Local variables, one per line")) UPROPERTY(meta=(Optional, Description="Local variables, one per line"))
FString LocalVariables; FString LocalVariables;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Modify variables of a blueprint, function graph, " UWingServer::AddHandler(this,
"macro graph, event dispatcher graph, or custom event node. "); TEXT("Modify variables of a blueprint, function graph, "
"macro graph, event dispatcher graph, or custom event node. "));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -33,11 +33,11 @@ public:
UPROPERTY(meta=(Optional, Description="Local variable names to remove, comma-separated")) UPROPERTY(meta=(Optional, Description="Local variable names to remove, comma-separated"))
FString LocalVariables; FString LocalVariables;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Remove variables from a blueprint, graph, or custom event node."); UWingServer::AddHandler(this,
TEXT("Remove variables from a blueprint, graph, or custom event node."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingFetcher F; WingFetcher F;

View File

@@ -39,12 +39,12 @@ public:
UPROPERTY(meta=(Optional, Description="Whether to expose the widget as a variable in the blueprint (default false)")) UPROPERTY(meta=(Optional, Description="Whether to expose the widget as a variable in the blueprint (default false)"))
bool IsVariable = false; bool IsVariable = false;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Add a widget to a Widget Blueprint's widget tree. " UWingServer::AddHandler(this,
"Use Widget_SearchTypes to find available widget types."); TEXT("Add a widget to a Widget Blueprint's widget tree. "
"Use Widget_SearchTypes to find available widget types."));
} }
virtual void Handle() override virtual void Handle() override
{ {
// Fetch the widget blueprint. // Fetch the widget blueprint.

View File

@@ -25,12 +25,12 @@ public:
UPROPERTY(meta=(Description="Path to the widget, eg /Game/Widgets/WB_Test,widget:MyButton")) UPROPERTY(meta=(Description="Path to the widget, eg /Game/Widgets/WB_Test,widget:MyButton"))
FString Widget; FString Widget;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Delete a widget from a Widget Blueprint's widget tree. " UWingServer::AddHandler(this,
"The widget must not have any children."); TEXT("Delete a widget from a Widget Blueprint's widget tree. "
"The widget must not have any children."));
} }
virtual void Handle() override virtual void Handle() override
{ {
// Walk to the widget. // Walk to the widget.

View File

@@ -28,11 +28,11 @@ public:
UPROPERTY(meta=(Description="Name of the new parent widget. Must be a panel.")) UPROPERTY(meta=(Description="Name of the new parent widget. Must be a panel."))
FString Parent; FString Parent;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Move a widget to a different parent in a Widget Blueprint's widget tree."); UWingServer::AddHandler(this,
TEXT("Move a widget to a different parent in a Widget Blueprint's widget tree."));
} }
virtual void Handle() override virtual void Handle() override
{ {
// Walk to the widget. // Walk to the widget.

View File

@@ -23,12 +23,12 @@ public:
UPROPERTY(meta=(Optional, Description="Maximum number of results (default 50)")) UPROPERTY(meta=(Optional, Description="Maximum number of results (default 50)"))
int32 MaxResults = 50; int32 MaxResults = 50;
virtual FString GetDescription() const override virtual void Register() override
{ {
return TEXT("Search for widget types that can be added to a Widget Blueprint. " UWingServer::AddHandler(this,
"Returns names for use with Widget_Create."); TEXT("Search for widget types that can be added to a Widget Blueprint. "
"Returns names for use with Widget_Create."));
} }
virtual void Handle() override virtual void Handle() override
{ {
WingWidgets Widgets; WingWidgets Widgets;

View File

@@ -44,9 +44,8 @@ void WingManual::PrintHandlerArguments(const FWingHandlerConfig& Handler)
void WingManual::PrintHandlerDescription(const FWingHandlerConfig& Handler) void WingManual::PrintHandlerDescription(const FWingHandlerConfig& Handler)
{ {
const UWingHandler* HandlerCDO = Cast<UWingHandler>(Handler.Class->GetDefaultObject()); if (Handler.Documentation.IsEmpty()) return;
if (!HandlerCDO) return; UWingServer::Print(WingUtils::WrapText(Handler.Documentation, 80, TEXT(" // ")));
UWingServer::Print(WingUtils::WrapText(HandlerCDO->GetDescription(), 80, TEXT(" // ")));
} }
void WingManual::PrintHandlerHelp(const FWingHandlerConfig& Handler) void WingManual::PrintHandlerHelp(const FWingHandlerConfig& Handler)

View File

@@ -452,21 +452,21 @@ void UWingServer::ClientThreadFunc(UWingServer* Server, TSharedPtr<FClientConnec
// BuildWingHandlerRegistry // BuildWingHandlerRegistry
// ============================================================ // ============================================================
void UWingHandler::Register(UWingServer* Server) void UWingServer::AddHandler(UObject* Obj, const FString& Documentation)
{ {
UClass* Class = GetClass(); AddHandler(Obj, WingUtils::GetHandlerName(Obj->GetClass()), Documentation, nullptr, EWingHandlerKind::Normal);
Server->AddHandler(WingUtils::GetHandlerName(Class), Class, nullptr, EWingHandlerKind::Normal);
} }
void UWingServer::AddHandler(const FString& Name, UClass* Class, UObject* Config, EWingHandlerKind Kind) void UWingServer::AddHandler(UObject* Obj, const FString& Name, const FString& Documentation, UObject* Config, EWingHandlerKind Kind)
{ {
FWingHandlerConfig H; FWingHandlerConfig H;
H.Name = Name; H.Name = Name;
H.Class = TStrongObjectPtr<UClass>(Class); H.Documentation = Documentation;
H.Class = TStrongObjectPtr<UClass>(Obj->GetClass());
H.Config = TStrongObjectPtr<UObject>(Config); H.Config = TStrongObjectPtr<UObject>(Config);
H.Kind = Kind; H.Kind = Kind;
WingHandlerRegistry.Add(MoveTemp(H)); GWingServer->WingHandlerRegistry.Add(MoveTemp(H));
} }
void UWingServer::BuildWingHandlerRegistry() void UWingServer::BuildWingHandlerRegistry()
@@ -474,7 +474,7 @@ void UWingServer::BuildWingHandlerRegistry()
for (UClass* Class : WingUtils::CollectHandlerClasses()) for (UClass* Class : WingUtils::CollectHandlerClasses())
{ {
UWingHandler* CDO = Cast<UWingHandler>(Class->GetDefaultObject()); UWingHandler* CDO = Cast<UWingHandler>(Class->GetDefaultObject());
CDO->Register(this); CDO->Register();
} }
WingHandlerRegistry.Sort([](const FWingHandlerConfig& A, const FWingHandlerConfig& B) { return A.Name < B.Name; }); WingHandlerRegistry.Sort([](const FWingHandlerConfig& A, const FWingHandlerConfig& B) { return A.Name < B.Name; });
} }

View File

@@ -24,8 +24,6 @@ struct FWingJsonArray
TArray<TSharedPtr<FJsonValue>> Array; TArray<TSharedPtr<FJsonValue>> Array;
}; };
class UWingServer;
UENUM() UENUM()
enum class EWingHandlerKind enum class EWingHandlerKind
{ {
@@ -38,6 +36,7 @@ struct FWingHandlerConfig
{ {
GENERATED_BODY() GENERATED_BODY()
FString Name; FString Name;
FString Documentation;
TStrongObjectPtr<UClass> Class; TStrongObjectPtr<UClass> Class;
TStrongObjectPtr<UObject> Config; TStrongObjectPtr<UObject> Config;
EWingHandlerKind Kind = EWingHandlerKind::Normal; EWingHandlerKind Kind = EWingHandlerKind::Normal;
@@ -49,11 +48,8 @@ class UEWINGMAN_API UWingHandler : public UObject
GENERATED_BODY() GENERATED_BODY()
public: public:
// Human-readable tool description for MCP tools/list.
virtual FString GetDescription() const PURE_VIRTUAL(UWingHandler::GetDescription, return FString(););
// Register this handler's commands with the server. // Register this handler's commands with the server.
virtual void Register(UWingServer* Server); virtual void Register() PURE_VIRTUAL(UWingHandler::Register);
// Called after parameter fields have been populated from JSON. // Called after parameter fields have been populated from JSON.
virtual void Handle() {} virtual void Handle() {}

View File

@@ -74,7 +74,8 @@ public:
int32 GetPort() const { return Port; } int32 GetPort() const { return Port; }
// ----- Tool dispatch ----- // ----- Tool dispatch -----
void AddHandler(const FString& Name, UClass* Class, UObject* Config, EWingHandlerKind Kind); static void AddHandler(UObject* Obj, const FString& Documentation);
static void AddHandler(UObject* Obj, const FString& Name, const FString& Documentation, UObject* Config, EWingHandlerKind Kind);
static const TArray<FWingHandlerConfig>& AllHandlers() { return GWingServer->WingHandlerRegistry; } static const TArray<FWingHandlerConfig>& AllHandlers() { return GWingServer->WingHandlerRegistry; }
private: private: