diff --git a/data/examples/draft_test_objects.FCStd b/data/examples/draft_test_objects.FCStd index 2f40a67f2b..4293fa4c90 100644 Binary files a/data/examples/draft_test_objects.FCStd and b/data/examples/draft_test_objects.FCStd differ diff --git a/src/App/DocumentObject.h b/src/App/DocumentObject.h index ca86a0719e..f4202f6eb8 100644 --- a/src/App/DocumentObject.h +++ b/src/App/DocumentObject.h @@ -78,7 +78,7 @@ public: DocumentObjectExecReturn(const char* sWhy, DocumentObject* WhichObject=0) : Which(WhichObject) { - if(sWhy) + if (sWhy) Why = sWhy; } diff --git a/src/App/Extension.cpp b/src/App/Extension.cpp index f0fb3d59f2..fe55f97ca9 100644 --- a/src/App/Extension.cpp +++ b/src/App/Extension.cpp @@ -74,13 +74,13 @@ Extension::~Extension() void Extension::initExtensionType(Base::Type type) { m_extensionType = type; - if(m_extensionType.isBad()) + if (m_extensionType.isBad()) throw Base::RuntimeError("Extension: Extension type not set"); } void Extension::initExtension(ExtensionContainer* obj) { - if(m_extensionType.isBad()) + if (m_extensionType.isBad()) throw Base::RuntimeError("Extension: Extension type not set"); //all properties are initialised without PropertyContainer father. Now that we know it we can @@ -107,13 +107,13 @@ PyObject* Extension::getExtensionPyObject(void) { std::string Extension::name() const { - if(m_extensionType.isBad()) + if (m_extensionType.isBad()) throw Base::RuntimeError("Extension::name: Extension type not set"); std::string temp(m_extensionType.getName()); std::string::size_type pos = temp.find_last_of(':'); - if(pos != std::string::npos) + if (pos != std::string::npos) return temp.substr(pos+1); else return std::string(); diff --git a/src/App/Property.h b/src/App/Property.h index 07df953ffd..be321d346c 100644 --- a/src/App/Property.h +++ b/src/App/Property.h @@ -329,7 +329,7 @@ public: * before, and only then will it call the property's aboutToSetValue(). */ void aboutToChange() { - if(!mProp.hasChanged) { + if (!mProp.hasChanged) { mProp.hasChanged = true; mProp.aboutToSetValue(); } @@ -350,12 +350,12 @@ public: // Must make sure to not throw in a destructor try { mProp.hasSetValue(); - }catch(Base::Exception &e) { + } catch(Base::Exception &e) { e.ReportException(); - }catch(...) {} + } catch(...) {} mProp.hasChanged = false; } - if(mProp.signalCounter>0) + if (mProp.signalCounter>0) mProp.signalCounter--; } @@ -367,9 +367,9 @@ public: // Destructor cannot throw. So we provide this function to allow error // propagation. void tryInvoke() { - if(mProp.signalCounter==1 && mProp.hasChanged) { + if (mProp.signalCounter==1 && mProp.hasChanged) { mProp.hasSetValue(); - if(mProp.signalCounter>0) + if (mProp.signalCounter>0) --mProp.signalCounter; mProp.hasChanged = false; } @@ -500,14 +500,14 @@ public: virtual void set1Value(int index, const_reference value) { int size = getSize(); - if(index<-1 || index>size) + if (index<-1 || index>size) throw Base::RuntimeError("index out of bound"); atomic_change guard(*this); - if(index==-1 || index == size) { + if (index==-1 || index == size) { index = size; setSize(index+1,value); - }else + } else _lValueList[index] = value; this->_touchList.insert(index); guard.tryInvoke(); @@ -517,17 +517,17 @@ protected: void setPyValues(const std::vector &vals, const std::vector &indices) override { - if(indices.empty()) { + if (indices.empty()) { ListT values; values.resize(vals.size()); - for(std::size_t i=0,count=vals.size();i::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) + for (std::set::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) delete (*Iter); } @@ -383,32 +383,32 @@ void ConsoleSingleton::DetachObserver(ILogger *pcObserver) void ConsoleSingleton::NotifyMessage(const char *sMsg) { - for(std::set::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) { - if((*Iter)->bMsg) + for (std::set::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) { + if ((*Iter)->bMsg) (*Iter)->SendLog(sMsg, LogStyle::Message); // send string to the listener } } void ConsoleSingleton::NotifyWarning(const char *sMsg) { - for(std::set::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) { - if((*Iter)->bWrn) + for (std::set::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) { + if ((*Iter)->bWrn) (*Iter)->SendLog(sMsg, LogStyle::Warning); // send string to the listener } } void ConsoleSingleton::NotifyError(const char *sMsg) { - for(std::set::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) { - if((*Iter)->bErr) + for (std::set::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) { + if ((*Iter)->bErr) (*Iter)->SendLog(sMsg, LogStyle::Error); // send string to the listener } } void ConsoleSingleton::NotifyLog(const char *sMsg) { - for(std::set::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) { - if((*Iter)->bLog) + for (std::set::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) { + if ((*Iter)->bLog) (*Iter)->SendLog(sMsg, LogStyle::Log); // send string to the listener } } @@ -416,26 +416,26 @@ void ConsoleSingleton::NotifyLog(const char *sMsg) ILogger *ConsoleSingleton::Get(const char *Name) const { const char* OName; - for(std::set::const_iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) { + for (std::set::const_iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) { OName = (*Iter)->Name(); // get the name - if(OName && strcmp(OName,Name) == 0) + if (OName && strcmp(OName,Name) == 0) return *Iter; } return 0; } int *ConsoleSingleton::GetLogLevel(const char *tag, bool create) { - if(!tag) tag = ""; - if(_logLevels.find(tag) != _logLevels.end()) + if (!tag) tag = ""; + if (_logLevels.find(tag) != _logLevels.end()) return &_logLevels[tag]; - if(!create) return 0; + if (!create) return 0; int &ret = _logLevels[tag]; ret = -1; return &ret; } void ConsoleSingleton::Refresh() { - if(_bCanRefresh) + if (_bCanRefresh) qApp->processEvents(QEventLoop::ExcludeUserInputEvents); } @@ -459,7 +459,7 @@ void ConsoleSingleton::Destruct(void) ConsoleSingleton & ConsoleSingleton::Instance(void) { // not initialized? - if(!_pcSingleton) + if (!_pcSingleton) { _pcSingleton = new ConsoleSingleton(); } @@ -681,19 +681,19 @@ PyObject *ConsoleSingleton::sPyGetStatus(PyObject * /*self*/, PyObject *args) PY_TRY{ bool b=false; ILogger *pObs = Instance().Get(pstr1); - if(!pObs) + if (!pObs) { Py_INCREF(Py_None); return Py_None; } - if(strcmp(pstr2,"Log") == 0) + if (strcmp(pstr2,"Log") == 0) b = pObs->bLog; - else if(strcmp(pstr2,"Wrn") == 0) + else if (strcmp(pstr2,"Wrn") == 0) b = pObs->bWrn; - else if(strcmp(pstr2,"Msg") == 0) + else if (strcmp(pstr2,"Msg") == 0) b = pObs->bMsg; - else if(strcmp(pstr2,"Err") == 0) + else if (strcmp(pstr2,"Err") == 0) b = pObs->bErr; return Py_BuildValue("i",b?1:0); @@ -710,22 +710,23 @@ PyObject *ConsoleSingleton::sPySetStatus(PyObject * /*self*/, PyObject *args) PY_TRY{ ILogger *pObs = Instance().Get(pstr1); - if(pObs) + if (pObs) { - if(strcmp(pstr2,"Log") == 0) + if (strcmp(pstr2,"Log") == 0) pObs->bLog = (Bool==0)?false:true; - else if(strcmp(pstr2,"Wrn") == 0) + else if (strcmp(pstr2,"Wrn") == 0) pObs->bWrn = (Bool==0)?false:true; - else if(strcmp(pstr2,"Msg") == 0) + else if (strcmp(pstr2,"Msg") == 0) pObs->bMsg = (Bool==0)?false:true; - else if(strcmp(pstr2,"Err") == 0) + else if (strcmp(pstr2,"Err") == 0) pObs->bErr = (Bool==0)?false:true; else Py_Error(Base::BaseExceptionFreeCADError,"Unknown Message Type (use Log, Err, Msg or Wrn)"); Py_INCREF(Py_None); return Py_None; - } else { + } + else { Py_Error(Base::BaseExceptionFreeCADError,"Unknown Console Type"); } @@ -948,8 +949,8 @@ std::stringstream &LogLevel::prefix(std::stringstream &str, const char *src, int { static FC_TIME_POINT s_tstart; static bool s_timing = false; - if(print_time) { - if(!s_timing) { + if (print_time) { + if (!s_timing) { s_timing = true; _FC_TIME_INIT(s_tstart); } @@ -957,10 +958,10 @@ std::stringstream &LogLevel::prefix(std::stringstream &str, const char *src, int auto d = std::chrono::duration_cast(tnow-s_tstart); str << d.count() << ' '; } - if(print_tag) str << '<' << tag << "> "; - if(print_src==2) { + if (print_tag) str << '<' << tag << "> "; + if (print_src==2) { PyFrameObject* frame = PyEval_GetFrame(); - if(frame) { + if (frame) { line = PyFrame_GetLineNumber(frame); #if PY_MAJOR_VERSION >= 3 src = PyUnicode_AsUTF8(frame->f_code->co_filename); @@ -969,7 +970,7 @@ std::stringstream &LogLevel::prefix(std::stringstream &str, const char *src, int #endif } } - if(print_src && src && src[0]) { + if (print_src && src && src[0]) { #ifdef FC_OS_WIN32 const char *_f = std::strrchr(src, '\\'); #else diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp index 048b0baf46..522429de6d 100644 --- a/src/Base/Exception.cpp +++ b/src/Base/Exception.cpp @@ -91,14 +91,14 @@ void Exception::ReportException (void) const { if (!_isReported) { const char *msg; - if(_sErrMsg.empty()) + if (_sErrMsg.empty()) msg = typeid(*this).name(); else msg = _sErrMsg.c_str(); #ifdef FC_DEBUG - if(_function.size()) { + if (_function.size()) { _FC_ERR(_file.c_str(),_line, _function << " -- " << msg); - }else + } else #endif _FC_ERR(_file.c_str(),_line,msg); _isReported = true; @@ -319,14 +319,14 @@ void FileException::ReportException (void) const { if (!_isReported) { const char *msg; - if(_sErrMsgAndFileName.empty()) + if (_sErrMsgAndFileName.empty()) msg = typeid(*this).name(); else msg = _sErrMsgAndFileName.c_str(); #ifdef FC_DEBUG - if(_function.size()) { + if (_function.size()) { _FC_ERR(_file.c_str(),_line, _function << " -- " << msg); - }else + } else #endif _FC_ERR(_file.c_str(),_line,msg); _isReported = true; diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp index ad7175014e..03b74aee61 100644 --- a/src/Base/Interpreter.cpp +++ b/src/Base/Interpreter.cpp @@ -82,7 +82,7 @@ PyException::PyException(void) _exceptionType = PP_last_exception_type; - if(PP_last_exception_type) { + if (PP_last_exception_type) { // WARNING: we are assuming that python type object will never be // destroyed, so we don't keep reference here to save book-keeping in // our copy constructor and destructor @@ -123,7 +123,7 @@ void PyException::raiseException() { if (_exceptionType == Base::BaseExceptionFreeCADAbort) edict.setItem("sclassname", Py::String(typeid(Base::AbortException).name())); - if(_isReported) + if (_isReported) edict.setItem("breported", Py::True()); Base::ExceptionFactory::Instance().raiseException(edict.ptr()); } diff --git a/src/Base/MatrixPyImp.cpp b/src/Base/MatrixPyImp.cpp index bb3501d3b2..6c18dfe0ca 100644 --- a/src/Base/MatrixPyImp.cpp +++ b/src/Base/MatrixPyImp.cpp @@ -178,10 +178,10 @@ PyObject * MatrixPy::number_power_handler (PyObject* self, PyObject* other, PyOb Base::Matrix4D a = static_cast(self)->value(); long b = Py::Int(other); - if(!b) + if (!b) return new MatrixPy(Matrix4D()); - if(b < 0) { + if (b < 0) { if (fabs(a.determinant()) > DBL_EPSILON) a.inverseGauss(); else { @@ -192,7 +192,7 @@ PyObject * MatrixPy::number_power_handler (PyObject* self, PyObject* other, PyOb } auto res = a; - for(--b;b;--b) + for (--b;b;--b) res *= a; return new MatrixPy(res); } @@ -303,7 +303,7 @@ PyObject* MatrixPy::scale(PyObject * args) PyObject* MatrixPy::hasScale(PyObject * args) { double tol=0; - if(!PyArg_ParseTuple(args, "|d", &tol)) + if (!PyArg_ParseTuple(args, "|d", &tol)) return 0; return Py::new_reference_to(Py::Int(getMatrixPtr()->hasScale(tol))); } diff --git a/src/Base/Quantity.cpp b/src/Base/Quantity.cpp index 4218fc1957..5fab996453 100644 --- a/src/Base/Quantity.cpp +++ b/src/Base/Quantity.cpp @@ -396,11 +396,11 @@ double num_change(char* yytext,char dez_delim,char grp_delim) double ret_val; char temp[40]; int i = 0; - for(char* c=yytext;*c!='\0';c++){ + for (char* c=yytext;*c!='\0';c++){ // skip group delimiter - if(*c==grp_delim) continue; + if (*c==grp_delim) continue; // check for a dez delimiter other then dot - if(*c==dez_delim && dez_delim !='.') + if (*c==dez_delim && dez_delim !='.') temp[i++] = '.'; else temp[i++] = *c; diff --git a/src/Base/Rotation.cpp b/src/Base/Rotation.cpp index 24bb6840b7..4d4971a6c3 100644 --- a/src/Base/Rotation.cpp +++ b/src/Base/Rotation.cpp @@ -121,7 +121,7 @@ void Rotation::evaluateVector() // Taken from // // Note: -1 < w < +1 (|w| == 1 not allowed, with w:=quat[3]) - if((this->quat[3] > -1.0) && (this->quat[3] < 1.0)) { + if ((this->quat[3] > -1.0) && (this->quat[3] < 1.0)) { double rfAngle = acos(this->quat[3]) * 2.0; double scale = sin(rfAngle / 2.0); // Get a normalized vector @@ -287,7 +287,7 @@ void Rotation::setValue(const Vector3d & rotateFrom, const Vector3d & rotateTo) else { // We can use any axis perpendicular to u (and v) Vector3d t = u % Vector3d(1.0, 0.0, 0.0); - if(t.Length() < Base::Vector3d::epsilon()) + if (t.Length() < Base::Vector3d::epsilon()) t = u % Vector3d(0.0, 1.0, 0.0); this->setValue(t.x, t.y, t.z, 0.0); } @@ -455,7 +455,7 @@ Rotation Rotation::slerp(const Rotation & q0, const Rotation & q1, double t) double scale1 = t; double dot = q0.quat[0]*q1.quat[0]+q0.quat[1]*q1.quat[1]+q0.quat[2]*q1.quat[2]+q0.quat[3]*q1.quat[3]; bool neg=false; - if(dot < 0.0) { + if (dot < 0.0) { dot = -dot; neg = true; } @@ -495,10 +495,10 @@ Rotation Rotation::makeRotationByAxes(Vector3d xdir, Vector3d ydir, Vector3d zdi }; //convert priorityOrder string into a sequence of ints. - if(strlen(priorityOrder)!=3) + if (strlen(priorityOrder)!=3) THROWM(ValueError, "makeRotationByAxes: length of priorityOrder is not 3"); int order[3]; - for(int i = 0; i < 3; ++i){ + for (int i = 0; i < 3; ++i){ order[i] = priorityOrder[i] - 'X'; if (order[i] < 0 || order[i] > 2) THROWM(ValueError, "makeRotationByAxes: characters in priorityOrder must be uppercase X, Y, or Z. Some other character encountered.") @@ -531,7 +531,7 @@ Rotation Rotation::makeRotationByAxes(Vector3d xdir, Vector3d ydir, Vector3d zdi //pick up the strict direction Vector3d mainDir; - for(int i = 0; i < 3; ++i){ + for (int i = 0; i < 3; ++i){ mainDir = *(dirs[order[0]]); if (mainDir.Length() > tol) break; @@ -544,7 +544,7 @@ Rotation Rotation::makeRotationByAxes(Vector3d xdir, Vector3d ydir, Vector3d zdi //pick up the 2nd priority direction, "hint" direction. Vector3d hintDir; - for(int i = 0; i < 2; ++i){ + for (int i = 0; i < 2; ++i){ hintDir = *(dirs[order[1]]); if ((hintDir.Cross(mainDir)).Length() > tol) break; @@ -619,7 +619,7 @@ Rotation Rotation::makeRotationByAxes(Vector3d xdir, Vector3d ydir, Vector3d zdi //build the rotation, by constructing a matrix first. Matrix4D m; m.setToUnity(); - for(int i = 0; i < 3; ++i){ + for (int i = 0; i < 3; ++i){ //matrix indexing: [row][col] m[0][i] = finaldirs[i].x; m[1][i] = finaldirs[i].y; diff --git a/src/Base/Tools.h b/src/Base/Tools.h index 7b0826bcc8..1decb4517d 100644 --- a/src/Base/Tools.h +++ b/src/Base/Tools.h @@ -202,12 +202,12 @@ struct FlagToggler { FlagToggler(Flag &_flag, Flag check) :flag(_flag),toggled(check==_flag) { - if(toggled) + if (toggled) flag = !flag; } ~FlagToggler() { - if(toggled) + if (toggled) flag = !flag; } }; diff --git a/src/Base/Tools2D.cpp b/src/Base/Tools2D.cpp index 973469d36f..b62aeb4a18 100644 --- a/src/Base/Tools2D.cpp +++ b/src/Base/Tools2D.cpp @@ -425,29 +425,29 @@ void Polygon2d::Intersect (const Polygon2d &rclPolygon, std::list &rc } bool Polygon2d::Intersect (const Polygon2d &other) const { - if(other.GetCtVectors()<2 || GetCtVectors() < 2) + if (other.GetCtVectors()<2 || GetCtVectors() < 2) return false; - for(auto &v : _aclVct) { - if(other.Contains(v)) + for (auto &v : _aclVct) { + if (other.Contains(v)) return true; } - if(Contains(other[0])) + if (Contains(other[0])) return true; - for(size_t j=1; j::const_iterator pos; pos = typemap.find(name); - if(pos != typemap.end()) + if (pos != typemap.end()) return typedata[pos->second]->type; else return Type::badType(); @@ -186,7 +186,7 @@ Type Type::fromName(const char *name) Type Type::fromKey(unsigned int key) { - if(key < typedata.size()) + if (key < typedata.size()) return typedata[key]->type; else return Type::badType(); @@ -207,7 +207,7 @@ bool Type::isDerivedFrom(const Type type) const Type temp(*this); do { - if(temp == type) + if (temp == type) return true; temp = temp.getParent(); } while (temp != badType()); @@ -221,7 +221,7 @@ int Type::getAllDerivedFrom(const Type type, std::vector & List) for(std::vector::const_iterator it = typedata.begin();it!= typedata.end();++it) { - if((*it)->type.isDerivedFrom(type)) + if ((*it)->type.isDerivedFrom(type)) { List.push_back((*it)->type); cnt++; diff --git a/src/Base/Unit.cpp b/src/Base/Unit.cpp index 933118700e..f3c63b763f 100644 --- a/src/Base/Unit.cpp +++ b/src/Base/Unit.cpp @@ -355,7 +355,7 @@ QString Unit::getString(void) const } if (Sig.Mass < 0) { - if(mult) + if (mult) ret<<'*'; mult = true; ret << "kg"; @@ -364,7 +364,7 @@ QString Unit::getString(void) const } if (Sig.Time < 0) { - if(mult) + if (mult) ret<<'*'; mult = true; ret << "s"; @@ -373,7 +373,7 @@ QString Unit::getString(void) const } if (Sig.ElectricCurrent < 0) { - if(mult) + if (mult) ret<<'*'; mult = true; ret << "A"; diff --git a/src/Base/UnitPyImp.cpp b/src/Base/UnitPyImp.cpp index 768abd2b30..07ebb12056 100644 --- a/src/Base/UnitPyImp.cpp +++ b/src/Base/UnitPyImp.cpp @@ -26,7 +26,7 @@ std::string UnitPy::representation(void) const ret << Sig.LuminousIntensity << ","; ret << Sig.Angle << ")"; std::string type = getUnitPtr()->getTypeString().toUtf8().constData(); - if(! type.empty()) + if (! type.empty()) ret << " [" << type << "]"; return ret.str(); diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index c1beaad45a..a79ad6a289 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -1503,7 +1503,7 @@ StdCmdEdit::StdCmdEdit() sToolTipText = QT_TR_NOOP("Toggles the selected object's edit mode"); sWhatsThis = "Std_Edit"; sStatusTip = QT_TR_NOOP("Activates or Deactivates the selected object's edit mode"); - sAccel = "Shift+E"; + sAccel = ""; #if QT_VERSION >= 0x040200 sPixmap = "edit-edit"; #endif diff --git a/src/Gui/DlgSettings3DView.ui b/src/Gui/DlgSettings3DView.ui index 07024daf4e..25c45f3814 100644 --- a/src/Gui/DlgSettings3DView.ui +++ b/src/Gui/DlgSettings3DView.ui @@ -214,6 +214,45 @@ but slower response to any scene changes. + + + + + + Transparent objects: + + + + + + + + 120 + 0 + + + + Render types of transparent objects + + + TransparentObjectRenderType + + + View + + + + One pass + + + + + Backface pass + + + + + @@ -223,7 +262,7 @@ but slower response to any scene changes. - + @@ -236,14 +275,14 @@ but slower response to any scene changes. - + Eye to eye distance for stereo modes - + @@ -279,7 +318,7 @@ bounding box size of the 3D object that is currently displayed. - + Backlight is enabled with the defined color @@ -295,7 +334,7 @@ bounding box size of the 3D object that is currently displayed. - + false @@ -318,7 +357,7 @@ bounding box size of the 3D object that is currently displayed. - + Qt::Horizontal @@ -331,7 +370,7 @@ bounding box size of the 3D object that is currently displayed. - + false @@ -347,7 +386,7 @@ bounding box size of the 3D object that is currently displayed. - + false diff --git a/src/Gui/DlgSettings3DViewImp.cpp b/src/Gui/DlgSettings3DViewImp.cpp index 6365e0e547..90db0ba8ce 100644 --- a/src/Gui/DlgSettings3DViewImp.cpp +++ b/src/Gui/DlgSettings3DViewImp.cpp @@ -83,6 +83,8 @@ void DlgSettings3DViewImp::saveSettings() index = ui->renderCache->currentIndex(); hGrp->SetInt("RenderCache", index); + ui->comboTransparentRender->onSave(); + QVariant const &vBoxMarkerSize = ui->boxMarkerSize->itemData(ui->boxMarkerSize->currentIndex()); hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt()); @@ -124,6 +126,8 @@ void DlgSettings3DViewImp::loadSettings() index = hGrp->GetInt("RenderCache", 0); ui->renderCache->setCurrentIndex(index); + ui->comboTransparentRender->onRestore(); + int const current = hGrp->GetInt("MarkerSize", 9L); ui->boxMarkerSize->addItem(tr("5px"), QVariant(5)); ui->boxMarkerSize->addItem(tr("7px"), QVariant(7)); diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index b0228fe3c1..71c3608b4a 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -189,6 +189,7 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent, OnChange(*hGrp,"Dimensions3dVisible"); OnChange(*hGrp,"DimensionsDeltaVisible"); OnChange(*hGrp,"PickRadius"); + OnChange(*hGrp,"TransparentObjectRenderType"); stopSpinTimer = new QTimer(this); connect(stopSpinTimer, SIGNAL(timeout()), this, SLOT(stopAnimating())); @@ -414,6 +415,17 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M else if (strcmp(Reason, "PickRadius") == 0) { _viewer->setPickRadius(rGrp.GetFloat("PickRadius", 5.0f)); } + else if (strcmp(Reason, "TransparentObjectRenderType") == 0) { + long renderType = rGrp.GetInt("TransparentObjectRenderType", 0); + if (renderType == 0) { + _viewer->getSoRenderManager()->getGLRenderAction() + ->setTransparentDelayedObjectRenderType(SoGLRenderAction::ONE_PASS); + } + else if (renderType == 1) { + _viewer->getSoRenderManager()->getGLRenderAction() + ->setTransparentDelayedObjectRenderType(SoGLRenderAction::NONSOLID_SEPARATE_BACKFACE_PASS); + } + } else { unsigned long col1 = rGrp.GetUnsigned("BackgroundColor",3940932863UL); unsigned long col2 = rGrp.GetUnsigned("BackgroundColor2",859006463UL); // default color (dark blue) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 519a904e8d..0458794dea 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -1332,22 +1332,27 @@ bool View3DInventorViewer::isEnabledVBO() const void View3DInventorViewer::setRenderCache(int mode) { - if(mode<0) { + if (mode<0) { ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ("User parameter:BaseApp/Preferences/View"); - int setting = hGrp->GetInt("RenderCache",0); - if(mode==-2) { - if(pcViewProviderRoot && setting!=1) + + int setting = hGrp->GetInt("RenderCache", 0); + if (mode == -2) { + if (pcViewProviderRoot && setting != 1) pcViewProviderRoot->renderCaching = SoSeparator::ON; mode = 2; - }else{ - if(pcViewProviderRoot) + } + else { + if (pcViewProviderRoot) pcViewProviderRoot->renderCaching = SoSeparator::AUTO; mode = setting; } } + SoFCSeparator::setCacheMode( - mode==0?SoSeparator::AUTO:(mode==1?SoSeparator::ON:SoSeparator::OFF)); + mode == 0 ? SoSeparator::AUTO : + (mode == 1 ? SoSeparator::ON : SoSeparator::OFF) + ); } void View3DInventorViewer::setEnabledNaviCube(bool on) diff --git a/src/Mod/Cloud/App/AppCloud.cpp b/src/Mod/Cloud/App/AppCloud.cpp index d1ae135e13..e669c67cf9 100644 --- a/src/Mod/Cloud/App/AppCloud.cpp +++ b/src/Mod/Cloud/App/AppCloud.cpp @@ -212,6 +212,11 @@ void Cloud::CloudWriter::createBucket() // Let's build the Header and call to curl curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); +#ifdef ALLOW_SELF_SIGNED_CERTIFICATE + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); +#endif + if ( curl ) { struct curl_slist *chunk = NULL; @@ -390,6 +395,10 @@ Cloud::CloudWriter::CloudWriter(const char* Url, const char* AccessKey, const ch // Let's build the Header and call to curl curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); +#ifdef ALLOW_SELF_SIGNED_CERTIFICATE + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); +#endif if ( curl ) { // Let's build our own header @@ -577,6 +586,10 @@ Cloud::CloudReader::CloudReader(const char* Url, const char* AccessKey, const ch std::string s; RequestData = Cloud::ComputeDigestAmzS3v2("GET", "application/xml", path, this->SecretKey, NULL, 0); curl = curl_easy_init(); +#ifdef ALLOW_SELF_SIGNED_CERTIFICATE + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); +#endif if ( curl ) { // Let's build our own header @@ -661,6 +674,10 @@ void Cloud::CloudReader::DownloadFile(Cloud::CloudReader::FileEntry *entry) // Let's build the Header and call to curl curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); +#ifdef ALLOW_SELF_SIGNED_CERTIFICATE + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); +#endif if ( curl ) { struct curl_slist *chunk = NULL; @@ -771,6 +788,10 @@ void Cloud::CloudWriter::pushCloud(const char *FileName, const char *data, long // Let's build the Header and call to curl curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); +#ifdef ALLOW_SELF_SIGNED_CERTIFICATE + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); +#endif if ( curl ) { struct curl_slist *chunk = NULL; diff --git a/src/Mod/Cloud/CMakeLists.txt b/src/Mod/Cloud/CMakeLists.txt index e7293661e1..c2519f4f84 100644 --- a/src/Mod/Cloud/CMakeLists.txt +++ b/src/Mod/Cloud/CMakeLists.txt @@ -1,8 +1,10 @@ +#----------------------------- Control certificate validation ------------ +option(ALLOW_SELF_SIGNED_CERTIFICATE "Allow self signed certificate" OFF) +if (ALLOW_SELF_SIGNED_CERTIFICATE) +add_compile_options("-DALLOW_SELF_SIGNED_CERTIFICATE") +endif () #------------------------------ OpenSSL and CURL ------------------------- -if (APPLE) - set(OPENSSL_ROOT_DIR ${HOMEBREW_PREFIX}/Cellar/openssl/*) -endif(APPLE) -if (UNIX AND NOT APPLE) +if (UNIX AND APPLE) find_package(PkgConfig REQUIRED) pkg_search_module(OPENSSL REQUIRED openssl) elseif(WIN32 AND LIBPACK_FOUND) @@ -27,8 +29,8 @@ elseif(WIN32 AND LIBPACK_FOUND) set(OPENSSL_VERSION ${openssl_version_str}) endif () else() - find_package(OPENSSL REQUIRED) -endif(UNIX AND NOT APPLE) + find_package(OpenSSL REQUIRED) +endif(UNIX AND APPLE) if(OPENSSL_FOUND) message(STATUS "openssl-${OPENSSL_VERSION} has been found\n") else() diff --git a/src/Mod/Draft/CMakeLists.txt b/src/Mod/Draft/CMakeLists.txt index fa8f6673c2..37658b24c4 100644 --- a/src/Mod/Draft/CMakeLists.txt +++ b/src/Mod/Draft/CMakeLists.txt @@ -13,7 +13,6 @@ SET(Draft_SRCS_base DraftVecUtils.py DraftGeomUtils.py DraftLayer.py - DraftEdit.py DraftFillet.py WorkingPlane.py getSVG.py @@ -85,6 +84,7 @@ SET(Draft_GUI_tools draftguitools/gui_snaps.py draftguitools/gui_snapper.py draftguitools/gui_trackers.py + draftguitools/gui_edit.py draftguitools/README.md ) diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index 8e3798f824..4c12910ac3 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -1619,7 +1619,7 @@ class DraftToolBar: """this function sends the entered text to the active draft command if enter has been pressed twice. Otherwise it blanks the line. """ - self.sourceCmd.text = self.textValue.toPlainText().split() + self.sourceCmd.text = self.textValue.toPlainText().splitlines() self.sourceCmd.createObject() def displayPoint(self, point=None, last=None, plane=None, mask=None): diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index 912e11f803..ab7f5428bb 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -36,7 +36,7 @@ __url__ = "https://www.freecadweb.org" # Generic stuff #--------------------------------------------------------------------------- -import sys, os, FreeCAD, FreeCADGui, WorkingPlane, math, re, Draft, Draft_rc, DraftVecUtils +import sys, FreeCAD, FreeCADGui, WorkingPlane, math, Draft, Draft_rc, DraftVecUtils from FreeCAD import Vector from PySide import QtCore,QtGui import DraftGui @@ -56,9 +56,9 @@ if not hasattr(FreeCAD, "DraftWorkingPlane"): # Commands that have been migrated to their own modules #--------------------------------------------------------------------------- -import DraftEdit -# import DraftFillet +import draftguitools.gui_edit import draftguitools.gui_selectplane +# import DraftFillet import drafttaskpanels.task_shapestring as task_shapestring import drafttaskpanels.task_scale as task_scale diff --git a/src/Mod/Draft/DraftEdit.py b/src/Mod/Draft/draftguitools/gui_edit.py similarity index 99% rename from src/Mod/Draft/DraftEdit.py rename to src/Mod/Draft/draftguitools/gui_edit.py index 095115269c..09d5687e50 100644 --- a/src/Mod/Draft/DraftEdit.py +++ b/src/Mod/Draft/draftguitools/gui_edit.py @@ -1,4 +1,8 @@ -# -*- coding: utf8 -*- +"""Provide the Draft_Edit command used by the Draft workbench.""" +## @package gui_edit +# \ingroup DRAFT +# \brief Provide the Draft_Edit command used by the Draft workbench + #*************************************************************************** #* Copyright (c) 2009, 2010 Yorik van Havre * #* Copyright (c) 2009, 2010 Ken Cline * diff --git a/src/Mod/Draft/drafttests/test_import_tools.py b/src/Mod/Draft/drafttests/test_import_tools.py index 77bd030f4a..1232da5ef0 100644 --- a/src/Mod/Draft/drafttests/test_import_tools.py +++ b/src/Mod/Draft/drafttests/test_import_tools.py @@ -38,7 +38,7 @@ class DraftImportTools(unittest.TestCase): def test_import_gui_draftedit(self): """Import Draft Edit.""" - module = "DraftEdit" + module = "draftguitools.gui_edit" if not App.GuiUp: aux._no_gui(module) self.assertTrue(True) diff --git a/src/Mod/Part/Gui/DlgSettingsObjectColor.ui b/src/Mod/Part/Gui/DlgSettingsObjectColor.ui index 97da9983d8..9de8a266bd 100644 --- a/src/Mod/Part/Gui/DlgSettingsObjectColor.ui +++ b/src/Mod/Part/Gui/DlgSettingsObjectColor.ui @@ -251,6 +251,9 @@ Two-side rendering + + true + TwoSideRendering diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index 70230e0af6..709873bc3d 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -246,7 +246,7 @@ ViewProviderPartExt::ViewProviderPartExt() ("User parameter:BaseApp/Preferences/Mod/Part"); NormalsFromUV = hPart->GetBool("NormalsFromUVNodes", NormalsFromUV); - long twoside = hPart->GetBool("TwoSideRendering", false) ? 1 : 0; + long twoside = hPart->GetBool("TwoSideRendering", true) ? 1 : 0; // Let the user define a custom lower limit but a value less than // OCCT's epsilon is not allowed diff --git a/src/Mod/Path/PathScripts/PathDeburr.py b/src/Mod/Path/PathScripts/PathDeburr.py index e44ab90c71..aa1b1e6d21 100644 --- a/src/Mod/Path/PathScripts/PathDeburr.py +++ b/src/Mod/Path/PathScripts/PathDeburr.py @@ -59,8 +59,7 @@ def toolDepthAndOffset(width, extraDepth, tool): toolOffset = float(tool.FlatRadius) extraOffset = float(tool.Diameter) / 2 - width if 180 == angle else extraDepth / tan offset = toolOffset + extraOffset - if offset < 0.0001: - offset = 0.01 + return (depth, offset)