ComputationalBiomechanicsLab / opensim-creator

A UI for building OpenSim models
https://opensimcreator.com
Apache License 2.0
141 stars 17 forks source link

Not able to hide the markerset in a model #738

Closed itbellix closed 6 months ago

itbellix commented 1 year ago

Hi @adamkewley, I am trying to hide markers in a model, but when selecting the whole markerset (or a single marker) in the Navigation panel, and right-clicking on it to "Hide" it this does not work and the marker remains there. image

I attach here the model that I am using, and will try now with another model too.

The same does not happen when trying to hide a body (like the head of the model). In that case, everything works smoothly.

itbellix commented 1 year ago

I confirm that the issue seems there also when using another model, and appears to be related to the visualization of the markers alone. Bodies, wrapping surfaces and muscles can be correctly hidden

adamkewley commented 1 year ago

Hi @itbellix

The visualization of markers is dictated by a special OpenSim flag that is treated separately from the right-click menu (which operates by manipulating any Appearance properties it can find).

To toggle those special flags, there is a row of buttons in the top menu bar of the UI:

Screenshot 2023-07-18 101208

The fact they are separate is annoying, though, and I'll keep this ticket open in case I can maybe do something like detect "if the user specifically right-clicks the markerset then have a special rule where it toggles the flag rather than the appearance"

itbellix commented 1 year ago

Hi @adamkewley, I see thank you for explaining. It might be better then to disable all the "Display" options for the markers then? Also, I think that the same options are present in OpenSim, and there they normally work also for the markers (apart from the fact that sometimes they stop working randomly, maybe because of the fact that deep down there are separate threads as you mentioned above...)

adamkewley commented 1 year ago

It might be better then to disable all the "Display" options for the markers then?

Agreed. The main reason I didn't do this is because it requires walking over the entire tree from where the user clicked (e.g. the entire model, a markerset, a forceset) and asking every single component "can you be toggled for visibility". I didn't implement it just in case it would mean that rendering the context menu would then become surprisingly expensive in order to grey out a button or similar.


Also, I think that the same options are present in OpenSim, and there they normally work also for the markers (apart from the fact that sometimes they stop working randomly, maybe because of the fact that deep down there are separate threads as you mentioned above...)

I have just investigated how OpenSim GUI is doing it, so that I can understand what OSC's options are. Effectively:

Effectively, it is able to show/hide components by directly telling a 3D visualizer to toggle the visibility of a piece of 3D geometry in the scene. Works fine, but has the drawback that the "state" being manipulated is held inside one visualizer (OSC needs to support multiple visualizers) and that the state isn't part of the model (so undo/redo will be broken). Also, the state change is initiated as a command with no flags for tracking it, which means that I imagine the visualization toggles will be forgotten if the visualizer ever needs to reboot.

I imagine OSC's implementation will require adding those toggles as state on the model, because I would want toggles to propagate between visualizers, be undo/redo friendly, etc. - the current approach isn't as powerful but it works "consistiently" (as in, once you know the behavior it will always behave the same way)

itbellix commented 1 year ago

I see, thank you for the clarifications!

adamkewley commented 6 months ago

Closing this because, although it's confusing, it's somewhat baked into the cake (OpenSim) and cannot be changed without OSC having to contain a lot of custom hacks - sorry @itbellix