From: mpv Date: Tue, 22 May 2018 11:49:12 +0000 (+0300) Subject: A better fix for the issue #2474: Part parameter has higher priority than partset... X-Git-Tag: V8_5_0rc2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a6edac8c641fa6606a703d78ae482a66e3c73090;p=modules%2Fshaper.git A better fix for the issue #2474: Part parameter has higher priority than partset parameter with the same name. In GUI sometimes previous fix did not work. --- diff --git a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp index d2481ebdd..cc2990833 100644 --- a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp +++ b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp @@ -255,32 +255,6 @@ void setParameterName(ResultParameterPtr theResultParameter, const std::string& aParameter->data()->setName(theName); aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID())->setValue(theName); aParameter->data()->blockSendAttributeUpdated(aWasBlocked); - - // #2474 : if parameter name now hides/shows the higher level parameter name, - // update the depended expressions - DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); - if (theResultParameter->document() != aRootDoc) { - std::list aNames; // collect names in the root document that must be checked - aNames.push_back(theName); - if (anOldName != theName) { - aNames.push_back(anOldName); - } - std::list::iterator aNIter = aNames.begin(); - for (; aNIter != aNames.end(); aNIter++) { - double aValue; - ResultParameterPtr aRootParam; - if (ModelAPI_Tools::findVariable(aParameter, *aNIter, aValue, aRootParam, aRootDoc)) { - std::set > anAttributes = - aRootParam->data()->refsToMe(); - std::set >::const_iterator anAttributeIt = - anAttributes.cbegin(); - for (; anAttributeIt != anAttributes.cend(); ++anAttributeIt) { - const AttributePtr& anAttribute = *anAttributeIt; - ModelAPI_AttributeEvalMessage::send(anAttribute, NULL); - } - } - } - } } void ParametersPlugin_EvalListener::processObjectRenamedEvent( diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp index ab6cf97e5..ab128d10b 100644 --- a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp @@ -78,8 +78,38 @@ void ParametersPlugin_Parameter::updateName() data()->setName(aName); ResultParameterPtr aParam = document()->createParameter(data()); + std::string anOldName = aParam->data()->name(); aParam->data()->setName(aName); setResult(aParam); + + + // #2474 : if parameter name now hides/shows the higher level parameter name, + // update the depended expressions + DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); + if (aParam->document() != aRootDoc) { + std::list aNames; // collect names in the root document that must be checked + aNames.push_back(aName); + if (anOldName != aName) { + aNames.push_back(anOldName); + } + std::list::iterator aNIter = aNames.begin(); + for (; aNIter != aNames.end(); aNIter++) { + double aValue; + ResultParameterPtr aRootParam; + FeaturePtr aThis = + std::dynamic_pointer_cast(string(VARIABLE_ID())->owner()); + if (ModelAPI_Tools::findVariable(aThis, *aNIter, aValue, aRootParam, aRootDoc)) { + std::set > anAttributes = + aRootParam->data()->refsToMe(); + std::set >::const_iterator anAttributeIt = + anAttributes.cbegin(); + for (; anAttributeIt != anAttributes.cend(); ++anAttributeIt) { + const AttributePtr& anAttribute = *anAttributeIt; + ModelAPI_AttributeEvalMessage::send(anAttribute, NULL); + } + } + } + } } bool ParametersPlugin_Parameter::updateExpression() @@ -97,6 +127,7 @@ bool ParametersPlugin_Parameter::updateExpression() AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE()); aValueAttribute->setValue(aValue); setResult(aParam); + return true; }