Salome HOME
Issue #1865: Model Widget for fields
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Reference.cpp
index 3e13a0b463d95f32fef462b83c9500c287d0d2d8..f427b7e921fe59265c042d29cbd9e38cc50a4eea 100644 (file)
@@ -25,6 +25,11 @@ ModelHighAPI_Reference::ModelHighAPI_Reference(
     const std::shared_ptr<ModelHighAPI_Interface> & theValue)
 : myObject(std::shared_ptr<ModelAPI_Object>(theValue->defaultResult()))
 {
+  // the result is not constructed yet, forcibly do it
+  if (!myObject) {
+    theValue->execute(true);
+    myObject = std::shared_ptr<ModelAPI_Object>(theValue->defaultResult());
+  }
 }
 
 ModelHighAPI_Reference::~ModelHighAPI_Reference()
@@ -44,3 +49,9 @@ void ModelHighAPI_Reference::appendToList(
 {
   theAttribute->append(myObject);
 }
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<ModelAPI_Feature> ModelHighAPI_Reference::feature() const
+{
+  return ModelAPI_Feature::feature(myObject);
+}