Giter Site home page Giter Site logo

unrealimgui's Introduction

Unreal ImGui

MIT licensed

Unreal ImGui is an Unreal Engine 4 plug-in that integrates Dear ImGui developed by Omar Cornut.

Dear ImGui is an immediate-mode graphical user interface library that is very lightweight and easy to use. It can be very useful when creating debugging tools.

Status

Version: 1.22

ImGui version: 1.74

Supported engine version: 4.26*

* Plugin has been tested and if necessary updated to compile and work with this engine version. As long as possible I will try to maintain backward compatibility of existing features and possibly but not necessarily when adding new features. When it comes to bare-bone ImGui version it should be at least backward compatible with the engine version 4.15. For NetImgui it needs to be determined.

Current work

Currently, I'm a little busy outside of this project so changes come slowly. But here is what to expect in the reasonably near future:

  • Stability first, so fixes for more critical issues like an invalidation of handles after reloading texture resources will be pushed first. The same goes for merges.
  • There are a few smaller issues that I'm aware of and that might be not reported but which I want to fix.
  • ImGui needs to be updated.
  • Smaller features might be slowly pushed but bigger ones will need to wait. The same goes for merges.
  • There is a branch with NetImgui which is really good, and which will be eventually merged to master, but first I want to fix a few issues that I know about (some are discussed in thread #28). In the meantime, the NetImgui branch is pretty much ready to use.

About

The main goal of this plugin is to provide a basic integration of the Dear ImGui which will be easy to use from the game code.

My main focus used to be on debugging and for that this plugin should work out of the box. It is possible to use it for different purposes but depending on the use case it may require some adaptations.

To support multi-PIE, each world gets its own ImGui context to which it can draw. All that is managed by the plugin in a way that should be invisible for the game code. I plan to extend it to allow own contexts and widgets but right now I don't have enough time to commit to that.

As of recently, the plugin has the net_imgui branch with an integration of the NetImgui developed by Sammyfreg. This is still experimental, but it is possible to already download and use it. Many thanks for the library and for the initial integration.

Key features

  • Multi-PIE support with each world getting its own ImGui context.
  • Automatic switching between different ImGui contexts.
  • Delegates for functions with ImGui content.
  • Support for Unreal textures.

How to Set up

To use this plug-in, you will need a C++ Unreal project.

Installation

Content of this repository needs to be placed in the Plugins directory under the project root: [Project Root]/Plugins/ImGui/. After you compile and run you should notice that ImGui module is now available.

Note that plugins can be also placed in the engine directory [UE4 Root]/Engine/Plugins/ but I didn't try it with this project.

If you want to use NetImgui, instead of please look at the How to Set up NetImgui.

Setting module type

The ImGui module type is set to Developer, what means that if it is not referenced by other runtime modules, it can be automatically excluded from shipping builds. This is convenient when using this plugging for debugging but if you want to change it to other type, you can do it in module description section in ImGui.uplugin file.

Developer type was depreciated in UE 4.24. I keep it for backward compatibility while I can, but if you get a UBT warning about module type, simply change it to DeveloperTool or Runtime.

Setting up module dependencies

To use ImGui in other modules you need to add it as a private or public dependency in their Build.cs files:

PrivateDependencyModuleNames.Add("ImGui");

or

PublicDependencyModuleNames.Add("ImGui");

You might also want to use ImGui only in certain builds:

if (Target.Configuration != UnrealTargetConfiguration.Shipping)
{
	PrivateDependencyModuleNames.Add("ImGui");
}

Conditional compilation

You can conditionally compile ImGui code by checking IMGUI_API:

#ifded IMGUI_API
#include <imgui.h>
#endif

// ... somewhere in your code
#ifded IMGUI_API
// ImGui code
#endif

Above code is fine but it requires wrapping include directives and does not follow the usual pattern used in Unreal. To improve that, you can add the following code to one of your headers (or a precompiled header, if you use one):

// ImGuiCommon.h
#pragma once

#ifdef IMGUI_API
#define WITH_IMGUI 1
#else
#define WITH_IMGUI 0
#endif // IMGUI_API

#if WITH_IMGUI
#include <imgui.h>
#endif // WITH_IMGUI

And then use it like this:

#include "ImGuiCommon.h"

// ... somewhere in your code
#if WITH_IMGUI
// ImGui code
#endif

How to Set up NetImgui

To use NetImgui, use content of the net_imgui branch in place of master. This will be gradually merged into the master but until then you need to use that experimental branch.

Similarly like ImGui, NetImgui is built as part of the UnrealImGui plugin and no other integration steps are required.

To be able to connect to the Unreal editor or application that use NetImgui, you need to run a server (netImguiServer). Please, see the NetImgui page for instructions how to get it.

After launching the server for the first time, you need to add two client configurations, for ports 8889 and 8890. After that, you can either initialise connection from the server or set it to autoconnection mode. More info will be added later.

Once you establish connection, you can use a top bar to switch between contexts and modes. In standalone game it should be one context and in the editor one editor context, plus one for each PIE instance. Please, note that all those features are experimental and might evolve. Any input is welcomed.

How to use it

Using ImGui in code

ImGui can be used from functions registered as ImGui delegates or directly in game code. However, if code is running outside of the game thread or is executed outside of the world update scope, delegates are a better choice.

Delegates have an additional advantage that their content will work also when game is paused.

ImGui Delegates

To use ImGui delegates, include ImGuiDelegates.h.

There are two major types of ImGui delegates: world and multi-context. First are created on demand for every world and are cleared once that world becomes invalid. They are designed to be used primarily by worlds objects. In opposition, multi-context delegates are called for every updated world, so the same code can be called multiple times per frame but in different contexts.

Delegates are called typically during world post actor tick event but they have alternative versions called during world tick start. In engine versions that does not support world post actor tick, that is below 4.18, all delegates are called during world tick start.

Delegates are called in order that allows multi-context delegates to add content before and after world objects:

  • multi-context early debug
  • world early debug
  • world update
  • world debug
  • multi-context debug.

FImGuiModule has delegates interface but it is depreciated and will be removed soon. Major issue with that interface is that it needs a module instance, what can be a problem when trying to register static objects. Additional issue is a requirement to always unregister with a handle.

Multi-context

In multi-PIE sessions each world gets its own ImGui context which is selected at the beginning of the world update. All that happens in the background and should allow debug code to stay context agnostic.

If your content is rendered in the wrong context, try using one of the ImGui delegates that should be always called after the right context is already set in ImGui.

Using Unreal textures

Unreal ImGui allows to register textures in order to use them in ImGui. To do that, include ImGuiModule.h and use FImGuiModule interface.

After registration you will get a texture handle, declared in ImGuiTextureHandle.h, that you need to pass to the ImGui API.

// Texture handle defined like this
FImGuiTextureHandle TextureHandle;

// Registration and update
TextureHandle = FImGuiModule::Get().RegisterTexture("TextureName", Texture);

// Release
FImGuiModule::Get().ReleaseTexture(TextureHandle);

// Find by name
TextureHandle = FImGuiModule::Get().FindTextureHandle("TextureName");

// Example of usage (it is implicitly converted to ImTextureID)
ImGui::Image(TextureHandle, Size);

Input mode

Right after the start ImGui will work in render-only mode. To interact with it, you need to activate input mode either by changing Input Enabled property from code, using ImGui.ToggleInput command or with a keyboard shortcut.

Sharing input

It is possible to enable input sharing features to pass keyboard, gamepad or mouse events to the game. Note, that the original design assumed that plugin should consume all input to isolate debug from game. While sharing keyboard or gamepad is pretty straightforward and works by passing input events to the viewport, mouse sharing works in a bit different way. Since the ImGui widget overlays the whole viewport, widget needs to switch hit visibility and update position in the background. It might be possible to generate a custom collision geometry matching ImGui and simplifying working with mouse and touch inputs, but I don't plan to work on this right now.

The default behaviour can be configured in input settings and changed during runtime by modifying Keyboard Input Shared, Gamepad Input Shared and Mouse Input Shared properties or ImGui.ToggleKeyboardInputSharing, ImGui.ToggleGamepadInputSharing and ImGui.ToggleMouseInputSharing commands.

Keyboard and gamepad navigation

When using ImGui on consoles you most probably need to enable keyboard and/or gamepad navigaiton. Both are ImGui features that allow to use it without mouse. See ImGui documentation for more details.

You can toggle those features by changing Keyboard Navigation and Gamepad Navigation properties or using ImGui.ToggleKeyboardNavigationand ImGui.ToggleGamepadNavigation commands.

Navigating around ImGui canvas

Most of the time ImGui canvas will be larger from the viewport. When ImGui is in the input mode, it is possible to change which part of the canvas should be visible on the screen. To do that press and hold Left Shift + Left Alt and use mouse to adjust.

  • Mouse Wheel - Zoom in or out.
  • Right Mouse Button - Drag canvas with ImGui content.
  • Middle Mouse Button - Drag frame representing which part of the canvas will be visible after ending the navigation mode.

The orange rectangle represents a scaled viewport and the area that will be visible on the screen after releasing keys. Zooming will scale that box and dragging with the middle mouse button will move everything.

The black rectangle represents a canvas border. You can drag canvas using the right mouse button. Dragging canvas will add a render offset between ImGui content and the viewport.

Image(s) needed.

Properties

ImGui module has a set of properties that allow to modify its behaviour:

All properties can be changed by corresponding console commands or from code.

You can get properties interface through the module instance:

FImGuiModule::Get().GetProperties();

Console commands

  • ImGui.ToggleInput - Toggle ImGui input mode. It is possible to assign a keyboard shortcut to this command.
  • ImGui.ToggleKeyboardNavigation - Toggle ImGui keyboard navigation.
  • ImGui.ToggleGamepadNavigation - Toggle ImGui gamepad navigation.
  • ImGui.ToggleKeyboardInputSharing - Toggle ImGui keyboard input sharing.
  • ImGui.ToggleGamepadInputSharing - Toggle ImGui gamepad input sharing.
  • ImGui.ToggleMouseInputSharing - Toggle ImGui mouse input sharing.
  • ImGui.ToggleDemo - Toggle ImGui demo.

Console debug variables

There is a self-debug functionality build into this plugin. This is hidden by default as it is hardly useful outside of this pluguin. To enable it, go to ImGuiModuleDebug.h and change IMGUI_MODULE_DEVELOPER.

  • ImGui.Debug.Widget - Show debug for SImGuiWidget.
  • ImGui.Debug.Input - Show debug for input state.

Settings

Plugin settings can be found in Project Settings/Plugins/ImGui panel. There is a bunch of properties allowing to tweak input handling, keyboard shortcuts (one for now), canvas size and DPI scale.

Extensions
  • ImGui Input Handler Class - Path to own implementation of ImGui Input Handler that allows limited customization of the input handling. If not set, then the default implementation is used.

If you decide to implement an own handler, please keep in mind that I'm thinking about replacing it.

Input
  • Share Keyboard Input - Whether by default, ImGui should share with game keyboard input.
  • Share Gamepad Input - Whether by default, ImGui should share with game gamepad input.
  • Share Mouse Input - Whether by default, ImGui should share with game mouse input.
  • Use Software Cursor - Whether ImGui should draw its own cursor in place of the hardware one.
Keyboard shortcuts
  • Toggle Input - Allows to define a shortcut key to a command that toggles the input mode. Note that this is using DebugExecBindings which is not available in shipping builds.

See also

License

Unreal ImGui is licensed under the MIT License, see LICENSE for more information.

unrealimgui's People

Contributors

grimeh avatar kkawachi avatar null3rr0r avatar segross avatar yash3ahuja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unrealimgui's Issues

How to change Viewport/Canvas size settings ?

It looks like by default the viewport and canvas size don't match, making some widget appear out of frame if your window is smaller than the screen. It looks intentional when looking at ImGui/Private/Widgets/SImGuiWidget.cpp, seeing there is a switch on an enum inside SetCanvasSizeInfo() than handle different behaviors leading to different sizes later in UpdateCanvasSize().

My question is how do I access the FImGuiModuleSettings module to be able to call the various Get/Set function and change this enum value ? I have looked around but didn't find the point of entry for me from outside of the plugin. I'm also having some include errors when trying to reference ImGuiModuleManager.h, so any input is welcome on that as well.

Right now I have to hack the UpdateCanvasSize() to answer my needs, which is not great for later mainteance.

ImGui.h compilation errors with Editor configs

I'm integrating this with my project, and after adding & compiling the plugin (and checking the demo window works), I'm trying to use the library.

I've added a simple #include <imgui.h> to one of our cpp files, and I'm seeing these compilation errors when compiled under DebugGame Editor (or any other Editor config):

1>  C:\Game\Plugins\ImGui\Source\ThirdParty\ImGuiLibrary\Include\imgui.h(130): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>  C:\Game\Plugins\ImGui\Source\ThirdParty\ImGuiLibrary\Include\imgui.h(130): error C2146: syntax error: missing ';' before identifier 'ImGuiIO'
1>  C:\Game\Plugins\ImGui\Source\ThirdParty\ImGuiLibrary\Include\imgui.h(131): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>  C:\Game\Plugins\ImGui\Source\ThirdParty\ImGuiLibrary\Include\imgui.h(131): error C2086: 'int ImGui::DLLIMPORT': redefinition
(and many more similar)

They don't occur with non-Editor configs (eg DebugGame Client, DebugGame, Development Client), so I assume it's something to do with linking ImGui as a DLL vs static lib.

Unreal 4.20 compatibility

Hey, I was curious if you've tried this with Unreal 4.20 yet to check it's compatible. We're planning on upgrading in the next couple weeks so we'll be testing all of our plugins soon. I wanted to see if you've already done this so we can save some time. If not it's no big deal and we can let you know what our results are. :)

