Skip to content

Commit

Permalink
Fix toggling ContactGeometry::Appearance::is_visible has no effect (#…
Browse files Browse the repository at this point in the history
…3993)

* Fix toggling ContactGeometry::Appearance::is_visible has no effect

- downstream: ComputationalBiomechanicsLab/opensim-creator#980

* Update CHANGELOG.md (#3993)
  • Loading branch information
adamkewley authored Jan 21, 2025
1 parent b4ba7ca commit efcbc48
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ v4.6
- Replace usages of `OpenSim::make_unique` with `std::make_unique` and remove wrapper function now that C++14 is used in OpenSim (#3979).
- Add utility method `createVectorLinspaceInterval` for the `std::vector` type and add unit tests. Utilize the new utility method to fix a bug (#3976) in creating the uniformly sampled time interval from the experimental data sampling frequency in `APDMDataReader` and `XsensDataReader` (#3977).
- Fix Point Kinematics Reporter variable and initialization error and add unit tests (#3966)

- `OpenSim::ContactHalfSpace`, `OpenSim::ContactMesh`, and `OpenSim::ContactSphere` now check their associated `Appearance`'s `is_visible` flag when deciding whether to emit their associated decorations (#3993).

v4.5.1
======
Expand Down
7 changes: 6 additions & 1 deletion OpenSim/Simulation/Model/ContactHalfSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ void ContactHalfSpace::generateDecorations(bool fixed, const ModelDisplayHints&
// There is no fixed geometry to generate here.
if (fixed) { return; }

if (!hints.get_show_contact_geometry()) return;
// Model-wide hints indicate that contact geometry shouldn't be shown.
if (!hints.get_show_contact_geometry()) { return; }

// The decoration has been toggled off by its `Appearance` block.
if (!get_Appearance().get_visible()) { return; }

// B: base Frame (Body or Ground)
// F: PhysicalFrame that this ContactGeometry is connected to
// P: the frame defined (relative to F) by the location and orientation
Expand Down
10 changes: 8 additions & 2 deletions OpenSim/Simulation/Model/ContactMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,15 @@ void ContactMesh::generateDecorations(bool fixed, const ModelDisplayHints& hints
// There is no fixed geometry to generate here.
if (fixed) { return; }

// Model-wide hints indicate that contact geometry shouldn't be shown.
if (!hints.get_show_contact_geometry()) { return; }

// The decoration has been toggled off by its `Appearance` block.
if (!get_Appearance().get_visible()) { return; }

// Guard against the case where the Force was disabled or mesh failed to load.
if (_decorativeGeometry == nullptr) return;
if (!hints.get_show_contact_geometry()) return;
if (_decorativeGeometry == nullptr) { return; }

// B: base Frame (Body or Ground)
// F: PhysicalFrame that this ContactGeometry is connected to
// P: the frame defined (relative to F) by the location and orientation
Expand Down
7 changes: 6 additions & 1 deletion OpenSim/Simulation/Model/ContactSphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ void ContactSphere::generateDecorations(bool fixed, const ModelDisplayHints& hin
// There is no fixed geometry to generate here.
if (fixed) { return; }

if (!hints.get_show_contact_geometry()) return;
// Model-wide hints indicate that contact geometry shouldn't be shown.
if (!hints.get_show_contact_geometry()) { return; }

// The decoration has been toggled off by its `Appearance` block.
if (!get_Appearance().get_visible()) { return; }

// B: base Frame (Body or Ground)
// F: PhysicalFrame that this ContactGeometry is connected to
// P: the frame defined (relative to F) by the location and orientation
Expand Down

0 comments on commit efcbc48

Please sign in to comment.