mySize->Set(0);
TDF_ChildIterator aSubIter(mySize->Label());
for(; aSubIter.More(); aSubIter.Next()) {
- aSubIter.Value().ForgetAllAttributes(Standard_True);
+ TDF_Label aLab = aSubIter.Value();
+ std::shared_ptr<Model_AttributeSelection> aNewAttr =
+ std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aLab));
+ if (owner()) {
+ aNewAttr->setObject(owner());
+ }
+ REMOVE_BACK_REF(aNewAttr->context());
+
+ aLab.ForgetAllAttributes(Standard_True);
}
owner()->data()->sendAttributeUpdated(this);
}
return;
myRefsToMe.erase(anAttribute);
+
+ // remove concealment immideately: on deselection it must be posible to reselect in GUI the same
+ if (ModelAPI_Session::get()->validators()->isConcealed(theFeature->getKind(), theAttrID)) {
+ std::set<AttributePtr>::iterator aRefsIter = myRefsToMe.begin();
+ for(; aRefsIter != myRefsToMe.end(); aRefsIter++) {
+ if (aRefsIter->get()) {
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRefsIter)->owner());
+ if (aFeature.get()) {
+ if (ModelAPI_Session::get()->validators()->isConcealed(
+ aFeature->getKind(), (*aRefsIter)->id())) {
+ return; // it is still concealed, nothing to do
+ }
+ }
+ }
+ }
+ // thus, no concealment references anymore => make not-concealed
+ std::shared_ptr<ModelAPI_Result> aRes =
+ std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
+ if (aRes.get()) {
+ aRes->setIsConcealed(false);
+ static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
+ ModelAPI_EventCreator::get()->sendUpdated(aRes, anEvent);
+ Events_Loop::loop()->flush(anEvent);
+ }
+ }
}
void Model_Data::addBackReference(FeaturePtr theFeature, std::string theAttrID,
friend class Model_AttributeRefAttr;
friend class Model_AttributeRefList;
friend class Model_AttributeSelection;
+ friend class Model_AttributeSelectionList;
public:
/// The simplest constructor. "setLabel" must be called just after to initialize correctly.
ObjectPtr Model_Objects::object(const std::string& theGroupID, const int theIndex)
{
- createHistory(theGroupID);
- //TODO: mpv stabilization hotfix
- if (myHistory[theGroupID].size() <= (const unsigned int)theIndex)
+ if (theIndex == -1)
return ObjectPtr();
+ createHistory(theGroupID);
return myHistory[theGroupID][theIndex];
}