From: azv Date: Tue, 23 Aug 2016 10:45:46 +0000 (+0300) Subject: Explicitly call execute for nested features before referring X-Git-Tag: V_2.5.0~137^2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e151691ef2dae3825508a710331a11c81205f05e;p=modules%2Fshaper.git Explicitly call execute for nested features before referring --- diff --git a/src/ConstructionAPI/ConstructionAPI_Point.cpp b/src/ConstructionAPI/ConstructionAPI_Point.cpp index 76be0f73b..5e9aea6e1 100644 --- a/src/ConstructionAPI/ConstructionAPI_Point.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Point.cpp @@ -83,7 +83,7 @@ void ConstructionAPI_Point::setByXYZ(const ModelHighAPI_Double& theX, fillAttribute(theY, myy); fillAttribute(theZ, myz); - execute(); + execute(false); } /*//================================================================================================== diff --git a/src/FeaturesAPI/FeaturesAPI_Boolean.cpp b/src/FeaturesAPI/FeaturesAPI_Boolean.cpp index 062731c89..f47eab172 100644 --- a/src/FeaturesAPI/FeaturesAPI_Boolean.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Boolean.cpp @@ -30,7 +30,7 @@ FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr fillAttribute(theMainObjects, mymainObjects); fillAttribute(theToolObjects, mytoolObjects); - execute(); + execute(false); } } diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.cpp b/src/ModelHighAPI/ModelHighAPI_Interface.cpp index 401ba5467..cfea20834 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Interface.cpp @@ -54,14 +54,15 @@ const std::string& ModelHighAPI_Interface::getKind() const return feature()->getKind(); } -void ModelHighAPI_Interface::execute() +void ModelHighAPI_Interface::execute(bool isForce) { - //SessionPtr aMgr = ModelAPI_Session::get(); - //ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); - //FeaturePtr aFeature = feature(); - //if(aFactory->validate(aFeature)) { - // aFeature->execute(); - //} + if (isForce) { + SessionPtr aMgr = ModelAPI_Session::get(); + ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + FeaturePtr aFeature = feature(); + if(aFactory->validate(aFeature)) + aFeature->execute(); + } Events_Loop* aLoop = Events_Loop::loop(); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.h b/src/ModelHighAPI/ModelHighAPI_Interface.h index f4c156fb7..43d267642 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.h +++ b/src/ModelHighAPI/ModelHighAPI_Interface.h @@ -49,8 +49,9 @@ public: const std::string& getKind() const; /// Shortcut for feature()->execute() + /// \param isForce start execution of feature instead of sending events MODELHIGHAPI_EXPORT - void execute(); + void execute(bool isForce = false); /// Shortcut for feature()->data()->setName() MODELHIGHAPI_EXPORT diff --git a/src/ModelHighAPI/ModelHighAPI_Reference.cpp b/src/ModelHighAPI/ModelHighAPI_Reference.cpp index 20a07f53b..f427b7e92 100644 --- a/src/ModelHighAPI/ModelHighAPI_Reference.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Reference.cpp @@ -25,6 +25,11 @@ ModelHighAPI_Reference::ModelHighAPI_Reference( const std::shared_ptr & theValue) : myObject(std::shared_ptr(theValue->defaultResult())) { + // the result is not constructed yet, forcibly do it + if (!myObject) { + theValue->execute(true); + myObject = std::shared_ptr(theValue->defaultResult()); + } } ModelHighAPI_Reference::~ModelHighAPI_Reference() diff --git a/src/SketchSolver/SketchSolver_Manager.cpp b/src/SketchSolver/SketchSolver_Manager.cpp index 4748424f8..61c0547b0 100644 --- a/src/SketchSolver/SketchSolver_Manager.cpp +++ b/src/SketchSolver/SketchSolver_Manager.cpp @@ -279,7 +279,7 @@ bool SketchSolver_Manager::changeWorkplane(CompositeFeaturePtr theSketch) } myGroups.push_back(aNewGroup); } - return aResult; + return aResult || isUpdated; } // ============================================================================