Closed jjiangweilan closed 1 year ago
Yes, I have been having the same problem.
I think it's doable by calling clip method on the drawlist at this place : https://github.com/CedricGuillemet/ImGuizmo/blob/93dd6aee3a3a1b296fde738ba28a4198fc45072c/ImGuizmo.cpp#L2524
@jjiangweilan, thanks to the suggestion from @CedricGuillemet, I was able to fix this like so:
First, draw your "Game Scene" window, whilst saving its corresponding draw list:
// Create scene view tab
if (ImGui::Begin("Scene View", nullptr))
{
sceneDrawList = ImGui::GetWindowDrawList();
// Draw rendered scene texture
}
Then, you need to apply the clipping to the draw list you have saved from the "Game View". You can do this easily:
ImGuizmo::SetDrawlist(sceneDrawList);
sceneDrawList->PushClipRect(
// Bottom-left X and Y coordinates of your "Game Scene"
{ ImGuiCore::GetSceneViewPositionX(), ImGuiCore::GetSceneViewPositionY() },
// The X and Y coordinates you just passed, added with the width and height of the window
{ ImGuiCore::GetSceneViewPositionX() + ImGuiCore::GetSceneViewWidth(), ImGuiCore::GetSceneViewPositionY() + ImGuiCore::GetSceneViewHeight() }
);
thanks, I will give it a try
I want to clip the gizmos so that it won't go out of bounds of the red rectangle which is the rect set to ImGuizmo::SetRect. Is it possible?