support of iOS/Android

hello,

I am trying to use it and it works for UE4 Editor but when trying to run on my Android,
I have got assertion at the checkf in the file
Plugins\ImGUI\Source\ImGui\Private\ImGuiInteroperability.cpp
inside the function GetKeyIndex().

It is called by the line below, which is inside the ctor of FUnrealToImGuiMapping
KeyMap[ImGuiKey_PageDown] = GetKeyIndex(EKeys::PageDown);

Actually, is Android and/or iOS supported or, if not yet, do you have any plan?

Thank you for your time.
Giby

Pass through unhandled mouse input to viewport

Thanks for an awesome plugin.

Is there any way to pass through unhandled mouse events to the game viewport when input is enabled? Similar to the keyboard sharing, for when the mouse is not over an ImGui widget.

Need a better way of managing input, among other things

This is really awesome, however it's a bit annoying having to work around input methods. Exposing more functionality would be great- both in C++ and some blueprint nodes. I'm able to toggle ImGui on with a key press, but after that I have to use the console to toggle the input off, then I can use my own key shortcut to toggle ImGui display.

What I'm doing is:

  • Toggling a debug boolean with a key press
  • Checking if debug mode is on, and if so, draw ImGui
  • Trying to toggle debug boolean off, and hide ImGui (this is where things fall apart)

