forked from TriAxis-Games/RealtimeMeshComponent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRuntimeMeshComponentEditorPlugin.cpp
More file actions
160 lines (124 loc) · 5.73 KB
/
Copy pathRuntimeMeshComponentEditorPlugin.cpp
File metadata and controls
160 lines (124 loc) · 5.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// Copyright 2016-2020 TriAxis Games L.L.C. All Rights Reserved.
#include "IRuntimeMeshComponentEditorPlugin.h"
#include "PropertyEditorModule.h"
#include "RuntimeMeshComponent.h"
#include "RuntimeMeshComponentDetails.h"
#include "RuntimeMeshComponentEditorStyle.h"
#include "RuntimeMeshComponentEditorCommands.h"
#include "Modules/ModuleManager.h"
#include "LevelEditor.h"
class FToolBarBuilder;
class FMenuBuilder;
#define LOCTEXT_NAMESPACE "FRuntimeMeshComponentEditorModule"
class FRuntimeMeshComponentEditorPlugin : public IRuntimeMeshComponentEditorPlugin
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
/** This function will be bound to Command. */
void DonateActionClicked();
void HelpActionClicked();
void ForumsActionClicked();
void IssuesActionClicked();
void DiscordActionClicked();
void MarketplaceActionClicked();
private:
void AddMenuBarExtension(FMenuBarBuilder& Builder);
void AddMenuExtension(FMenuBuilder& Builder);
private:
TSharedPtr<class FUICommandList> PluginCommands;
};
IMPLEMENT_MODULE(FRuntimeMeshComponentEditorPlugin, RuntimeMeshComponentEditor)
void FRuntimeMeshComponentEditorPlugin::StartupModule()
{
{
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyModule.RegisterCustomClassLayout(URuntimeMeshComponent::StaticClass()->GetFName(), FOnGetDetailCustomizationInstance::CreateStatic(&FRuntimeMeshComponentDetails::MakeInstance));
}
FRuntimeMeshComponentEditorStyle::Initialize();
FRuntimeMeshComponentEditorStyle::ReloadTextures();
FRuntimeMeshComponentEditorCommands::Register();
PluginCommands = MakeShareable(new FUICommandList);
PluginCommands->MapAction(
FRuntimeMeshComponentEditorCommands::Get().DonateAction,
FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::DonateActionClicked),
FCanExecuteAction());
PluginCommands->MapAction(
FRuntimeMeshComponentEditorCommands::Get().HelpAction,
FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::HelpActionClicked),
FCanExecuteAction());
PluginCommands->MapAction(
FRuntimeMeshComponentEditorCommands::Get().ForumsAction,
FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::ForumsActionClicked),
FCanExecuteAction());
PluginCommands->MapAction(
FRuntimeMeshComponentEditorCommands::Get().IssuesAction,
FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::IssuesActionClicked),
FCanExecuteAction());
PluginCommands->MapAction(
FRuntimeMeshComponentEditorCommands::Get().DiscordAction,
FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::DiscordActionClicked),
FCanExecuteAction());
PluginCommands->MapAction(
FRuntimeMeshComponentEditorCommands::Get().MarketplaceAction,
FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::MarketplaceActionClicked),
FCanExecuteAction());
FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
{
TSharedPtr<FExtender> MenuExtender = MakeShareable(new FExtender());
MenuExtender->AddMenuBarExtension("Window", EExtensionHook::After, PluginCommands, FMenuBarExtensionDelegate::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::AddMenuBarExtension));
LevelEditorModule.GetMenuExtensibilityManager()->AddExtender(MenuExtender);
}
}
void FRuntimeMeshComponentEditorPlugin::ShutdownModule()
{
FRuntimeMeshComponentEditorStyle::Shutdown();
FRuntimeMeshComponentEditorCommands::Unregister();
}
void FRuntimeMeshComponentEditorPlugin::DonateActionClicked()
{
FPlatformProcess::LaunchURL(TEXT("https://www.paypal.com/paypalme/Koderz"), NULL, NULL);
}
void FRuntimeMeshComponentEditorPlugin::HelpActionClicked()
{
FPlatformProcess::LaunchURL(TEXT("https://runtimemesh.koderz.io/"), NULL, NULL);
}
void FRuntimeMeshComponentEditorPlugin::ForumsActionClicked()
{
FPlatformProcess::LaunchURL(TEXT("https://forums.unrealengine.com/unreal-engine/marketplace/85617-runtime-mesh-component"), NULL, NULL);
}
void FRuntimeMeshComponentEditorPlugin::IssuesActionClicked()
{
FPlatformProcess::LaunchURL(TEXT("https://github.com/TriAxis-Games/RuntimeMeshComponent/issues"), NULL, NULL);
}
void FRuntimeMeshComponentEditorPlugin::DiscordActionClicked()
{
FPlatformProcess::LaunchURL(TEXT("https://discord.gg/KGvBBTv"), NULL, NULL);
}
void FRuntimeMeshComponentEditorPlugin::MarketplaceActionClicked()
{
FPlatformProcess::LaunchURL(TEXT("https://www.unrealengine.com/marketplace/en-US/product/runtime-mesh-component"), NULL, NULL);
}
void FRuntimeMeshComponentEditorPlugin::AddMenuBarExtension(FMenuBarBuilder& Builder)
{
Builder.AddPullDownMenu(
LOCTEXT("RuntimeMeshComponentMenu", "Runtime Mesh Component"),
LOCTEXT("RuntimeMeshComponentMenu_ToolTip", "Open Runtime Mesh Component Help and Documentation"),
FNewMenuDelegate::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::AddMenuExtension),
"Runtime Mesh Component");
}
void FRuntimeMeshComponentEditorPlugin::AddMenuExtension(FMenuBuilder& Builder)
{
Builder.BeginSection("Help", LOCTEXT("RuntimeMeshComponentMenu_Help", "Help"));
Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().MarketplaceAction);
Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().ForumsAction);
Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().HelpAction);
Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().IssuesAction);
Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().DiscordAction);
Builder.EndSection();
Builder.BeginSection("Support", LOCTEXT("RuntimeMeshComponentMenu_Support", "Support"));
Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().DonateAction);
Builder.EndSection();
}
#undef LOCTEXT_NAMESPACE