#include <ModelAPI_ResultParameter.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_Tools.h>
#include <ModuleBase_IModule.h>
#include <ModuleBase_Tools.h>
action("SHADING_CMD")->setEnabled(true);
}
if (!hasFeature) {
- if (aObject->isDisplayed()) {
+ bool aHasSubResults = ModelAPI_Tools::hasSubResults(
+ std::dynamic_pointer_cast<ModelAPI_Result>(aObject));
+ if (aHasSubResults) {
action("HIDE_CMD")->setEnabled(true);
- } else if (hasResult && (!hasParameter)) {
action("SHOW_CMD")->setEnabled(true);
}
-
+ else {
+ if (aObject->isDisplayed()) {
+ action("HIDE_CMD")->setEnabled(true);
+ } else if (hasResult && (!hasParameter)) {
+ action("SHOW_CMD")->setEnabled(true);
+ }
+ }
if (!(hasParameter || hasFeature))
action("SHOW_ONLY_CMD")->setEnabled(true);
}
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
}
- QString anInfoStr = anInfo.join(", ");
+ QString anInfoStr = anInfo.join(";\t");
qDebug(QString("onFeatureRedisplayMsg: %1, %2").arg(aObjects.size()).arg(anInfoStr).toStdString().c_str());
#endif
bool isVisibleObject = aDisplayer->isVisible(aObj);
#ifdef DEBUG_FEATURE_REDISPLAY
QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
- qDebug(QString("visible=%1 : display= %2").arg(isVisibleObject).arg(anObjInfo).toStdString().c_str());
+ //qDebug(QString("visible=%1 : display= %2").arg(isVisibleObject).arg(anObjInfo).toStdString().c_str());
/*FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
if (aFeature.get()) {
std::string aKind = aFeature->getKind();
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
}
- QString anInfoStr = anInfo.join(", ");
+ QString anInfoStr = anInfo.join(";\t");
qDebug(QString("onFeatureCreatedMsg: %1, %2").arg(aObjects.size()).arg(anInfoStr).toStdString().c_str());
#endif
if (!aHide) {
// setDisplayed has to be called in order to synchronize internal state of the object
// with list of displayed objects
- if (displayObject(anObject)) {
+ if (myWorkshop->module()->canDisplayObject(anObject)) {
anObject->setDisplayed(true);
+ isDisplayed = displayObject(*aIt);
} else
anObject->setDisplayed(false);
}
bool XGUI_WorkshopListener::displayObject(ObjectPtr theObj)
{
XGUI_Workshop* aWorkshop = workshop();
- if (ModelAPI_Tools::hasSubResults(std::dynamic_pointer_cast<ModelAPI_Result>(theObj)) ||
- !aWorkshop->module()->canDisplayObject(theObj))
+ // do not display the object if it has sub objects. They should be displayed separately.
+ if (!aWorkshop->module()->canDisplayObject(theObj) ||
+ ModelAPI_Tools::hasSubResults(std::dynamic_pointer_cast<ModelAPI_Result>(theObj)))
return false;
XGUI_Displayer* aDisplayer = aWorkshop->displayer();