Wrapping up a lot of ImGui in easily accessible C++ and BP nodes would be awesome. If I weren't wrapped up a dozen other projects, I'd probably tackle it myself 😉

So, this is more of an issue plus feature request! Again, this is awesome to see in UE and quite welcome. A bit more polish and it would be amazing 💎

Crash on play button, after compilation

So I just integrated the plugin following the "How to use it", and it works properly. Problem is that after one hot reload from the compilation, UE4 is guaranteed to crash from pressing the play button. But once UE4 is restarted, the same project can now be played with working ImGui, until the next compile.

This is strange because it didn't have the problem when I tested it out with ShowDemoWindow. UE4 didn't crash when I changed some texts from the imgui_demo.cpp in the plugin and recompiled. Pressing the play button will work fine with the changes.

The callstack of the crash always point to this specific point of code :

UE4Editor_ImGui_5295!ImGui::FindWindowByName()
[....plugins\imgui\source\thirdparty\imguilibrary\private\imgui.cpp:4158]

Which is executed from ImGui::Begin(). But when I tried with only ImGui::Text() since it will automatically generate a debug window, the crash still happens but now with unknown cause. I tried with UE4.21.1 on Window, but I have tried it out on UE4.19.2, which basically produce the same issue.

UnrealImGui doesn't compile in non unity mode.

When compiling in nonunity (pass -ForceNonUnity to RunUAT BuildCookRun, or add false to your BuildConfiguration.xml), there are several compile errors and some linker errors.

14:03:13   ImGuiContextProxy.cpp
14:03:13   d:\jenkins\workspace\code_nonunity\engine\source\runtime\core\public\Templates/UniquePtr.h(47): error C4150: deletion of pointer to incomplete type 'ImGuiContext'; no destructor called
14:03:13   D:\Jenkins\workspace\Code_NonUnity\Archon\Plugins\UnrealImGui\Source\ThirdParty\ImGuiLibrary\Include\imgui.h(76): note: see declaration of 'ImGuiContext'
14:03:13   d:\jenkins\workspace\code_nonunity\engine\source\runtime\core\public\Templates/UniquePtr.h(46): note: while compiling class template member function 'void TDefaultDelete<T>::operator ()(T *) const'
14:03:13           with
14:03:13           [
14:03:13               T=ImGuiContext
14:03:13           ]
14:03:13   d:\jenkins\workspace\code_nonunity\engine\source\runtime\core\public\Templates/UniquePtr.h(195): note: see reference to function template instantiation 'void TDefaultDelete<T>::operator ()(T *) const' being compiled
14:03:13           with
14:03:13           [
14:03:13               T=ImGuiContext
14:03:13           ]
14:03:13   d:\jenkins\workspace\code_nonunity\engine\source\runtime\core\public\Templates/UniquePtr.h(85): note: see reference to class template instantiation 'TDefaultDelete<T>' being compiled
14:03:13           with
14:03:13           [
14:03:13               T=ImGuiContext
14:03:13           ]
14:03:13   d:\jenkins\workspace\code_nonunity\archon\plugins\unrealimgui\source\imgui\private\ImGuiContextProxy.h(78): note: see reference to class template instantiation 'TUniquePtr<ImGuiContext,TDefaultDelete<T>>' being compiled
14:03:13           with
14:03:13           [
14:03:13               T=ImGuiContext
14:03:13           ]
14:03:13   
14:03:13   Error executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe (tool returned code: 2)
2>ImGuiModule.cpp.obj : warning LNK4006: "int __cdecl Utilities::GetWorldContextIndex(class UWorld const &)" (?GetWorldContextIndex@Utilities@@YAHAEBVUWorld@@@Z) already defined in ImGuiContextManager.cpp.obj; second definition ignored
2>   Creating library C:\Perforce\Dauntless\Archon\Plugins\UnrealImGui\Intermediate\Build\Win64\UE4Editor\Development\ImGui\UE4Editor-ImGui.lib and object C:\Perforce\Dauntless\Archon\Plugins\UnrealImGui\Intermediate\Build\Win64\UE4Editor\Development\ImGui\UE4Editor-ImGui.exp
2>UE4Editor-ImGui.dll (0:03.71 at +0:24)
2>ImGuiModule.cpp.obj : error LNK2005: "int __cdecl Utilities::GetWorldContextIndex(class UWorld const &)" (?GetWorldContextIndex@Utilities@@YAHAEBVUWorld@@@Z) already defined in ImGuiContextManager.cpp.obj
2>   Creating library C:\Perforce\Dauntless\Archon\Plugins\UnrealImGui\Intermediate\Build\Win64\UE4Editor\Development\ImGui\UE4Editor-ImGui.suppressed.lib and object C:\Perforce\Dauntless\Archon\Plugins\UnrealImGui\Intermediate\Build\Win64\UE4Editor\Development\ImGui\UE4Editor-ImGui.suppressed.exp
2>C:\Perforce\Dauntless\Archon\Plugins\UnrealImGui\Binaries\Win64\UE4Editor-ImGui.dll : fatal error LNK1169: one or more multiply defined symbols found

