Gui: Avoid unnecessary exception in View3DSettings::OnChange.

This gets caught in the debugger at startup, in this case its easy to
avoid it.
This commit is contained in:
Joao Matos
2024-12-28 20:46:56 +00:00
committed by Chris Hennes
parent dfee5d60c4
commit 23ccb75e58

View File

@@ -129,9 +129,11 @@ void View3DSettings::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
else if (strcmp(Reason,"HeadlightDirection") == 0) {
try {
std::string pos = rGrp.GetASCII("HeadlightDirection");
Base::Vector3f dir = Base::to_vector(pos);
for (auto _viewer : _viewers) {
_viewer->getHeadlight()->direction.setValue(dir.x, dir.y, dir.z);
if (!pos.empty()) {
Base::Vector3f dir = Base::to_vector(pos);
for (auto _viewer : _viewers) {
_viewer->getHeadlight()->direction.setValue(dir.x, dir.y, dir.z);
}
}
}
catch (const std::exception&) {
@@ -161,9 +163,11 @@ void View3DSettings::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
else if (strcmp(Reason,"BacklightDirection") == 0) {
try {
std::string pos = rGrp.GetASCII("BacklightDirection");
Base::Vector3f dir = Base::to_vector(pos);
for (auto _viewer : _viewers) {
_viewer->getBacklight()->direction.setValue(dir.x, dir.y, dir.z);
if (!pos.empty()) {
Base::Vector3f dir = Base::to_vector(pos);
for (auto _viewer : _viewers) {
_viewer->getBacklight()->direction.setValue(dir.x, dir.y, dir.z);
}
}
}
catch (const std::exception&) {