PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
: ModuleBase_IModule(theWshop),
- myIsDragging(false), myRestartingMode(RM_LastFeatureUse), myDragDone(false)
+ myIsDragging(false), myRestartingMode(RM_None), myDragDone(false)
{
//myWorkshop = dynamic_cast<XGUI_Workshop*>(theWshop);
ModuleBase_IViewer* aViewer = aViewer = theWshop->viewer();
FeaturePtr aFeature = theOperation->feature();
std::shared_ptr<SketchPlugin_Feature> aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
- if (aSPFeature && (myRestartingMode != RM_None)) {
+ if (aSPFeature && (myRestartingMode == RM_LastFeatureUse ||
+ myRestartingMode == RM_LastFeatureUse)) {
myLastOperationId = theOperation->id();
myLastFeature = myRestartingMode == RM_LastFeatureUse ? theOperation->feature() : FeaturePtr();
launchOperation(myLastOperationId);
- } else {
- breakOperationSequence();
}
+ breakOperationSequence();
}
void PartSet_Module::breakOperationSequence()
myLastOperationId = "";
myLastFeature = FeaturePtr();
myRestartingMode = RM_None;
-
}
void PartSet_Module::onOperationAborted(ModuleBase_Operation* theOperation)
void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation)
{
- myRestartingMode = RM_LastFeatureUse;
if (theOperation->id().toStdString() == SketchPlugin_Sketch::ID()) {
// Display all sketcher sub-Objects
myCurrentSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theOperation->feature());
std::shared_ptr<SketchPlugin_Feature> aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if (aSPFeature) {
+ if (myRestartingMode != RM_ForbidRestarting)
+ myRestartingMode = RM_LastFeatureUse;
aOperation->commit();
}
}
ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
if (aWidgets.last() == aPanel->activeWidget()) {
- breakOperationSequence();
+ myRestartingMode = RM_ForbidRestarting;
}
}
}
/// Enumeration to specify the restart operation properties.
enum RestartingMode {
RM_None, /// the operation should not be restarted
+ RM_ForbidRestarting, /// the operation should not be restarted after there is no active widget
RM_LastFeatureUse, /// the operation is restarted and use the previous feature for own initialization
RM_LastFeatureEmpty /// the operation is restarted and does not use the previous feature
};