Missing 'inline' in ImGuiInteroperability.h

GetKeyIndex and GetMouseIndex are missing their FORCEINLINE/inline keywords, causing "multiply defined symbols" link errors in non-unity (or adaptive-unity) builds.

I'm happy to fix this (and a couple of other Linux issues), but I can't edit the repo or add a new branch to submit pull requests, any chance of getting access?

AddEditorImGuiDelegate not work?

The same callback register with diffrence api, AddMultiContextImGuiDelegate & AddWorldImGuiDelegate will dispaly UI in game as expected, but display nothing in editor for AddEditorImGuiDelegate

//DelegateHandle = FImGuiModule::Get().AddMultiContextImGuiDelegate(FImGuiDelegate::CreateUObject(this, &UDearImGuiManager::OnImGuiDraw)); // display in game ui
//DelegateHandle = FImGuiModule::Get().AddWorldImGuiDelegate(FImGuiDelegate::CreateUObject(this, &UDearImGuiManager::OnImGuiDraw)); // display in game ui
DelegateHandle = FImGuiModule::Get().AddEditorImGuiDelegate(FImGuiDelegate::CreateUObject(this, &UDearImGuiManager::OnImGuiDraw)); // display nothing

Dynamic UTexture2D appears white in ImGui

Hello!

I'm trying to display a texture in ImGui that I build at runtime and regularly update in my code. However, any custom transient texture I create that way doesn't seem to be displayed - code doesn't crash, but ImGui only displays a white texture instead of the one I wrote (a yellow test texture).

In essence, here is the code I'm using.

CurrentTexture is a transient UTexture2D* UPROPERTY on an actor. In BeginPlay,

CurrentTexture = UTexture2D::CreateTransient(256, 256, EPixelFormat::PF_R8G8B8A8_UINT);
CurrentTexture->UpdateResource();

In Tick, where I'm in the process of writing in my ImGui window:

uint8* Pixels = new uint8[4 * 256 * 256];

for (int32 TextureY = 0; TextureY < 256; ++TextureY)
{
	int32 RowOffset = TextureY * 256;
	for (int32 TextureX = 0; TextureX < 256; ++TextureX)
	{
		int32 PixelIndex = RowOffset + TextureX;

		// Something more interesting should happen here, but let's say I fill the texture with yellow pixels
		Pixels[4 * PixelIndex]     = 255;
		Pixels[4 * PixelIndex + 1] = 255;
		Pixels[4 * PixelIndex + 2] = 0;
		Pixels[4 * PixelIndex + 3] = 255;
	}
}

// This doesn't seem to be doing anything:
State.CurrentTexture->UpdateTextureRegions(
	0,
	1,
	new FUpdateTextureRegion2D(
		0, 0, 0, 0,
		256,
		256
	),
	4 * 256,
	4,
	Pixels,
	[](uint8* Data, const FUpdateTextureRegion2D* UpdateRegion)
	{
		delete UpdateRegion;
		delete Data;
	});

// This didn't work either (Pixels was then on the stack):
// uint8* TextureData = static_cast<uint8*>(State.CurrentTexture->GetPlatformData()->Mips[0].BulkData.Lock(LOCK_READ_WRITE));
// FMemory::Memcpy(TextureData, Pixels, 4 * sizeof(uint8) * 256 * 256);
// State.CurrentTexture->GetPlatformData()->Mips[0].BulkData.Unlock();

State.CurrentTexture->UpdateResource();
State.ImguiTextureHandle = FImGuiModule::Get().RegisterTexture("WorldDebugMinimap", State.CurrentTexture, false);

// Draw the texture.
ImGui::Image(
	State.ImguiTextureHandle,
	ImVec2(256, 256));

What am I doing wrong? Am I missing some flags on the UTexture2D? Does it need to be uploaded manually on the GPU?
Do I need to call FImGuiModule::RegisterTexture every time I update the texture, or only once (I tried both, and it doesn't change anything).
I tried using RenderDoc, and it seems the texture ImGui draws is a 1x1 white texture in my 256x256 ImGui::Image(...) call. I used a breakpoint in the tick, and was seeing the texture containing the right data... so it seems more like a gpu upload issue?

Any help much appreciated <3 The doc is not super clear for playing with textures, and the demo doesn't feature something with a dynamic transient one either.

Thanks in advance! Awesome plugin :)

Slate/Hardware cursor support

Locally I've implemented hardware cursor support - simply translating ImGui's requested cursor to slate's SetCursor function.

Remove the IO.MouseDrawCursor = InputState.HasMousePointer(); from ImGuiInteroperability::CopyInput, and add this to SImGuiWidget::UpdateInputEnabled:

if (bInputEnabled)
{
	ImGuiMouseCursor CursorShape = ImGui::GetMouseCursor();
	EMouseCursor::Type SlateCursorShape;
	switch(CursorShape)
	{
	case ImGuiMouseCursor_None:
		SlateCursorShape = EMouseCursor::None;
		break;
	case ImGuiMouseCursor_Arrow:
		SlateCursorShape = EMouseCursor::Default;
		break;
	case ImGuiMouseCursor_TextInput:
		SlateCursorShape = EMouseCursor::TextEditBeam;
		break;
	case ImGuiMouseCursor_Move:
		SlateCursorShape = EMouseCursor::CardinalCross;
		break;
	case ImGuiMouseCursor_ResizeNS:
		SlateCursorShape = EMouseCursor::ResizeUpDown;
		break;
	case ImGuiMouseCursor_ResizeEW:
		SlateCursorShape = EMouseCursor::ResizeLeftRight;
		break;
	case ImGuiMouseCursor_ResizeNESW:
		SlateCursorShape = EMouseCursor::ResizeSouthWest;
		break;
	case ImGuiMouseCursor_ResizeNWSE:
		SlateCursorShape = EMouseCursor::ResizeSouthEast;
		break;
	default:
		unimplemented();
		break;
	}
	SetCursor(SlateCursorShape);
}
else
	SetCursor(EMouseCursor::None);

