nmwsharp / nmwsharp/polyscope

How to create submenus (or multiple command UIs)

Open
#122 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.2k
Forks
242
Avg merge
11m
Merged PRs (30d)
1

Description

I have some UI

submenu

Everything into the Command UI is a Imgui::Button inside the callback

    ImGui::InputInt("Radius", &radius);

    ImGui::SameLine();

    //
    // Button
    if (ImGui::Button("Max Curvature"))
    {
        // get mesh
        polyscope::registerSurfaceMesh("mesh", V, F);
        
        // Compute curvature directions via quadric fitting
        MatrixXd PD1, PD2;
        VectorXd PV1, PV2;
        std::vector<Index> bv = {};
        
        igl::principal_curvature(V, F, PD1, PD2, PV1, PV2, bv, radius);
        
        polyscope::getSurfaceMesh("mesh")
            ->addVertexScalarQuantity("Max Curvature", PV1,
                                      polyscope::DataType::SYMMETRIC);
        
    }

pretty standard. Now I'd like to add the "radius" input inside the button scope, so that when I press the button all the relevant data is presented to the user.
Of course, if I simply put the input widget code inside the button one the input widget is just show for an instant then deleted, as the callback runs over and over.
The best option would be to create a separate sub-UI, possibly opening down below the command UI itself. Or to create multiple command UIs.
Is there a way?
Thank you

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Command UI callback and the ImGui::InputInt and ImGui::Button usage shown in the issue. Determine how a persistent radius input or separate submenu could remain visible across callback invocations, and define the interaction that should count as done; the issue names no files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.