Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gizmos rendered over ButtonBehavior are not responding to input #281

Open
Silveryard opened this issue Dec 19, 2022 · 0 comments
Open

Gizmos rendered over ButtonBehavior are not responding to input #281

Silveryard opened this issue Dec 19, 2022 · 0 comments

Comments

@Silveryard
Copy link

Hi,

I encountered a small problem regarding mouse input when rendering manipluate gizmos over other UI elements that react to mouse input.

Screenshot 2022-12-19 170259

I am rendering an invisible ButtonBehavior over the scene view to capture mouse inputs for things like object picking and camera movement. The overlay buttons in the top left are still working correctly (due to ImGuiButtonFlags_AllowItemOverlap) but the manipulate gizmos are not. When the ButtonBehavior is present they only react correctly when hovering them but you cannot actually manipulate the object.

const ImRect textureRect = ImGui::GetCurrentWindow()->InnerClipRect;
ImGui::GetBackgroundDrawList()->AddImage(textureId, textureRect.Min, textureRect.Max);

const ImRect rect = ImGui::GetCurrentWindow()->InnerClipRect;
const ImGuiID id = ImGui::GetCurrentWindow()->GetID("SceneViewButton");
ImGui::ItemAdd(rect, id);
ImGui::ButtonBehavior(rect, id, nullptr, nullptr, ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_MouseButtonMask_);
ImGui::SetItemAllowOverlap();
                
ImGuizmo::SetDrawlist();

const glm::uvec2 position = EditorGui::GetWindowPosition();
const glm::uvec2 size = EditorGui::GetWindowSize();
ImGuizmo::SetRect(static_cast<float>(position.x), static_cast<float>(position.y), 
                    static_cast<float>(size.x), static_cast<float>(size.y));

//ImGuizmo::Manipulate calls follow here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant