mirror of
				https://github.com/kevinporetti/UnrealImGui.git
				synced 2025-11-03 23:33:16 +00:00 
			
		
		
		
	Cleaned up unused input processor
This commit is contained in:
		
							parent
							
								
									cb89223375
								
							
						
					
					
						commit
						9496087f9c
					
				@ -1 +0,0 @@
 | 
				
			|||||||
#include "ImGuiInputPreprocessor.h"
 | 
					 | 
				
			||||||
@ -1,79 +0,0 @@
 | 
				
			|||||||
#pragma once
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ImGuiModuleManager.h"
 | 
					 | 
				
			||||||
#include "Framework/Application/IInputProcessor.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class FImGuiModuleManager;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class FImGuiInputPreprocessor : public IInputProcessor
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
public:
 | 
					 | 
				
			||||||
	FImGuiInputPreprocessor(FImGuiModuleManager& InModuleManager)
 | 
					 | 
				
			||||||
		: ModuleManager(InModuleManager)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	virtual void Tick(const float DeltaTime, FSlateApplication& SlateApp, TSharedRef<ICursor> Cursor) override
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	virtual bool HandleKeyDownEvent(FSlateApplication& SlateApp, const FKeyEvent& InKeyEvent) override
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	virtual bool
 | 
					 | 
				
			||||||
	HandleAnalogInputEvent(FSlateApplication& SlateApp, const FAnalogInputEvent& InAnalogInputEvent) override
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	virtual bool HandleMouseMoveEvent(FSlateApplication& SlateApp, const FPointerEvent& InPointerEvent) override
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
		const bool bIsWindowHovered = ImGui::IsWindowHovered();
 | 
					 | 
				
			||||||
		FImGuiContextProxy* Proxy = ModuleManager.GetContextManager().GetContextProxy(0);
 | 
					 | 
				
			||||||
		if (Proxy)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			GEngine->AddOnScreenDebugMessage(10, 0, Proxy->WantsMouseCapture() ? FColor::Green : FColor::Red, TEXT("Move Capture"));
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			GEngine->AddOnScreenDebugMessage(10, 0, FColor::Red, TEXT("No proxy"));
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		GEngine->AddOnScreenDebugMessage(1, 0, bIsWindowHovered ? FColor::Green : FColor::Red, TEXT("Move Hover"));
 | 
					 | 
				
			||||||
		*/
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	virtual bool HandleMouseButtonDownEvent(FSlateApplication& SlateApp, const FPointerEvent& InPointerEvent) override
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		//if (ModuleManager.GetProperties().IsMouseInputShared())
 | 
					 | 
				
			||||||
		if (false) {
 | 
					 | 
				
			||||||
			FImGuiContextProxy* Proxy = ModuleManager.GetContextManager().GetContextProxy(0);
 | 
					 | 
				
			||||||
			const bool bWantsCapture = Proxy ? Proxy->WantsMouseCapture() : false;
 | 
					 | 
				
			||||||
			const bool bIsWindowHovered = ImGui::IsWindowHovered();
 | 
					 | 
				
			||||||
			GEngine->AddOnScreenDebugMessage(2, 10, bIsWindowHovered ? FColor::Green : FColor::Red, TEXT("InputPreproc: Click Hover"));
 | 
					 | 
				
			||||||
			GEngine->AddOnScreenDebugMessage(3, 10, bWantsCapture ? FColor::Green : FColor::Red, TEXT("InputPreproc: Wants capture"));
 | 
					 | 
				
			||||||
			return bWantsCapture;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	virtual bool
 | 
					 | 
				
			||||||
	HandleMouseButtonDoubleClickEvent(FSlateApplication& SlateApp, const FPointerEvent& InPointerEvent) override
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	virtual const TCHAR* GetDebugName() const override { return TEXT("CommonInput"); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
private:
 | 
					 | 
				
			||||||
	bool IsRelevantInput(FSlateApplication& SlateApp, const FInputEvent& InputEvent)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	FImGuiModuleManager& ModuleManager;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
@ -4,7 +4,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "ImGuiDelegatesContainer.h"
 | 
					#include "ImGuiDelegatesContainer.h"
 | 
				
			||||||
#include "ImGuiModuleManager.h"
 | 
					#include "ImGuiModuleManager.h"
 | 
				
			||||||
#include "ImGuiInputPreprocessor.h"
 | 
					 | 
				
			||||||
#include "TextureManager.h"
 | 
					#include "TextureManager.h"
 | 
				
			||||||
#include "Utilities/WorldContext.h"
 | 
					#include "Utilities/WorldContext.h"
 | 
				
			||||||
#include "Utilities/WorldContextIndex.h"
 | 
					#include "Utilities/WorldContextIndex.h"
 | 
				
			||||||
@ -132,9 +131,6 @@ void FImGuiModule::StartupModule()
 | 
				
			|||||||
	checkf(!ImGuiModuleManager, TEXT("Instance of the ImGui Module Manager already exists. Instance should be created only during module startup."));
 | 
						checkf(!ImGuiModuleManager, TEXT("Instance of the ImGui Module Manager already exists. Instance should be created only during module startup."));
 | 
				
			||||||
	ImGuiModuleManager = new FImGuiModuleManager();
 | 
						ImGuiModuleManager = new FImGuiModuleManager();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ImGuiInputPreprocessor = MakeShared<FImGuiInputPreprocessor>(*ImGuiModuleManager);
 | 
					 | 
				
			||||||
	FSlateApplication::Get().RegisterInputPreProcessor(ImGuiInputPreprocessor, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if WITH_EDITOR
 | 
					#if WITH_EDITOR
 | 
				
			||||||
	checkf(!ImGuiEditor, TEXT("Instance of the ImGui Editor already exists. Instance should be created only during module startup."));
 | 
						checkf(!ImGuiEditor, TEXT("Instance of the ImGui Editor already exists. Instance should be created only during module startup."));
 | 
				
			||||||
	ImGuiEditor = new FImGuiEditor();
 | 
						ImGuiEditor = new FImGuiEditor();
 | 
				
			||||||
 | 
				
			|||||||
@ -177,8 +177,6 @@ public:
 | 
				
			|||||||
	virtual void ShutdownModule() override;
 | 
						virtual void ShutdownModule() override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	TSharedPtr<class FImGuiInputPreprocessor> ImGuiInputPreprocessor;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if WITH_EDITOR
 | 
					#if WITH_EDITOR
 | 
				
			||||||
	virtual void SetProperties(const FImGuiModuleProperties& Properties);
 | 
						virtual void SetProperties(const FImGuiModuleProperties& Properties);
 | 
				
			||||||
	struct FImGuiContextHandle* ImGuiContextHandle = nullptr;
 | 
						struct FImGuiContextHandle* ImGuiContextHandle = nullptr;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user