Mesh: PR6497 move return statement to new line

This commit is contained in:
Chris Hennes
2022-03-29 12:36:30 -05:00
parent a9c33d8f58
commit 3ecd16e0bd
21 changed files with 131 additions and 63 deletions

View File

@@ -102,7 +102,8 @@ CmdMeshTransform::CmdMeshTransform()
void CmdMeshTransform::activated(int)
{
unsigned int n = getSelection().countObjectsOfType(Mesh::Feature::getClassTypeId());
if ( n!=1 ) return;
if ( n!=1 )
return;
std::string fName = getUniqueObjectName("Move");
std::vector<Gui::SelectionSingleton::SelObj> cSel = getSelection().getSelection();
@@ -141,7 +142,8 @@ CmdMeshDemolding::CmdMeshDemolding()
void CmdMeshDemolding::activated(int)
{
unsigned int n = getSelection().countObjectsOfType(Mesh::Feature::getClassTypeId());
if ( n!=1 ) return;
if ( n!=1 )
return;
std::string fName = getUniqueObjectName("Demolding");
std::vector<Gui::SelectionSingleton::SelObj> cSel = getSelection().getSelection();
@@ -608,7 +610,8 @@ void CmdMeshFromGeometry::activated(int)
bool CmdMeshFromGeometry::isActive()
{
App::Document* doc = App::GetApplication().getActiveDocument();
if (!doc) return false;
if (!doc)
return false;
return getSelection().countObjectsOfType(App::GeoFeature::getClassTypeId()) >= 1;
}
@@ -1647,7 +1650,8 @@ void CmdMeshFillupHoles::activated(int)
bool ok;
int FillupHolesOfLength = QInputDialog::getInt(Gui::getMainWindow(), QObject::tr("Fill holes"),
QObject::tr("Fill holes with maximum number of edges:"), 3, 3, 10000, 1, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok) return;
if (!ok)
return;
openCommand(QT_TRANSLATE_NOOP("Command", "Fill up holes"));
for (std::vector<App::DocumentObject*>::const_iterator it = meshes.begin(); it != meshes.end(); ++it) {
doCommand(Doc,"App.activeDocument().getObject(\"%s\").Mesh.fillupHoles(%d)"

View File

@@ -163,7 +163,8 @@ Gui::View3DInventorViewer* MeshSelection::getViewer() const
return ivViewer;
Gui::Document* doc = Gui::Application::Instance->activeDocument();
if (!doc) return nullptr;
if (!doc)
return nullptr;
Gui::MDIView* view = doc->getActiveView();
if (view && view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventor*>(view)->getViewer();

View File

@@ -125,7 +125,8 @@ void RemoveComponents::on_cbDeselectComp_toggled(bool on)
void RemoveComponents::deleteSelection()
{
Gui::Document* doc = Gui::Application::Instance->activeDocument();
if (!doc) return;
if (!doc)
return;
// delete all selected faces
doc->openCommand(QT_TRANSLATE_NOOP("Command", "Delete selection"));
bool ok = meshSel.deleteSelection();

View File

@@ -909,7 +909,8 @@ void SoFCIndexedFaceSet::doAction(SoAction * action)
{
if (action->getTypeId() == Gui::SoGLSelectAction::getClassTypeId()) {
SoNode* node = action->getNodeAppliedTo();
if (!node) return; // on no node applied
if (!node) // on no node applied
return;
// The node we have is the parent of this node and the coordinate node
// thus we search there for it.
@@ -919,7 +920,8 @@ void SoFCIndexedFaceSet::doAction(SoAction * action)
sa.setType(SoCoordinate3::getClassTypeId(), 1);
sa.apply(node);
SoPath * path = sa.getPath();
if (!path) return;
if (!path)
return;
// make sure we got the node we wanted
SoNode* coords = path->getNodeFromTail(0);
@@ -931,7 +933,8 @@ void SoFCIndexedFaceSet::doAction(SoAction * action)
}
else if (action->getTypeId() == Gui::SoVisibleFaceAction::getClassTypeId()) {
SoNode* node = action->getNodeAppliedTo();
if (!node) return; // on no node applied
if (!node) // on no node applied
return;
// The node we have is the parent of this node and the coordinate node
// thus we search there for it.
@@ -941,7 +944,8 @@ void SoFCIndexedFaceSet::doAction(SoAction * action)
sa.setType(SoCoordinate3::getClassTypeId(), 1);
sa.apply(node);
SoPath * path = sa.getPath();
if (!path) return;
if (!path)
return;
// make sure we got the node we wanted
SoNode* coords = path->getNodeFromTail(0);

View File

@@ -114,7 +114,9 @@ SbBool SoSFMeshFacetArray::readValue(SoInput *in)
}
value->resize(numtoread);
if (!this->readBinaryValues(in, numtoread)) { return FALSE; }
if (!this->readBinaryValues(in, numtoread)) {
return FALSE;
}
}
// ** ASCII format *******************************************************
@@ -135,7 +137,8 @@ SbBool SoSFMeshFacetArray::readValue(SoInput *in)
// makeRoom() makes sure the allocation strategy is decent.
if (currentidx >= value->size()) value->resize(currentidx + 1);
if (!this->read1Value(in, currentidx++)) return FALSE;
if (!this->read1Value(in, currentidx++))
return FALSE;
READ_VAL(c);
if (c == ',') { READ_VAL(c); } // Treat trailing comma as whitespace.
@@ -158,7 +161,8 @@ SbBool SoSFMeshFacetArray::readValue(SoInput *in)
else {
in->putBack(c);
value->resize(1);
if (!this->read1Value(in, 0)) return FALSE;
if (!this->read1Value(in, 0))
return FALSE;
}
}
@@ -1046,7 +1050,8 @@ void SoFCMeshFaceSet::computeBBox(SoAction *action, SbBox3f &box, SbVec3f &cente
*/
void SoFCMeshFaceSet::getPrimitiveCount(SoGetPrimitiveCountAction * action)
{
if (!this->shouldPrimitiveCount(action)) return;
if (!this->shouldPrimitiveCount(action))
return;
SoState* state = action->getState();
const MeshCore::MeshFacetArray * coordIndex = SoFCMeshFacetElement::get(state);
action->addNumTriangles(coordIndex->size());
@@ -1193,7 +1198,8 @@ void SoFCMeshOpenEdgeSet::computeBBox(SoAction *action, SbBox3f &box, SbVec3f &c
*/
void SoFCMeshOpenEdgeSet::getPrimitiveCount(SoGetPrimitiveCountAction * action)
{
if (!this->shouldPrimitiveCount(action)) return;
if (!this->shouldPrimitiveCount(action))
return;
SoState* state = action->getState();
const MeshCore::MeshFacetArray * rFaces = SoFCMeshFacetElement::get(state);

View File

@@ -566,7 +566,8 @@ void SoFCMeshNode::computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center)
*/
void SoFCMeshNode::getPrimitiveCount(SoGetPrimitiveCountAction * action)
{
if (!this->shouldPrimitiveCount(action)) return;
if (!this->shouldPrimitiveCount(action))
return;
action->addNumTriangles(countTriangles());
}
@@ -591,7 +592,8 @@ void SoFCMeshNode::write( SoWriteAction* action )
else if (out->getStage() == SoOutput::WRITE) {
const MeshCore::MeshPointArray& rPoints = _mesh->getKernel().GetPoints();
const MeshCore::MeshFacetArray& rFacets = _mesh->getKernel().GetFacets();
if (this->writeHeader(out, FALSE, FALSE)) return;
if (this->writeHeader(out, FALSE, FALSE))
return;
point.setNum(rPoints.size());
unsigned int pos=0;
for (MeshCore::MeshPointArray::_TConstIterator cP=rPoints.begin(); cP!=rPoints.end(); ++cP)
@@ -744,7 +746,8 @@ void SoFCMeshOpenEdge::computeBBox(SoAction *action, SbBox3f &box, SbVec3f &cent
*/
void SoFCMeshOpenEdge::getPrimitiveCount(SoGetPrimitiveCountAction * action)
{
if (!this->shouldPrimitiveCount(action)) return;
if (!this->shouldPrimitiveCount(action))
return;
// Count number of open edges first
int ctEdges=0;

View File

@@ -634,7 +634,8 @@ void SoFCMeshObjectShape::GLRender(SoGLRenderAction *action)
SbBool mode = Gui::SoFCInteractiveElement::get(state);
const Mesh::MeshObject * mesh = SoFCMeshObjectElement::get(state);
if (!mesh || mesh->countPoints() == 0) return;
if (!mesh || mesh->countPoints() == 0)
return;
Binding mbind = this->findMaterialBinding(state);
@@ -974,7 +975,8 @@ void SoFCMeshObjectShape::doAction(SoAction * action)
{
if (action->getTypeId() == Gui::SoGLSelectAction::getClassTypeId()) {
SoNode* node = action->getNodeAppliedTo();
if (!node) return; // on no node applied
if (!node) // on no node applied
return;
// The node we have is the parent of this node and the coordinate node
// thus we search there for it.
@@ -984,7 +986,8 @@ void SoFCMeshObjectShape::doAction(SoAction * action)
sa.setType(SoFCMeshObjectNode::getClassTypeId(), 1);
sa.apply(node);
SoPath * path = sa.getPath();
if (!path) return;
if (!path)
return;
// make sure we got the node we wanted
SoNode* coords = path->getNodeFromTail(0);
@@ -1241,7 +1244,8 @@ void SoFCMeshObjectShape::computeBBox(SoAction *action, SbBox3f &box, SbVec3f &c
*/
void SoFCMeshObjectShape::getPrimitiveCount(SoGetPrimitiveCountAction * action)
{
if (!this->shouldPrimitiveCount(action)) return;
if (!this->shouldPrimitiveCount(action))
return;
SoState* state = action->getState();
const Mesh::MeshObject * mesh = SoFCMeshObjectElement::get(state);
action->addNumTriangles(mesh->countFacets());
@@ -1284,7 +1288,8 @@ void SoFCMeshSegmentShape::GLRender(SoGLRenderAction *action)
SbBool mode = Gui::SoFCInteractiveElement::get(state);
const Mesh::MeshObject * mesh = SoFCMeshObjectElement::get(state);
if (!mesh) return;
if (!mesh)
return;
Binding mbind = this->findMaterialBinding(state);
@@ -1652,7 +1657,8 @@ void SoFCMeshSegmentShape::computeBBox(SoAction *action, SbBox3f &box, SbVec3f &
*/
void SoFCMeshSegmentShape::getPrimitiveCount(SoGetPrimitiveCountAction * action)
{
if (!this->shouldPrimitiveCount(action)) return;
if (!this->shouldPrimitiveCount(action))
return;
SoState* state = action->getState();
const Mesh::MeshObject * mesh = SoFCMeshObjectElement::get(state);
if (mesh && mesh->countSegments() > this->index.getValue()) {
@@ -1684,7 +1690,8 @@ void SoFCMeshObjectBoundary::GLRender(SoGLRenderAction *action)
{
SoState* state = action->getState();
const Mesh::MeshObject * mesh = SoFCMeshObjectElement::get(state);
if (!mesh) return;
if (!mesh)
return;
SoMaterialBundle mb(action);
SoTextureCoordinateBundle tb(action, true, false);
@@ -1801,7 +1808,8 @@ void SoFCMeshObjectBoundary::computeBBox(SoAction *action, SbBox3f &box, SbVec3f
*/
void SoFCMeshObjectBoundary::getPrimitiveCount(SoGetPrimitiveCountAction * action)
{
if (!this->shouldPrimitiveCount(action)) return;
if (!this->shouldPrimitiveCount(action))
return;
SoState* state = action->getState();
const Mesh::MeshObject * mesh = SoFCMeshObjectElement::get(state);
if (!mesh)

View File

@@ -91,7 +91,9 @@ SbBool SoSFMeshPointArray::readValue(SoInput *in)
}
value->resize(numtoread);
if (!this->readBinaryValues(in, numtoread)) { return FALSE; }
if (!this->readBinaryValues(in, numtoread)) {
return FALSE;
}
}
// ** ASCII format *******************************************************
@@ -112,7 +114,8 @@ SbBool SoSFMeshPointArray::readValue(SoInput *in)
// makeRoom() makes sure the allocation strategy is decent.
if (currentidx >= value->size()) value->resize(currentidx + 1);
if (!this->read1Value(in, currentidx++)) return FALSE;
if (!this->read1Value(in, currentidx++))
return FALSE;
READ_VAL(c);
if (c == ',') { READ_VAL(c); } // Treat trailing comma as whitespace.
@@ -135,7 +138,8 @@ SbBool SoSFMeshPointArray::readValue(SoInput *in)
else {
in->putBack(c);
value->resize(1);
if (!this->read1Value(in, 0)) return FALSE;
if (!this->read1Value(in, 0))
return FALSE;
}
}

View File

@@ -81,9 +81,11 @@ void SoPolygon::GLRender(SoGLRenderAction *action)
{
SoState* state = action->getState();
const SoCoordinateElement * coords = SoCoordinateElement::getInstance(state);
if (!coords) return;
if (!coords)
return;
const SbVec3f * points = coords->getArrayPtr3();
if (!points) return;
if (!points)
return;
SoMaterialBundle mb(action);
SoTextureCoordinateBundle tb(action, true, false);
@@ -145,9 +147,11 @@ void SoPolygon::computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center)
{
SoState* state = action->getState();
const SoCoordinateElement * coords = SoCoordinateElement::getInstance(state);
if (!coords) return;
if (!coords)
return;
const SbVec3f * points = coords->getArrayPtr3();
if (!points) return;
if (!points)
return;
float maxX=-FLT_MAX, minX=FLT_MAX,
maxY=-FLT_MAX, minY=FLT_MAX,
maxZ=-FLT_MAX, minZ=FLT_MAX;

View File

@@ -1260,8 +1260,10 @@ std::vector<Mesh::FacetIndex> ViewProviderMesh::getFacetsOfRegion(const SbViewpo
void ViewProviderMesh::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.

View File

@@ -309,7 +309,8 @@ void ViewProviderMeshCurvature::updateData(const App::Property* prop)
}
else if (prop->getTypeId() == Mesh::PropertyCurvatureList::getClassTypeId()) {
const Mesh::PropertyCurvatureList* curv = static_cast<const Mesh::PropertyCurvatureList*>(prop);
if (curv->getSize() < 3) return; // invalid array
if (curv->getSize() < 3) // invalid array
return;
#if 0 // FIXME: Do not always change the range
init(curv); // init color bar
#endif

View File

@@ -258,7 +258,8 @@ std::vector<std::string> ViewProviderMeshNode::getDisplayModes(void) const
bool ViewProviderMeshNode::setEdit(int ModNum)
{
if ( m_bEdit ) return true;
if ( m_bEdit )
return true;
m_bEdit = true;
return true;
}