2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "TextureEditorPrivatePCH.h"
|
2014-10-27 07:53:18 -04:00
|
|
|
#include "ISettingsModule.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
#include "ModuleManager.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "FTextureEditorModule"
|
|
|
|
|
|
|
|
|
|
const FName TextureEditorAppIdentifier = FName(TEXT("TextureEditorApp"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
|
FTextureEditorModule
|
|
|
|
|
-----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
class FTextureEditorModule
|
|
|
|
|
: public ITextureEditorModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
// ITextureEditorModule interface
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
virtual TSharedRef<ITextureEditorToolkit> CreateTextureEditor( const EToolkitMode::Type Mode, const TSharedPtr< IToolkitHost >& InitToolkitHost, UTexture* Texture ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
TSharedRef<FTextureEditorToolkit> NewTextureEditor(new FTextureEditorToolkit());
|
|
|
|
|
NewTextureEditor->InitTextureEditor(Mode, InitToolkitHost, Texture);
|
|
|
|
|
|
|
|
|
|
return NewTextureEditor;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-01 07:20:55 -04:00
|
|
|
virtual TSharedPtr<FExtensibilityManager> GetMenuExtensibilityManager( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return MenuExtensibilityManager;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-01 07:20:55 -04:00
|
|
|
virtual TSharedPtr<FExtensibilityManager> GetToolBarExtensibilityManager( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return ToolBarExtensibilityManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
// IModuleInterface interface
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
virtual void StartupModule( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// register menu extensions
|
|
|
|
|
MenuExtensibilityManager = MakeShareable(new FExtensibilityManager);
|
|
|
|
|
ToolBarExtensibilityManager = MakeShareable(new FExtensibilityManager);
|
|
|
|
|
|
|
|
|
|
// register settings
|
2014-10-27 07:53:18 -04:00
|
|
|
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
if (SettingsModule != nullptr)
|
|
|
|
|
{
|
|
|
|
|
SettingsModule->RegisterSettings("Editor", "ContentEditors", "TextureEditor",
|
|
|
|
|
LOCTEXT("TextureEditorSettingsName", "Texture Editor"),
|
|
|
|
|
LOCTEXT("TextureEditorSettingsDescription", "Configure the look and feel of the Texture Editor."),
|
2014-04-23 19:10:37 -04:00
|
|
|
GetMutableDefault<UTextureEditorSettings>()
|
2014-03-14 14:13:41 -04:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
virtual void ShutdownModule( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// unregister settings
|
2014-10-27 07:53:18 -04:00
|
|
|
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
if (SettingsModule != nullptr)
|
|
|
|
|
{
|
|
|
|
|
SettingsModule->UnregisterSettings("Editor", "ContentEditors", "TextureEditor");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// unregister menu extensions
|
|
|
|
|
MenuExtensibilityManager.Reset();
|
|
|
|
|
ToolBarExtensibilityManager.Reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// Holds the menu extensibility manager.
|
|
|
|
|
TSharedPtr<FExtensibilityManager> MenuExtensibilityManager;
|
|
|
|
|
|
|
|
|
|
// Holds the tool bar extensibility manager.
|
|
|
|
|
TSharedPtr<FExtensibilityManager> ToolBarExtensibilityManager;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE(FTextureEditorModule, TextureEditor);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|