mirror of
https://github.com/Ed94/Cog.git
synced 2026-07-26 01:13:47 +00:00
CogCommonUI: Add a new plugin to fix CommonUI blocking cog shortcuts (F1, F2, ...)
Reference this plugin where other cog modules are added. This plugin uses a CommonUI ActionRouter to let Cog receives the shortcuts it needs. If you already have an Action Router, you can call FCogImguiInputHelper::IsTopPriorityKey to know if the key event to should handled or not.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class CogCommonUI : ModuleRules
|
||||
{
|
||||
public CogCommonUI(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicIncludePaths.AddRange(
|
||||
new string[] {
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PrivateIncludePaths.AddRange(
|
||||
new string[] {
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PublicDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"Core",
|
||||
"CogCommon",
|
||||
"CogImgui",
|
||||
"CogDebug",
|
||||
"CogWindow",
|
||||
"CommonUI",
|
||||
"InputCore",
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
DynamicallyLoadedModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#include "CogCommonUIModule.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FCogCommonUIModule"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogCommonUIModule::StartupModule()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogCommonUIModule::ShutdownModule()
|
||||
{
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
IMPLEMENT_MODULE(FCogCommonUIModule, CogCommonUI)
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "CogCommonUI_ActionRouter.h"
|
||||
|
||||
#include "CogImguiInputHelper.h"
|
||||
|
||||
ERouteUIInputResult UCogCommonUI_ActionRouter::ProcessInput(FKey Key, EInputEvent InputEvent) const
|
||||
{
|
||||
UWorld* World = GetWorld();
|
||||
|
||||
if (FCogImguiInputHelper::IsTopPriorityKey(World, Key))
|
||||
{
|
||||
return ERouteUIInputResult::Unhandled;
|
||||
}
|
||||
|
||||
return UCommonUIActionRouterBase::ProcessInput(Key, InputEvent);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
class COGCOMMONUI_API FCogCommonUIModule : public IModuleInterface
|
||||
{
|
||||
public:
|
||||
|
||||
static inline FCogCommonUIModule& Get()
|
||||
{
|
||||
return FModuleManager::LoadModuleChecked<FCogCommonUIModule>("CogCommonUI");
|
||||
}
|
||||
|
||||
/** IModuleInterface implementation */
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
|
||||
private:
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Input/CommonUIActionRouterBase.h"
|
||||
#include "CogCommonUI_ActionRouter.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class COGCOMMONUI_API UCogCommonUI_ActionRouter : public UCommonUIActionRouterBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
virtual ERouteUIInputResult ProcessInput(FKey Key, EInputEvent InputEvent) const override;
|
||||
};
|
||||
Reference in New Issue
Block a user