opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
783 stars 316 forks source link

Fix PathSpring overwriting any user-set appearance for its GeometryPath #3668

Closed adamkewley closed 8 months ago

adamkewley commented 8 months ago

Fixes issue: https://github.com/ComputationalBiomechanicsLab/opensim-creator/issues/818

Minor nit noticed by a user who's making a model containing path springs: if you change the Appearance of the path spring's GeometryPath it has no effect.

The reason why this is a bug is because finalizeFromProperties is called after properties are updated (e.g. from loading an XML file or editing in OpenSim GUI or OpenSim Creator) - the existing implementation will then unconditionally overwrite the color of the pathspring with green.

The fix instead sets the default in the constructor, which is usually called before properties are updated (e.g. when the object is loaded from an XML file it effectively sets properties on an already-constructed prototype).

Brief summary of changes

Testing I've completed

I hotfixed it into an OSC build and it now correctly shows a green spring unless the user specifies a different color in the XML file.

Looking for feedback on...

CHANGELOG.md (choose one)


This change is Reviewable