Touch input?

It seems like ImGui doesn't do a very good job of handling touch input -- I have to "share" all input in order to get anything passed down to the actual game, and when rendering a window I can get the handy-dandy fake ImGui cursor to move where I touch, but hover controls are iffy at best and I can't click on any buttons on a touch-enabled device (even though those same buttons are clickable with a mouse in the editor).

Is there any support for touch input, or is that something coming in the future?

FImGuiModuleCommands::SetKeyBinding does not work when using a child of UPlayerInput

I have added an UpdatePlayerInput for all chld classes (DebugExecBindings.cpp) and it seems to work

// Update default player input, so changes will be visible in all PIE sessions created after this point.
if (UPlayerInput* DefaultPlayerInput = GetMutableDefault())
{
UpdatePlayerInput(DefaultPlayerInput, KeyBind);
for (TObjectIterator ClassIt; ClassIt; ++ClassIt)
{
if (ClassIt != UPlayerInput::StaticClass() && ClassIt->IsChildOf(UPlayerInput::StaticClass()))
{
UPlayerInput
DefaultChildPlayerInput = (UPlayerInput*)ClassIt->GetDefaultObject();
UpdatePlayerInput(DefaultChildPlayerInput, KeyBind);;
}
}
}

Deal with ReloadTextureResources

Not displayed correctly character when UE4.26.1 standalone playing.
Font texture was not reloaded when called FSlateApplication::Get().GetRenderer()->ReloadTextureResources()

thank you.

Input Method Editor implementation?

It appears that the plugin drops support for IME, which ImGui has rudimentary support for. Unreal seems to conflict with ImGui's use of ::ImmGetContext, causing it to be deactivated, except when using a slate text widget.

It looks like the engine would want us to implement ITextInputMethodContext for SImGuiWidget, but it seems to be quite involved - requiring a much more complex interaction with ImGui to pull out the active document, render the composition etc.

Has anyone tried doing this, or found a way for Unreal's TextInputService to co-exist with the simple ::ImmGetContext API?

Custom Fonts Example

Just wondering if you could provide an example of how to use custom fonts with the plugin?

I've tried the standard ImGui method of adding a font but end up with a broken font atlas (just using a standard ttf font).
I see there's some methods for using custom fonts through the Unreal wrappers provided, but no indication how to really use these.

image

Plugin is not rendering anything in 4.21, however plugin code is being called.

Hello

I have attempted to use this plugin in 4.21, and it appears to not render anything.

I turned on the demo window, and stepped through the plugin code . It issues all the ImGui commands to draw the demo windows, but never display on screen.
I attatched render doc, and It was never drawing in the capture either (I was hoping it was just behind my other UI or the world or something.)

Is this due to me using 4.21? Or possibly just a bug?

Compile error in non-editor build

ContextProxyCreatedEvent.Broadcast(Utilities::STANDALONE_GAME_CONTEXT_INDEX, *Data->ContextProxy);

I think this should be:
Data = &Contexts.Emplace(Utilities::STANDALONE_GAME_CONTEXT_INDEX, FContextData{GetWorldContextName(), Utilities::STANDALONE_GAME_CONTEXT_INDEX, OnDrawMultiContext, FontAtlas});
OnContextProxyCreated.Broadcast(Utilities::STANDALONE_GAME_CONTEXT_INDEX, *Data->ContextProxy);

Stale pointer causing random crashes

In UImGuiInputHandler::Initialize, the InputState member caches the value from the indexed ContextProxy like so:

auto* ContextProxy = ModuleManager->GetContextManager().GetContextProxy(ContextIndex);
checkf(ContextProxy, TEXT("Missing context during initialization of input handler: ContextIndex = %d"), ContextIndex);
InputState = &ContextProxy->GetInputState();

However, it seems like the InputState pointer can become stale. This may be due to a resize of the container holding all the content proxies -- a newly constructed ContextProxy can be created along with a new InputState (or at least a copy), which invalidates the cached UImGuiInputHandler->InputState pointer. On my machine, I was seeing this when running 4 PIE sessions plus a dedicated server (plus the editor itself). My guess is that the container holding the content proxies was set to hold 5 elements, but then one of the clients caused the container to be resized (or something along those lines). The result is that InputState becomes a stale pointer pointing to some random piece of memory.

When input gets cleared, the input arrays get wiped... which wipes data from that random piece of memory. Sometimes this causes weird side effects, sometimes you don't notice, sometimes it results in a crash. Changing code changes where things are mapped out in memory, so the crash could go away for a bit and then come back when you write some more code.

I've come up with a hacky solution by updating the InputState every frame during UImGuiInputHandler::OnPostImGuiUpdate, using the same code that UImGuiInputHandler::Initialize uses (the bit I pasted above).

It may be that it only needs to be done on the first frame, but I've honestly spent about a week trying to debug this code (which is frustrating since it doesn't happen every time or on every machine, even with the same codebase) and the hacky solution seems to work. However, as I mentioned, the bug is intermittent and changes based on code changes elsewhere in the project.

I don't know if my hacky solution is the right way to do things, but it might be worth taking a look at how that stuff gets stored.

[NetImGui] Crash when running without a renderer

In changelist 0e4fa23, the LoadTextures in ImGuiModuleManager.cpp was moved from FImGuiModuleManager::AddWidgetToViewport to FImGuiModuleManager::OnContextProxyCreated. Since the proxy seems to be always created on first Tick even without a renderer, this crashes with the following callstack.

 	[Inline Frame] UnrealEditor-SlateCore.dll!FSlateBrush::CanRenderResourceObject(UObject *) Line 137	C++
>	UnrealEditor-SlateCore.dll!FSlateBrush::SetResourceObject(UObject * InResourceObject) Line 148	C++
 	UnrealEditor-ImGui.dll!FTextureManager::FTextureEntry::FTextureEntry(const FName & InName, UTexture2D * InTexture, bool bAddToRoot) Line 140	C++
 	UnrealEditor-ImGui.dll!FTextureManager::CreateTextureInternal(const FName & Name, int Width, int Height, unsigned int SrcBpp, unsigned char * SrcData, TFunction<void __cdecl(unsigned char *)> SrcDataCleanup) Line 68	C++
 	UnrealEditor-ImGui.dll!FTextureManager::CreatePlainTextureInternal(const FName & Name, int Width, int Height, const FColor & Color) Line 100	C++
 	[Inline Frame] UnrealEditor-ImGui.dll!FTextureManager::InitializeErrorTexture(const FColor &) Line 13	C++
 	[Inline Frame] UnrealEditor-ImGui.dll!FImGuiModuleManager::LoadTextures() Line 85	C++
 	UnrealEditor-ImGui.dll!FImGuiModuleManager::OnContextProxyCreated(int ContextIndex, FImGuiContextProxy & ContextProxy) Line 232	C++

