}
void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature,
- bool& hasParameter, bool& hasCompositeOwner)
+ bool& hasParameter, bool& hasCompositeOwner, bool& hasResultInHistory)
{
hasResult = false;
hasFeature = false;
hasParameter = false;
hasCompositeOwner = false;
+ hasResultInHistory = false;
foreach(ObjectPtr aObj, theObjects) {
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
hasParameter |= (aConstruction.get() != NULL);
if (hasFeature)
hasCompositeOwner |= (ModelAPI_Tools::compositeOwner(aFeature) != NULL);
+
+ if (!hasResultInHistory && aResult.get()) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aResult);
+ hasResultInHistory = aFeature.get() && aFeature->isInHistory();
+ }
+
if (hasFeature && hasResult && hasParameter && hasCompositeOwner)
break;
}
/// \param hasFeature will be set to true if list contains Feature objects
/// \param hasParameter will be set to true if list contains Parameter objects
/// \param hasCompositeOwner will be set to true if list contains Sub-Feature objects
+/// \param hasResultInHistory will be set to true if one of result is in history
MODULEBASE_EXPORT void checkObjects(const QObjectPtrList& theObjects, bool& hasResult,
- bool& hasFeature, bool& hasParameter, bool& hasCompositeOwner);
+ bool& hasFeature, bool& hasParameter, bool& hasCompositeOwner,
+ bool& hasResultInHistory);
/// Sets the default coeffient into the driver calculated accordingly the shape type.
/// It provides 1.e-4 for results of construction type
bool hasFeature = false;
bool hasParameter = false;
bool hasCompositeOwner = false;
+ bool hasResultInHistory = false;
ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
- hasCompositeOwner);
+ hasCompositeOwner, hasResultInHistory);
ModuleBase_Operation* aCurrentOp = myWorkshop->currentOperation();
if (aSelected == 1) {
bool hasFeature = false;
bool hasParameter = false;
bool hasCompositeOwner = false;
+ bool hasResultInHistory = false;
ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
- hasCompositeOwner);
+ hasCompositeOwner, hasResultInHistory);
//Process Feature
if (aSelected == 1) {
ObjectPtr aObject = aObjects.first();
action("CLEAN_HISTORY_CMD")->setEnabled(true);
action("SHOW_RESULTS_CMD")->setEnabled(hasFeature);
- action("SHOW_FEATURE_CMD")->setEnabled(hasResult);
+ action("SHOW_FEATURE_CMD")->setEnabled(hasResult && hasResultInHistory);
}
// Show/Hide command has to be disabled for objects from non active document
bool hasFeature = false;
bool hasParameter = false;
bool hasCompositeOwner = false;
- ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter, hasCompositeOwner);
+ bool hasResultInHistory = false;
+ ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter, hasCompositeOwner,
+ hasResultInHistory);
if (!(hasFeature || hasParameter))
return;