The correction: to store/restore selection if the presentation is only customized.
/// Remove default selection filters of the module from the current viewer\r
virtual void deactivateSelectionFilters() {};\r
\r
+ // Stores the current selection\r
+ virtual void storeSelection() {};\r
+\r
+ // Restores the current selection\r
+ virtual void restoreSelection() {};\r
+\r
/// Reads description of features from XML file \r
virtual void createFeatures();\r
\r
//emit valuesChanged();
//}
- /// remove unused objects from the model attribute
- //removeUnusedAttributeObjects(theValues);
-
theValues.clear();
if (!aSkippedValues.empty())
theValues.append(aSkippedValues);
anOpMgr->startOperation(anOpAction);
}
- myModule->sketchMgr()->storeSelection();
-
if (anObjects.size() > 0) {
QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end();
for (; anIt != aLast; anIt++) {
anOpMgr->commitOperation();
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
- myModule->sketchMgr()->restoreSelection();
}
bool PartSet_MenuMgr::canSetAuxiliary(bool& theValue) const
}
}
+void PartSet_Module::storeSelection()
+{
+ sketchMgr()->storeSelection();
+}
+
+void PartSet_Module::restoreSelection()
+{
+ sketchMgr()->restoreSelection();
+}
+
void PartSet_Module::registerValidators()
{
//Registering of validators
// Remove default selection filters of the module from the current viewer
virtual void deactivateSelectionFilters();
+ // Stores the current selection
+ virtual void storeSelection();
+
+ // Restores the current selection
+ virtual void restoreSelection();
+
/// Creates custom widgets for property panel
virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, QWidget* theParent,
Config_WidgetAPI* theWidgetApi, std::string theParentId);
void PartSet_SketcherMgr::storeSelection(const bool theHighlightedOnly)
{
+ if (!myCurrentSketch.get())
+ return;
+
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
ModuleBase_ISelection* aSelect = aWorkshop->selection();
QList<ModuleBase_ViewerPrs> aHighlighted = aSelect->getHighlighted();
void PartSet_SketcherMgr::restoreSelection()
{
+ if (!myCurrentSketch.get())
+ return;
+
//qDebug(QString("restoreSelection: %1").arg(myCurrentSelection.size()).toStdString().c_str());
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
arg(!isEqualShapes || isCustomized).arg(isEqualShapes).arg(isCustomized).toStdString().c_str());
#endif
if (!isEqualShapes || isCustomized) {
+ /// if shapes are equal and presentation are customized, selection should be restored
+ bool aNeedToRestoreSelection = isEqualShapes && isCustomized;
+ if (aNeedToRestoreSelection)
+ myWorkshop->module()->storeSelection();
+
aContext->Redisplay(aAISIO, false);
+
+ if (aNeedToRestoreSelection)
+ myWorkshop->module()->restoreSelection();
+
aRedisplayed = true;
#ifdef DEBUG_FEATURE_REDISPLAY
qDebug(" Redisplay happens");