Update geometry from UI parameter
I have this UI callback to control how a mesh is generated but changing it in the UI doesn't affect the mesh in the viewport. What am I missing? I can't find any documentation about this. Thanks.
int sides = 6;
void UICallback()
{
bool changed = ImGui::InputInt("Sides", &sides);
}
// In main:
polyscope::init();
polyscope::state::userCallback = UICallback;
polyscope::show();
Hi!
How is this sides variable being used in your full code? If you are updating the scene geometry somehow, you need to re-send that updated geometry to Polyscope.
The usual workflow would be something like (1) get a new value for the sides parameter, (2) run some of your own code to update/regenerate the scene content, and (3) send that updated to content with polyscope_mesh->updateVertexPositions() or a new polyscope::registerSurfaceMesh() or something like that. All of these (1), (2), (3) would be called inside of your UI callback function (perhaps only if changed=true).