aboutsummaryrefslogtreecommitdiff
path: root/Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCCreator.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/SimpleUGCCreator.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/SimpleUGCCreator.cpp')
-rw-r--r--Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCCreator.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCCreator.cpp b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCCreator.cpp
new file mode 100644
index 0000000..d7403a9
--- /dev/null
+++ b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Private/SimpleUGCCreator.cpp
@@ -0,0 +1,65 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+//#include "SimpleUGCEditorPrivatePCH.h"
+#include "SimpleUGCCreator.h"
+
+#include "SimpleUGCPluginWizardDefinition.h"
+#include "Widgets/Docking/SDockTab.h"
+
+// This depends on the Plugin Browser module to work correctly...
+#include "IPluginBrowser.h"
+
+
+
+#define LOCTEXT_NAMESPACE "FSimpleUGCCreator"
+
+const FName FSimpleUGCCreator::SimpleUGCEditorPluginCreatorName("SimpleUGCPluginCreator");
+
+FSimpleUGCCreator::FSimpleUGCCreator()
+{
+ RegisterTabSpawner();
+}
+
+FSimpleUGCCreator::~FSimpleUGCCreator()
+{
+ UnregisterTabSpawner();
+}
+
+void FSimpleUGCCreator::OpenNewPluginWizard(bool bSuppressErrors) const
+{
+ if (IPluginBrowser::IsAvailable())
+ {
+ FGlobalTabmanager::Get()->InvokeTab(SimpleUGCEditorPluginCreatorName);
+ }
+ else if (!bSuppressErrors)
+ {
+ FMessageDialog::Open(EAppMsgType::Ok,
+ LOCTEXT("PluginBrowserDisabled", "Creating a game mod requires the use of the Plugin Browser, but it is currently disabled."));
+ }
+}
+
+void FSimpleUGCCreator::RegisterTabSpawner()
+{
+ FTabSpawnerEntry& Spawner = FGlobalTabmanager::Get()->RegisterNomadTabSpawner(SimpleUGCEditorPluginCreatorName,
+ FOnSpawnTab::CreateRaw(this, &FSimpleUGCCreator::HandleSpawnPluginTab));
+
+ // Set a default size for this tab
+ FVector2D DefaultSize(800.0f, 500.0f);
+ FTabManager::RegisterDefaultTabWindowSize(SimpleUGCEditorPluginCreatorName, DefaultSize);
+
+ Spawner.SetDisplayName(LOCTEXT("NewUGCTabHeader", "Create New UGC Package"));
+ Spawner.SetMenuType(ETabSpawnerMenuType::Hidden);
+}
+
+void FSimpleUGCCreator::UnregisterTabSpawner()
+{
+ FGlobalTabmanager::Get()->UnregisterNomadTabSpawner(SimpleUGCEditorPluginCreatorName);
+}
+
+TSharedRef<SDockTab> FSimpleUGCCreator::HandleSpawnPluginTab(const FSpawnTabArgs& SpawnTabArgs)
+{
+ check(IPluginBrowser::IsAvailable());
+ return IPluginBrowser::Get().SpawnPluginCreatorTab(SpawnTabArgs, MakeShared<FSimpleUGCPluginWizardDefinition>());
+}
+
+#undef LOCTEXT_NAMESPACE \ No newline at end of file