PD: PR6497 move return statement to new line

This commit is contained in:
Chris Hennes
2022-03-29 12:37:21 -05:00
parent 2ecc125497
commit 65aa374083
9 changed files with 64 additions and 31 deletions

View File

@@ -121,7 +121,8 @@ void UnifiedDatumCommand(Gui::Command &cmd, Base::Type type, std::string name)
support.removeValue(pcActiveBody);
auto Feat = pcActiveBody->getDocument()->getObject(FeatName.c_str());
if (!Feat) return;
if (!Feat)
return;
//test if current selection fits a mode.
if (support.getSize() > 0) {
@@ -311,7 +312,8 @@ void CmdPartDesignShapeBinder::activated(int iMsg)
support.removeValue(pcActiveBody);
auto Feat = pcActiveBody->getObject(FeatName.c_str());
if (!Feat) return;
if (!Feat)
return;
//test if current selection fits a mode.
if (support.getSize() > 0) {
@@ -395,7 +397,8 @@ void CmdPartDesignSubShapeBinder::activated(int iMsg)
binder = dynamic_cast<PartDesign::SubShapeBinder*>(
App::GetApplication().getActiveDocument()->getObject(FeatName.c_str()));
}
if (!binder) return;
if (!binder)
return;
binder->setLinks(std::move(values));
updateActive();
commitCommand();
@@ -1386,7 +1389,8 @@ void CmdPartDesignHole::activated(int iMsg)
Gui::Command* cmd = this;
auto worker = [cmd](Part::Feature* sketch, App::DocumentObject *Feat) {
if (!Feat) return;
if (!Feat)
return;
finishProfileBased(cmd, sketch, Feat);
cmd->adjustCameraPosition();
@@ -1432,7 +1436,8 @@ void CmdPartDesignRevolution::activated(int iMsg)
Gui::Command* cmd = this;
auto worker = [cmd, &pcActiveBody](Part::Feature* sketch, App::DocumentObject *Feat) {
if (!Feat) return;
if (!Feat)
return;
if (sketch->isDerivedFrom(Part::Part2DObject::getClassTypeId())) {
FCMD_OBJ_CMD(Feat,"ReferenceAxis = (" << getObjectCmd(sketch) << ",['V_Axis'])");
@@ -1490,7 +1495,8 @@ void CmdPartDesignGroove::activated(int iMsg)
Gui::Command* cmd = this;
auto worker = [cmd, &pcActiveBody](Part::Feature* sketch, App::DocumentObject *Feat) {
if (!Feat) return;
if (!Feat)
return;
if (sketch->isDerivedFrom(Part::Part2DObject::getClassTypeId())) {
FCMD_OBJ_CMD(Feat,"ReferenceAxis = ("<<getObjectCmd(sketch)<<",['V_Axis'])");
@@ -1556,7 +1562,8 @@ void CmdPartDesignAdditivePipe::activated(int iMsg)
Gui::Command* cmd = this;
auto worker = [cmd](Part::Feature* sketch, App::DocumentObject *Feat) {
if (!Feat) return;
if (!Feat)
return;
// specific parameters for pipe
Gui::Command::updateActive();
@@ -1606,7 +1613,8 @@ void CmdPartDesignSubtractivePipe::activated(int iMsg)
Gui::Command* cmd = this;
auto worker = [cmd](Part::Feature* sketch, App::DocumentObject *Feat) {
if (!Feat) return;
if (!Feat)
return;
// specific parameters for pipe
Gui::Command::updateActive();
@@ -1656,7 +1664,8 @@ void CmdPartDesignAdditiveLoft::activated(int iMsg)
Gui::Command* cmd = this;
auto worker = [cmd](Part::Feature* sketch, App::DocumentObject *Feat) {
if (!Feat) return;
if (!Feat)
return;
// specific parameters for pipe
Gui::Command::updateActive();
@@ -1706,7 +1715,8 @@ void CmdPartDesignSubtractiveLoft::activated(int iMsg)
Gui::Command* cmd = this;
auto worker = [cmd](Part::Feature* sketch, App::DocumentObject *Feat) {
if (!Feat) return;
if (!Feat)
return;
// specific parameters for pipe
Gui::Command::updateActive();
@@ -1755,7 +1765,8 @@ void CmdPartDesignAdditiveHelix::activated(int iMsg)
Gui::Command* cmd = this;
auto worker = [cmd, &pcActiveBody](Part::Feature* sketch, App::DocumentObject *Feat) {
if (!Feat) return;
if (!Feat)
return;
// Creating a helix with default values isn't always valid but fixes
// itself when more values are set. So, this guard is used to suppress
@@ -1831,7 +1842,8 @@ void CmdPartDesignSubtractiveHelix::activated(int iMsg)
Gui::Command* cmd = this;
auto worker = [cmd, &pcActiveBody](Part::Feature* sketch, App::DocumentObject *Feat) {
if (!Feat) return;
if (!Feat)
return;
// specific parameters for helix
Gui::Command::updateActive();
@@ -1950,7 +1962,8 @@ void finishDressupFeature(const Gui::Command* cmd, const std::string& which,
std::string FeatName = cmd->getUniqueObjectName(which.c_str(), base);
auto body = PartDesignGui::getBodyFor(base, false);
if (!body) return;
if (!body)
return;
cmd->openCommand((std::string("Make ") + which).c_str());
FCMD_OBJ_CMD(body,"newObject('PartDesign::"<<which<<"','"<<FeatName<<"')");
auto Feat = body->getDocument()->getObject(FeatName.c_str());
@@ -2532,7 +2545,8 @@ void CmdPartDesignMultiTransform::activated(int iMsg)
f++;
}
if (features.empty()) return;
if (features.empty())
return;
// Note: If multiple Transformed features were selected, only the first one is used
PartDesign::Transformed* trFeat = static_cast<PartDesign::Transformed*>(features.front());
@@ -2634,7 +2648,8 @@ void CmdPartDesignBoolean::activated(int iMsg)
{
Q_UNUSED(iMsg);
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(/*messageIfNot = */true);
if (!pcActiveBody) return;
if (!pcActiveBody)
return;
Gui::SelectionFilter BodyFilter("SELECT Part::Feature COUNT 1..");

View File

@@ -667,10 +667,13 @@ void CmdPartDesignMoveFeature::activated(int iMsg)
{
Q_UNUSED(iMsg);
std::vector<App::DocumentObject*> features = getSelection().getObjectsOfType(Part::Feature::getClassTypeId());
if (features.empty()) return;
if (features.empty())
return;
// Check if all features are valid to move
if (std::any_of(std::begin(features), std::end(features), [](App::DocumentObject* obj){return !PartDesignGui::isFeatureMovable(obj); }))
if (std::any_of(std::begin(features), std::end(features), [](App::DocumentObject* obj){
return !PartDesignGui::isFeatureMovable(obj);
}))
{
//show messagebox and cancel
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Features cannot be moved"),
@@ -725,9 +728,11 @@ void CmdPartDesignMoveFeature::activated(int iMsg)
qApp->translate("PartDesign_MoveFeature", "Select body"),
qApp->translate("PartDesign_MoveFeature", "Select a body from the list"),
items, 0, false, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok) return;
if (!ok)
return;
int index = items.indexOf(text);
if (index < 0) return;
if (index < 0)
return;
PartDesign::Body* target = static_cast<PartDesign::Body*>(target_bodies[index]);
@@ -829,7 +834,8 @@ void CmdPartDesignMoveFeatureInTree::activated(int iMsg)
{
Q_UNUSED(iMsg);
std::vector<App::DocumentObject*> features = getSelection().getObjectsOfType(Part::Feature::getClassTypeId());
if (features.empty()) return;
if (features.empty())
return;
PartDesign::Body *body = PartDesignGui::getBodyFor ( features.front(), false );
App::DocumentObject * bodyBase = nullptr;
@@ -875,7 +881,8 @@ void CmdPartDesignMoveFeatureInTree::activated(int iMsg)
qApp->translate("PartDesign_MoveFeatureInTree", "Select feature"),
qApp->translate("PartDesign_MoveFeatureInTree", "Select a feature from the list"),
items, 0, false, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok) return;
if (!ok)
return;
int index = items.indexOf(text);
// first object is the beginning of the body
App::DocumentObject* target = index != 0 ? model[index-1] : nullptr;

View File

@@ -118,7 +118,8 @@ void CmdPrimtiveCompAdditive::activated(int iMsg)
auto* prm = static_cast<PartDesign::FeaturePrimitive*>(
pcActiveBody->getDocument()->getObject(FeatName.c_str()));
if(!prm) return;
if(!prm)
return;
FCMD_OBJ_CMD(pcActiveBody,"addObject("<<getObjectCmd(prm)<<")");
Gui::Command::updateActive();

View File

@@ -452,7 +452,8 @@ void TaskMultiTransformParameters::moveTransformFeature(const int increment)
PartDesign::MultiTransform* pcMultiTransform = static_cast<PartDesign::MultiTransform*>(TransformedView->getObject());
std::vector<App::DocumentObject*> transformFeatures = pcMultiTransform->Transformations.getValues();
if (transformFeatures.empty()) return;
if (transformFeatures.empty())
return;
App::DocumentObject* feature = transformFeatures[row];
transformFeatures.erase(transformFeatures.begin() + row);

View File

@@ -203,7 +203,8 @@ void TaskTransformedParameters::onButtonAddFeature(bool checked)
void TaskTransformedParameters::checkVisibility() {
auto feat = getObject();
auto body = feat->getFeatureBody();
if(!body) return;
if(!body)
return;
auto inset = feat->getInListEx(true);
inset.emplace(feat);
for(auto o : body->Group.getValues()) {

View File

@@ -68,7 +68,8 @@ bool setEdit(App::DocumentObject *obj, PartDesign::Body *body) {
}
}
auto *activeView = Gui::Application::Instance->activeView();
if(!activeView) return false;
if(!activeView)
return false;
App::DocumentObject *parent = nullptr;
std::string subname;
auto activeBody = activeView->getActiveObject<PartDesign::Body*>(PDBODYKEY,&parent,&subname);
@@ -451,7 +452,9 @@ bool isFeatureMovable(App::DocumentObject* const feat)
return false;
if (auto prop = static_cast<App::PropertyLinkList*>(prim->getPropertyByName("Sections"))) {
if (std::any_of(prop->getValues().begin(), prop->getValues().end(), [](App::DocumentObject* obj){return !isFeatureMovable(obj); }))
if (std::any_of(prop->getValues().begin(), prop->getValues().end(), [](App::DocumentObject* obj){
return !isFeatureMovable(obj);
}))
return false;
}

View File

@@ -274,7 +274,8 @@ bool ViewProviderDatum::doubleClicked(void)
if(!activeDoc)
activeDoc = getDocument();
auto activeView = activeDoc->getActiveView();
if(!activeView) return false;
if(!activeView)
return false;
std::string Msg("Edit ");
Msg += this->pcObject->Label.getValue();

View File

@@ -86,10 +86,12 @@ void ViewProviderDressUp::highlightReferences(const bool on)
{
PartDesign::DressUp* pcDressUp = static_cast<PartDesign::DressUp*>(getObject());
Part::Feature* base = pcDressUp->getBaseObject (/*silent =*/ true);
if (base == nullptr) return;
if (base == nullptr)
return;
PartGui::ViewProviderPart* vp = dynamic_cast<PartGui::ViewProviderPart*>(
Gui::Application::Instance->getViewProvider(base));
if (vp == nullptr) return;
if (vp == nullptr)
return;
std::vector<std::string> faces = pcDressUp->Base.getSubValuesStartsWith("Face");
std::vector<std::string> edges = pcDressUp->Base.getSubValuesStartsWith("Edge");

View File

@@ -144,7 +144,8 @@ void ViewProviderShapeBinder::highlightReferences(const bool on, bool /*auxiliar
PartGui::ViewProviderPart* svp = dynamic_cast<PartGui::ViewProviderPart*>(
Gui::Application::Instance->getViewProvider(obj));
if (svp == nullptr) return;
if (svp == nullptr)
return;
if (on) {
if (!subs.empty() && originalLineColors.empty()) {
@@ -270,7 +271,8 @@ std::string ViewProviderSubShapeBinder::dropObjectEx(App::DocumentObject* obj, A
const char* subname, const std::vector<std::string>& elements)
{
auto self = dynamic_cast<PartDesign::SubShapeBinder*>(getObject());
if (!self) return std::string();
if (!self)
return std::string();
std::map<App::DocumentObject*, std::vector<std::string> > values;
if (!subname) subname = "";
std::string sub(subname);