ModelAPI_Tools::allResults(theFeature, allResults);
std::list<ResultPtr>::iterator aRes = allResults.begin();
for(; aRes != allResults.end(); aRes++) {
- const std::set<std::shared_ptr<ModelAPI_Attribute> >& aRefs = (*aRes)->data()->refsToMe();
- std::set<std::shared_ptr<ModelAPI_Attribute> >::const_iterator aRefIter = aRefs.cbegin();
- for(; aRefIter != aRefs.cend(); aRefIter++) {
- if ((*aRefIter)->isArgument()) {
- FeaturePtr aReferenced = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRefIter)->owner());
+ const std::set<std::shared_ptr<ModelAPI_Attribute> >& aResRefs = (*aRes)->data()->refsToMe();
+ std::set<std::shared_ptr<ModelAPI_Attribute> >::const_iterator aRIter = aResRefs.cbegin();
+ for(; aRIter != aResRefs.cend(); aRIter++) {
+ if ((*aRIter)->isArgument()) {
+ FeaturePtr aReferenced = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRIter)->owner());
if (aReferenced.get()) {
addModified(aReferenced, theFeature);
}
void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
static Events_Loop* aLoop = Events_Loop::loop();
- static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators();
+ //static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators();
static const Events_ID kCreatedEvent = aLoop->eventByName(EVENT_OBJECT_CREATED);
static const Events_ID kUpdatedEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED);
static const Events_ID kOpFinishEvent = aLoop->eventByName("FinishOperation");
}
}
processFeatures();
- myIsPreviewBlocked = myIsPreviewBlocked;
+ myIsPreviewBlocked = aPreviewBlockedState;
}
}
aFeatures.push_back(*anObjIter);
} else {
aResults.push_back(*anObjIter);
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*anObjIter);
+ if (aPart.get() && aPart->data().get() && aPart->data()->isValid()) {
+ aPart->shape(); // to update the shape on creation of the result
+ }
}
}
}
for(; aRefIter != aRefs.cend(); aRefIter++) {
if (!(*aRefIter)->owner()->data()->isValid())
continue;
- FeaturePtr anUpdated = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRefIter)->owner());
+ anUpdated = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRefIter)->owner());
if (anUpdated.get()) {
if (addModified(anUpdated, aReason))
aSomeModified = true;
bool isObligatory = aFactory->isCase(theFeature, theFeature->data()->id(aSel));
if (isObligatory)
aState = ModelAPI_StateInvalidArgument;
+ } else if (theFeature->getKind() == "Sketch" && aSel->id() == "External" &&
+ aSel->isInitialized()) {
+ // #19703 : if sketch plane was selected, but after context disappears, it must become invalid
+ aSel->update();
+ if (aSel->isInvalid()) {
+ aState = ModelAPI_StateInvalidArgument;
+ }
}
}
// update the selection list attributes if any
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(*aRefsIter);
// #19071 : avoid sending of update event in cycle
bool aWasBlocked = theFeature->data()->blockSendAttributeUpdated(true);
+ // list to keep the shared pointers while update is blocked (in messages raw poiters are used)
+ std::list<AttributeSelectionPtr> anAttrList;
for(int a = aSel->size() - 1; a >= 0; a--) {
std::shared_ptr<ModelAPI_AttributeSelection> aSelAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(aSel->value(a));
// update argument only if the referenced object is ready to use
if (aContext.get() && !aContext->isDisabled()) {
if (isReason(theFeature, aContext)) {
+ anAttrList.push_back(aSelAttr);
if (!aSelAttr->update()) {
bool isObligatory = !aFactory->isNotObligatory(
theFeature->getKind(), theFeature->data()->id(aSel)) &&