Recast: left panel UX improvements

Make it slightly larger (20 units) and make the sliders wider as well.
This commit is contained in:
Kawe Mazidjatari 2024-09-22 14:28:34 +02:00
parent 5f3abdb656
commit feaca14e8a
7 changed files with 20 additions and 28 deletions

View File

@ -929,7 +929,7 @@ void CrowdTool::handleMenu()
if (ImGui::Checkbox("Obstacle Avoidance", &params->m_obstacleAvoidance))
m_state->updateAgentParams();
ImGui::PushItemWidth(90.f);
ImGui::PushItemWidth(120.f);
if (ImGui::SliderInt("Avoidance Quality", &params->m_obstacleAvoidanceType, 0, 3))
{
m_state->updateAgentParams();
@ -1093,36 +1093,36 @@ void CrowdTool::handleRenderOverlay(double* proj, double* model, int* view)
if (m_mode == TOOLMODE_CREATE)
{
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, ty), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: add agent. Shift+LMB: remove agent.");
ImVec2(300, ty), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: add agent. Shift+LMB: remove agent.");
}
else if (m_mode == TOOLMODE_MOVE_TARGET)
{
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, ty), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: set move target. Shift+LMB: adjust set velocity.");
ImVec2(300, ty), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: set move target. Shift+LMB: adjust set velocity.");
ty += 20;
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, ty), ImVec4(1.0f,1.0f,1.0f,0.75f), "Setting velocity will move the agents without pathfinder.");
ImVec2(300, ty), ImVec4(1.0f,1.0f,1.0f,0.75f), "Setting velocity will move the agents without pathfinder.");
}
else if (m_mode == TOOLMODE_SELECT)
{
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, ty), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: select agent.");
ImVec2(300, ty), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: select agent.");
}
ty += 20.f;
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, ty), ImVec4(1.0f,1.0f,1.0f,0.75f), "SPACE: Run/Pause simulation. 1: Step simulation.");
ImVec2(300, ty), ImVec4(1.0f,1.0f,1.0f,0.75f), "SPACE: Run/Pause simulation. 1: Step simulation.");
ty += 20.f;
if (m_state && m_state->isRunning())
{
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, ty), ImVec4(0.15f,1.0f,0.05f,0.8f), "- RUNNING -");
ImVec2(300, ty), ImVec4(0.15f,1.0f,0.05f,0.8f), "- RUNNING -");
}
else
{
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, ty), ImVec4(1.0f,0.15f,0.05f,0.8f), "- PAUSED -");
ImVec2(300, ty), ImVec4(1.0f,0.15f,0.05f,0.8f), "- PAUSED -");
}
}

View File

@ -186,7 +186,7 @@ public:
ImGui::PopItemWidth();
}
ImGui::PushItemWidth(180);
ImGui::PushItemWidth(185);
ImGui::SliderFloat3("Cursor", m_hitPos, MIN_COORD_FLOAT, MAX_COORD_FLOAT);
ImGui::PopItemWidth();
@ -427,7 +427,7 @@ public:
}
// Tool help
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft, ImVec2(280, 40),
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft, ImVec2(300, 40),
ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: Rebuild hit tile. Shift+LMB: Clear hit tile.");
}

View File

@ -362,5 +362,5 @@ void NavMeshPruneTool::handleRenderOverlay(double* proj, double* model, int* vie
rdIgnoreUnused(view);
// Tool help
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft, ImVec2(280, 40), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: Click fill area.");
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft, ImVec2(300, 40), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: Click fill area.");
}

View File

@ -1413,7 +1413,7 @@ void NavMeshTesterTool::handleRenderOverlay(double* proj, double* model, int* vi
}
// Tool help
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft, ImVec2(280, 40),
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft, ImVec2(300, 40),
ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB+SHIFT: Set start location LMB: Set end location");
}

View File

