Sketcher: ViewProviderSketch inhibit update if internal transaction is ongoing
============================================================================== Inhibit ViewProviderSketch updateData with invalid data (internal transaction). Trigger update internally for internal transactions in SketchObject via touched() so as to trigger updateData. This leads to a reduction of updateData calls.
This commit is contained in:
committed by
abdullahtahiriyo
parent
736aa11f6e
commit
5119513488
@@ -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<int> &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<int> &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++) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user