Skip to content

Commit ffd5ead

Browse files
authored
Handle setting controls file to blank in tools more intuitively (#4058)
1 parent fb5fac1 commit ffd5ead

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

OpenSim/Simulation/Model/AbstractTool.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ std::string AbstractTool::getControlsFileName() const
728728
*/
729729
void AbstractTool::setControlsFileName(const std::string& controlsFilename)
730730
{
731-
if (controlsFilename=="" || controlsFilename=="Unassigned") return;
731+
bool disableControlSetController = (controlsFilename=="" || controlsFilename=="Unassigned");
732732

733733
int numControllers = _controllerSet.getSize();
734734

@@ -738,8 +738,11 @@ void AbstractTool::setControlsFileName(const std::string& controlsFilename)
738738
continue;
739739
OpenSim::ControlSetController& dController = (OpenSim::ControlSetController&)_controllerSet[i];
740740
dController.setControlSetFileName(controlsFilename);
741+
if (disableControlSetController)
742+
dController.setEnabled(false);
741743
return;
742744
}
745+
if (disableControlSetController) return;
743746
// Create a new controlsetController and add it to the tool
744747
ControlSetController* csc = new ControlSetController();
745748
csc->setControlSetFileName(controlsFilename);

0 commit comments

Comments
 (0)