@ -190,11 +190,11 @@ void OffMeshConnectionTool::handleRenderOverlay(double* proj, double* model, int
if (!m_hitPosSet)
{
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, 40), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: Create new connection. SHIFT+LMB: Delete existing connection, click close to start or end point.");
ImVec2(300, 40), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: Create new connection. SHIFT+LMB: Delete existing connection, click close to start or end point.");
}
else
{
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, 40), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: Set connection end point and finish.");
ImVec2(300, 40), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: Set connection end point and finish.");
}
}

View File

@ -152,8 +152,6 @@ void ShapeVolumeTool::handleMenu()
ImGui::EndCombo();
}
ImGui::PushItemWidth(120.f);
switch (m_selectedPrimitive)
{
case VOLUME_BOX:
@ -171,8 +169,6 @@ void ShapeVolumeTool::handleMenu()
break;
}
ImGui::PopItemWidth();
if ((m_npts || m_nhull) && ImGui::Button("Clear Shape##ShapeVolumeCreate"))
{
m_npts = 0;
@ -225,8 +221,6 @@ void ShapeVolumeTool::handleMenu()
vol.flags = (unsigned short)flags;
}
ImGui::PushItemWidth(120.f);
switch (vol.type)
{
case VOLUME_BOX:
@ -279,7 +273,7 @@ void ShapeVolumeTool::handleMenu()
break;
}
ImGui::PushItemWidth(55);
ImGui::PushItemWidth(60);
ImGui::SliderFloat(sliderId, &vol.verts[(i*3)+0], m_shapeCopy.verts[(i*3)+0]-4000, m_shapeCopy.verts[(i*3)+0]+4000);
ImGui::SameLine();
sliderId[len] = 'Y';
@ -304,8 +298,6 @@ void ShapeVolumeTool::handleMenu()
return;
}
ImGui::PopItemWidth();
}
void ShapeVolumeTool::handleClick(const float* /*s*/, const float* p, const int v, bool shift)
@ -464,11 +456,11 @@ void ShapeVolumeTool::handleRenderOverlay(double* /*proj*/, double* /*model*/, i
if (!m_npts)
{
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, 40), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: Create new shape. SHIFT+LMB: Delete existing shape (click on a shape).");
ImVec2(300, 40), ImVec4(1.0f,1.0f,1.0f,0.75f), "LMB: Create new shape. SHIFT+LMB: Delete existing shape (click on a shape).");
}
else
{
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, 60), ImVec4(1.0f,1.0f,1.0f,0.75f), "The shape will be convex hull of all added points.");
ImVec2(300, 60), ImVec4(1.0f,1.0f,1.0f,0.75f), "The shape will be convex hull of all added points.");
}
}

View File

@ -951,7 +951,7 @@ int not_main(int argc, char** argv)
if (showMenu)
{
ImGui_RenderText(ImGuiTextAlign_e::kAlignLeft,
ImVec2(280, 20), ImVec4(1.0f,1.0f,1.0f,0.5f), "W/S/A/D: Move RMB: Rotate");
ImVec2(300, 20), ImVec4(1.0f,1.0f,1.0f,0.5f), "W/S/A/D: Move RMB: Rotate");
}
string geom_path;
@ -1294,8 +1294,8 @@ int not_main(int argc, char** argv)
if (!showTestCases && showTools && showMenu) // && geom && editor)
{
ImGui::SetNextWindowPos(ImVec2(10.f, 10.f), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(260, (float)height-20), ImGuiCond_Once);
ImGui::SetNextWindowSizeConstraints(ImVec2(260, 300), ImVec2(FLT_MAX, FLT_MAX));
ImGui::SetNextWindowSize(ImVec2(280, (float)height-20), ImGuiCond_Once);
ImGui::SetNextWindowSizeConstraints(ImVec2(280, 300), ImVec2(FLT_MAX, FLT_MAX));
if (ImGui::Begin("Tools", nullptr, baseWindowFlags))
{