On this line

if (FSlateApplicationBase::IsInitialized())
{
	return FSlateApplicationBase::Get().GetRenderer()->CanRenderResource(*InResourceObject);
}

With the error:

Exception thrown: read access violation.
FSlateApplicationBase::CurrentBaseApplication.Object->Renderer.Object was nullptr.

To reproduce, I opened the editor with -run=GenerateSoundBanks.

Any plan to update to latest?

Hello,

Out of curiosity this seems to be relying on Dear ImGui 1.65 which is about 9 releases ago, any reason for not updating to a more recent version of the core library?

Cheers,
Omar

Upgrading to Dear ImGui 1.60

Hey, I was wondering if you had plans on updating this plugin to use ImGui 1.60 in the near future.

I was testing out the upgrade locally and it's pretty smooth, but the removal of the global default context causes some issues that would take me some time to solve. So if you were already in the process of doing it I'd rather wait.

There's also work needed to be done to allow for the keyboard/gamepad navigation changes to be used but personally I'm in no rush for it.

Integrate Remote ImGui

Hey,
Not really an issue but have you tried to add the remote imgui stuff in unreal ?

Question not directly related to UnrealImGui (Porting Ultralight to UE)

Hi @segross!

Great work that you've done with UnreallImGui!
I'm currently contemplating on creating Unreal Engine bindings for the HTML5 rendering engine https://ultralig.ht/
Reason being that this would allow web developers to create user interfaces using web technologies. This would simplify and streamline a lot of UI work I believe and at least for me personally, this would make it much easier and less error prone to work with dynamic data (e. g. a list for servers that users could join)

I'm a novice C++ programmer though and the task seems daunting to me.
I've looked at some of your commits on UnrealImGui but I personally wouldn't know where to start on my project.

So I was thinking if you could give me your insights into how much work and how complex it is to create something like that based on your experience with UnrealImGui.

And perhaps you could point me towards helpful documentation regarding such an undertaking. I myself have to yet find useful examples online besides your code repository which I already use for reference.

Render ImGui to a texture or 3D plane?

Hi,

I'm looking into trying to render ImGUI to an Unreal texture so I can use it for a debug panel in-world. The idea for this is to have a small debug menu that works in VR.

I've had a look through the code, and getting a bit stuck. Can you offer any suggestions on where I could start or what things I would need to unhook/modify to do this?

Thanks

Adding Fonts

after adding a new font like this:

ImGuiIO& io = ImGui::GetIO();
	ImFont* ImFont=	io.Fonts->AddFontFromFileTTF(TCHAR_TO_ANSI(*FilePath), 13);

	if(!ImFont)
		UE_LOG(LogTemp,Error,TEXT("Font is null")); 

I tried to open style editor , new fonts exists but its labeled "Unknown " and clicking on it will crash the engine.(font reference is not null ) I also tried font->build() but after doing so every text in UI will turn into squares

[Linux] Crash with any text input field

Every time I try to get the focus a text field to type something, I crash in ImGui function ImGui::InputTextEx.
I easily reproduce it with the Demo Window and using the Widgets > Text Input > Resize Callstack example.

LogCore: === Critical error: ===
Unhandled Exception: SIGSEGV: invalid attempt to read memory at address 0x0000000003b37200

LogCore: Fatal error!

libUE4Editor-ImGui.so!ImGui::InputTextEx(char const*, char const*, char*, int, ImVec2 const&, int, int (*)(ImGuiInputTextCallbackData*), void*) [/mnt/dev/Perforce/Exedre/Plugins/ImGui/Source/ThirdParty/ImGuiLibrary/Private/imgui_widgets.cpp:3689]
libUE4Editor-ImGui.so!ShowDemoWindowWidgets() [/mnt/dev/Perforce/Exedre/Plugins/ImGui/Source/ThirdParty/ImGuiLibrary/Private/imgui_demo.cpp:1075]
libUE4Editor-ImGui.so!ImGui::ShowDemoWindow(bool*) [/mnt/dev/Perforce/Exedre/Plugins/ImGui/Source/ThirdParty/ImGuiLibrary/Private/imgui_demo.cpp:428]
libUE4Editor-Exedre.so!UExedreDebugUI::RenderMenu(float) [/mnt/dev/Perforce/Exedre/Source/Exedre/GUI/ExedreDebugUI.cpp:327]
libUE4Editor-Exedre.so!AExedreWidgetManager::UpdateAndRenderMenus(float) [/mnt/dev/Perforce/Exedre/Source/Exedre/GUI/ExedreWidgetManager_Render.cpp:160]
libUE4Editor-Exedre.so!AExedreWidgetManager::ManualTick(float) [/mnt/dev/Perforce/Exedre/Source/Exedre/GUI/ExedreWidgetManager_Base.cpp:287]
libUE4Editor-Engine.so!AHUD::PostRender() [/mnt/dev/UE4/Engine/UnrealEngine_4-25-2/Engine/Source/Runtime/Engine/Private/HUD.cpp:172]
libUE4Editor-Engine.so!UGameViewportClient::Draw(FViewport*, FCanvas*) [/mnt/dev/UE4/Engine/UnrealEngine_4-25-2/Engine/Source/Runtime/Engine/Private/GameViewportClient.cpp:1620]
libUE4Editor-Engine.so!FViewport::Draw(bool) [/mnt/dev/UE4/Engine/UnrealEngine_4-25-2/Engine/Source/Runtime/Engine/Private/UnrealClient.cpp:1541]
libUE4Editor-Engine.so!UGameEngine::RedrawViewports(bool) [/mnt/dev/UE4/Engine/UnrealEngine_4-25-2/Engine/Source/Runtime/Engine/Private/GameEngine.cpp:682]
libUE4Editor-Engine.so!UGameEngine::Tick(float, bool) [/mnt/dev/UE4/Engine/UnrealEngine_4-25-2/Engine/Source/Runtime/Engine/Private/GameEngine.cpp:1806]
UE4Editor-Cmd!FEngineLoop::Tick() [/mnt/dev/UE4/Engine/UnrealEngine_4-25-2/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp:4844]
UE4Editor-Cmd!GuardedMain(char16_t const*) [/mnt/dev/UE4/Engine/UnrealEngine_4-25-2/Engine/Source/Runtime/Launch/Private/Launch.cpp:171]
libUE4Editor-UnixCommonStartup.so!CommonUnixMain(int, char**, int (*)(char16_t const*), void (*)()) [/mnt/dev/UE4/Engine/UnrealEngine_4-25-2/Engine/Source/Runtime/Unix/UnixCommonStartup/Private/UnixCommonStartup.cpp:264]
libc.so.6!__libc_start_main(+0xf1)
UE4Editor-Cmd!_start()

