diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 74b5919714..e04352df98 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -921,8 +921,8 @@ int SketchObject::delGeometry(int GeoId, bool deleteinternalgeo) this->Geometry.setValues(newVals); this->Constraints.setValues(std::move(newConstraints)); } - // Update geometry indices and rebuild vertexindex now - acceptGeometry(); + // Update geometry indices and rebuild vertexindex now via onChanged, so that ViewProvider::UpdateData is triggered. + Geometry.touch(); if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver solve(); @@ -941,8 +941,8 @@ int SketchObject::deleteAllGeometry() this->Geometry.setValues(newVals); this->Constraints.setValues(newConstraints); } - - acceptGeometry(); + // Update geometry indices and rebuild vertexindex now via onChanged, so that ViewProvider::UpdateData is triggered. + Geometry.touch(); if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver solve(); @@ -3579,7 +3579,8 @@ int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, } // we delayed update, so trigger it now. - acceptGeometry(); + // Update geometry indices and rebuild vertexindex now via onChanged, so that ViewProvider::UpdateData is triggered. + Geometry.touch(); return Geometry.getSize()-1; } @@ -4004,7 +4005,8 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 } // we inhibited update, so we trigger it now - acceptGeometry(); + // Update geometry indices and rebuild vertexindex now via onChanged, so that ViewProvider::UpdateData is triggered. + Geometry.touch(); return Geometry.getSize()-1; @@ -4973,7 +4975,8 @@ bool SketchObject::convertToNURBS(int GeoId) } // trigger update now - acceptGeometry(); + // Update geometry indices and rebuild vertexindex now via onChanged, so that ViewProvider::UpdateData is triggered. + Geometry.touch(); delete bspline; @@ -5166,7 +5169,8 @@ bool SketchObject::modifyBSplineKnotMultiplicity(int GeoId, int knotIndex, int m this->Constraints.setValues(newcVals); } // Trigger update now - acceptGeometry(); + // Update geometry indices and rebuild vertexindex now via onChanged, so that ViewProvider::UpdateData is triggered. + Geometry.touch(); std::sort (delGeoId.begin(), delGeoId.end()); @@ -5307,7 +5311,8 @@ int SketchObject::carbonCopy(App::DocumentObject * pObj, bool construction) this->Constraints.setValues(newcVals); } // we trigger now the update (before dealing with expressions) - acceptGeometry(); + // Update geometry indices and rebuild vertexindex now via onChanged, so that ViewProvider::UpdateData is triggered. + Geometry.touch(); int sourceid = 0; for (std::vector< Sketcher::Constraint * >::const_iterator it= scvals.begin(); it != scvals.end(); ++it,nextcid++,sourceid++) { diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index 9cc6de71fc..dc41ffb9c4 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -378,6 +378,8 @@ public: bool isExternalAllowed(App::Document *pDoc, App::DocumentObject *pObj, eReasonList* rsn = 0) const; bool isCarbonCopyAllowed(App::Document *pDoc, App::DocumentObject *pObj, bool & xinv, bool & yinv, eReasonList* rsn = 0) const; + + bool isPerformingInternalTransaction() const {return internaltransaction;}; public: // Analyser functions int autoConstraint(double precision = Precision::Confusion() * 1000, double angleprecision = M_PI/20, bool includeconstruction = true); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index ff0ffaefa7..6543cb5d84 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -5564,8 +5564,12 @@ void ViewProviderSketch::updateData(const App::Property *prop) { ViewProvider2DObject::updateData(prop); + // In the case of an undo/redo transaction, updateData is triggered by SketchObject::onUndoRedoFinished() in the solve() + // In the case of an internal transaction, touching the geometry results in a call to updateData. if ( edit && !getSketchObject()->getDocument()->isPerformingTransaction() && + !getSketchObject()->isPerformingInternalTransaction() && (prop == &(getSketchObject()->Geometry) || prop == &(getSketchObject()->Constraints))) { + edit->FullyConstrained = false; // At this point, we do not need to solve the Sketch // If we are adding geometry an update can be triggered before the sketch is actually solved.