From 4414042b8fb6bf33f9772745d95a86aa9eb4b29d Mon Sep 17 00:00:00 2001 From: Ladislav Michl Date: Wed, 30 Apr 2025 20:13:35 +0200 Subject: [PATCH] Gui: fix warning in NavigationStyle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warning: suggest braces around empty body in an ‘if’ statement. While there also guard similar debug messages instead of commenting them out. Fixes: 8d2cb99712c7 ("Gui: Added classic trackball orbit style") --- src/Gui/Navigation/NavigationStyle.cpp | 40 ++++++++++++++------------ 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/Gui/Navigation/NavigationStyle.cpp b/src/Gui/Navigation/NavigationStyle.cpp index d0c81e3a60..38f170877c 100644 --- a/src/Gui/Navigation/NavigationStyle.cpp +++ b/src/Gui/Navigation/NavigationStyle.cpp @@ -117,20 +117,18 @@ public: // drop the sphere intersection onto the tolerance plane SbLine projectLine(sphereIntersection, sphereIntersection + planeDir); - if (!tolPlane.intersect(projectLine, planeIntersection)) -#ifdef DEBUG + if (!tolPlane.intersect(projectLine, planeIntersection)) { +#ifdef FC_DEBUG SoDebugError::post("SbSphereSheetProjector::project", "Couldn't intersect working line with plane"); -#else - /* Do nothing */; +#endif + } + } + else if (!tolPlane.intersect(workingLine, planeIntersection)) { +#ifdef FC_DEBUG + SoDebugError::post("SbSphereSheetProjector::project", "Couldn't intersect with plane"); #endif } - else if (!tolPlane.intersect(workingLine, planeIntersection)) -#ifdef DEBUG - SoDebugError::post("SbSphereSheetProjector::project", "Couldn't intersect with plane"); -#else - /* Do nothing */; -#endif // Three possibilities: // (1) Intersection is on the sphere inside where the fillet @@ -813,13 +811,16 @@ void NavigationStyle::zoom(SoCamera * cam, float diffvalue) // frustum (similar to glFrustum()) if (!t.isDerivedFrom(SoPerspectiveCamera::getClassTypeId()) && tname != "FrustumCamera") { - /* static SbBool first = true; - if (first) { - SoDebugError::postWarning("SoGuiFullViewerP::zoom", - "Unknown camera type, " - "will zoom by moving position, but this might not be correct."); - first = false; - }*/ +#ifdef FC_DEBUG + static SbBool first = true; + if (first) { + SoDebugError::postWarning("NavigationStyle::zoom", + "Unknown camera type, " + "will zoom by moving position, " + "but this might not be correct."); + first = false; + } +#endif } const float oldfocaldist = cam->focalDistance.getValue(); @@ -1719,8 +1720,9 @@ void NavigationStyle::syncWithEvent(const SoEvent * const ev) auto const event = static_cast(ev); const int button = event->getButton(); const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false; - - // SoDebugError::postInfo("processSoEvent", "button = %d", button); +#ifdef FC_DEBUG + SoDebugError::postInfo("processSoEvent", "button = %d", button); +#endif switch (button) { case SoMouseButtonEvent::BUTTON1: this->button1down = press;