Looks like it's crashing on this line:
if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }

I gave a try at the standalone ImGui versions 1.78 and 1.74 (via the example example_sdl_opengl2) and it's not crashing. Any idea what that might be ?
I'm using the following by the way :

	FImGuiModule::Get().GetProperties().SetInputEnabled( true );
	FImGuiModule::Get().GetProperties().SetKeyboardInputShared( true );

Unreal 5 support

Just curious if you are considering adding support for Unreal 5. Thanks for effort on the project!

Gamepad Input with CommonUI

It seems that CommonUI is using a fake analog cursor to handle the gamepad actions. In CommonUI, the Gamepad Facebutton down is treated as an EKeys::Virtual_Accept that later down the input system, is translated to a LeftMouse button action.

Everything seems to work fine except when you use the gamepad face button down to activate a button, in that case, the input seems to be lost and passes through the slate imgui widget to the viewport, losing focus on the Imgui window.

Do you know if support for this behavior can be added?

Crash on Unreal Engine 4.19

We are using the latest GitHub code on 4.19 branch (at the moment preview 6) and it works fine for us with all the plugins working. But only adding ImGui plugin to the Plugins folder will crash our game upon hitting the play button on both Windows and Linux.

Here is the call stack and crash log and the failed assert from engine code: https://pastebin.com/xRvTsGGS

Zoom / DPI awareness

UE4.22.3
master branch (equivalent to 4.24 tag, I think)

Nice job on this implementation; the install was relatively painless. I did have some problems though with trying to add on some third party widgets; the most frequent issue was imgui_internal.h not being on the include directories (../Private/imgui_internal.h works).

Issue:
I am on a 4K screen (200% scale in Windows), which makes my imgui windows in UE4 very small. I see there is a way to temporarily zoom in with the Alt+Shift controls; is there a way to choose a set zoom level, or otherwise make ImGui windows more DPI-aware?

I was going to refer you to the DX11 example on the imgui repo for good DPI awareness, but from some quick looks at your code, it seems like you're using Slate as the backend for imgui. A secondary question: does this plugin work for Mac and Linux packaged UE4 clients?

Conversion from TCHAR to ImWchar on Linux

Linux builds emit the static assert in FImGuiInputState::AddCharacter:

static_assert(sizeof(TCHAR) <= sizeof(InputCharacters[0]), "Size of elements in Input Characters buffer is smaller than size of 'TCHAR'. Possible truncation.");

It appears that TCHAR is 32-bit on clang by default. It seems reasonable to allow the truncation to happen as I imagine it's rare that the upper two bytes will be used. Would it be sensible to downgrade this to a runtime assert that fires if truncation will actually happen (ie the top two bytes of Char are non-zero)?

[Linux] Compilation errors on UE4 4.25

I'm testing the plugin to see if I could use Dear ImGUI in UE4 (4.25.2) for my debug UI, unfortunately I'm hitting several walls when trying to compile it.

Straight off the shelf, I get the following error :

/mnt/dev/Perforce/Exedre/Plugins/ImGui/Source/ImGui/Private/TextureManager.h:29:2: error: explicitly defaulted move constructor is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
        FTextureManager(FTextureManager&&) = default;
        ^
/mnt/dev/Perforce/Exedre/Plugins/ImGui/Source/ImGui/Private/TextureManager.h:151:16: note: move constructor of 'FTextureManager' is implicitly deleted because field 'ErrorTexture' has a deleted move constructor
        FTextureEntry ErrorTexture;
                      ^
/mnt/dev/Perforce/Exedre/Plugins/ImGui/Source/ImGui/Private/TextureManager.h:136:3: note: 'FTextureEntry' has been explicitly marked deleted here
                FTextureEntry(FTextureEntry&&) = delete;
                ^
1 error generated.

I tentatively fixed that by removing the = default (two lines) in TextureManager.h.


After that I was able to draw the default debug UI via ImGui::ShowDemoWindow();. When I wanted to go further and start to manage the inputs with FImGuiModule::Get().GetProperties(); (following the recommendations from the readme). Unfortunately I'm hitting another compilation error when trying to include <ImGuiModule.h> :

Plugins/ImGui/Source/ImGui/Public/ImGuiModule.h:173:10: error: unknown type name 'FImGuiContextHandle'; did you mean 'FImGuiTextureHandle'?
        virtual FImGuiContextHandle& GetImGuiContextHandle();

I tried to fix that by moving the friend struct X into struct X at the top of the ImGuiModule.h header file to forward declare them, but that lead to another error :

Plugins/ImGui/Intermediate/Build/Linux/B4D820EA/UE4Editor/Development/ImGui/Module.ImGui.cpp:8:
/mnt/dev/Perforce/Exedre/Plugins/ImGui/Source/ImGui/Private/ImGuiDelegatesContainer.cpp:18:23: error: 'GetDelegatesContainerHandle' is a private member of 'FImGuiModule'
                        SetParent(&Module->GetDelegatesContainerHandle());

It's probably not the right thing to do, but at this point the Plugin structure is starting to elude me and I'm not sure what to do. I properly declared the module in my Build.cs file, so I'm not sure what more I could do.


My system:

  • OS: Linux Manjaro 20.1 Mikah
  • Kernel: x86_64 Linux 5.7.15-1-MANJARO
  • CPU: AMD Ryzen 9 3900X 12-Core @ 24x 3.8GHz
  • GPU: GeForce GTX 980 Ti

Add imgui widget to EditorViewPort

imgui widget can now only be invoked in PIE mode,Is there a way to make it work in editor mode?
UGameViewportClient has function AddWidgetToViewport(),but i can not find similar function in FEditorViewportClient
image

Improvements to sharing mouse input

Creating a new ticket as the old one was closed
#49

I read the description of input sharing and the issues with mouse being that there is an ImGui Slate widget covering the whole screen and intercepting mouse events. I'm not a complete expert on how your plugin works so maybe this is a naive idea but...

I see that ImGuiInputHandler returns FReply::Handled for MouseDown and MouseUp events and that seems to be what make sure that mouse clicks on the UI don't accidentally go through to the game.

