Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix load issue with scale tool #3110

Merged
merged 2 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This is not a comprehensive list of changes but rather a hand-curated collection
v4.4
====
- Updated ezc3d to version 1.4.6 which better manage the events defined in a c3d file.
- Fixed an issue that could happen sometimes with ScaleTool where loading the model file or marker set file could fail if the file was given as an absolute path (Issue #3109, PR #3110)

v4.3
====
Expand Down
8 changes: 6 additions & 2 deletions OpenSim/Tools/GenericModelMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,17 @@ Model* GenericModelMaker::processModel(const string& aPathToSubject) const

try
{
model = new Model(aPathToSubject + _fileName);
std::string modelPath =
SimTK::Pathname::getAbsolutePathnameUsingSpecifiedWorkingDirectory(aPathToSubject, _fileName);
model = new Model(modelPath);
model->initSystem();

if (!_markerSetFileNameProp.getValueIsDefault() && _markerSetFileName !="Unassigned") {
log_info("Loading marker set from '{}'.",
aPathToSubject + _markerSetFileName);
MarkerSet *markerSet = new MarkerSet(aPathToSubject + _markerSetFileName);
std::string markerSetPath =
SimTK::Pathname::getAbsolutePathnameUsingSpecifiedWorkingDirectory(aPathToSubject, _markerSetFileName);
MarkerSet *markerSet = new MarkerSet(markerSetPath);
model->updateMarkerSet(*markerSet);
}
}
Expand Down
7 changes: 5 additions & 2 deletions OpenSim/Tools/ScaleTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,11 @@ Model* ScaleTool::createModel() const
Model *model = getGenericModelMaker().processModel(_pathToSubject);
if (!model)
{
log_error("Unable to load generic model at path {}.",
_pathToSubject);
// processModel() attempts to load both the model and market set
// file. _pathToSubject might be misleading of model path was
// given as an aboslute path in the setup file, so it was
// removed from this error message.
log_error("Unable to load the generic model or marker set file.");
return 0;
}
else {
Expand Down