Coder Social home page Coder Social logo

imgui's Issues

Proper way to do user-side context initialization?

I've updated to latest according to #4 (comment) and I was going to remove my change to ImGuiContext.cpp to add new fonts when I realized that I still don't really know where to put those AddFont calls instead. Ideally this would have to be done when the context is first created but that happens in response to the Slate widget being created and that happens the first time an FScopedContext is used, so it could be anywhere.

Do you have a suggestion where to put this? Feels like either the ImGuiModule needs some customization where you can supply a delegate that's called when the context is first created, or I need to create the context explicitly at some well-known point on startup. However, that could be tricky itself because I would have to carefuly manage the lifetime of that context until the Slate widget has been created, which doesn't feel ideal.

Any ideas?

Doesnt compile on UE5.3.2

It complains about

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2039	'KeysDown': is not a member of 'ImGuiIO'	MyFirstProject	C:\Users\Neon\Documents\Unreal Projects\MyFirstProject\Plugins\UnrealImGui\Source\ImGui\Private\ImGuiInteroperability.h	25	
Error	C2039	'NavInputs': is not a member of 'ImGuiIO'	MyFirstProject	C:\Users\Neon\Documents\Unreal Projects\MyFirstProject\Plugins\UnrealImGui\Source\ImGui\Private\ImGuiInteroperability.h	26	
Error	C2039	'KeyMap': is not a member of 'ImGuiIO'	MyFirstProject	C:\Users\Neon\Documents\Unreal Projects\MyFirstProject\Plugins\UnrealImGui\Source\ImGui\Private\ImGuiInteroperability.h	28	

Checked and KeysDown is not defined in ImGuiIO. Do you used another version?

Found this after testing other versions like benui-dev and IDI-Systems and those worked fine.

Exclusive mouse control to imgui

Hello,

Thanks for your library. I find it very well designed.
I'm looking at replacing my Unreal Imgui integration (inspired by UnrealImGui) by yours in my project https://github.com/arnaud-jamin/Cog.

I have the following use case which forces me to modify your sources in a way I do not really like. Maybe you will come up with a better idea.

I want to give the option to the imgui user to change this dynamically:

  1. Disable imgui mouse. Then only the game handle the mouse.
  2. Share mouse between the game and imgui (imgui uses the mouse only over a imgui window otherwise it is for the game)
  3. Give exclusive control of the mouse to imgui. The game doesn't receive the mouse anymore.

Point 1) Can be done by using the flag ImGuiConfigFlags_NoMouse
Point 2) Can be done by disabling the flag ImGuiConfigFlags_NoMouse
Point 3) Can be done in different ways:

A) dynamically change the return value of the functions in input processor:

The InputProcessor could have a member variable "OnlyEnableImGuiMouse". Related functions would return true when this variable is true.

	virtual bool HandleMouseMoveEvent(FSlateApplication& SlateApp, const FPointerEvent& Event) override
	{
		[...]

                if (OnlyEnableImGuiMouse)
                {
                    return true;
                }    
		
                return IO.WantCaptureMouse;
	}

To be able to change that variable I would need to expose an accessor to the Overlay or the Context inside FScopedContext. Or I could create the Context by calling this:

TSharedPtr<FImGuiContext> ImGuiContext = FImGuiModule::Get().FindOrCreateContext();

Then I could keeping a reference to the created context and call a SetOnlyEnableImGuiMouse() on it. I would need to get the context from FScopedContext to do:

	virtual bool HandleMouseMoveEvent(FSlateApplication& SlateApp, const FPointerEvent& Event) override
	{
		ImGui::FScopedContext ScopedContext(Owner->GetContext());
                [...]

                if (ScopedContext.GetContext()->GetOnlyEnableImGuiMouse())
                {
                    return true;
                }    
		
                return IO.WantCaptureMouse;
	}

This doesn't seem great.

B) Another way to do this is to have a transparent imgui widget the cover the whole screen so IO.WantCaptureMouse always return true. (it could be the docking central node without ImGuiDockNodeFlags_PassthruCentralNode but made transparent)

Any suggestion ?

Thanks!

Good job

Not an issue, just wanted to let you know I have found your codebase pleasing with its clean and minimalastic approach. And on top of it, you have Dear ImGui viewport support!

I am currently working on adding local drawing support in my UnrealNetImgui plugin, and I am also aiming for something simple and clear.

Good work.

Inherent frame delay?

Hi,

I've noticed that when projecting a world position to screen and rendering a circle onto the ImGui background draw list at that position, that rendered circle will slightly lag behind when moving the camera.

I found that the plugin calls ImGui::Render just before calling ImGui::NewFrame in the same tick. That means all ImGui rendering will inherently be delayed by one tick since you only submit the render commands for the current tick in the next tick. Is there a reason why the plugin works this way? Could it be changed to submit render commands in the same tick?

Thanks!

How to render images?

Hi,

thanks for this library, it works so much better than another library we were using beforehand!

I'm currently trying to render an image with ImGui. I found one example within the plugin itself where the font atlas is built and then the pointer to the UTexture2D is passed as an ImTextureID.

So I tried just passing a pointer to a UTexture2D (which is set as a default property on another class) to ImGui::Image but nothing is rendered. I also couldn't find where the conversion between ImTextureID and the actual draw commands is taking place so I can't say why it's not working.

Should this be supported?

Handling key release after lost window focus

Hello,

I'm facing an issue where the ImGuiMod_Ctrl/Shift/Alt/Super keys are still considered to be down by the application after alt + shift tabbing out of the game window. This results in any call to ImGui::IsKeyDown(ImGuiKey_LeftAlt) == true before tabbing back or focusing the game window again. How would I best go about detecting focus loss and setting these keys to no longer being considered down? Or do you have any other ideas for how I should go about this?

And also, a big thank YOU for developing this excellent plugin🎉

Default font isn't packaged

ImGuiContext.cpp references the TTF file directly like this:

const FString FontPath = FPaths::EngineContentDir() / TEXT("Slate/Fonts/Roboto-Regular.ttf");

This works fine in editor and non-staged builds, however as soon as you stage and/or package, ImGui reverts to the (quite ugly) default ImGui font.

One way to fix this is to add this line to your Build.cs file:

RuntimeDependencies.Add(Path.Combine(EngineDirectory, "Content/Slate/Fonts/Roboto-Regular.ttf"), StagedFileType.NonUFS);

Specifically, this needs to be of type NonUFS so that the file can be found using regular file operations, not just using the Unreal file system.

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.