diff --git a/src/Gui/3Dconnexion/GuiNativeEventWin32.cpp b/src/Gui/3Dconnexion/GuiNativeEventWin32.cpp index 24726546be..02012ec989 100644 --- a/src/Gui/3Dconnexion/GuiNativeEventWin32.cpp +++ b/src/Gui/3Dconnexion/GuiNativeEventWin32.cpp @@ -327,7 +327,8 @@ unsigned short HidToVirtualKey(unsigned long pid, unsigned short hidKeyCode) bool Gui::GuiNativeEvent::RawInputEventFilter(void* msg, long* result) { - if (gMouseInput == 0) return false; + if (gMouseInput == 0) + return false; MSG* message = (MSG*)(msg); @@ -438,7 +439,8 @@ bool Gui::GuiNativeEvent::Is3dmouseAttached() return false; } - if (nDevices == 0) return false; + if (nDevices == 0) + return false; std::vector rawInputDeviceList(nDevices); if (::GetRawInputDeviceList(&rawInputDeviceList[0], &nDevices, sizeof(RAWINPUTDEVICELIST)) == static_cast(-1)) { @@ -479,12 +481,14 @@ bool Gui::GuiNativeEvent::InitializeRawInput(HWND hwndTarget) fWindow = hwndTarget; // Simply fail if there is no window - if (!hwndTarget) return false; + if (!hwndTarget) + return false; unsigned int numDevices = 0; PRAWINPUTDEVICE devicesToRegister = GetDevicesToRegister(&numDevices); - if (numDevices == 0) return false; + if (numDevices == 0) + return false; // Get OS version. OSVERSIONINFO osvi = {sizeof(OSVERSIONINFO),0}; @@ -753,7 +757,8 @@ bool Gui::GuiNativeEvent::TranslateRawInputData(UINT nInputCode, PRAWINPUT pRawI qDebug("Rawinput.header.dwType=0x%x\n", pRawInput->header.dwType); #endif // We are not interested in keyboard or mouse data received via raw input - if (pRawInput->header.dwType != RIM_TYPEHID) return false; + if (pRawInput->header.dwType != RIM_TYPEHID) + return false; #if _TRACE_RIDI_DEVICENAME UINT dwSize=0; diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 2fb742be05..dbfe69dc90 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -2438,7 +2438,8 @@ void Application::checkForPreviousCrashes() } App::Document *Application::reopen(App::Document *doc) { - if(!doc) return nullptr; + if(!doc) + return nullptr; std::string name = doc->FileName.getValue(); std::set untouchedDocs; for(auto &v : d->documents) { diff --git a/src/Gui/BlenderNavigationStyle.cpp b/src/Gui/BlenderNavigationStyle.cpp index 6a5ef070b6..ccccc0d008 100644 --- a/src/Gui/BlenderNavigationStyle.cpp +++ b/src/Gui/BlenderNavigationStyle.cpp @@ -68,7 +68,9 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev) // Events when in "ready-to-seek" mode are ignored, except those // which influence the seek mode itself -- these are handled further // up the inheritance hierarchy. - if (this->isSeekMode()) { return inherited::processSoEvent(ev); } + if (this->isSeekMode()) { + return inherited::processSoEvent(ev); + } // Switch off viewing mode (Bug #0000911) if (!this->isSeekMode() && !this->isAnimating() && this->isViewing()) this->setViewing(false); // by default disable viewing mode to render the scene diff --git a/src/Gui/CADNavigationStyle.cpp b/src/Gui/CADNavigationStyle.cpp index 04c24d4886..7cd4002ced 100644 --- a/src/Gui/CADNavigationStyle.cpp +++ b/src/Gui/CADNavigationStyle.cpp @@ -69,7 +69,9 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev) // Events when in "ready-to-seek" mode are ignored, except those // which influence the seek mode itself -- these are handled further // up the inheritance hierarchy. - if (this->isSeekMode()) { return inherited::processSoEvent(ev); } + if (this->isSeekMode()) { + return inherited::processSoEvent(ev); + } #else // Switch off viewing mode (Bug #0000911) if (!this->isSeekMode() && !this->isAnimating() && this->isViewing()) diff --git a/src/Gui/CallTips.cpp b/src/Gui/CallTips.cpp index 8e97cdf9c1..24fa27a0ab 100644 --- a/src/Gui/CallTips.cpp +++ b/src/Gui/CallTips.cpp @@ -443,7 +443,8 @@ void CallTipsList::extractTipsFromProperties(Py::Object& obj, QMapgetPropertyContainerPtr(); // Make sure that the C++ object is alive - if (!container) return; + if (!container) + return; std::map Map; container->getPropertyMap(Map); @@ -689,7 +690,8 @@ bool CallTipsList::eventFilter(QObject * watched, QEvent * event) void CallTipsList::callTipItemActivated(QListWidgetItem *item) { hide(); - if (!item->isSelected()) return; + if (!item->isSelected()) + return; QString text = item->text(); QTextCursor cursor = textEdit->textCursor(); diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index da8be223ed..720bcedbed 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -228,9 +228,11 @@ Command::~Command() bool Command::isViewOfType(Base::Type t) const { Gui::Document *d = getGuiApplication()->activeDocument(); - if (!d) return false; + if (!d) + return false; Gui::BaseView *v = d->getActiveView(); - if (!v) return false; + if (!v) + return false; if (v->getTypeId().isDerivedFrom(t)) return true; else @@ -938,7 +940,8 @@ void Command::adjustCameraPosition() SoGetBoundingBoxAction action(viewer->getSoRenderManager()->getViewportRegion()); action.apply(viewer->getSceneGraph()); SbBox3f box = action.getBoundingBox(); - if (box.isEmpty()) return; + if (box.isEmpty()) + return; // get cirumscribing sphere and check if camera is inside SbVec3f cam_pos = camera->position.getValue(); diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 3df3e6ed0d..cc2a256d81 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -1158,7 +1158,8 @@ bool StdCmdPaste::isActive(void) return true; QClipboard* cb = QApplication::clipboard(); const QMimeData* mime = cb->mimeData(); - if (!mime) return false; + if (!mime) + return false; return getMainWindow()->canInsertFromMimeData(mime); } diff --git a/src/Gui/CommandLink.cpp b/src/Gui/CommandLink.cpp index 43b7bbe676..34fb044168 100644 --- a/src/Gui/CommandLink.cpp +++ b/src/Gui/CommandLink.cpp @@ -468,7 +468,8 @@ static bool linkConvertible(bool unlink) { int count = 0; for(auto &sel : TreeWidget::getSelection()) { auto parent = sel.parentVp; - if(!parent) return false; + if(!parent) + return false; auto obj = sel.vp->getObject(); if(unlink) { auto linked = obj->getLinkedObject(false); diff --git a/src/Gui/CommandTest.cpp b/src/Gui/CommandTest.cpp index 74a46bf651..c1f4f9ab12 100644 --- a/src/Gui/CommandTest.cpp +++ b/src/Gui/CommandTest.cpp @@ -185,7 +185,8 @@ void FCCmdTest3::activated(int iMsg) { Q_UNUSED(iMsg); App::Document *pcDoc = getDocument(); - if (!pcDoc) return; + if (!pcDoc) + return; } @@ -215,7 +216,8 @@ void FCCmdTest4::activated(int iMsg) { Q_UNUSED(iMsg); App::Document *pcDoc = getDocument(); - if(!pcDoc) return; + if(!pcDoc) + return; } @@ -244,7 +246,8 @@ void FCCmdTest5::activated(int iMsg) { Q_UNUSED(iMsg); App::Document *pcDoc = getDocument(); - if(!pcDoc) return; + if(!pcDoc) + return; } bool FCCmdTest5::isActive(void) @@ -273,7 +276,8 @@ void FCCmdTest6::activated(int iMsg) { Q_UNUSED(iMsg); App::Document *pcDoc = getDocument(); - if(!pcDoc) return; + if(!pcDoc) + return; } bool FCCmdTest6::isActive(void) @@ -301,7 +305,8 @@ void CmdTestCmdFuncs::activated(int iMsg) Q_UNUSED(iMsg); App::Document *doc = getDocument(); auto obj = doc->addObject("App::Annotation", "obj"); - if (!obj) return; + if (!obj) + return; std::string objName = obj->getNameInDocument(); diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index fd33ea0749..59114f5828 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -458,7 +458,8 @@ void StdCmdFreezeViews::onRestoreViews() bool ok; int scheme = root.attribute(QString::fromLatin1("SchemaVersion")).toInt(&ok); - if (!ok) return; + if (!ok) + return; // SchemeVersion "1" if (scheme == 1) { // read the views, ignore the attribute 'Count' @@ -1693,7 +1694,8 @@ void StdViewDockUndockFullscreen::activated(int iMsg) getMainWindow()->showNormal(); MDIView* view = getMainWindow()->activeWindow(); - if (!view) return; // no active view + if (!view) // no active view + return; // nothing to do when the view is docked and 'Docked' is pressed if (iMsg == 0 && view->currentViewMode() == MDIView::Child) @@ -2167,7 +2169,8 @@ bool StdCmdAxisCross::isActive(void) if (_pcAction->isChecked()) _pcAction->setChecked(false); } - if (view ) return true; + if (view ) + return true; return false; } diff --git a/src/Gui/DAGView/DAGView.cpp b/src/Gui/DAGView/DAGView.cpp index b8859dfac9..a9e99c532f 100644 --- a/src/Gui/DAGView/DAGView.cpp +++ b/src/Gui/DAGView/DAGView.cpp @@ -114,7 +114,8 @@ void View::onSelectionChanged(const SelectionChanges& msg) return; } auto doc = Gui::Application::Instance->getDocument(msg.pDocName); - if (!doc) return; + if (!doc) + return; auto &model = modelMap[doc]; if(!model) model = std::make_shared(this, *doc); diff --git a/src/Gui/DemoMode.cpp b/src/Gui/DemoMode.cpp index 55f81a8a62..73beef6d03 100644 --- a/src/Gui/DemoMode.cpp +++ b/src/Gui/DemoMode.cpp @@ -140,7 +140,8 @@ float DemoMode::getSpeed(int v) const SbVec3f DemoMode::getDirection(Gui::View3DInventor* view) const { SoCamera* cam = view->getViewer()->getSoRenderManager()->getCamera(); - if (!cam) return this->viewAxis; + if (!cam) + return this->viewAxis; SbRotation rot = cam->orientation.getValue(); SbRotation inv = rot.inverse(); SbVec3f vec(this->viewAxis); @@ -156,7 +157,8 @@ void DemoMode::on_angleSlider_valueChanged(int v) Gui::View3DInventor* view = activeView(); if (view) { SoCamera* cam = view->getViewer()->getSoRenderManager()->getCamera(); - if (!cam) return; + if (!cam) + return; float angle = Base::toRadians(/*90-v*/v - this->oldvalue); SbRotation rot(SbVec3f(-1, 0, 0), angle); reorientCamera(cam ,rot); diff --git a/src/Gui/DlgDisplayPropertiesImp.cpp b/src/Gui/DlgDisplayPropertiesImp.cpp index 75cec6e3e7..2af0df35dc 100644 --- a/src/Gui/DlgDisplayPropertiesImp.cpp +++ b/src/Gui/DlgDisplayPropertiesImp.cpp @@ -399,7 +399,8 @@ void DlgDisplayPropertiesImp::setDisplayModes(const std::vectorgetPropertyByName("DisplayMode"); if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) { App::PropertyEnumeration* display = static_cast(prop); - if (!display->getEnums()) return; + if (!display->getEnums()) + return; const std::vector& value = display->getEnumVector(); if (it == views.begin()) { for (std::vector::const_iterator jt = value.begin(); jt != value.end(); ++jt) diff --git a/src/Gui/DlgObjectSelection.cpp b/src/Gui/DlgObjectSelection.cpp index 375f324deb..e6de8139d5 100644 --- a/src/Gui/DlgObjectSelection.cpp +++ b/src/Gui/DlgObjectSelection.cpp @@ -343,7 +343,8 @@ std::vector DlgObjectSelection::getSelections(SelectionOpt } void DlgObjectSelection::onDepItemChanged(QTreeWidgetItem * depItem, int column) { - if(column) return; + if(column) + return; QSignalBlocker blocker(ui->depList); QSignalBlocker blocker2(ui->inList); QSignalBlocker blocker3(ui->treeWidget); diff --git a/src/Gui/DlgPropertyLink.cpp b/src/Gui/DlgPropertyLink.cpp index b6a16e14b0..8036235892 100644 --- a/src/Gui/DlgPropertyLink.cpp +++ b/src/Gui/DlgPropertyLink.cpp @@ -1023,7 +1023,8 @@ void DlgPropertyLink::onItemExpanded(QTreeWidgetItem * item) { } } else if(allowSubObject) { auto obj = doc->getObject(objName); - if(!obj) return; + if(!obj) + return; std::set childSet; std::string sub; for(auto child : obj->getLinkedObject(true)->getOutList()) { diff --git a/src/Gui/DockWindowManager.cpp b/src/Gui/DockWindowManager.cpp index 5e40d7b5cc..8480c9015a 100644 --- a/src/Gui/DockWindowManager.cpp +++ b/src/Gui/DockWindowManager.cpp @@ -256,7 +256,8 @@ void DockWindowManager::activate(QWidget* widget) par = par->parentWidget(); } - if (!dw) return; + if (!dw) + return; if (!dw->toggleViewAction()->isChecked()) { dw->toggleViewAction()->activate(QAction::Trigger); diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 4c08af803e..6cbb1e82ac 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -737,7 +737,8 @@ void Document::slotDeletedObject(const App::DocumentObject& Obj) // cycling to all views of the document ViewProvider* viewProvider = getViewProvider(&Obj); - if(!viewProvider) return; + if(!viewProvider) + return; if (d->_editViewProvider==viewProvider || d->_editViewProviderParent==viewProvider) _resetEdit(); diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index c805fbbaf2..32ff54967f 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -623,9 +623,12 @@ bool PythonEditorView::onMsg(const char* pMsg,const char** ppReturn) */ bool PythonEditorView::onHasMsg(const char* pMsg) const { - if (strcmp(pMsg,"Run")==0) return true; - if (strcmp(pMsg,"StartDebug")==0) return true; - if (strcmp(pMsg,"ToggleBreakpoint")==0) return true; + if (strcmp(pMsg,"Run")==0) + return true; + if (strcmp(pMsg,"StartDebug")==0) + return true; + if (strcmp(pMsg,"ToggleBreakpoint")==0) + return true; return EditorView::onHasMsg(pMsg); } diff --git a/src/Gui/GestureNavigationStyle.cpp b/src/Gui/GestureNavigationStyle.cpp index 39295d9da0..3f4b953d43 100644 --- a/src/Gui/GestureNavigationStyle.cpp +++ b/src/Gui/GestureNavigationStyle.cpp @@ -869,7 +869,9 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent* const ev) // Events when in "ready-to-seek" mode are ignored, except those // which influence the seek mode itself -- these are handled further // up the inheritance hierarchy. - if (this->isSeekMode()) { return superclass::processSoEvent(ev); } + if (this->isSeekMode()) { + return superclass::processSoEvent(ev); + } // Switch off viewing mode (Bug #0000911) if (!this->isSeekMode()&& !this->isAnimating() && this->isViewing() ) this->setViewing(false); // by default disable viewing mode to render the scene @@ -887,7 +889,8 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent* const ev) // give the nodes in the foreground root the chance to handle events (e.g color bar) if (!viewer->isEditing()) { bool processed = handleEventInForeground(ev); - if (processed) return true; + if (processed) + return true; } if ( (smev.isRelease(1) && this->button1down == false) diff --git a/src/Gui/Inventor/SmSwitchboard.cpp b/src/Gui/Inventor/SmSwitchboard.cpp index e9ed020b80..bf2a72d669 100644 --- a/src/Gui/Inventor/SmSwitchboard.cpp +++ b/src/Gui/Inventor/SmSwitchboard.cpp @@ -203,6 +203,7 @@ void SmSwitchboard::search(SoSearchAction * action) { SoNode::search(action); // clazy:exclude=skipped-base-method - if (action->isFound()) return; + if (action->isFound()) + return; SmSwitchboard::doAction(action); } diff --git a/src/Gui/InventorNavigationStyle.cpp b/src/Gui/InventorNavigationStyle.cpp index 347b6a4097..476d10cc89 100644 --- a/src/Gui/InventorNavigationStyle.cpp +++ b/src/Gui/InventorNavigationStyle.cpp @@ -75,7 +75,9 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev) // Events when in "ready-to-seek" mode are ignored, except those // which influence the seek mode itself -- these are handled further // up the inheritance hierarchy. - if (this->isSeekMode()) { return inherited::processSoEvent(ev); } + if (this->isSeekMode()) { + return inherited::processSoEvent(ev); + } // Switch off viewing mode (Bug #0000911) if (!this->isSeekMode()&& !this->isAnimating() && this->isViewing() ) this->setViewing(false); // by default disable viewing mode to render the scene diff --git a/src/Gui/LinkViewPyImp.cpp b/src/Gui/LinkViewPyImp.cpp index c60f683069..f6c68ed524 100644 --- a/src/Gui/LinkViewPyImp.cpp +++ b/src/Gui/LinkViewPyImp.cpp @@ -236,7 +236,8 @@ PyObject* LinkViewPy::setLink(PyObject *args) Py::Object LinkViewPy::getOwner() const { auto owner = getLinkViewPtr()->getOwner(); - if(!owner) return Py::Object(); + if(!owner) + return Py::Object(); return Py::Object(owner->getPyObject(),true); } diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index da07ab1b9a..48bce66be4 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1004,7 +1004,8 @@ void MainWindow::setActiveWindow(MDIView* view) void MainWindow::onWindowActivated(QMdiSubWindow* w) { - if (!w) return; + if (!w) + return; MDIView* view = dynamic_cast(w->widget()); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index 7b26871d86..85b7ed6000 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -518,7 +518,8 @@ public: static void reorientCamera(SoCamera * cam, const SbRotation & rot) { - if (cam == nullptr) return; + if (cam == nullptr) + return; // Find global coordinates of focal point. SbVec3f direction; diff --git a/src/Gui/MayaGestureNavigationStyle.cpp b/src/Gui/MayaGestureNavigationStyle.cpp index 80e82a5ebf..30bc333d94 100644 --- a/src/Gui/MayaGestureNavigationStyle.cpp +++ b/src/Gui/MayaGestureNavigationStyle.cpp @@ -120,7 +120,9 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev) // Events when in "ready-to-seek" mode are ignored, except those // which influence the seek mode itself -- these are handled further // up the inheritance hierarchy. - if (this->isSeekMode()) { return inherited::processSoEvent(ev); } + if (this->isSeekMode()) { + return inherited::processSoEvent(ev); + } // Switch off viewing mode (Bug #0000911) if (!this->isSeekMode()&& !this->isAnimating() && this->isViewing() ) this->setViewing(false); // by default disable viewing mode to render the scene diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp index 3b43290d9e..ae6d62356e 100644 --- a/src/Gui/NavigationStyle.cpp +++ b/src/Gui/NavigationStyle.cpp @@ -325,7 +325,8 @@ void NavigationStyle::seekToPoint(const SbVec3f& scenepos) SbBool NavigationStyle::lookAtPoint(const SbVec2s screenpos) { SoCamera* cam = viewer->getSoRenderManager()->getCamera(); - if (cam == nullptr) return false; + if (cam == nullptr) + return false; SoRayPickAction rpaction(viewer->getSoRenderManager()->getViewportRegion()); rpaction.setPoint(screenpos); @@ -347,7 +348,8 @@ SbBool NavigationStyle::lookAtPoint(const SbVec2s screenpos) void NavigationStyle::lookAtPoint(const SbVec3f& pos) { SoCamera* cam = viewer->getSoRenderManager()->getCamera(); - if (cam == nullptr) return; + if (cam == nullptr) + return; PRIVATE(this)->rotationCenterFound = false; // Find global coordinates of focal point. @@ -405,7 +407,8 @@ void NavigationStyle::lookAtPoint(const SbVec3f& pos) void NavigationStyle::setCameraOrientation(const SbRotation& rot, SbBool moveToCenter) { SoCamera* cam = viewer->getSoRenderManager()->getCamera(); - if (cam == nullptr) return; + if (cam == nullptr) + return; // Find global coordinates of focal point. SbVec3f direction; @@ -484,7 +487,8 @@ void NavigationStyleP::viewAnimationCB(void * data, SoSensor * sensor) SbRotation slerp = SbRotation::slerp(that->spinRotation, PRIVATE(that)->endRotation, step); SbVec3f focalpoint = (1.0f-step)*PRIVATE(that)->focal1 + step*PRIVATE(that)->focal2; SoCamera* cam = that->viewer->getSoRenderManager()->getCamera(); - if (!cam) return; // no camera + if (!cam) // no camera + return; SbVec3f direction; cam->orientation.setValue(slerp); @@ -508,7 +512,8 @@ void NavigationStyleP::viewAnimationCB(void * data, SoSensor * sensor) void NavigationStyle::boxZoom(const SbBox2s& box) { SoCamera* cam = viewer->getSoRenderManager()->getCamera(); - if (!cam) return; // no camera + if (!cam) // no camera + return; const SbViewportRegion & vp = viewer->getSoRenderManager()->getViewportRegion(); SbViewVolume vv = cam->getViewVolume(vp.getViewportAspectRatio()); @@ -551,7 +556,8 @@ void NavigationStyle::viewAll() SoGetBoundingBoxAction action(viewer->getSoRenderManager()->getViewportRegion()); action.apply(viewer->getSceneGraph()); SbBox3f box = action.getBoundingBox(); - if (box.isEmpty()) return; + if (box.isEmpty()) + return; #if 0 // check whether the box is very wide or tall, if not do nothing @@ -564,7 +570,8 @@ void NavigationStyle::viewAll() #endif SoCamera* cam = viewer->getSoRenderManager()->getCamera(); - if (!cam) return; + if (!cam) + return; SbViewVolume vol = cam->getViewVolume(); if (vol.ulf == vol.llf) @@ -615,7 +622,8 @@ void NavigationStyle::viewAll() */ void NavigationStyle::reorientCamera(SoCamera * cam, const SbRotation & rot) { - if (cam == nullptr) return; + if (cam == nullptr) + return; // Find global coordinates of focal point. SbVec3f direction; @@ -634,8 +642,10 @@ void NavigationStyle::reorientCamera(SoCamera * cam, const SbRotation & rot) void NavigationStyle::panCamera(SoCamera * cam, float aspectratio, const SbPlane & panplane, const SbVec2f & currpos, const SbVec2f & prevpos) { - if (cam == nullptr) return; // can happen for empty scenegraph - if (currpos == prevpos) return; // useless invocation + if (cam == nullptr) // can happen for empty scenegraph + return; + if (currpos == prevpos) // useless invocation + return; // Find projection points for the last and current mouse coordinates. @@ -693,7 +703,8 @@ void NavigationStyle::panToCenter(const SbPlane & pplane, const SbVec2f & currpo */ void NavigationStyle::zoom(SoCamera * cam, float diffvalue) { - if (cam == nullptr) return; // can happen for empty scenegraph + if (cam == nullptr) // can happen for empty scenegraph + return; SoType t = cam->getTypeId(); SbName tname = t.getName(); @@ -890,7 +901,8 @@ SbVec3f NavigationStyle::getFocalPoint() const */ void NavigationStyle::spin(const SbVec2f & pointerpos) { - if (this->log.historysize < 2) return; + if (this->log.historysize < 2) + return; assert(this->spinprojector != nullptr); const SbViewportRegion & vp = viewer->getSoRenderManager()->getViewportRegion(); @@ -1050,7 +1062,8 @@ void NavigationStyle::saveCursorPosition(const SoEvent * const ev) float ratio = vp.getViewportAspectRatio(); SoCamera* cam = viewer->getSoRenderManager()->getCamera(); - if (!cam) return; // no camera + if (!cam) // no camera + return; SbViewVolume vv = cam->getViewVolume(ratio); SbLine line; @@ -1069,7 +1082,8 @@ void NavigationStyle::saveCursorPosition(const SoEvent * const ev) float ratio = vp.getViewportAspectRatio(); SoCamera* cam = viewer->getSoRenderManager()->getCamera(); - if (!cam) return; // no camera + if (!cam) // no camera + return; SoGetBoundingBoxAction action(viewer->getSoRenderManager()->getViewportRegion()); action.apply(viewer->getSceneGraph()); @@ -1187,7 +1201,8 @@ SbBool NavigationStyle::isAnimating() const */ void NavigationStyle::startAnimating(const SbVec3f& axis, float velocity) { - if (!isAnimationEnabled()) return; + if (!isAnimationEnabled()) + return; this->prevRedrawTime = SbTime::getTimeOfDay(); this->spinincrement = SbRotation::identity(); @@ -1396,7 +1411,9 @@ void NavigationStyle::syncModifierKeys(const SoEvent * const ev) void NavigationStyle::setViewingMode(const ViewerMode newmode) { const ViewerMode oldmode = this->currentmode; - if (newmode == oldmode) { return; } + if (newmode == oldmode) { + return; + } switch (newmode) { case DRAGGING: @@ -1522,7 +1539,9 @@ void NavigationStyle::syncWithEvent(const SoEvent * const ev) // Events when in "ready-to-seek" mode are ignored, except those // which influence the seek mode itself -- these are handled further // up the inheritance hierarchy. - if (this->isSeekMode()) { return; } + if (this->isSeekMode()) { + return; + } const SoType type(ev->getTypeId()); diff --git a/src/Gui/OpenCascadeNavigationStyle.cpp b/src/Gui/OpenCascadeNavigationStyle.cpp index 0e2e060e98..8869703f86 100644 --- a/src/Gui/OpenCascadeNavigationStyle.cpp +++ b/src/Gui/OpenCascadeNavigationStyle.cpp @@ -67,7 +67,9 @@ SbBool OpenCascadeNavigationStyle::processSoEvent(const SoEvent * const ev) // Events when in "ready-to-seek" mode are ignored, except those // which influence the seek mode itself -- these are handled further // up the inheritance hierarchy. - if (this->isSeekMode()) { return inherited::processSoEvent(ev); } + if (this->isSeekMode()) { + return inherited::processSoEvent(ev); + } // Switch off viewing mode if (!this->isSeekMode() && !this->isAnimating() && this->isViewing()) this->setViewing(false); // by default disable viewing mode to render the scene diff --git a/src/Gui/OpenSCADNavigationStyle.cpp b/src/Gui/OpenSCADNavigationStyle.cpp index 03836aac78..76a8dc5891 100644 --- a/src/Gui/OpenSCADNavigationStyle.cpp +++ b/src/Gui/OpenSCADNavigationStyle.cpp @@ -67,7 +67,9 @@ SbBool OpenSCADNavigationStyle::processSoEvent(const SoEvent * const ev) // Events when in "ready-to-seek" mode are ignored, except those // which influence the seek mode itself -- these are handled further // up the inheritance hierarchy. - if (this->isSeekMode()) { return inherited::processSoEvent(ev); } + if (this->isSeekMode()) { + return inherited::processSoEvent(ev); + } // Switch off viewing mode if (!this->isSeekMode() && !this->isAnimating() && this->isViewing()) this->setViewing(false); // by default disable viewing mode to render the scene diff --git a/src/Gui/Placement.cpp b/src/Gui/Placement.cpp index c9810d749b..d486e800d2 100644 --- a/src/Gui/Placement.cpp +++ b/src/Gui/Placement.cpp @@ -219,7 +219,8 @@ void Placement::revertTransformation() void Placement::applyPlacement(const Base::Placement& p, bool incremental) { Gui::Document* document = Application::Instance->activeDocument(); - if (!document) return; + if (!document) + return; std::vector sel = Gui::Selection().getObjectsOfType (App::DocumentObject::getClassTypeId(), document->getDocument()->getName()); @@ -257,7 +258,8 @@ void Placement::applyPlacement(const Base::Placement& p, bool incremental) void Placement::applyPlacement(const QString& data, bool incremental) { Gui::Document* document = Application::Instance->activeDocument(); - if (!document) return; + if (!document) + return; // When directly changing the property we now only have to commit the transaction, // do a recompute and open a new transaction diff --git a/src/Gui/PythonDebugger.cpp b/src/Gui/PythonDebugger.cpp index c733340605..e6d7783358 100644 --- a/src/Gui/PythonDebugger.cpp +++ b/src/Gui/PythonDebugger.cpp @@ -430,7 +430,8 @@ void PythonDebugger::runFile(const QString& fn) #else FILE *fp = fopen((const char*)pxFileName,"r"); #endif - if (!fp) return; + if (!fp) + return; Base::PyGILStateLocker locker; PyObject *module, *dict; diff --git a/src/Gui/QSint/actionpanel/actionbox.cpp b/src/Gui/QSint/actionpanel/actionbox.cpp index 7635555f96..bc9d582c79 100644 --- a/src/Gui/QSint/actionpanel/actionbox.cpp +++ b/src/Gui/QSint/actionpanel/actionbox.cpp @@ -215,7 +215,8 @@ void ActionBox::addLayout(QLayout * l) void ActionBox::addWidget(QWidget * w, QLayout * l) { - if (!w) return; + if (!w) + return; w->setParent(this); diff --git a/src/Gui/Quarter/DragDropHandler.cpp b/src/Gui/Quarter/DragDropHandler.cpp index da02a2952e..f8b957c42b 100644 --- a/src/Gui/Quarter/DragDropHandler.cpp +++ b/src/Gui/Quarter/DragDropHandler.cpp @@ -115,12 +115,15 @@ void DragDropHandlerP::dragEnterEvent(QDragEnterEvent * event) { const QMimeData * mimedata = event->mimeData(); - if (!mimedata->hasUrls() && !mimedata->hasText()) return; + if (!mimedata->hasUrls() && !mimedata->hasText()) + return; if (mimedata->hasUrls()) { QFileInfo fileinfo(mimedata->urls().takeFirst().path()); QString suffix = fileinfo.suffix().toLower(); - if (!this->suffixes.contains(suffix)) { return; } + if (!this->suffixes.contains(suffix)) { + return; + } } event->acceptProposedAction(); @@ -139,18 +142,21 @@ DragDropHandlerP::dropEvent(QDropEvent * event) QUrl url = mimedata->urls().takeFirst(); if (url.scheme().isEmpty() || url.scheme().toLower() == QString("file") ) { // attempt to open file - if (!in.openFile(url.toLocalFile().toLatin1().constData())) return; + if (!in.openFile(url.toLocalFile().toLatin1().constData())) + return; } } else if (mimedata->hasText()) { /* FIXME 2007-11-09 preng: dropping text buffer does not work on Windows Vista. */ bytes = mimedata->text().toUtf8(); in.setBuffer((void *) bytes.constData(), bytes.size()); - if (!in.isValidBuffer()) return; + if (!in.isValidBuffer()) + return; } // attempt to import it root = SoDB::readAll(&in); - if (root == nullptr) return; + if (root == nullptr) + return; // set new scenegraph this->quarterwidget->setSceneGraph(root); diff --git a/src/Gui/RevitNavigationStyle.cpp b/src/Gui/RevitNavigationStyle.cpp index 0f70546fb6..f8e337ebbc 100644 --- a/src/Gui/RevitNavigationStyle.cpp +++ b/src/Gui/RevitNavigationStyle.cpp @@ -67,7 +67,9 @@ SbBool RevitNavigationStyle::processSoEvent(const SoEvent * const ev) // Events when in "ready-to-seek" mode are ignored, except those // which influence the seek mode itself -- these are handled further // up the inheritance hierarchy. - if (this->isSeekMode()) { return inherited::processSoEvent(ev); } + if (this->isSeekMode()) { + return inherited::processSoEvent(ev); + } // Switch off viewing mode (Bug #0000911) if (!this->isSeekMode() && !this->isAnimating() && this->isViewing()) this->setViewing(false); // by default disable viewing mode to render the scene diff --git a/src/Gui/Selection.cpp b/src/Gui/Selection.cpp index aa79a4b80e..92a872fa0c 100644 --- a/src/Gui/Selection.cpp +++ b/src/Gui/Selection.cpp @@ -723,12 +723,14 @@ void SelectionSingleton::slotSelectionChanged(const SelectionChanges& msg) { if(msg.Object.getSubName().size()) { auto pParent = msg.Object.getObject(); - if(!pParent) return; + if(!pParent) + return; std::pair elementName; auto &newElementName = elementName.first; auto &oldElementName = elementName.second; auto pObject = App::GeoFeature::resolveElement(pParent,msg.pSubName,elementName); - if (!pObject) return; + if (!pObject) + return; SelectionChanges msg2(msg.Type,pObject->getDocument()->getName(), pObject->getNameInDocument(), newElementName.size()?newElementName.c_str():oldElementName.c_str(), @@ -892,7 +894,8 @@ void SelectionSingleton::setPreselectCoord( float x, float y, float z) static char buf[513]; // if nothing is in preselect ignore - if(CurrentPreselection.Object.getObjectName().empty()) return; + if(CurrentPreselection.Object.getObjectName().empty()) + return; CurrentPreselection.x = x; CurrentPreselection.y = y; @@ -1285,9 +1288,11 @@ bool SelectionSingleton::updateSelection(bool show, const char* pDocName, rmvPreselect(); } auto pDoc = getDocument(pDocName); - if(!pDoc) return false; + if(!pDoc) + return false; auto pObject = pDoc->getObject(pObjectName); - if(!pObject) return false; + if(!pObject) + return false; if (!isSelected(pObject, pSubName,0)) return false; @@ -1352,7 +1357,8 @@ void SelectionSingleton::rmvSelection(const char* pDocName, const char* pObjectN notify(SelectionChanges(SelectionChanges::PickedListChanged)); } - if(!pDocName) return; + if(!pDocName) + return; _SelObj temp; int ret = checkSelection(pDocName,pObjectName,pSubName,0,temp); @@ -1704,7 +1710,8 @@ int SelectionSingleton::checkSelection(const char *pDocName, const char *pObject const char *SelectionSingleton::getSelectedElement(App::DocumentObject *obj, const char* pSubName) const { - if (!obj) return nullptr; + if (!obj) + return nullptr; for(list<_SelObj>::const_iterator It = _SelList.begin();It != _SelList.end();++It) { if (It->pObject == obj) { @@ -1722,7 +1729,8 @@ const char *SelectionSingleton::getSelectedElement(App::DocumentObject *obj, con void SelectionSingleton::slotDeletedObject(const App::DocumentObject& Obj) { - if(!Obj.getNameInDocument()) return; + if(!Obj.getNameInDocument()) + return; // For safety reason, don't bother checking rmvPreselect(); diff --git a/src/Gui/SelectionView.cpp b/src/Gui/SelectionView.cpp index 84713911f8..d0d90d43b2 100644 --- a/src/Gui/SelectionView.cpp +++ b/src/Gui/SelectionView.cpp @@ -360,11 +360,13 @@ void SelectionView::deselect(void) void SelectionView::toggleSelect(QListWidgetItem* item) { - if (!item) return; + if (!item) + return; std::string name = item->text().toLatin1().constData(); char *docname = &name.at(0); char *objname = std::strchr(docname,'#'); - if(!objname) return; + if(!objname) + return; *objname++ = 0; char *subname = std::strchr(objname,'.'); if(subname) { @@ -398,11 +400,13 @@ void SelectionView::toggleSelect(QListWidgetItem* item) void SelectionView::preselect(QListWidgetItem* item) { - if (!item) return; + if (!item) + return; std::string name = item->text().toLatin1().constData(); char *docname = &name.at(0); char *objname = std::strchr(docname,'#'); - if(!objname) return; + if(!objname) + return; *objname++ = 0; char *subname = std::strchr(objname,'.'); if(subname) { diff --git a/src/Gui/SoFCOffscreenRenderer.cpp b/src/Gui/SoFCOffscreenRenderer.cpp index 33cecb0de5..dbb27928cb 100644 --- a/src/Gui/SoFCOffscreenRenderer.cpp +++ b/src/Gui/SoFCOffscreenRenderer.cpp @@ -496,7 +496,9 @@ SoQtOffscreenRenderer::getBackgroundColor(void) const void SoQtOffscreenRenderer::setGLRenderAction(SoGLRenderAction * action) { - if (action == PRIVATE(this)->renderaction) { return; } + if (action == PRIVATE(this)->renderaction) { + return; + } if (PRIVATE(this)->didallocation) { delete PRIVATE(this)->renderaction; } PRIVATE(this)->renderaction = action; diff --git a/src/Gui/SoFCSelection.cpp b/src/Gui/SoFCSelection.cpp index da112473da..7e6386324a 100644 --- a/src/Gui/SoFCSelection.cpp +++ b/src/Gui/SoFCSelection.cpp @@ -308,10 +308,14 @@ void SoFCSelection::doAction(SoAction *action) int SoFCSelection::getPriority(const SoPickedPoint* p) { const SoDetail* detail = p->getDetail(); - if(!detail) return 0; - if(detail->isOfType(SoFaceDetail::getClassTypeId())) return 1; - if(detail->isOfType(SoLineDetail::getClassTypeId())) return 2; - if(detail->isOfType(SoPointDetail::getClassTypeId())) return 3; + if(!detail) + return 0; + if(detail->isOfType(SoFaceDetail::getClassTypeId())) + return 1; + if(detail->isOfType(SoLineDetail::getClassTypeId())) + return 2; + if(detail->isOfType(SoPointDetail::getClassTypeId())) + return 3; return 0; } diff --git a/src/Gui/SoFCUnifiedSelection.cpp b/src/Gui/SoFCUnifiedSelection.cpp index d8321cc854..12274ce71a 100644 --- a/src/Gui/SoFCUnifiedSelection.cpp +++ b/src/Gui/SoFCUnifiedSelection.cpp @@ -204,7 +204,8 @@ void SoFCUnifiedSelection::write(SoWriteAction * action) SoOutput * out = action->getOutput(); if (out->getStage() == SoOutput::WRITE) { // Do not write out the fields of this class - if (this->writeHeader(out, true, false)) return; + if (this->writeHeader(out, true, false)) + return; SoGroup::doAction((SoAction *)action); this->writeFooter(out); } @@ -216,10 +217,14 @@ void SoFCUnifiedSelection::write(SoWriteAction * action) int SoFCUnifiedSelection::getPriority(const SoPickedPoint* p) { const SoDetail* detail = p->getDetail(); - if (!detail) return 0; - if (detail->isOfType(SoFaceDetail::getClassTypeId())) return 1; - if (detail->isOfType(SoLineDetail::getClassTypeId())) return 2; - if (detail->isOfType(SoPointDetail::getClassTypeId())) return 3; + if (!detail) + return 0; + if (detail->isOfType(SoFaceDetail::getClassTypeId())) + return 1; + if (detail->isOfType(SoLineDetail::getClassTypeId())) + return 2; + if (detail->isOfType(SoPointDetail::getClassTypeId())) + return 3; return 0; } @@ -263,7 +268,8 @@ SoFCUnifiedSelection::getPickedList(SoHandleEventAction* action, bool singlePick ret.push_back(info); } - if(ret.size()<=1) return ret; + if(ret.size()<=1) + return ret; // To identify the picking of lines in a concave area we have to // get all intersection points. If we have two or more intersection @@ -534,7 +540,8 @@ bool SoFCUnifiedSelection::setHighlight(SoFullPath *path, const SoDetail *det, } bool SoFCUnifiedSelection::setSelection(const std::vector &infos, bool ctrlDown) { - if(infos.empty() || !infos[0].vpd) return false; + if(infos.empty() || !infos[0].vpd) + return false; std::vector sels; if(infos.size()>1) { @@ -559,9 +566,11 @@ bool SoFCUnifiedSelection::setSelection(const std::vector &infos, bo const auto &info = infos[0]; auto vpd = info.vpd; - if(!vpd) return false; + if(!vpd) + return false; const char *objname = vpd->getObject()->getNameInDocument(); - if(!objname) return false; + if(!objname) + return false; const char *docname = vpd->getObject()->getDocument()->getName(); bool hasNext = false; diff --git a/src/Gui/SoFCVectorizeSVGAction.cpp b/src/Gui/SoFCVectorizeSVGAction.cpp index 9e14fe955e..b37bcad4fd 100644 --- a/src/Gui/SoFCVectorizeSVGAction.cpp +++ b/src/Gui/SoFCVectorizeSVGAction.cpp @@ -294,7 +294,8 @@ Separator { */ void SoFCVectorizeSVGActionP::printTriangle(const SbVec3f * v, const SbColor * c) const { - if (v[0] == v[1] || v[1] == v[2] || v[0] == v[2]) return; + if (v[0] == v[1] || v[1] == v[2] || v[0] == v[2]) + return; uint32_t cc = c->getPackedValue(); std::ostream& str = publ->getSVGOutput()->getFileStream(); diff --git a/src/Gui/SoFCVectorizeU3DAction.cpp b/src/Gui/SoFCVectorizeU3DAction.cpp index 2c786e9117..de876ad066 100644 --- a/src/Gui/SoFCVectorizeU3DAction.cpp +++ b/src/Gui/SoFCVectorizeU3DAction.cpp @@ -228,7 +228,8 @@ void SoFCVectorizeU3DActionP::printTriangle(const SoVectorizeTriangle * item) co void SoFCVectorizeU3DActionP::printTriangle(const SbVec3f * v, const SbColor * c) const { - if (v[0] == v[1] || v[1] == v[2] || v[0] == v[2]) return; + if (v[0] == v[1] || v[1] == v[2] || v[0] == v[2]) + return; //uint32_t cc = c->getPackedValue(); //std::ostream& str = publ->getU3DOutput()->getFileStream(); diff --git a/src/Gui/SoTextLabel.cpp b/src/Gui/SoTextLabel.cpp index e230fb7825..9ec2118c01 100644 --- a/src/Gui/SoTextLabel.cpp +++ b/src/Gui/SoTextLabel.cpp @@ -114,7 +114,8 @@ SoTextLabel::SoTextLabel() */ void SoTextLabel::GLRender(SoGLRenderAction *action) { - if (!this->shouldGLRender(action)) return; + if (!this->shouldGLRender(action)) + return; // only draw text without background if (!this->background.getValue()) { diff --git a/src/Gui/TaskElementColors.cpp b/src/Gui/TaskElementColors.cpp index 9a4c5c3c9d..08452e1e8d 100644 --- a/src/Gui/TaskElementColors.cpp +++ b/src/Gui/TaskElementColors.cpp @@ -271,7 +271,8 @@ public: } void onSelectionChanged() { - if(busy) return; + if(busy) + return; busy = true; std::map sels; for(auto &sel : Selection().getSelectionEx( diff --git a/src/Gui/TaskView/TaskAppearance.cpp b/src/Gui/TaskView/TaskAppearance.cpp index b6e7b87f8e..cd6d93deff 100644 --- a/src/Gui/TaskView/TaskAppearance.cpp +++ b/src/Gui/TaskView/TaskAppearance.cpp @@ -202,7 +202,8 @@ void TaskAppearance::setDisplayModes(const std::vector& view App::Property* prop = (*it)->getPropertyByName("DisplayMode"); if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) { App::PropertyEnumeration* display = static_cast(prop); - if (!display->getEnums()) return; + if (!display->getEnums()) + return; const std::vector& value = display->getEnumVector(); if (it == views.begin()) { for (std::vector::const_iterator jt = value.begin(); jt != value.end(); ++jt) diff --git a/src/Gui/TinkerCADNavigationStyle.cpp b/src/Gui/TinkerCADNavigationStyle.cpp index 30c84bada9..f3d6159a7b 100644 --- a/src/Gui/TinkerCADNavigationStyle.cpp +++ b/src/Gui/TinkerCADNavigationStyle.cpp @@ -67,7 +67,9 @@ SbBool TinkerCADNavigationStyle::processSoEvent(const SoEvent * const ev) // Events when in "ready-to-seek" mode are ignored, except those // which influence the seek mode itself -- these are handled further // up the inheritance hierarchy. - if (this->isSeekMode()) { return inherited::processSoEvent(ev); } + if (this->isSeekMode()) { + return inherited::processSoEvent(ev); + } // Switch off viewing mode if (!this->isSeekMode() && !this->isAnimating() && this->isViewing()) this->setViewing(false); // by default disable viewing mode to render the scene diff --git a/src/Gui/TouchpadNavigationStyle.cpp b/src/Gui/TouchpadNavigationStyle.cpp index 184562bb16..8f9ed4b552 100644 --- a/src/Gui/TouchpadNavigationStyle.cpp +++ b/src/Gui/TouchpadNavigationStyle.cpp @@ -66,7 +66,9 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev) // Events when in "ready-to-seek" mode are ignored, except those // which influence the seek mode itself -- these are handled further // up the inheritance hierarchy. - if (this->isSeekMode()) { return inherited::processSoEvent(ev); } + if (this->isSeekMode()) { + return inherited::processSoEvent(ev); + } // Switch off viewing mode (Bug #0000911) if (!this->isSeekMode() && !this->isAnimating() && this->isViewing()) this->setViewing(false); // by default disable viewing mode to render the scene diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 4f682b8bb9..b805759295 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -1060,7 +1060,8 @@ void TreeWidget::onFinishEditing() DocumentObjectItem* objitem = static_cast (this->contextItem); App::DocumentObject* obj = objitem->object()->getObject(); - if (!obj) return; + if (!obj) + return; Gui::Document* doc = Gui::Application::Instance->getDocument(obj->getDocument()); doc->commitCommand(); doc->resetEdit(); @@ -1238,7 +1239,8 @@ std::vector TreeWidget::getSelection(App::Document* doc) break; } } - if (!tree) return ret; + if (!tree) + return ret; if (tree->selectTimer->isActive()) tree->onSelectTimer(); @@ -1438,13 +1440,15 @@ void TreeWidget::keyPressEvent(QKeyEvent* event) void TreeWidget::mouseDoubleClickEvent(QMouseEvent* event) { QTreeWidgetItem* item = itemAt(event->pos()); - if (!item) return; + if (!item) + return; try { if (item->type() == TreeWidget::DocumentType) { //QTreeWidget::mouseDoubleClickEvent(event); Gui::Document* doc = static_cast(item)->document(); - if (!doc) return; + if (!doc) + return; if (doc->getDocument()->testStatus(App::Document::PartialDoc)) { contextItem = item; onReloadDoc(); @@ -2867,7 +2871,8 @@ void TreeWidget::syncView(ViewProviderDocumentObject* vp) void TreeWidget::onShowHidden() { - if (!this->contextItem) return; + if (!this->contextItem) + return; DocumentItem* docItem = nullptr; if (this->contextItem->type() == DocumentType) docItem = static_cast(contextItem); @@ -4144,7 +4149,8 @@ void DocumentItem::updateSelection(QTreeWidgetItem* ti, bool unselect) { } } - if (unselect) return; + if (unselect) + return; for (int i = 0, count = ti->childCount(); i < count; ++i) updateSelection(ti->child(i)); } @@ -4469,7 +4475,8 @@ void DocumentItem::selectItems(SelectionReason reason) { void DocumentItem::populateParents(const ViewProvider* vp, ViewParentMap& parentMap) { auto it = parentMap.find(vp); - if (it == parentMap.end()) return; + if (it == parentMap.end()) + return; for (auto parent : it->second) { auto it = ObjectMap.find(parent->getObject()); if (it == ObjectMap.end()) diff --git a/src/Gui/TreeView.cpp b/src/Gui/TreeView.cpp index 3f937ddb5c..6b5945c9ed 100644 --- a/src/Gui/TreeView.cpp +++ b/src/Gui/TreeView.cpp @@ -65,7 +65,8 @@ void TreeView::mouseDoubleClickEvent (QMouseEvent * event) QTreeView::mouseDoubleClickEvent(event); const Gui::Document* doc = static_cast(item); MDIView *view = doc->getActiveView(); - if (!view) return; + if (!view) + return; getMainWindow()->setActiveWindow(view); } else if (item->getTypeId().isDerivedFrom(ViewProvider::getClassTypeId())) { diff --git a/src/Gui/UiLoader.cpp b/src/Gui/UiLoader.cpp index eb50ac9fad..47c88f046c 100644 --- a/src/Gui/UiLoader.cpp +++ b/src/Gui/UiLoader.cpp @@ -408,7 +408,8 @@ QDir QUiLoader::workingDirectory() const PythonWrapper wrap; Py::Object dir((uiloader.callMemberFunction("workingDirectory"))); QDir* d = wrap.toQDir(dir.ptr()); - if (d) return *d; + if (d) + return *d; return QDir::current(); } catch (Py::Exception& e) { diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 8967c722b0..97a1cb1d56 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -584,7 +584,8 @@ bool View3DInventor::onMsg(const char* pMsg, const char** ppReturn) } else if(strcmp("GetCamera",pMsg) == 0 ) { SoCamera * Cam = _viewer->getSoRenderManager()->getCamera(); - if (!Cam) return false; + if (!Cam) + return false; *ppReturn = SoFCDB::writeNodesToString(Cam).c_str(); return true; } diff --git a/src/Gui/View3DInventorExamples.cpp b/src/Gui/View3DInventorExamples.cpp index e0225ea2af..a4e23fb0e2 100644 --- a/src/Gui/View3DInventorExamples.cpp +++ b/src/Gui/View3DInventorExamples.cpp @@ -276,7 +276,8 @@ void LightManip(SoSeparator * root) SoInput in; in.setBuffer((void *)scenegraph, std::strlen(scenegraph)); SoSeparator * _root = SoDB::readAll( &in ); - if ( _root == nullptr ) return; // Shouldn't happen. + if ( _root == nullptr ) // Shouldn't happen. + return; root->addChild(_root); root->ref(); @@ -289,7 +290,8 @@ void LightManip(SoSeparator * root) sa.setSearchingAll( false ); sa.apply( root ); SoPath * path = sa.getPath(); - if ( path == nullptr) return; // Shouldn't happen. + if ( path == nullptr) // Shouldn't happen. + return; SoPointLightManip * manip = new SoPointLightManip; manip->replaceNode( path ); @@ -394,7 +396,8 @@ timersensorcallback(void * data, SoSensor *) void AnimationTexture(SoSeparator * root) { // Scene graph - if ( root == nullptr ) return; // Shouldn't happen. + if ( root == nullptr ) // Shouldn't happen. + return; // Generate a julia set to use as a texturemap julia(global_cr, global_ci, 2.5, texturewidth, textureheight, 4, bitmap, 64); diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 6454627033..9863c86d49 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -2404,7 +2404,8 @@ void View3DInventorViewer::setSeekMode(SbBool on) void View3DInventorViewer::printDimension() { SoCamera* cam = getSoRenderManager()->getCamera(); - if (!cam) return; // no camera there + if (!cam) // no camera there + return; SoType t = getSoRenderManager()->getCamera()->getTypeId(); if (t.isDerivedFrom(SoOrthographicCamera::getClassTypeId())) { @@ -2493,7 +2494,8 @@ SbVec3f View3DInventorViewer::getViewDirection() const { SoCamera* cam = this->getSoRenderManager()->getCamera(); - if (!cam) return SbVec3f(0,0,-1); // this is the default + if (!cam) // this is the default + return SbVec3f(0,0,-1); SbVec3f projDir = cam->getViewVolume().getProjectionDirection(); return projDir; @@ -2510,7 +2512,8 @@ SbVec3f View3DInventorViewer::getUpDirection() const { SoCamera* cam = this->getSoRenderManager()->getCamera(); - if (!cam) return SbVec3f(0,1,0); + if (!cam) + return SbVec3f(0,1,0); SbRotation camrot = cam->orientation.getValue(); SbVec3f upvec(0, 1, 0); // init to default up vector @@ -2559,7 +2562,8 @@ SbVec3f View3DInventorViewer::getPointOnFocalPlane(const SbVec2s& pnt) const SbVec2f pnt2d = getNormalizedPosition(pnt); SoCamera* pCam = this->getSoRenderManager()->getCamera(); - if (!pCam) return SbVec3f(); // return invalid point + if (!pCam) // return invalid point + return SbVec3f(); SbViewVolume vol = pCam->getViewVolume(); @@ -2599,7 +2603,8 @@ void View3DInventorViewer::getNearPlane(SbVec3f& rcPt, SbVec3f& rcNormal) const { SoCamera* pCam = getSoRenderManager()->getCamera(); - if (!pCam) return; // just do nothing + if (!pCam) // just do nothing + return; SbViewVolume vol = pCam->getViewVolume(); @@ -2617,7 +2622,8 @@ void View3DInventorViewer::getFarPlane(SbVec3f& rcPt, SbVec3f& rcNormal) const { SoCamera* pCam = getSoRenderManager()->getCamera(); - if (!pCam) return; // just do nothing + if (!pCam) // just do nothing + return; SbViewVolume vol = pCam->getViewVolume(); @@ -2636,7 +2642,8 @@ SbVec3f View3DInventorViewer::projectOnNearPlane(const SbVec2f& pt) const SbVec3f pt1, pt2; SoCamera* cam = this->getSoRenderManager()->getCamera(); - if (!cam) return SbVec3f(); // return invalid point + if (!cam) // return invalid point + return SbVec3f(); SbViewVolume vol = cam->getViewVolume(); vol.projectPointToLine(pt, pt1, pt2); @@ -2648,7 +2655,8 @@ SbVec3f View3DInventorViewer::projectOnFarPlane(const SbVec2f& pt) const SbVec3f pt1, pt2; SoCamera* cam = this->getSoRenderManager()->getCamera(); - if (!cam) return SbVec3f(); // return invalid point + if (!cam) // return invalid point + return SbVec3f(); SbViewVolume vol = cam->getViewVolume(); vol.projectPointToLine(pt, pt1, pt2); @@ -2660,7 +2668,8 @@ void View3DInventorViewer::projectPointToLine(const SbVec2s& pt, SbVec3f& pt1, S SbVec2f pnt2d = getNormalizedPosition(pt); SoCamera* pCam = this->getSoRenderManager()->getCamera(); - if (!pCam) return; + if (!pCam) + return; SbViewVolume vol = pCam->getViewVolume(); vol.projectPointToLine(pnt2d, pt1, pt2); @@ -2754,7 +2763,8 @@ const SoPickedPoint* View3DInventorViewer::getPickedPoint(SoEventCallback* n) co { if (selectionRoot) { auto ret = selectionRoot->getPickedList(n->getAction(), true); - if(ret.size()) return ret[0].pp; + if(ret.size()) + return ret[0].pp; return nullptr; } return n->getPickedPoint(); @@ -2786,7 +2796,8 @@ void View3DInventorViewer::setCameraType(SoType t) // close camera but we don't have this other ugly effect. SoCamera* cam = this->getSoRenderManager()->getCamera(); - if(cam == nullptr) return; + if(cam == nullptr) + return; static_cast(cam)->heightAngle = (float)(M_PI / 4.0); } @@ -2827,7 +2838,8 @@ namespace Gui { void View3DInventorViewer::moveCameraTo(const SbRotation& rot, const SbVec3f& pos, int steps, int ms) { SoCamera* cam = this->getSoRenderManager()->getCamera(); - if (cam == nullptr) return; + if (cam == nullptr) + return; CameraAnimation anim(cam, rot, pos); anim.setDuration(Base::clamp(ms,0,5000)); @@ -2991,9 +3003,11 @@ void View3DInventorViewer::viewAll(float factor) { SoCamera* cam = this->getSoRenderManager()->getCamera(); - if (!cam) return; + if (!cam) + return; - if (factor <= 0.0f) return; + if (factor <= 0.0f) + return; if (factor != 1.0f) { SoSearchAction sa; diff --git a/src/Gui/View3DPy.cpp b/src/Gui/View3DPy.cpp index 060cd09b69..ad2e42cc8f 100644 --- a/src/Gui/View3DPy.cpp +++ b/src/Gui/View3DPy.cpp @@ -943,7 +943,8 @@ Py::Object View3DInventorPy::viewPosition(const Py::Tuple& args) } SoCamera* cam = getView3DIventorPtr()->getViewer()->getSoRenderManager()->getCamera(); - if (!cam) return Py::None(); + if (!cam) + return Py::None(); SbRotation rot = cam->orientation.getValue(); SbVec3f pos = cam->position.getValue(); @@ -1783,7 +1784,8 @@ void View3DInventorPy::eventCallback(void * ud, SoEventCallback * n) try { Py::Dict dict; const SoEvent* e = n->getEvent(); - if (!e) return; // invalid event + if (!e) // invalid event + return; // Type dict.setItem("Type", Py::String(std::string(e->getTypeId().getName().getString()))); // Time diff --git a/src/Gui/ViewProvider.cpp b/src/Gui/ViewProvider.cpp index dc265b759d..29f94b01d4 100644 --- a/src/Gui/ViewProvider.cpp +++ b/src/Gui/ViewProvider.cpp @@ -904,7 +904,8 @@ std::vector< App::DocumentObject* > ViewProvider::claimChildren3D(void) const return vec; } bool ViewProvider::getElementPicked(const SoPickedPoint *pp, std::string &subname) const { - if(!isSelectable()) return false; + if(!isSelectable()) + return false; auto vector = getExtensionsDerivedFromType(); for(Gui::ViewProviderExtension* ext : vector) { if(ext->extensionGetElementPicked(pp,subname)) diff --git a/src/Gui/ViewProviderDocumentObject.cpp b/src/Gui/ViewProviderDocumentObject.cpp index 26daa82db9..ad26d09c15 100644 --- a/src/Gui/ViewProviderDocumentObject.cpp +++ b/src/Gui/ViewProviderDocumentObject.cpp @@ -581,7 +581,8 @@ bool ViewProviderDocumentObject::showInTree() const { bool ViewProviderDocumentObject::getElementPicked(const SoPickedPoint *pp, std::string &subname) const { - if(!isSelectable()) return false; + if(!isSelectable()) + return false; auto vector = getExtensionsDerivedFromType(); for(Gui::ViewProviderExtension* ext : vector) if(ext->extensionGetElementPicked(pp,subname)) @@ -601,7 +602,8 @@ bool ViewProviderDocumentObject::getElementPicked(const SoPickedPoint *pp, std:: if(idx<0 || idx+1>=path->getLength()) return false; auto vp = getDocument()->getViewProvider(path->getNode(idx+1)); - if(!vp) return false; + if(!vp) + return false; auto obj = vp->getObject(); if(!obj || !obj->getNameInDocument()) return false; @@ -629,13 +631,17 @@ bool ViewProviderDocumentObject::getDetailPath(const char *subname, SoFullPath * } const char *dot = strchr(subname,'.'); - if(!dot) return false; + if(!dot) + return false; auto obj = getObject(); - if(!obj || !obj->getNameInDocument()) return false; + if(!obj || !obj->getNameInDocument()) + return false; auto sobj = obj->getSubObject(std::string(subname,dot-subname+1).c_str()); - if(!sobj) return false; + if(!sobj) + return false; auto vp = Application::Instance->getViewProvider(sobj); - if(!vp) return false; + if(!vp) + return false; auto childRoot = getChildRoot(); if(!childRoot) diff --git a/src/Gui/ViewProviderInventorObject.cpp b/src/Gui/ViewProviderInventorObject.cpp index 7ab56b8184..96900b6269 100644 --- a/src/Gui/ViewProviderInventorObject.cpp +++ b/src/Gui/ViewProviderInventorObject.cpp @@ -94,7 +94,8 @@ void ViewProviderInventorObject::updateData(const App::Property* prop) SoInput in; std::string buffer = ivObj->Buffer.getValue(); coinRemoveAllChildren(pcBuffer); - if (buffer.empty()) return; + if (buffer.empty()) + return; in.setBuffer((void *)buffer.c_str(), buffer.size()); SoSeparator * node = SoDB::readAll(&in); if (node) { diff --git a/src/Gui/ViewProviderLink.cpp b/src/Gui/ViewProviderLink.cpp index 25e09e926b..4ac8ea3457 100644 --- a/src/Gui/ViewProviderLink.cpp +++ b/src/Gui/ViewProviderLink.cpp @@ -151,7 +151,8 @@ public: } static Pointer get(ViewProviderDocumentObject *vp, LinkOwner *owner) { - if(!vp) return Pointer(); + if(!vp) + return Pointer(); auto ext = vp->getExtensionByType(true); if(!ext) { @@ -272,7 +273,8 @@ public: } void updateSwitch(SoSwitch *node=nullptr) { - if(!isLinked() || !pcLinkedSwitch) return; + if(!isLinked() || !pcLinkedSwitch) + return; int index = pcLinkedSwitch->whichChild.getValue(); for(size_t i=0;igetUseSelectionRoot()) pcSnapshot = new SoFCSelectionRoot; @@ -505,9 +508,11 @@ public: { SoPath *path = pp->getPath(); int index = path->findNode(pcChildGroup); - if(index<=0) return false; + if(index<=0) + return false; auto it = nodeMap.find(path->getNode(index+1)); - if(it==nodeMap.end()) return false; + if(it==nodeMap.end()) + return false; return it->second->getElementPicked(true,LinkView::SnapshotChild,pp,str); }else{ std::string subname; @@ -540,11 +545,13 @@ public: bool getDetail(bool checkname, int type, const char* subname, SoDetail *&det, SoFullPath *path) const { - if(!isLinked()) return false; + if(!isLinked()) + return false; if(checkname) { subname = checkSubname(pcLinked->getObject(),subname); - if(!subname) return false; + if(!subname) + return false; } if(pcSnapshots[type]->findChild(pcSwitches[type]) < 0) { @@ -563,7 +570,8 @@ public: return false; appendPath(path,pcSwitches[type]); } - if(*subname == 0) return true; + if(*subname == 0) + return true; auto pcSwitch = pcSwitches[type]; if(!pcChildGroup || !pcSwitch || pcSwitch->whichChild.getValue()<0 || @@ -597,7 +605,8 @@ public: const char *dot = strchr(subname,'.'); const char *nextsub = subname; - if(!dot) return false; + if(!dot) + return false; auto geoGroup = pcLinked->getObject(); auto sobj = geoGroup; while(1) { @@ -732,7 +741,8 @@ void ViewProviderLinkObserver::extensionReattach(App::DocumentObject *) { void ViewProviderLinkObserver::extensionOnChanged(const App::Property *prop) { #if 0 auto owner = freecad_dynamic_cast(getExtendedContainer()); - if(!owner || !linkInfo) return; + if(!owner || !linkInfo) + return; if(prop != &owner->Visibility && prop != &owner->DisplayMode) linkInfo->update(); #else @@ -1270,7 +1280,8 @@ std::vector LinkView::getSubNames() const { void LinkView::setNodeType(SnapshotType type, bool sublink) { autoSubLink = sublink; - if(nodeType==type) return; + if(nodeType==type) + return; if(type>=SnapshotMax || (type<0 && type!=SnapshotContainer && type!=SnapshotContainerTransform)) LINK_THROW(Base::ValueError,"LinkView: invalid node type"); @@ -1445,7 +1456,8 @@ bool LinkView::linkGetElementPicked(const SoPickedPoint *pp, std::string &subnam } } - if(!isLinked()) return false; + if(!isLinked()) + return false; if(nodeType >= 0) { if(linkInfo->getElementPicked(false,nodeType,pp,ss)) { @@ -1455,7 +1467,8 @@ bool LinkView::linkGetElementPicked(const SoPickedPoint *pp, std::string &subnam return false; } auto idx = path->findNode(pcLinkedRoot); - if(idx<0 || idx+1>=path->getLength()) return false; + if(idx<0 || idx+1>=path->getLength()) + return false; auto node = path->getNode(idx+1); for(const auto &v : subInfo) { auto &sub = *v.second; @@ -1494,7 +1507,8 @@ bool LinkView::getGroupHierarchy(int index, SoFullPath *path) const { bool LinkView::linkGetDetailPath(const char *subname, SoFullPath *path, SoDetail *&det) const { - if(!subname || *subname==0) return true; + if(!subname || *subname==0) + return true; auto len = path->getLength(); if(nodeArray.empty()) { if(!appendPathSafe(path,pcLinkRoot)) @@ -1594,7 +1608,8 @@ bool LinkView::linkGetDetailPath(const char *subname, SoFullPath *path, SoDetail } void LinkView::unlink(LinkInfoPtr info) { - if(!info) return; + if(!info) + return; if(info == linkOwner) { linkOwner->remove(this); linkOwner.reset(); @@ -1798,7 +1813,8 @@ void ViewProviderLink::onChanged(const App::Property* prop) { bool ViewProviderLink::setLinkType(App::LinkBaseExtension *ext) { auto propLink = ext->getLinkedObjectProperty(); - if(!propLink) return false; + if(!propLink) + return false; LinkType type; if(hasSubName) type = LinkTypeSubs; @@ -1848,7 +1864,8 @@ static inline bool canScale(const Base::Vector3d &v) { } void ViewProviderLink::updateDataPrivate(App::LinkBaseExtension *ext, const App::Property *prop) { - if(!prop) return; + if(!prop) + return; if(prop == &ext->_ChildCache) { updateElementList(ext); } else if(prop == &ext->_LinkTouched) { @@ -2050,7 +2067,8 @@ void ViewProviderLink::updateElementList(App::LinkBaseExtension *ext) { void ViewProviderLink::checkIcon(const App::LinkBaseExtension *ext) { if(!ext) { ext = getLinkExtension(); - if(!ext) return; + if(!ext) + return; } const char *icon; auto element = freecad_dynamic_cast(getObject()); @@ -2089,7 +2107,8 @@ void ViewProviderLink::applyMaterial() { void ViewProviderLink::finishRestoring() { FC_TRACE("finish restoring"); auto ext = getLinkExtension(); - if(!ext) return; + if(!ext) + return; linkView->setDrawStyle(DrawStyle.getValue(),LineWidth.getValue(),PointSize.getValue()); updateDataPrivate(ext,ext->getLinkedObjectProperty()); if(ext->getLinkPlacementProperty()) @@ -2115,7 +2134,8 @@ void ViewProviderLink::finishRestoring() { bool ViewProviderLink::hasElements(const App::LinkBaseExtension *ext) const { if(!ext) { ext = getLinkExtension(); - if(!ext) return false; + if(!ext) + return false; } const auto &elements = ext->getElementListValue(); return elements.size() && (int)elements.size()==ext->_getElementCountValue(); @@ -2124,7 +2144,8 @@ bool ViewProviderLink::hasElements(const App::LinkBaseExtension *ext) const { bool ViewProviderLink::isGroup(const App::LinkBaseExtension *ext, bool plainGroup) const { if(!ext) { ext = getLinkExtension(); - if(!ext) return false; + if(!ext) + return false; } return (plainGroup && ext->linkedPlainGroup()) || (ext->getElementListProperty() && !ext->getLinkedObjectProperty()); @@ -2297,7 +2318,8 @@ std::string ViewProviderLink::dropObjectEx(App::DocumentObject* obj, bool ViewProviderLink::canDragAndDropObject(App::DocumentObject* obj) const { auto ext = getLinkExtension(); - if(!ext) return true; + if(!ext) + return true; if(isGroup(ext)) { return ext->getLinkModeValue()getDocument()==getObject()->getDocument(); @@ -2313,9 +2335,11 @@ bool ViewProviderLink::canDragAndDropObject(App::DocumentObject* obj) const { } bool ViewProviderLink::getElementPicked(const SoPickedPoint *pp, std::string &subname) const { - if(!isSelectable()) return false; + if(!isSelectable()) + return false; auto ext = getLinkExtension(); - if(!ext) return false; + if(!ext) + return false; if(childVpLink && childVp) { auto path = pp->getPath(); int idx = path->findNode(childVpLink->getSnapshot(LinkView::SnapshotTransform)); @@ -2342,7 +2366,8 @@ bool ViewProviderLink::getDetailPath( const char *subname, SoFullPath *pPath, bool append, SoDetail *&det) const { auto ext = getLinkExtension(); - if(!ext) return false; + if(!ext) + return false; auto len = pPath->getLength(); if(append) { @@ -2963,7 +2988,8 @@ void ViewProviderLink::updateDraggingPlacement(const Base::Placement &pla, bool } bool ViewProviderLink::callDraggerProxy(const char *fname, bool update) { - if(!pcDragger) return false; + if(!pcDragger) + return false; Base::PyGILStateLocker lock; try { auto* proxy = getPropertyByName("Proxy"); @@ -3341,7 +3367,8 @@ void ViewProviderLink::applyColors() { void ViewProviderLink::setOverrideMode(const std::string &mode) { auto ext = getLinkExtension(); - if(!ext) return; + if(!ext) + return; auto obj = ext->getTrueLinkedObject(false); if(obj && obj!=getObject()) { auto vp = Application::Instance->getViewProvider(obj); diff --git a/src/Gui/ViewProviderPythonFeature.cpp b/src/Gui/ViewProviderPythonFeature.cpp index 3de75aad5f..0085bcb537 100644 --- a/src/Gui/ViewProviderPythonFeature.cpp +++ b/src/Gui/ViewProviderPythonFeature.cpp @@ -465,7 +465,8 @@ ViewProviderPythonFeatureImp::getElementPicked(const SoPickedPoint *pp, std::str Py::Tuple args(1); args.setItem(0, Py::Object(pivy, true)); Py::Object ret(Base::pyCall(py_getElementPicked.ptr(),args.ptr())); - if(!ret.isString()) return Rejected; + if(!ret.isString()) + return Rejected; subname = ret.as_string(); return Accepted; }