CedricGuillemet / ImGuizmo

Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui
MIT License
3.22k stars 907 forks source link

Alternative active window ID/handle #333

Closed RedSkittleFox closed 1 month ago

RedSkittleFox commented 2 months ago

The function IsHoveringWindow would always return false, partially because I was using imguizmo inside another window that had IO for camera controls. I propose the change to add an alternative window handle / id that the IsHoveringWindow function would accept as valid.

I propose adding a following variable and check to the IsHoveringWidnow to allow users to embed imguizmos inside their own windows.

https://github.com/RedSkittleFox/ImGuizmo/blob/ce1092a924505eb561ce35132fcf9096137a35bf/ImGuizmo.h#L221

https://github.com/RedSkittleFox/ImGuizmo/blob/ce1092a924505eb561ce35132fcf9096137a35bf/ImGuizmo.cpp#L927C16-L941C1

maritim commented 1 month ago

Hello @RedSkittleFox!

I've identified the problem as well and mentioned it in issue #327. I've provided more details there regarding this situation you presented, and I proposed a similar approach.

From what I can tell, using the ImGuizmo library with ImGui's docking branch has some problems and incompatibilities. The situation is that the owner of this library has never been particularly interested in ensuring compatibility with this branch, even though it has recently become very widely used. Additionally, as I understand it, the plan for ImGui is to adopt the docking branch directly into the master.

@CedricGuillemet , could you take a look at this situation, please? Thank you!

CedricGuillemet commented 1 month ago

yes, it's been a while since the last update. I'll take care of that this weekend.

CedricGuillemet commented 1 month ago

@RedSkittleFox Can you please do a PR? Can this feature be tested in the testApp with 2 windows, without the docking branch?

RedSkittleFox commented 1 month ago

Yes, here is the PR. I have not tested it with 2 windows. I can do it later today (in about 10 hours). https://github.com/CedricGuillemet/ImGuizmo/pull/335

CedricGuillemet commented 1 month ago

Should be fixed now. Closing.