Coder Social home page Coder Social logo

imgui-godot's People

Contributors

arran-nz avatar aschuhardt avatar pkdawson avatar valkyrienyanko 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

imgui-godot's Issues

How to Render ImGui in a New Window Instead of the Main Program Window?

I am currently working on an application that involves multiple windows: a main program window and a newly created secondary window. My issue is that ImGui seems to render its content in the main window by default. I'm looking to have ImGui content rendered in the secondary window instead.

Unfortunately, I'm not fully familiar with the rendering process of ImGui and how it decides the target window for rendering. My apologies for reaching out without a deep understanding of the system's internals – I haven't had the chance to delve into the implementation details of ImGui's window handling.

Could someone guide me on how to direct ImGui to render in a specific window that is not the main program window? Any insights or references to documentation/examples that explain how ImGui interacts with multiple window contexts would be greatly appreciated.

Interface for C++ / GDExtension

It's possible to also use ImGui from outside C# by sharing the context pointer and using the exact same version of ImGui. I should document this, and add a method for getting the current context. That could be done on ImGuiLayer, but I'll probably wait and use GDExtension instead, which should be available for C# soon.

I'd also like to provide an optional C++ implementation of the renderer, but viewports make that more complicated.

Error (-3) creating shader module for stage: Vertex

I get this error on my laptop (Radeon RX Vega 10 graphics). Here's the callstack (none is my code). I get this with any simple ImGui.Begin("blah")/ImGui.End() in a single node's _Process function (I'm using the 4.1.2 dotnet)

E 0:00:02:0871   Godot.NativeInterop.NativeFuncs.generated.cs:345 @ void Godot.NativeInterop.NativeFuncs.godotsharp_method_bind_ptrcall(IntPtr , IntPtr , System.Void** , System.Void* ): Error (-3) creating shader module for stage: Vertex
  <C++ Error>    Method/function failed. Returning: RID()
  <C++ Source>   drivers/vulkan/rendering_device_vulkan.cpp:5131 @ shader_create_from_bytecode()
  <Stack Trace>  Godot.NativeInterop.NativeFuncs.generated.cs:345 @ void Godot.NativeInterop.NativeFuncs.godotsharp_method_bind_ptrcall(IntPtr , IntPtr , System.Void** , System.Void* )
                 NativeCalls.cs:7393 @ Godot.Rid Godot.NativeCalls.godot_icall_2_814(IntPtr , IntPtr , IntPtr , System.String )
                 RenderingDevice.cs:2381 @ Godot.Rid Godot.RenderingDevice.ShaderCreateFromSpirV(Godot.RDShaderSpirV , System.String )
                 RdRenderer.cs:56 @ ImGuiGodot.Internal.RdRenderer..ctor()
                 ImGuiGD.cs:79 @ void ImGuiGodot.ImGuiGD.Init(Godot.Window , Godot.Rid , System.Nullable`1[System.Single] , ImGuiGodot.RendererType )
                 ImGuiLayer.cs:83 @ void ImGuiGodot.ImGuiLayer._EnterTree()
                 Node.cs:2057 @ Boolean Godot.Node.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.NativeVariantPtrArgs , Godot.NativeInterop.godot_variant& )
                 CanvasLayer.cs:379 @ Boolean Godot.CanvasLayer.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.NativeVariantPtrArgs , Godot.NativeInterop.godot_variant& )
                 ImGuiGodot.ImGuiLayer_ScriptMethods.generated.cs:82 @ Boolean ImGuiGodot.ImGuiLayer.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.NativeVariantPtrArgs , Godot.NativeInterop.godot_variant& )
                 CSharpInstanceBridge.cs:24 @ Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(IntPtr , Godot.NativeInterop.godot_string_name* , Godot.NativeInterop.godot_variant** , Int32 , Godot.NativeInterop.godot_variant_call_error* , Godot.NativeInterop.godot_variant* )

Godot 4.1 support

Node processing priority seems currently unimplemented in 4.1-dev3 because of ongoing refactoring for threading support. No satisfactory alternatives.

Renderer bug

To reproduce, just open Help in the demo window and scroll around.

Might have messed up the indices while refactoring

Add support for running ImGui in the Editor ([Tool])

Currently, if you run any ImGuiNET code in the editor Godot will crash, and you will have to delete the offending code and rebuild to stop the crashing.

I'm not 100% sure if the issue is with this plugin or ImGuiNET generally, but I thought it was worth bringing to this project's attention.

Minimal example (and attach to a Node in the scene):

using Godot;
using ImGuiNET;

namespace Example;

[Tool]
public sealed partial class MyTool : Node
{
    public override void _Process(double delta)
    {
        ImGui.Text("Hello from the editor!");
    }
}

3D rendering panels/framebuffers

Howdy, I was wondering if you had any advice on making an imgui panel that renders in 3D space (similar to the 3D Gui example in the godot examples repo).

I've done this before in another game engine by modifying the imgui renderer to render the frame to an FBO, and then I can use that framebuffer as the source for a texture. In my experience it works really well, and I can just give each panel its own context if needed. Maybe multi-viewports is better though, but I have not used it before. I also am not super familiar with godot's rendering abstraction, it's a little different from directly calling OpenGL to make framebuffers.

Another approach might be to render imgui in another scene, and then render that scene to texture to display in-game? I don't know how this would affect performance (I have not done this before), would it be the easiest solution?

My usecase is that a) I like using imgui :D and b) it makes it easy to implement dynamic UI for in-game panels. I think this would also be very useful for debugging in VR/XR setups, similar to how Desktop+ uses imgui for its settings menu.

Would it be better to wait until the GDExtension work has progressed more? I'd be interested in contributing to docs and other things if needed.

Beta 16 broken

Trying to either load a SPIR-V resource or compile SPIR-V source in C# causes a crash in beta 16. I'll see if I can help fix this upstream, but beta 16 is probably unusable.

Image does no work with AtlasTextures and their Regions

The Image widget appears not working correctly when using AtlasTextures. It will display the whole AtlasTexture and not just the specified region of the AtlasTexture e.g. The whole TileSet is shown instead of the a single tile.

DPI scaling

Figure out which Godot scaling option(s) we can support.

https://docs.godotengine.org/en/latest/tutorials/rendering/multiple_resolutions.html

https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#q-how-should-i-handle-dpi-in-my-application

We need to save the full font configuration so it can be changed and reloaded if the scale changes. AddFont should just build a configuration, RebuildFontAtlas should actually load everything.

Stretch mode disabled is simple enough. We should optionally auto-detect "retina" displays, and have configurable scaling on top of that.

canvas_items may require a SubViewport to override the scaling and do our own custom scaling?
https://github.com/godotengine/godot-demo-projects/tree/4.0-dev/viewport/3d_scaling

Modify the code to compile without warrnings with "Nullable reference types: Enabled"

I like my projects to run with Nullable reference types: Enabled to allow me as a developer to notice obvious issues with nullable types.

Fixing 3-4 issues with the with lack of ? on some types, it shows 35 warrnings. I would love to have this fixed.

It doesn't break anything to use this in your project. It's just ignored when someone has this Disabled (as it is by default)

Example of the warning:

Project\addons\imgui-godot\ImGuiGodot\Internal\Fonts.cs(15,25): warning CS8618: Non-nullable property 'Font' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. 

Support mobile export

Discussed in #42

Originally posted by amroc-dev October 20, 2023
First off this is amazing and thanks so much for it. I recently tried an iOS export in the new Godot 4.2 beta that brings back (experimental) C#/iOS support and an error is thrown in XCode using this library, due to iOS disallowing code generation (I think it was Reflection.Emit specifically). I don't know much about the inner workings of imgui-godot but just thought I'd ask to see if there was a way around this. Thanks :)

ImGui rendering glitches on Godot 4.3/Vulkan Backend

image

Steps to reproduce: just directly open imgui-godot demo project with official Godot v4.3dev1, and with rendering method in project settings set to "forward_plus".
When rendering method is set to "compatibility", everything works well.

ImGui.NET 1.89.3 breaks fonts

The io.Fonts.Fonts data structure is not being correctly updated after adding a font. This is an upstream issue with the ImGui.NET NuGet package, just don't use 1.89.3.

Docking?

Docking doesn't seem to work

    public override void _Process(double delta)
    {
        base._Process(delta);
		if(ImGui.BeginMainMenuBar())
		{
			if (ImGui.BeginMenu("File" ))
			{
				if (ImGui.MenuItem("New"     )) EmitSignal(SignalName.FileNew);
				ImGui.Separator();
				if (ImGui.MenuItem("Open"    )) EmitSignal(SignalName.FileOpen);
				if (ImGui.MenuItem("Save"    )) EmitSignal(SignalName.FileSave);
				if (ImGui.MenuItem("SaveAs..")) EmitSignal(SignalName.FileSaveAs);
				ImGui.Separator();
				if (ImGui.MenuItem("Exit"    )) EmitSignal(SignalName.FileExit);
				ImGui.EndMenu();
			}
			if (ImGui.BeginMenu("Tools"))
			{
				if (ImGui.MenuItem("Screen" )) EmitSignal(SignalName.ToolsScreen);
				ImGui.EndMenu();
			}
			ImGui.EndMainMenuBar();

		}
		ImGui.DockSpaceOverViewport();
    }

Add widget for Godot viewports

Hello,

I'm currently using your plugin to create a level editor and I'm currently facing an issue with input processing.

I created a godot viewport to bind the texture to an imgui window, and it works perfectly fine.

Inside that godot viewport I have a meshInstance, with an Area node and a collisionshape, that allow to select the mesh with my mouse by using the signal input_event from godot.

The issue I'm facing is that your imguinode is stopping the input event propagation, to handle it directly with imgui.

I tried to recreate a new custom event that I forward to my viewport (after handling it through imgui), but that input event doesn't get to the collisionshape input_event.

Do you know how I could forward an input from imgui back to the collisionshape input_event?

Thanks in advance for your help.

ImGui Viewports: Main window stops responding to input

If a window is created as the mouse leaves the frame of the main window, and the “mouse button up” event isn’t received, then the main window will stop responding to all inputs.

Workaround

Drag the new window back into the main window. You may need to repeat this once or twice (drag it out, then back in).

Notes

This bug is easy to reproduce (depending on the input handling code), but it’s been frustratingly difficult to find the root cause, so I’m documenting it here.

All I know is that in this situation, the main window stops receiving window messages at all, and it’s not caused by WS_EX_NOACTIVATE or MA_NOACTIVATEANDEAT. Destroying the new window usually fixes it, at least temporarily.

I’ve been unable to make an MRP. I’m not entirely convinced it’s a Godot bug, but I also don’t know how my code or ImGui could break the main window like that.

TODO: Examine the following scenario

Reproduce the issue, then ctrl+tab to a window within the main window. This fixes the main window. Then click the new window, which breaks it again. This can be repeated. Ctrl+tab to the new window does not break it.

Vulkan errors with "Multi-Threaded" thread model

When using the "Multi-Threaded" thread model in Godot (4.0.3.stable), Vulkan fails to submit its graphics queue and fails to create the swapchain.

OS: Windows 11 22H2, build 22621.1702

Error messages:
E 0:00:09:0012 swap_buffers: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
<C++ Error> Condition "err" is true. Returning: ERR_CANT_CREATE
<C++ Source> drivers/vulkan/vulkan_context.cpp:2357 @ swap_buffers()

E 0:00:09:0013 prepare_buffers: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
<C++ Error> Condition "err != VK_SUCCESS" is true. Breaking.
<C++ Source> drivers/vulkan/vulkan_context.cpp:2280 @ prepare_buffers()

To reproduce, just try to use imgui-godot with the "Multi-Threaded" thread model.
(This appears to only happen sometimes, but should be reproduceable after a couple of restarts)

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.