Added snapping

This commit is contained in:
Antoine Pilote
2024-08-27 14:07:04 -04:00
parent 64ef0b7f94
commit ddeafd7bfa
2 changed files with 52 additions and 1 deletions

View File

@@ -264,7 +264,8 @@ namespace Nuake {
glm::value_ptr(cameraView),
glm::value_ptr(cameraProjection),
CurrentOperation, CurrentMode,
glm::value_ptr(transform)
glm::value_ptr(transform), NULL,
UseSnapping ? &CurrentSnapping.x : NULL
);
if (ImGuizmo::IsUsing())
@@ -2427,6 +2428,54 @@ namespace Nuake {
ImGui::PopStyleColor();
}
ImGui::SameLine();
selectedMode = CurrentMode == ImGuizmo::MODE::WORLD;
if (selectedMode)
{
Color color = Engine::GetProject()->Settings.PrimaryColor;
ImGui::PushStyleColor(ImGuiCol_Button, { color.r, color.g, color.b, 1.0f });
}
if (ImGui::Button(ICON_FA_GLOBE, ImVec2(30, 28)))
{
CurrentMode = ImGuizmo::MODE::WORLD;
}
if (selectedMode)
{
ImGui::PopStyleColor();
}
ImGui::SameLine();
selectedMode = CurrentMode == ImGuizmo::MODE::LOCAL;
if (selectedMode)
{
Color color = Engine::GetProject()->Settings.PrimaryColor;
ImGui::PushStyleColor(ImGuiCol_Button, { color.r, color.g, color.b, 1.0f });
}
if (ImGui::Button(ICON_FA_CUBE, ImVec2(30, 28)))
{
CurrentMode = ImGuizmo::MODE::LOCAL;
}
if (selectedMode)
{
ImGui::PopStyleColor();
}
ImGui::SameLine();
ImGui::Checkbox("Snapping", &UseSnapping);
if (UseSnapping)
{
ImGui::SameLine();
ImGui::DragFloat("##snapping", &CurrentSnapping.x, 0.01f, 0.0f, 100.0f);
}
ImGui::PopStyleVar();
ImGui::PopStyleVar();
ImGui::PopStyleColor();