Is there no way to only return FReply::Handled if the cursor is over a UI element? That way the Slate widget can behave kind of like HitTestInvisible?

Edit: Okay yeah it was mega naive, checking for WantCaptureMouse and IsWindowHovered doesn't work, even though the imgui demo window seems to show the flags correctly.

FReply UImGuiInputHandler::OnMouseButtonDown(const FPointerEvent& MouseEvent)
{
	if (MouseEvent.IsTouchEvent())
	{
		return ToReply(false);
	}

	//const bool bHandled = ImGui::GetIO().WantCaptureMouse;
	const bool bHandled = ImGui::IsWindowHovered();

	InputState->SetMouseDown(MouseEvent, true);
	return ToReply(bHandled);
}

How to input Chinese?

After I call AddFontFromFileTTF to add a Chinese font, I can display Chinese
but the inputtext widget still can not input Chisese.
Any advice?
Thanks !

Use for custom Unreal editor window?

Hi,
Thank you for the wonderful UE4 integration. I have created a in-game debug tool for my project. It's really convenient and easy to use, compared with Slate.
I have read some source code and tried to create a custom editor window using it. But it seems the imgui widgets can be added to game viewports only. I wonder is there a way to draw the imgui widgets on the eidtor window?

Can't Get Mouse Input When Showing HUD

I'm seeing a problem where having a HUD with widget elements shown is causing mouse inputs to be swallowed because of what looks like a lack of focus.

Below are two logs in which I am enabling input and then clicking on one of the menus that appears (so I would expect a receipt of focus and a mouse enter event).

Here is the log when I have a HUD shown with widget elements -

[2022.05.06-22.52.30:769][ 71]LogImGuiWidget: ImGui Widget -2 - Input Enabled changed to 'true'.
[2022.05.06-22.52.30:769][ 71]LogImGuiWidget: VeryVerbose: ImGui Widget -2 - Visibility updated to 'Visible'.
[2022.05.06-22.52.30:770][ 71]LogImGuiWidget: VeryVerbose: ImGui Widget -2 - Taking focus for player.
[2022.05.06-22.52.30:774][ 72]LogImGuiWidget: VeryVerbose: ImGui Widget -2 - Focus Received.
[2022.05.06-22.52.30:780][ 73]LogImGuiWidget: VeryVerbose: ImGui Widget -2 - Mouse Leave.
[2022.05.06-22.52.31:892][306]LogImGuiWidget: VeryVerbose: ImGui Widget -2 - Focus Lost.

And here is the same flow with a HUD without widgets -

[2022.05.06-22.54.12:539][310]LogImGuiWidget: ImGui Widget -2 - Input Enabled changed to 'true'.
[2022.05.06-22.54.12:540][310]LogImGuiWidget: VeryVerbose: ImGui Widget -2 - Visibility updated to 'Visible'.
[2022.05.06-22.54.12:540][310]LogImGuiWidget: VeryVerbose: ImGui Widget -2 - Taking focus for player.
[2022.05.06-22.54.12:544][311]LogImGuiWidget: VeryVerbose: ImGui Widget -2 - Focus Received.
[2022.05.06-22.54.12:549][312]LogImGuiWidget: VeryVerbose: ImGui Widget -2 - Mouse Leave.
[2022.05.06-22.54.13:406][489]LogImGuiWidget: VeryVerbose: ImGui Widget -2 - Mouse Enter.
[2022.05.06-22.54.16:297][ 84]LogImGuiWidget: VeryVerbose: ImGui Widget -2 - Mouse Leave.

In the first log I never see a Mouse Enter event, instead only a Mouse Leave followed by a Focus Lost. Again the only difference (that I can tell matters) between these two things is that one has a HUD with widgets on it and the other does not.

Any insight into this would be very appreciated!

When mouse input sharing is turned on, the ImGui window may not receive focus.

Hello.

When mouse input sharing is turned on, clicking (or touching) the ImGui window may not receive the focus.
(It happened when playing the game while displaying the debug menu on ImGui.)

It occurs when the following procedure is performed.

  1. Turn on mouse input sharing setting and start gameplay
  2. Display the ImGui window (for example, use the ImGui.ToggleDemo command)
  3. Turn on ImGui input (for example, use the ImGui.ToggleInput command)
  4. Click the part that is not the ImGui window
  5. Click the ImGui window

In 5, ImGui window does not receive focus.
I want to focus just by clicking on the ImGui window. Is there any way?

Imgui + game and widget events

Hi . Is here any option or flag to enable ImGUI Input along with game and other widget input ?
its kinda useless (at least for me) if it disables the game and UI input. :((
thanks for your effort 👍

[Linux] Compiling for Server Target fails (UE 4.25)

Related issue to #34

Using the suggested fixes from the issue above (making constructors = delete and adding struct to lines 172 and 173 of ImGuiModule.h) leaves the following error when compiling a Linux Server:

1>  ...\Plugins\ImGui\Source\ImGui\Private\ImGuiDelegatesContainer.cpp(17,23): error : no member named 'GetDelegatesContainerHandle' in 'FImGuiModule'
1>                          SetParent(&Module->GetDelegatesContainerHandle());
1>                                     ~~~~~~  ^
1>  1 error generated.

GetDelegatesContainerHandle() is declared in ImGuiModule.h and is one of the functions to which the struct keyword was added, however when compiling for the Server target it is #if'd out because WITH_EDITOR is 0.

I can't for the life of me find a way to make Unreal just not bother compiling the plugin when targeting a Linux Server (no UI, no need for ImGui). However, omitting it from the DependencyModuleNames in the Build.cs file nor Blacklisting the Server target in the .uplugin made any difference.

I have managed to get it to compile by playing some Linker Error whack-a-mole. If you comment the #if WITH_EDITOR blocks in ImGuiImplementation.cpp (lines 20 & 43, and lines 59 and 69), ImGuiImplementation.h (lines 10 & 16), ImGuiModule.h (lines 168 & 174), and ImGuiModule.cpp (lines 167 & 182) so that their contents is always compiled it seems happy. I doubt this is a clean or safe solution, however, and I'm unsure of any potential knock on effects this might be causing.

Support for more than just UTexture2D with RegisterTexture()

The TextureManager only handle UTexture2D objects and not Render Target textures (UTextureRenderTarget2D or UCanvasRenderTarget2D for example). Do you think it could be possible to add that support ? Those two class inherit from UTexture and not UTexture2D.

I have plenty of render targets that handle custom effects and I often display them on screen for debug. So being able to display them via ImGui would be very handy.

A workaround could be to use CreateTexture() to convert the render target resource, but that would require to do a copy (and an expensive one).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.