#include <ModuleBase_Tools.h>
#include <ModuleBase_FilterFactory.h>
#include <ModuleBase_Filter.h>
+#include <ModuleBase_IModule.h>
#include <Config_WidgetAPI.h>
#include <Events_Loop.h>
}
} else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
AttributeRefAttrPtr aRefAttr = aData->refattr(attributeID());
- ObjectPtr aObject = aRefAttr->object();
- if (!(aObject && aObject->isSame(theSelectedObject))) {
- aRefAttr->setObject(theSelectedObject);
+
+ AttributePtr anAttribute = myWorkshop->module()->findAttribute(theSelectedObject, theShape);
+ if (anAttribute.get())
+ aRefAttr->setAttr(anAttribute);
+ else {
+ ObjectPtr aObject = aRefAttr->object();
+ if (!(aObject && aObject->isSame(theSelectedObject))) {
+ aRefAttr->setObject(theSelectedObject);
+ }
}
} else if (aType == ModelAPI_AttributeSelection::typeId()) {
AttributeSelectionPtr aSelectAttr = aData->selection(attributeID());
if (!aData->isValid())
return aShape;
- AttributeSelectionPtr aSelect = aData->selection(attributeID());
- if (aSelect)
- aShape = aSelect->value();
+ std::string aType = aData->attribute(attributeID())->attributeType();
+ if (aType == ModelAPI_AttributeReference::typeId()) {
+ } else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
+ AttributeRefAttrPtr aRefAttr = aData->refattr(attributeID());
+ aShape = myWorkshop->module()->findShape(aRefAttr);
+ } else if (aType == ModelAPI_AttributeSelection::typeId()) {
+ AttributeSelectionPtr aSelectAttr = aData->selection(attributeID());
+ aShape = aSelectAttr->value();
+ }
return aShape;
}
aRefAttr->setAttr(myRefAttribute);
}
}
-
-//********************************************************************
-bool ModuleBase_WidgetShapeSelector::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
-{
- ObjectPtr anObject;
- GeomShapePtr aShape;
- getGeomSelection(thePrs, anObject, aShape);
-
- setObject(anObject, aShape);
- return true;
-}