aboutsummaryrefslogtreecommitdiff
path: root/Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCEditorCommands.cpp
diff options
context:
space:
mode:
authorivey <[email protected]>2020-06-15 15:54:16 -0400
committerivey <[email protected]>2020-06-15 15:54:16 -0400
commitd5310c3455f9849243b7b950deb4e910aa1f24dd (patch)
tree994a81eec10538d2a1efd9ed78469a249ff086f2 /Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCEditorCommands.cpp
parentUpdated image paths. (diff)
downloadugcexample-d5310c3455f9849243b7b950deb4e910aa1f24dd.tar.xz
ugcexample-d5310c3455f9849243b7b950deb4e910aa1f24dd.zip
Initial commit of the UGCExample Project
Diffstat (limited to 'Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCEditorCommands.cpp')
-rw-r--r--Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCEditorCommands.cpp51
1 files changed, 51 insertions, 0 deletions
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<TSharedPtr<FUICommandInfo>> FSimpleUGCEditorCommands::RegisterUGCCommands(const TArray<TSharedRef<class IPlugin>>& UGCList) const
+{
+ TArray<TSharedPtr<FUICommandInfo>> AvailableUGCActions;
+ AvailableUGCActions.Reserve(UGCList.Num());
+
+ FSimpleUGCEditorCommands* MutableThis = const_cast<FSimpleUGCEditorCommands*>(this);
+
+ for (int32 Index = 0; Index < UGCList.Num(); ++Index)
+ {
+ AvailableUGCActions.Add(TSharedPtr<FUICommandInfo>());
+ TSharedRef<IPlugin> 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<TSharedPtr<FUICommandInfo>>& UICommands) const
+{
+ FSimpleUGCEditorCommands* MutableThis = const_cast<FSimpleUGCEditorCommands*>(this);
+
+ for (TSharedPtr<FUICommandInfo> Command : UICommands)
+ {
+ FUICommandInfo::UnregisterCommandInfo(MutableThis->AsShared(), Command.ToSharedRef());
+ }
+}
+
+#undef LOCTEXT_NAMESPACE \ No newline at end of file