nmwsharp / nmwsharp/polyscope

How to create submenus (or multiple command UIs)

Offen
#122 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C++
Sterne
2.2k
Forks
242
Ø Merge
11 Min.
Gemergte PRs (30 T.)
1

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem Command-UI-Callback und der im Issue gezeigten Verwendung von ImGui::InputInt und ImGui::Button. Ermittle, wie ein dauerhaft sichtbares Radius-Eingabefeld oder ein separates Untermenü über mehrere Callback-Aufrufe hinweg sichtbar bleiben könnte, und lege fest, welche Interaktion als abgeschlossen gelten soll; im Issue werden keine Dateien oder Tests genannt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
frontend
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.