From: mpv Date: Thu, 21 May 2015 13:55:33 +0000 (+0300) Subject: Debug of loading parts X-Git-Tag: V_1.2.0~123^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=735e05198d7a73d8cab22fc6261e038f46969250;p=modules%2Fshaper.git Debug of loading parts --- diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 2dafa8929..2356a2053 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -486,6 +486,7 @@ void Model_Objects::synchronizeFeatures( aNewFeatures.insert(aFeature); initData(aFeature, aFeatureLabel, TAG_FEATURE_ARGUMENTS); updateHistory(aFeature); + aFeature->setDisabled(false); // by default created feature is enabled (this allows to recreate the results before "setCurrent" is called) // event: model is updated ModelAPI_EventCreator::get()->sendUpdated(aFeature, aCreateEvent); @@ -786,7 +787,9 @@ void Model_Objects::updateResults(FeaturePtr theFeature) if (aGroup->Get() == ModelAPI_ResultBody::group().c_str()) { aNewBody = createBody(theFeature->data(), aResIndex); } else if (aGroup->Get() == ModelAPI_ResultPart::group().c_str()) { - aNewBody = createPart(theFeature->data(), aResIndex); + //aNewBody = createPart(theFeature->data(), aResIndex); + theFeature->execute(); // create the part result + break; } else if (aGroup->Get() == ModelAPI_ResultConstruction::group().c_str()) { theFeature->execute(); // construction shapes are needed for sketch solver break; diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index ea951c796..de3cddb28 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -250,6 +250,11 @@ std::list > Model_Session::allOpenedDocuments return aResult; } +bool Model_Session::isLoadByDemand(const std::string theDocID) +{ + return Model_Application::getApplication()->isLoadByDemand(theDocID); +} + std::shared_ptr Model_Session::copy( std::shared_ptr theSource, std::string theID) { diff --git a/src/Model/Model_Session.h b/src/Model/Model_Session.h index ebfef43d0..2584a2e20 100644 --- a/src/Model/Model_Session.h +++ b/src/Model/Model_Session.h @@ -90,6 +90,9 @@ class Model_Session : public ModelAPI_Session, public Events_Listener /// Returns all the opened documents of the session (without postponed) MODEL_EXPORT virtual std::list > allOpenedDocuments(); + /// Returns true if document is not loaded yet + MODEL_EXPORT virtual bool isLoadByDemand(const std::string theDocID); + /// Registers the plugin that creates features. /// It is obligatory for each plugin to call this function on loading to be found by /// the plugin manager on call of the feature) diff --git a/src/ModelAPI/ModelAPI_Session.h b/src/ModelAPI/ModelAPI_Session.h index 5c927e7d3..47f607181 100644 --- a/src/ModelAPI/ModelAPI_Session.h +++ b/src/ModelAPI/ModelAPI_Session.h @@ -93,6 +93,9 @@ class MODELAPI_EXPORT ModelAPI_Session /// Returns all the opened documents of the session (without postponed) virtual std::list > allOpenedDocuments() = 0; + /// Returns true if document is not loaded yet + virtual bool isLoadByDemand(const std::string theDocID) = 0; + /// Copies the document to the new one with the given id virtual std::shared_ptr copy(std::shared_ptr theSource, std::string theID) = 0; diff --git a/src/PartSetPlugin/PartSetPlugin_Part.cpp b/src/PartSetPlugin/PartSetPlugin_Part.cpp index 95fa5f06b..09a768acf 100644 --- a/src/PartSetPlugin/PartSetPlugin_Part.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Part.cpp @@ -27,7 +27,11 @@ void PartSetPlugin_Part::execute() if (!aResult) { aResult = document()->createPart(data()); setResult(aResult); - aResult->activate(); + // do not activate part by simple execution if it is not loaded yet: it must be explicitly + // activated for this + if (!ModelAPI_Session::get()->isLoadByDemand(aResult->data()->name())) { + aResult->activate(); + } } }