Header file reorg, documentation, and cleanup
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include "WingBasics.h"
|
||||
#include "WingServer.h"
|
||||
#include "WingFetcher.h"
|
||||
#include "WingReferences.h"
|
||||
#include "WingProperty.h"
|
||||
#include "WingUtils.h"
|
||||
#include "EdGraph/EdGraphPin.h"
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "WingServer.h"
|
||||
#include "WingBasics.h"
|
||||
#include "WingFetcher.h"
|
||||
#include "WingReferences.h"
|
||||
#include "WingProperty.h"
|
||||
#include "WingUtils.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "WingServer.h"
|
||||
#include "WingBasics.h"
|
||||
#include "WingFetcher.h"
|
||||
#include "WingReferences.h"
|
||||
#include "WingProperty.h"
|
||||
#include "WingUtils.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "WingBasics.h"
|
||||
#include "WingUtils.h"
|
||||
#include "WingComponent.h"
|
||||
#include "WingReferences.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "EdGraph/EdGraph.h"
|
||||
#include "EdGraph/EdGraphNode.h"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "WingComponent.h"
|
||||
#include "WingUtils.h"
|
||||
#include "WingBasics.h"
|
||||
#include "WingReferences.h"
|
||||
#include "WingServer.h"
|
||||
#include "WingTypes.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#include "WingReferences.h"
|
||||
#include "WingUtils.h"
|
||||
#include "EdGraph/EdGraphNode.h"
|
||||
#include "EdGraph/EdGraphPin.h"
|
||||
|
||||
|
||||
@@ -6,25 +6,22 @@
|
||||
#include "Dom/JsonObject.h"
|
||||
#include "WingBasics.generated.h"
|
||||
|
||||
// Marker struct for handler parameters that accept a JSON object.
|
||||
// PopulateFromJson stashes the actual JSON object into the Json field.
|
||||
//
|
||||
USTRUCT()
|
||||
struct FWingJsonObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
TSharedPtr<FJsonObject> Json;
|
||||
};
|
||||
class UEdGraphNode;
|
||||
class UEdGraphPin;
|
||||
|
||||
// Marker struct for handler parameters that accept a JSON array.
|
||||
// PopulateFromJson stashes the actual JSON array into the Array field.
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
USTRUCT()
|
||||
struct FWingJsonArray
|
||||
{
|
||||
GENERATED_BODY()
|
||||
TArray<TSharedPtr<FJsonValue>> Array;
|
||||
};
|
||||
// Handlers.
|
||||
//
|
||||
// Each command supported by the MCP is implemented by a
|
||||
// 'handler'. The server receives the request, which
|
||||
// contains a command. The server looks up the right
|
||||
// handler class for the command, and creates a handler
|
||||
// object. Using reflection, it inserts the command
|
||||
// parameters into uproperty fields of the handler, then
|
||||
// calls the handle method, which executes the command.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
UENUM()
|
||||
enum class EWingHandlerKind
|
||||
@@ -59,13 +56,56 @@ public:
|
||||
|
||||
// The configuration object.
|
||||
FWingHandlerConfig *Configuration;
|
||||
|
||||
public:
|
||||
};
|
||||
|
||||
// A 'WingOut' is our version of an output stream. It always
|
||||
// contains a pointer to a string builder, or nullptr.
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Json wrappers.
|
||||
//
|
||||
// Normally, the json request is automatically used to
|
||||
// populate the properties of the handler, so the handler
|
||||
// doesn't have to deal with json. However, in a few cases,
|
||||
// the handler actually does want to see some json. These
|
||||
// wrappers allow a handler to request raw json data instead
|
||||
// of pre-processed values.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
USTRUCT()
|
||||
struct FWingJsonObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
TSharedPtr<FJsonObject> Json;
|
||||
};
|
||||
|
||||
// Marker struct for handler parameters that accept a JSON array.
|
||||
// PopulateFromJson stashes the actual JSON array into the Array field.
|
||||
//
|
||||
USTRUCT()
|
||||
struct FWingJsonArray
|
||||
{
|
||||
GENERATED_BODY()
|
||||
TArray<TSharedPtr<FJsonValue>> Array;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// WingOut.
|
||||
//
|
||||
// A thin wrapper around unreal string builders. Handlers
|
||||
// put their output into a WingOut (string builder), which
|
||||
// eventually gets forwarded to the agent. This output
|
||||
// buffer is called WingOut::Stdout.
|
||||
//
|
||||
// Subroutines that can generate error messages take a
|
||||
// parameter 'WingOut Errors', a string builder where they
|
||||
// can put the error message. Unlike a raw string builder,
|
||||
// a WingOut can be nullptr, which is useful if you want to
|
||||
// ignore error messages from certain subroutines. You can
|
||||
// also direct error messages directly to WingOut::Stdout.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
class WingOut
|
||||
{
|
||||
public:
|
||||
@@ -87,6 +127,16 @@ private:
|
||||
FStringBuilderBase *Buffer;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FWingStructAndUStruct.
|
||||
//
|
||||
// A pointer to a struct, and also a pointer to a UStruct
|
||||
// that describes the struct. This also can store a
|
||||
// UObject and the UClass that describes the UObject.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
// A FWingStructAndUStruct is a pointer to a struct and its associated ustruct.
|
||||
//
|
||||
struct FWingStructAndUStruct
|
||||
@@ -108,3 +158,75 @@ struct FWingStructAndUStruct
|
||||
FWingStructAndUStruct(T *Struct) : StructPtr(Struct), UStructPtr(Struct->StaticStruct()) {}
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// References.
|
||||
//
|
||||
// The MCP has a variety of operations that can manipulate
|
||||
// any object, including: actors, components, graphs, graph
|
||||
// nodes, graph pins, widgets, and so forth. For example,
|
||||
// the agent can request a 'details panel' for any of these.
|
||||
//
|
||||
// However, some of those objects aren't UObjects. This
|
||||
// makes it awkward to write code that deals with them
|
||||
// uniformly. To homogenize them, we turn them all into
|
||||
// UObjects by creating wrappers for those that aren't.
|
||||
//
|
||||
// Some things that you would think are UObjects, like
|
||||
// components, are actually only UObjects at runtime.
|
||||
// When a blueprint is still being edited, the component
|
||||
// is represented by a bunch of related data structures
|
||||
// inside the blueprint. At that time, there is no one
|
||||
// UObject to point to as 'the component.'
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// Pin Ref: A pointer to a graph node, plus a pin name.
|
||||
UCLASS()
|
||||
class UWingPinReference : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY()
|
||||
UEdGraphNode* Node = nullptr;
|
||||
|
||||
FName PinName;
|
||||
};
|
||||
|
||||
// Component Ref: A pointer to a blueprint plus a component
|
||||
// name. The component can be an inherited component, as
|
||||
// opposed to one that is defined in the blueprint itself.
|
||||
UCLASS()
|
||||
class UWingComponentReference : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UPROPERTY()
|
||||
UBlueprint* BP = nullptr;
|
||||
|
||||
// The component name.
|
||||
FName VariableName;
|
||||
};
|
||||
|
||||
// Struct Ref: A pointer to an object, and a struct inside
|
||||
// that object. The editable flag indicates whether the
|
||||
// struct is marked CPF_Edit. If not, then the intent is
|
||||
// that this struct is for viewing only.
|
||||
UCLASS()
|
||||
class UWingStructPointer : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UPROPERTY()
|
||||
UObject* Object;
|
||||
|
||||
UPROPERTY()
|
||||
UStruct* StructType;
|
||||
|
||||
void *StructBase;
|
||||
|
||||
bool Editable;
|
||||
};
|
||||
|
||||
@@ -2,29 +2,12 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "WingBasics.h"
|
||||
#include "WingComponent.generated.h"
|
||||
|
||||
class UBlueprint;
|
||||
class USCS_Node;
|
||||
class UActorComponent;
|
||||
class USimpleConstructionScript;
|
||||
|
||||
// a 'Component Reference' is just a pointer to a
|
||||
// blueprint plus a component name.
|
||||
//
|
||||
UCLASS()
|
||||
class UWingComponentReference : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
// The blueprint that was queried: not necessarily the
|
||||
// same blueprint that defined the component.
|
||||
UPROPERTY()
|
||||
UBlueprint* BP = nullptr;
|
||||
|
||||
// The component name.
|
||||
FName VariableName;
|
||||
};
|
||||
|
||||
struct UWingComponent
|
||||
{
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/Object.h"
|
||||
#include "WingBasics.h"
|
||||
#include "WingReferences.generated.h"
|
||||
|
||||
class UEdGraphNode;
|
||||
class UEdGraphPin;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The WingFetcher module allows you to start at an asset and
|
||||
// walk to any object within that asset. For example, you can
|
||||
// start at an actor blueprint, walk to its event graph, then
|
||||
// walk to a graph node, and then walk to a graph pin.
|
||||
//
|
||||
// The following classes make it possible to 'walk' to a
|
||||
// place that isn't a UObject, or that isn't a single UObject.
|
||||
// We accomplish this by creating a UObject class that
|
||||
// contains some sort of reference to the item in question.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// WingStructPointer: Stores a pointer to a ustruct which is
|
||||
// inside a UObject. This makes it possible to walk to a
|
||||
// struct property.
|
||||
//
|
||||
// The Object field should be point at the containing object
|
||||
// to ensure it doesn't get garbage collected.
|
||||
//
|
||||
// The editable flag indicates whether the struct property
|
||||
// we walked into is marked CPF_Edit. If not, then the intent
|
||||
// is that this struct is for viewing only.
|
||||
|
||||
UCLASS()
|
||||
class UWingStructPointer : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UPROPERTY()
|
||||
UObject* Object;
|
||||
|
||||
UPROPERTY()
|
||||
UStruct* StructType;
|
||||
|
||||
void *StructBase;
|
||||
|
||||
bool Editable;
|
||||
};
|
||||
|
||||
// WingPinReference: Stores the name of a UEdGraphPin which is
|
||||
// inside a UEdGraphNode.
|
||||
|
||||
UCLASS()
|
||||
class UWingPinReference : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY()
|
||||
UEdGraphNode* Node = nullptr;
|
||||
|
||||
FName PinName;
|
||||
};
|
||||
Reference in New Issue
Block a user