ComputationalBiomechanicsLab / opensim-creator

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

Fatal error when trying to add markers to model #800

Closed AdrianHendrik closed 11 months ago

AdrianHendrik commented 11 months ago

When I tried to add marker to an existing model I get an fatal error message and the model viewer closes. Note that this happens as soon as I click on the 'Add->Component->Marker' button. There is no window that opens where I can specify the properties of the marker component. I am able to add other components to the model just fine.

The log outputs the following: [error] an std::exception was thrown while drawing the model editor editor [error] message = Socket parent_frame of type PhysicalFrame in / of type Marker is not connected. Thrown at Component.h:3339 in getConnectee(). [error] exceptions typically happen when the model is damaged or made invalid by an edit (e.g. setting a property to an invalid value) [error] attempting to rollback the model edit to a clean state [error] model rollback succeeded [error] an std::exception was thrown while drawing the model editor editor [error] message = Socket parent_frame of type PhysicalFrame in / of type Marker is not connected. Thrown at Component.h:3339 in getConnectee(). [error] exceptions typically happen when the model is damaged or made invalid by an edit (e.g. setting a property to an invalid value) [error] because the model isn't recoverable, closing the editor tab

Is this due to OSC or is somehting wrong with the model?

adamkewley commented 11 months ago

Hi @AdrianHendrik

It looks like a bug where OpenSim requires the marker to be initialized in a particular way - many of the components in Add > Components(uncategorized) work this way.

I'll try and hotfix it in OSC and push a patch for you

adamkewley commented 11 months ago

Hi @AdrianHendrik ,

I believe I've fixed this now, just waiting on CI etc. to confirm.

While I was in the area, I also added automated tests for opening each popup automatically and verifying a crash like this can't happen in the future (hopefully).

The source of the crash is that OSC added support for editing spatial quantities w.r.t. some other frame in the model. In this case, the thing being added isn't in the model (yet), so the message being shown is because the UI is trying to get something that isn't logically possible (a parent frame of an object that isn't in the model) - this one wasn't OpenSim's fault, my mischaracterization!

adamkewley commented 11 months ago

This is building + working, but the tests fail on Windows because GitHub's CI computer can't render 3D graphics (and the test suite involves simulating a user clicking each add option etc so, naturally, they're asking for a renderer).

adamkewley commented 11 months ago

This is now fixed, merged, and will be shipped as part of 0.5.4 later today - thanks again @AdrianHendrik !