opensim-gui
opensim-gui copied to clipboard
Loading and saving over an "empty" scale file leads to another "empty" file
Steps to reproduce
- Load ThoracoscapularShoulderModel.osim (attached)
- Open Scale tool and load setup_scaling.xml (attached)
- Choose static_upper.trc (attached)
- Save setup file over setup_scaling.xml
Expected result
The setup_scaling.xml file is not "empty"
Actual result
File is "empty" (and unchanged)
Environment and GUI version
Win 10, OpenSim 4.2-2021-01-09-fc62aad
Seems like a rather corner case but worth understanding why it happens
This is a fundamental issue with the use of old style nested Object properties where changes are not propagated upstream, instead there's a separate flag ValueIsDefault. If you have code working with an Object that is bound to a property and the object changes, the Property doesn't know about the change and is never written. This is most relevant to ScaleTool since it is an aggregate of two old style properties. Some possible solutions:
- Have GUI mark the properties as dirty to force writing but this can introduce clutter.
- Override print method to recursively "check" if values are different from default (more surgical but less clutter).
- Retire old Deprecated Properties 👿