From d5310c3455f9849243b7b950deb4e910aa1f24dd Mon Sep 17 00:00:00 2001 From: ivey Date: Mon, 15 Jun 2020 15:54:16 -0400 Subject: Initial commit of the UGCExample Project --- .../Private/SimpleUGCEditorCommands.cpp | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCEditorCommands.cpp (limited to 'Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCEditorCommands.cpp') diff --git a/Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCEditorCommands.cpp b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCEditorCommands.cpp new file mode 100644 index 0000000..846c5a3 --- /dev/null +++ b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCEditorCommands.cpp @@ -0,0 +1,51 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#include "SimpleUGCEditorCommands.h" +#include "Interfaces/IPluginManager.h" + +#define LOCTEXT_NAMESPACE "FSimpleUGCEditorModule" + +void FSimpleUGCEditorCommands::RegisterCommands() +{ + UI_COMMAND(CreateUGCAction, "Create UGC", "Create a new UGC package in a mod plugin", EUserInterfaceActionType::Button, FInputGesture()); + UI_COMMAND(PackageUGCAction, "Package UGC", "Share and distribute your UGC", EUserInterfaceActionType::Button, FInputGesture()); +} + +TArray> FSimpleUGCEditorCommands::RegisterUGCCommands(const TArray>& UGCList) const +{ + TArray> AvailableUGCActions; + AvailableUGCActions.Reserve(UGCList.Num()); + + FSimpleUGCEditorCommands* MutableThis = const_cast(this); + + for (int32 Index = 0; Index < UGCList.Num(); ++Index) + { + AvailableUGCActions.Add(TSharedPtr()); + TSharedRef UGC = UGCList[Index]; + + FString CommandName = "UGCEditorUGC_" + UGC->GetName(); + + FUICommandInfo::MakeCommandInfo(MutableThis->AsShared(), + AvailableUGCActions[Index], + FName(*CommandName), + FText::FromString(UGC->GetName()), + FText::FromString(UGC->GetBaseDir()), + FSlateIcon(), + EUserInterfaceActionType::Button, + FInputGesture()); + } + + return AvailableUGCActions; +} + +void FSimpleUGCEditorCommands::UnregisterUGCCommands(TArray>& UICommands) const +{ + FSimpleUGCEditorCommands* MutableThis = const_cast(this); + + for (TSharedPtr Command : UICommands) + { + FUICommandInfo::UnregisterCommandInfo(MutableThis->AsShared(), Command.ToSharedRef()); + } +} + +#undef LOCTEXT_NAMESPACE \ No newline at end of file -- cgit v1.2.3