Working on handling custom event nodes
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#include "Engine/SimpleConstructionScript.h"
|
||||
#include "Engine/SCS_Node.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "BlueprintComponent_Add.generated.h"
|
||||
#include "ActorComponent_Add.generated.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -19,7 +19,7 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
UCLASS()
|
||||
class UWing_BlueprintComponent_Add : public UObject, public IWingHandler
|
||||
class UWing_ActorComponent_Add : public UObject, public IWingHandler
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "WingActorComponent.h"
|
||||
#include "Engine/SCS_Node.h"
|
||||
#include "Engine/SimpleConstructionScript.h"
|
||||
#include "BlueprintComponent_Dump.generated.h"
|
||||
#include "ActorComponent_Dump.generated.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -18,7 +18,7 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
UCLASS()
|
||||
class UWing_BlueprintComponent_Dump : public UObject, public IWingHandler
|
||||
class UWing_ActorComponent_Dump : public UObject, public IWingHandler
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "WingUtils.h"
|
||||
#include "Engine/SCS_Node.h"
|
||||
#include "Engine/SimpleConstructionScript.h"
|
||||
#include "BlueprintComponent_Remove.generated.h"
|
||||
#include "ActorComponent_Remove.generated.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -15,7 +15,7 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
UCLASS()
|
||||
class UWing_BlueprintComponent_Remove : public UObject, public IWingHandler
|
||||
class UWing_ActorComponent_Remove : public UObject, public IWingHandler
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "Engine/SimpleConstructionScript.h"
|
||||
#include "Engine/SCS_Node.h"
|
||||
#include "BlueprintComponent_Reparent.generated.h"
|
||||
#include "ActorComponent_Reparent.generated.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -17,7 +17,7 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
UCLASS()
|
||||
class UWing_BlueprintComponent_Reparent : public UObject, public IWingHandler
|
||||
class UWing_ActorComponent_Reparent : public UObject, public IWingHandler
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "WingServer.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "Kismet2/BlueprintEditorUtils.h"
|
||||
#include "Blueprint_AddInterface.generated.h"
|
||||
#include "BlueprintInterface_Add.generated.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "WingServer.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "Kismet2/BlueprintEditorUtils.h"
|
||||
#include "Blueprint_RemoveInterface.generated.h"
|
||||
#include "BlueprintInterface_Remove.generated.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "EdGraphSchema_K2.h"
|
||||
#include "Kismet2/BlueprintEditorUtils.h"
|
||||
#include "BlueprintDispatcher_Create.generated.h"
|
||||
#include "EventDispatcher_Create.generated.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -18,7 +18,7 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
UCLASS()
|
||||
class UWing_BlueprintDispatcher_Create : public UObject, public IWingHandler
|
||||
class UWing_EventDispatcher_Create : public UObject, public IWingHandler
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "WingUtils.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "Kismet2/BlueprintEditorUtils.h"
|
||||
#include "BlueprintDispatcher_Delete.generated.h"
|
||||
#include "EventDispatcher_Delete.generated.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -15,7 +15,7 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
UCLASS()
|
||||
class UWing_BlueprintDispatcher_Delete : public UObject, public IWingHandler
|
||||
class UWing_EventDispatcher_Delete : public UObject, public IWingHandler
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "WingFunctionArgs.h"
|
||||
#include "Kismet2/BlueprintEditorUtils.h"
|
||||
#include "BlueprintDispatcher_Dump.generated.h"
|
||||
#include "EventDispatcher_Dump.generated.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -17,7 +17,7 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
UCLASS()
|
||||
class UWing_BlueprintDispatcher_Dump : public UObject, public IWingHandler
|
||||
class UWing_EventDispatcher_Dump : public UObject, public IWingHandler
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -55,6 +55,6 @@ public:
|
||||
FString Args = WingFunctionArgs::GetArgs(EntryNode.Get());
|
||||
|
||||
UWingServer::Printf(TEXT("Event dispatcher %s in %s:\n"), *Dispatcher, *WingUtils::FormatName(BP));
|
||||
UWingServer::Printf(TEXT(" Args: %s\n"), *Args);
|
||||
UWingServer::Printf(TEXT(" Arguments: %s\n"), *Args);
|
||||
}
|
||||
};
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "WingFunctionArgs.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "Kismet2/BlueprintEditorUtils.h"
|
||||
#include "BlueprintDispatcher_Modify.generated.h"
|
||||
#include "EventDispatcher_Modify.generated.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -16,7 +16,7 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
UCLASS()
|
||||
class UWing_BlueprintDispatcher_Modify : public UObject, public IWingHandler
|
||||
class UWing_EventDispatcher_Modify : public UObject, public IWingHandler
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "WingServer.h"
|
||||
#include "WingHandler.h"
|
||||
#include "WingFetcher.h"
|
||||
#include "WingUtils.h"
|
||||
#include "EdGraph/EdGraphNode.h"
|
||||
#include "Kismet2/Kismet2NameValidators.h"
|
||||
#include "GraphNode_Rename.generated.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
UCLASS()
|
||||
class UWing_GraphNode_Rename : public UObject, public IWingHandler
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(meta=(Description="Target node"))
|
||||
FString Node;
|
||||
|
||||
UPROPERTY(meta=(Description="New name for the node"))
|
||||
FString Name;
|
||||
|
||||
virtual FString GetDescription() const override
|
||||
{
|
||||
return TEXT("Rename a graph node. Works on custom events, timelines, "
|
||||
"composite nodes, comment nodes, and other renameable node types.");
|
||||
}
|
||||
|
||||
virtual void Handle() override
|
||||
{
|
||||
WingFetcher F;
|
||||
UEdGraphNode* FoundNode = F.Walk(Node).Cast<UEdGraphNode>();
|
||||
if (!FoundNode) return;
|
||||
|
||||
if (!FoundNode->bCanRenameNode)
|
||||
{
|
||||
UWingServer::Printf(TEXT("ERROR: Node %s does not support renaming.\n"), *WingUtils::FormatName(FoundNode));
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate the proposed name
|
||||
TSharedPtr<INameValidatorInterface> Validator = FNameValidatorFactory::MakeValidator(FoundNode);
|
||||
EValidatorResult Result = Validator->IsValid(Name, false);
|
||||
if (Result != EValidatorResult::Ok && Result != EValidatorResult::ExistingName)
|
||||
{
|
||||
UWingServer::Printf(TEXT("ERROR: %s\n"), *INameValidatorInterface::GetErrorString(Name, Result));
|
||||
return;
|
||||
}
|
||||
|
||||
FoundNode->Modify();
|
||||
FoundNode->OnRenameNode(Name);
|
||||
|
||||
UWingServer::Printf(TEXT("Renamed node to %s\n"), *Name);
|
||||
}
|
||||
};
|
||||
@@ -41,7 +41,7 @@ UEdGraphNode* FWingGraphAction::Execute(const FVector2D &Location) const
|
||||
|
||||
TArray<FWingGraphAction*> FWingGraphActions::Search(const FString &Query, int32 MaxResults, bool Exact)
|
||||
{
|
||||
FString ExtQuery = FString::Printf(TEXT("*%s*"), *Query);
|
||||
FString ExtQuery = FString::Printf(TEXT("*%s*"), *Query.Replace(TEXT(" "), TEXT("*")));
|
||||
TArray<FWingGraphAction*> Results;
|
||||
for (FWingGraphAction &Result : Actions)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user