aboutsummaryrefslogtreecommitdiff
path: root/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public
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/Public
parentUpdated image paths. (diff)
downloadugcexample-d5310c3455f9849243b7b950deb4e910aa1f24dd.tar.xz
ugcexample-d5310c3455f9849243b7b950deb4e910aa1f24dd.zip
Initial commit of the UGCExample Project
Diffstat (limited to 'Plugins/SimpleUGC/Source/SimpleUGCEditor/Public')
-rw-r--r--Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCCreator.h33
-rw-r--r--Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditor.h41
-rw-r--r--Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditorCommands.h27
-rw-r--r--Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditorStyle.h31
-rw-r--r--Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCPackager.h49
-rw-r--r--Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCPluginWizardDefinition.h70
6 files changed, 251 insertions, 0 deletions
diff --git a/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCCreator.h b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCCreator.h
new file mode 100644
index 0000000..43e41ea
--- /dev/null
+++ b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCCreator.h
@@ -0,0 +1,33 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+class FSimpleUGCPluginWizardDefinition;
+class SDockTab;
+
+class FSimpleUGCCreator : public TSharedFromThis<FSimpleUGCCreator>
+{
+public:
+
+ FSimpleUGCCreator();
+ ~FSimpleUGCCreator();
+
+ /**
+ * Opens the mod creator wizard.
+ * @param bSuppressErrors If false, a dialog will be shown if the wizard cannot be opened for whatever reason
+ */
+ void OpenNewPluginWizard(bool bSuppressErrors = false) const;
+
+ /** The name to use when creating the tab for the tab spawner */
+ static const FName SimpleUGCEditorPluginCreatorName;
+
+private:
+ /** Registers a nomad tab spawner that will create the mod wizard */
+ void RegisterTabSpawner();
+
+ /** Unregisters the nomad tab spawner */
+ void UnregisterTabSpawner();
+
+ /** Spawns the tab that hosts the mod creator wizard widget */
+ TSharedRef<SDockTab> HandleSpawnPluginTab(const class FSpawnTabArgs& SpawnTabArgs);
+}; \ No newline at end of file
diff --git a/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditor.h b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditor.h
new file mode 100644
index 0000000..574e7d9
--- /dev/null
+++ b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditor.h
@@ -0,0 +1,41 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Slate.h"
+#include "SimpleUGCPackager.h"
+#include "Modules\ModuleManager.h"
+
+class FToolBarBuilder;
+class FMenuBuilder;
+
+class FSimpleUGCEditorModule : public IModuleInterface
+{
+public:
+
+ /** IModuleInterface implementation */
+ virtual void StartupModule() override;
+ virtual void ShutdownModule() override;
+
+ // When the Create Button is clicked
+ void CreateUGCButtonClicked();
+
+ /** Adds the plugin creator as a new toolbar button */
+ void AddUGCCreatorToolbarExtension(FToolBarBuilder& Builder);
+
+ /** Adds the plugin creator as a new menu option */
+ void AddUGCCreatorMenuExtension(FMenuBuilder& Builder);
+
+ /** Adds the plugin packager as a new toolbar button */
+ void AddUGCPackagerToolbarExtension(FToolBarBuilder& Builder);
+
+ /** Adds the plugin packager as a new menu option */
+ void AddUGCPackagerMenuExtension(FMenuBuilder& Builder);
+
+private:
+
+ TSharedPtr<class FSimpleUGCCreator> UGCCreator;
+ TSharedPtr<class FSimpleUGCPackager> UGCPackager;
+ TSharedPtr<class FUICommandList> PluginCommands;
+}; \ No newline at end of file
diff --git a/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditorCommands.h b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditorCommands.h
new file mode 100644
index 0000000..247340c
--- /dev/null
+++ b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditorCommands.h
@@ -0,0 +1,27 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Framework/Commands/Commands.h"
+#include "SimpleUGCEditorStyle.h"
+
+class FSimpleUGCEditorCommands : public TCommands<FSimpleUGCEditorCommands>
+{
+public:
+
+ FSimpleUGCEditorCommands()
+ : TCommands<FSimpleUGCEditorCommands>(TEXT("SimpleUGCEditor"), NSLOCTEXT("Contexts", "SimpleUGCEditor", "SimpleUGCEditor Plugin"), NAME_None, FSimpleUGCEditorStyle::GetStyleSetName())
+ {
+ }
+
+ // TCommands<> interface
+ virtual void RegisterCommands() override;
+
+ TArray<TSharedPtr<FUICommandInfo>> RegisterUGCCommands(const TArray<TSharedRef<class IPlugin>>& UGCList) const;
+ void UnregisterUGCCommands(TArray<TSharedPtr<FUICommandInfo>>& UICommands) const;
+
+public:
+ TSharedPtr< FUICommandInfo > CreateUGCAction;
+ TSharedPtr< FUICommandInfo > PackageUGCAction;
+}; \ No newline at end of file
diff --git a/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditorStyle.h b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditorStyle.h
new file mode 100644
index 0000000..46f4843
--- /dev/null
+++ b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCEditorStyle.h
@@ -0,0 +1,31 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Styling/SlateStyle.h"
+
+class FSimpleUGCEditorStyle
+{
+public:
+
+ static void Initialize();
+
+ static void Shutdown();
+
+ /** reloads textures used by slate renderer */
+ static void ReloadTextures();
+
+ /** @return The Slate style set for the Shooter game */
+ static const ISlateStyle& Get();
+
+ static FName GetStyleSetName();
+
+private:
+
+ static TSharedRef< class FSlateStyleSet > Create();
+
+private:
+
+ static TSharedPtr< class FSlateStyleSet > StyleInstance;
+}; \ No newline at end of file
diff --git a/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCPackager.h b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCPackager.h
new file mode 100644
index 0000000..f287732
--- /dev/null
+++ b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCPackager.h
@@ -0,0 +1,49 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "CoreMinimal.h"
+
+struct FSimpleUGCCommand
+{
+ TSharedPtr<class IPlugin> PluginInfo;
+ TSharedPtr<class FUICommandInfo> CommandInfo;
+};
+
+class FSimpleUGCPackager : public TSharedFromThis<FSimpleUGCPackager>
+{
+public:
+ FSimpleUGCPackager();
+ ~FSimpleUGCPackager();
+
+ void OpenPluginPackager(TSharedRef<class IPlugin> Plugin);
+
+ void PackagePlugin(TSharedRef<class IPlugin> Plugin, const FString& OutputDirectory);
+
+ /** Generates submenu content for the plugin packager command */
+ void GeneratePackagerMenuContent(class FMenuBuilder& MenuBuilder);
+
+ /** Generates the menu content for the plugin packager toolbar button */
+ TSharedRef<class SWidget> GeneratePackagerComboButtonContent();
+
+private:
+ /** Gets all available game mod plugin packages */
+ void FindAvailableGameMods(TArray<TSharedRef<class IPlugin>>& OutAvailableGameMods);
+
+ /** Gets all available game mod plugins and registers command info for them */
+ void GetAvailableUGCCommands(const TArray<TSharedRef<class IPlugin>>& AvailableUGC);
+
+ /** Generates menu content for the supplied set of commands */
+ void GeneratePackagerMenuContent_Internal(class FMenuBuilder& MenuBuilder, const TArray<TSharedPtr<FUICommandInfo>>& Commands);
+
+ /**
+ * Checks if a plugin has any unsaved content
+ *
+ * @param Plugin The plugin to check for unsaved content
+ * @return True if all mod content has been saved, false otherwise
+ */
+ bool IsAllContentSaved(TSharedRef<class IPlugin> Plugin);
+
+private:
+ TArray<TSharedPtr<class FUICommandInfo>> UGCCommands;
+};
diff --git a/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCPluginWizardDefinition.h b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCPluginWizardDefinition.h
new file mode 100644
index 0000000..9543a27
--- /dev/null
+++ b/Plugins/SimpleUGC/Source/SimpleUGCEditor/Public/SimpleUGCPluginWizardDefinition.h
@@ -0,0 +1,70 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+// Depends on code from the plugin browser to work correctly
+#include "../../../../Plugins/Editor/PluginBrowser/Source/PluginBrowser/Public/IPluginWizardDefinition.h"
+
+class FSimpleUGCPluginWizardDefinition : public IPluginWizardDefinition
+{
+public:
+ FSimpleUGCPluginWizardDefinition();
+
+ // Begin IPluginWizardDefinition interface
+ virtual const TArray<TSharedRef<FPluginTemplateDescription>>& GetTemplatesSource() const override;
+ virtual void OnTemplateSelectionChanged(TArray<TSharedRef<FPluginTemplateDescription>> InSelectedItems, ESelectInfo::Type SelectInfo) override;
+ virtual TArray<TSharedPtr<FPluginTemplateDescription>> GetSelectedTemplates() const override;
+ virtual void ClearTemplateSelection() override;
+ virtual bool HasValidTemplateSelection() const override;
+
+ virtual ESelectionMode::Type GetSelectionMode() const override { return ESelectionMode::Multi; }
+ virtual bool AllowsEnginePlugins() const override { return false; }
+ virtual bool CanShowOnStartup() const override { return true; }
+ virtual bool CanContainContent() const override;
+ virtual bool HasModules() const override;
+ virtual bool IsMod() const override;
+ virtual void OnShowOnStartupCheckboxChanged(ECheckBoxState CheckBoxState) override;
+ virtual ECheckBoxState GetShowOnStartupCheckBoxState() const override;
+ virtual TSharedPtr<class SWidget> GetCustomHeaderWidget() override;
+ virtual FText GetInstructions() const override;
+
+ virtual bool GetPluginIconPath(FString& OutIconPath) const override;
+ virtual EHostType::Type GetPluginModuleDescriptor() const override;
+ virtual ELoadingPhase::Type GetPluginLoadingPhase() const override;
+ virtual bool GetTemplateIconPath(TSharedRef<FPluginTemplateDescription> InTemplate, FString& OutIconPath) const override;
+ virtual FString GetPluginFolderPath() const override;
+ virtual TArray<FString> GetFoldersForSelection() const override;
+ virtual void PluginCreated(const FString& PluginName, bool bWasSuccessful) const override;
+ // End IPluginWizardDefinition interface
+
+private:
+ /** The available templates for the mod. They should function as mixins to the backing template */
+ TArray<TSharedRef<FPluginTemplateDescription>> TemplateDefinitions;
+
+ /** The content that will be used when creating the mod */
+ TArray<TSharedRef<FPluginTemplateDescription>> SelectedTemplates;
+
+ /** The base directory of this plugin. Used for accessing the templates used to create mods */
+ FString PluginBaseDir;
+
+ /**
+ * The path to the template that ultimately serves as the template that the mod will be based on. It's not intended to be
+ * selected directly, but rather other templates will act as mixins to define what content will exist in the plugin.
+ */
+ FString BackingTemplatePath;
+
+ /** The backing template definition for the mod. This should never be directly selectable */
+ TSharedPtr<FPluginTemplateDescription> BackingTemplate;
+
+ /** The base code template definition. Can be directly selectable to create an "empty" code mod, but should be included with any code mod selection */
+ TSharedPtr<FPluginTemplateDescription> BaseCodeTemplate;
+
+ /** Maps a specific template to a specific icon file */
+ TMap<FString, FString> TemplateToIconMap;
+
+ /** Brush used for drawing the custom header widget */
+ TSharedPtr<struct FSlateDynamicImageBrush> IconBrush;
+
+ /** Custom header widget */
+ TSharedPtr<class SWidget> CustomHeaderWidget;
+}; \ No newline at end of file