]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #591 - Highlight of the first argument of constraints
authornds <natalia.donis@opencascade.com>
Wed, 1 Jul 2015 12:01:49 +0000 (15:01 +0300)
committernds <natalia.donis@opencascade.com>
Wed, 1 Jul 2015 12:02:19 +0000 (15:02 +0300)
Crash fix in sketch manager when find a dected owner.

src/ModuleBase/ModuleBase_IModule.h
src/PartSet/CMakeLists.txt
src/PartSet/PartSet_CustomPrs.cpp [new file with mode: 0755]
src/PartSet/PartSet_CustomPrs.h [new file with mode: 0755]
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_OperationPrs.cpp [new file with mode: 0755]
src/PartSet/PartSet_OperationPrs.h [new file with mode: 0755]
src/PartSet/PartSet_SketcherMgr.cpp
src/XGUI/XGUI_Displayer.cpp

index bea23dbcd5108862e1fdf5c4c6ff2e71eb802067..1ef962d28f8a6ddd42fa352e728943bc6cdff7d6 100644 (file)
@@ -144,6 +144,14 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \param theModes a list of modes\r
   virtual void activeSelectionModes(QIntList& theModes) {}\r
 \r
+  /** Update the object presentable properties such as color, lines width and other\r
+  * If the object is result with the color attribute value set, it is used,\r
+  * otherwise the customize is applyed to the object's feature if it is a custom prs\r
+  * \param theObject an object instance\r
+  * \return the true state if there is changes and the presentation is customized\r
+  */\r
+  virtual bool customizeObject(ObjectPtr theObject) { return false; }\r
+\r
   /// This method is called on object browser creation for customisation of module specific features\r
   /// \param theObjectBrowser a pinter on Object Browser widget\r
   virtual void customizeObjectBrowser(QWidget* theObjectBrowser) {}\r
index f86ae4385bcf5d87f71b883d17a3b4e58d7b37ae..1a9d16288ce65663310d7635ac21d92ebea43e11 100644 (file)
@@ -7,8 +7,10 @@ SET(CMAKE_AUTOMOC ON)
 SET(PROJECT_HEADERS
        PartSet.h
        PartSet_Constants.h
+       PartSet_CustomPrs.h
        PartSet_ExternalObjectsMgr.h
        PartSet_Module.h
+       PartSet_OperationPrs.h
        PartSet_Tools.h
        PartSet_WidgetSketchLabel.h
        PartSet_Validators.h
@@ -24,15 +26,17 @@ SET(PROJECT_HEADERS
        PartSet_FilterInfinite.h
        PartSet_SketcherMgr.h
        PartSet_MenuMgr.h
-    PartSet_DocumentDataModel.h
-    PartSet_PartDataModel.h
-    PartSet_DataTreeModel.h
+       PartSet_DocumentDataModel.h
+       PartSet_PartDataModel.h
+       PartSet_DataTreeModel.h
        PartSet_WidgetSketchCreator.h
 )
 
 SET(PROJECT_SOURCES
+       PartSet_CustomPrs.cpp
        PartSet_ExternalObjectsMgr.cpp
        PartSet_Module.cpp
+       PartSet_OperationPrs.cpp
        PartSet_Tools.cpp
        PartSet_WidgetSketchLabel.cpp
        PartSet_Validators.cpp
@@ -48,8 +52,8 @@ SET(PROJECT_SOURCES
        PartSet_FilterInfinite.cpp
        PartSet_SketcherMgr.cpp
        PartSet_MenuMgr.cpp
-    PartSet_DocumentDataModel.cpp
-    PartSet_PartDataModel.cpp
+       PartSet_DocumentDataModel.cpp
+       PartSet_PartDataModel.cpp
        PartSet_WidgetSketchCreator.cpp
 )
 
diff --git a/src/PartSet/PartSet_CustomPrs.cpp b/src/PartSet/PartSet_CustomPrs.cpp
new file mode 100755 (executable)
index 0000000..3ae8460
--- /dev/null
@@ -0,0 +1,156 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        PartSet_CustomPrs.cpp
+// Created:     30 Jun 2015
+// Author:      Natalia ERMOLAEVA
+
+#include <PartSet_CustomPrs.h>
+
+#include <XGUI_ModuleConnector.h>
+#include <XGUI_Workshop.h>
+#include <XGUI_Displayer.h>
+
+#include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_IViewer.h>
+
+#include <GeomValidators_Tools.h>
+
+#include <ModelAPI_Attribute.h>
+#include <ModelAPI_AttributeSelectionList.h>
+
+#include <Config_PropManager.h>
+
+#include <AIS_InteractiveContext.hxx>
+
+#define OPERATION_PARAMETER_COLOR "255, 255, 0"
+
+PartSet_CustomPrs::PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop)
+  : myWorkshop(theWorkshop)
+{
+}
+
+void PartSet_CustomPrs::setCustomized(const ObjectPtr& theObject)
+{
+/*  QMap<ResultPtr, QList<GeomShapePtr> > aNewCustomized;
+
+  QList<GeomShapePtr> aShapeList;
+  ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+  if (aResult.get()) {
+    aNewCustomized[aResult] = aShapeList;
+  }
+  else {
+    FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+    if (aFeature.get()) {
+      std::list<AttributePtr> anAttributes = aFeature->data()->attributes("");
+      std::list<AttributePtr>::const_iterator anIt = anAttributes.begin(), aLast = anAttributes.end();
+      for (; anIt != aLast; anIt++) {
+        AttributePtr anAttribute = *anIt;
+        ObjectPtr anObject = GeomValidators_Tools::getObject(anAttribute);
+        if (anObject.get()) {
+          ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
+          if (aResult.get())
+            aNewCustomized[aResult] = aShapeList;
+        }
+        else if (anAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) {
+          std::shared_ptr<ModelAPI_AttributeSelectionList> aCurSelList = 
+                  std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(anAttribute);
+          for(int i = 0; i < aCurSelList->size(); i++) {
+            std::shared_ptr<ModelAPI_AttributeSelection> aSelAttribute = aCurSelList->value(i);
+            ObjectPtr anObject = GeomValidators_Tools::getObject(aSelAttribute);
+            if (anObject.get()) {
+              ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
+              if (aResult.get())
+                aNewCustomized[aResult] = aShapeList;
+            }
+          }
+        }
+      }
+    }
+  }
+
+  bool isDone = false;
+  XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
+  XGUI_Workshop* aWorkshop = aConnector->workshop();
+  XGUI_Displayer* aDisplayer = aWorkshop->displayer();
+  Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+  // find objects which are not customized anymore
+  QMap<ResultPtr, QList<GeomShapePtr> > aNotCustomized;
+  QMap<ResultPtr, QList<GeomShapePtr> >::const_iterator anIt = myCustomized.begin(),
+                                                        aLast = myCustomized.end();
+  for (; anIt != aLast; anIt++) {
+    ResultPtr aResult = anIt.key();
+    if (!aNewCustomized.contains(aResult))
+      aNotCustomized[aResult] = aShapeList;
+  }
+
+  myCustomized.clear();
+  // restore the previous state of the object if there is no such object in the new map
+  for (anIt = aNotCustomized.begin(), aLast = aNotCustomized.end(); anIt != aLast; anIt++) {
+    ResultPtr aResult = anIt.key();
+    AISObjectPtr anAISObj = aDisplayer->getAISObject(aResult);
+    if (anAISObj.get()) {
+      Handle(AIS_InteractiveObject) anAISIO = anAISObj->impl<Handle(AIS_InteractiveObject)>();
+      aContext->Redisplay(anAISIO, false);
+    }
+    isDone = aDisplayer->customizeObject(aResult);
+  }
+
+  // set customized for the new objects
+  myCustomized = aNewCustomized;
+  for (anIt = myCustomized.begin(), aLast = myCustomized.end(); anIt != aLast; anIt++) {
+    ResultPtr aResult = anIt.key();
+    AISObjectPtr anAISObj = aDisplayer->getAISObject(aResult);
+    if (anAISObj.get())
+      isDone = customisePresentation(aResult, anAISObj, 0) || isDone;
+  }
+  if (isDone)
+    aDisplayer->updateViewer();*/
+}
+
+/*#include <AIS_InteractiveObject.hxx>
+#include <AIS_Shape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <StdPrs_ShadedShape.hxx>
+#include <StdPrs_WFDeflectionShape.hxx>*/
+bool PartSet_CustomPrs::customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
+                                              std::shared_ptr<GeomAPI_ICustomPrs> theCustomPrs)
+{
+  bool isDone = false;
+  if (myCustomized.contains(theResult)) {
+    std::vector<int> aColor = Config_PropManager::color("Visualization", "operation_parameter_color",
+                                                        OPERATION_PARAMETER_COLOR);
+    isDone = thePrs->setColor(aColor[0], aColor[1], aColor[2]);
+    /*
+    Handle(AIS_InteractiveObject) anAISIO = thePrs->impl<Handle(AIS_InteractiveObject)>();
+
+    const Handle(Prs3d_Presentation)& aPresentation = anAISIO->Presentation();
+    if (!aPresentation.IsNull()) {
+      Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAISIO);
+      if (!aShapeAIS.IsNull()) {
+        TopExp_Explorer anExp(aShapeAIS->Shape(), TopAbs_VERTEX);
+        Handle(Prs3d_Drawer) aDrawer = aShapeAIS->Attributes();
+        for (; anExp.More(); anExp.Next()) {
+          const TopoDS_Vertex& aVertex = (const TopoDS_Vertex&)anExp.Current();
+          StdPrs_WFDeflectionShape::Add(aPresentation, aVertex, aDrawer);
+        }
+      }
+    }
+    thePrs->setPointMarker(5, 5.); // Set point as a '+' symbol*/
+  }
+  /*
+  std::vector<int> aColor;
+
+  getResultColor(theResult, aColor);
+
+  SessionPtr aMgr = ModelAPI_Session::get();
+  if (aMgr->activeDocument() != theResult->document()) {
+    QColor aQColor(aColor[0], aColor[1], aColor[2]);
+    QColor aNewColor = QColor::fromHsvF(aQColor.hueF(), aQColor.saturationF()/3., aQColor.valueF());
+    aColor[0] = aNewColor.red();
+    aColor[1] = aNewColor.green();
+    aColor[2] = aNewColor.blue();
+  }
+  return !aColor.empty() && thePrs->setColor(aColor[0], aColor[1], aColor[2]);*/
+  return isDone;
+}
diff --git a/src/PartSet/PartSet_CustomPrs.h b/src/PartSet/PartSet_CustomPrs.h
new file mode 100755 (executable)
index 0000000..df17bea
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        PartSet_CustomPrs.hxx
+// Created:     30 Jun 2015
+// Author:      Natalia ERMOLAEVA
+
+#ifndef PartSet_CustomPrs_H
+#define PartSet_CustomPrs_H
+
+#include "PartSet.h"
+
+#include <ModelAPI_Object.h>
+#include <ModelAPI_Result.h>
+
+#include <GeomAPI_ICustomPrs.h>
+#include <GeomAPI_AISObject.h>
+#include <GeomAPI_Shape.h>
+
+#include <QMap>
+#include <QList>
+
+class ModuleBase_IWorkshop;
+
+/**
+* Interface of a class which can provide specific customization of
+* object presentation
+*/
+class PartSet_CustomPrs : public GeomAPI_ICustomPrs
+{
+public:
+  PARTSET_EXPORT PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop);
+  PARTSET_EXPORT virtual ~PartSet_CustomPrs() {};
+
+  void setCustomized(const ObjectPtr& theObject);
+
+  /// Modifies the given presentation in the custom way.
+  virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
+                                     std::shared_ptr<GeomAPI_ICustomPrs> theCustomPrs);
+private:
+  ModuleBase_IWorkshop* myWorkshop; /// current workshop
+
+  QMap<ResultPtr, QList<GeomShapePtr> > myCustomized; /// objects, which are customized
+};
+
+#endif
index 1eaed276abb723d0aa3e6d72c43fed0cbb59f85d..e6ee9c5b714b88810e3a9e5b2beb1273c7784114 100644 (file)
@@ -14,6 +14,7 @@
 #include "PartSet_WidgetSketchCreator.h"
 #include "PartSet_SketcherMgr.h"
 #include "PartSet_MenuMgr.h"
+#include <PartSet_CustomPrs.h>
 
 #include "PartSet_Filters.h"
 #include "PartSet_FilterInfinite.h"
@@ -131,6 +132,7 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
           SLOT(onViewTransformed(int)));
 
   myMenuMgr = new PartSet_MenuMgr(this);
+  myCustomPrs = std::shared_ptr<GeomAPI_ICustomPrs>(new PartSet_CustomPrs(theWshop));
 
   Events_Loop* aLoop = Events_Loop::loop();
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
@@ -718,6 +720,25 @@ void PartSet_Module::onViewTransformed(int theTrsfType)
     aDisplayer->updateViewer();
 }
 
+void PartSet_Module::setCustomized(const ObjectPtr& theObject)
+{
+ std::shared_ptr<PartSet_CustomPrs> aCustomPrs =
+                        std::dynamic_pointer_cast<PartSet_CustomPrs>(myCustomPrs);
+ if (aCustomPrs.get())
+   aCustomPrs->setCustomized(theObject);
+}
+
+bool PartSet_Module::customizeObject(ObjectPtr theObject)
+{
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
+ XGUI_Workshop* aWorkshop = aConnector->workshop();
+ XGUI_Displayer* aDisplayer = aWorkshop->displayer();
+
+ AISObjectPtr anAISObj = aDisplayer->getAISObject(aResult);
+ return myCustomPrs->customisePresentation(aResult, anAISObj, myCustomPrs);
+}
 
 void PartSet_Module::customizeObjectBrowser(QWidget* theObjectBrowser)
 {
index d6c2d478614f30397c32847d06ab6ae3f3ebe008..3f9dd010e8b9a485e797a9af5b19ade6daf57d9a 100644 (file)
@@ -12,6 +12,8 @@
 #include <ModelAPI_Attribute.h>
 #include <ModelAPI_CompositeFeature.h>
 
+#include <GeomAPI_ICustomPrs.h>
+
 #include <Events_Listener.h>
 
 //#include <StdSelect_FaceFilter.hxx>
@@ -142,6 +144,18 @@ public:
   /// \param theMessage an event message
   virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
 
+  /// Set the object with the object results are customized
+  /// \param theObject an object
+  void setCustomized(const ObjectPtr& theObject);
+
+  /** Update the object presentable properties such as color, lines width and other
+  * If the object is result with the color attribute value set, it is used,
+  * otherwise the customize is applyed to the object's feature if it is a custom prs
+  * \param theObject an object instance
+  * \return the true state if there is changes and the presentation is customized
+  */
+  virtual bool customizeObject(ObjectPtr theObject);
+
   /// This method is called on object browser creation for customisation of module specific features
   /// \param theObjectBrowser a pinter on Object Browser widget
   virtual void customizeObjectBrowser(QWidget* theObjectBrowser);
@@ -215,8 +229,9 @@ protected slots:
   SelectMgr_ListOfFilter mySelectionFilters;
 
   PartSet_SketcherMgr* mySketchMgr;
-
   PartSet_MenuMgr* myMenuMgr;
+  /// A default custom presentation, which is used for references objects of started operation
+  GeomCustomPrsPtr myCustomPrs;
 
   int myVisualLayerId;
 
diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp
new file mode 100755 (executable)
index 0000000..6bcdb1c
--- /dev/null
@@ -0,0 +1,101 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        PartSet_OperationPrs.cpp
+// Created:     01 Jul 2015
+// Author:      Natalia ERMOLAEVA
+
+#include "PartSet_OperationPrs.h"
+
+#include <ModelAPI_Tools.h>
+#include <ModelAPI_ResultConstruction.h>
+#include <GeomAPI_PlanarEdges.h>
+
+#include <BRep_Builder.hxx>
+#include <Prs3d_IsoAspect.hxx>
+#include <TopoDS_Builder.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape);
+IMPLEMENT_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape);
+
+PartSet_OperationPrs::PartSet_OperationPrs(FeaturePtr theFeature)
+  : ViewerData_AISShape(TopoDS_Shape()), myFeature(theFeature)
+{
+/*  std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(theResult);
+  std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr = 
+    std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aShapePtr);
+  if (aWirePtr) {
+    if (aWirePtr->hasPlane() ) {
+      // If this is a wire with plane defined thin it is a sketch-like object
+      // It must have invisible faces
+      myIsSketchMode = true;
+    }
+  }
+  Set(aShapePtr->impl<TopoDS_Shape>());
+*/
+}
+
+
+/*#include <TopExp_Explorer.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <StdPrs_ShadedShape.hxx>
+#include <StdPrs_WFDeflectionShape.hxx>
+*/
+void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+                                   const Handle(Prs3d_Presentation)& thePresentation, 
+                                   const Standard_Integer theMode)
+{
+/*  std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(myResult);
+  if (!aShapePtr)
+    return;
+  if (myIsSketchMode) {
+    myFacesList.clear();
+    ResultConstructionPtr aConstruction = 
+      std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(myResult);
+    if (aConstruction.get()) {
+      int aFacesNum = aConstruction->facesNum();
+      for(int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) {
+        myFacesList.push_back(aConstruction->face(aFaceIndex));
+      }
+    }
+  }
+  myOriginalShape = aShapePtr->impl<TopoDS_Shape>();
+  if (!myOriginalShape.IsNull()) {
+    Set(myOriginalShape);
+
+    AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
+    /*
+    TopExp_Explorer anExp(myOriginalShape, TopAbs_VERTEX);
+    Handle(Prs3d_Drawer) aDrawer = Attributes();
+    for (; anExp.More(); anExp.Next()) {
+      const TopoDS_Vertex& aVertex = (const TopoDS_Vertex&)anExp.Current();
+      StdPrs_WFDeflectionShape::Add(thePresentation, aVertex, aDrawer);
+    }*|/
+  }*/
+}
+
+
+void PartSet_OperationPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+                                            const Standard_Integer aMode)
+{
+/*  if (aMode > TopAbs_SHAPE)
+    // In order to avoid using custom selection modes
+    return;
+
+  if (myIsSketchMode) {
+    if (aMode == TopAbs_FACE) {
+      BRep_Builder aBuilder;
+      TopoDS_Compound aComp;
+      aBuilder.MakeCompound(aComp);
+      aBuilder.Add(aComp, myOriginalShape);
+      std::list<std::shared_ptr<GeomAPI_Shape>>::const_iterator aIt;
+      for (aIt = myFacesList.cbegin(); aIt != myFacesList.cend(); ++aIt) {
+        TopoDS_Shape aFace = (*aIt)->impl<TopoDS_Shape>();
+        aBuilder.Add(aComp, aFace);
+      }
+      Set(aComp);
+    } else {
+      Set(myOriginalShape);
+    }
+  }*/
+  AIS_Shape::ComputeSelection(aSelection, aMode);
+}
\ No newline at end of file
diff --git a/src/PartSet/PartSet_OperationPrs.h b/src/PartSet/PartSet_OperationPrs.h
new file mode 100755 (executable)
index 0000000..9d2cc93
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        PartSet_OperationPrs.h
+// Created:     01 Jul 2015
+// Author:      Natalia ERMOLAEVA
+
+#ifndef PartSet_OperationPrs_H
+#define PartSet_OperationPrs_H
+
+#include "PartSet.h"
+
+#include <ModelAPI_Result.h>
+#include <ModelAPI_Feature.h>
+
+#include <ViewerData_AISShape.hxx>
+#include <Standard_DefineHandle.hxx>
+
+DEFINE_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape)
+
+/**
+* \ingroup GUI
+* A redefinition of standard AIS Interactive Object in order to provide specific behaviour 
+* for wire presentations based in a one plane
+*/
+class PartSet_OperationPrs : public ViewerData_AISShape
+{
+public:
+  /// Constructor
+  /// \param theResult a result object
+  Standard_EXPORT PartSet_OperationPrs(FeaturePtr theFeature);
+
+  DEFINE_STANDARD_RTTI(PartSet_OperationPrs)
+protected:
+  /// Redefinition of virtual function
+  Standard_EXPORT virtual void Compute(
+            const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+            const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
+
+  /// Redefinition of virtual function
+  Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+                                                const Standard_Integer aMode) ;
+private:
+  /// Reference to a feature object
+  FeaturePtr myFeature;
+};
+
+
+#endif
\ No newline at end of file
index 067dc093a92c1bd1393ea34b620aae7632a2d530..cb21c0190208f85632af711ff9c2bb9bd3a5488b 100644 (file)
@@ -290,6 +290,12 @@ void PartSet_SketcherMgr::onAfterValuesChangedInPropertyPanel()
 
 void PartSet_SketcherMgr::onValuesChangedInPropertyPanel()
 {
+  ModuleBase_Operation* anOperation = getCurrentOperation();
+  bool isSketchOp = isSketchOperation(anOperation);
+  bool isNestedSketchOp = isNestedSketchOperation(anOperation);
+  if (isSketchOp || isNestedSketchOp)
+    myModule->setCustomized(anOperation->feature());
+
   if (!isNestedCreateOperation(getCurrentOperation()))
     return;
 
@@ -818,6 +824,7 @@ void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation)
     onShowConstraintsToggle(true);
   }
   connectToPropertyPanel(true);
+  myModule->setCustomized(getCurrentOperation()->feature());
 }
 
 void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp)
@@ -826,6 +833,8 @@ void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp)
   myIsResetCurrentValue = false;
   myIsMouseOverViewProcessed = true;
   operationMgr()->onValidateOperation();
+
+  myModule->setCustomized(ObjectPtr());
 }
 
 void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation)
@@ -994,6 +1003,8 @@ void PartSet_SketcherMgr::getCurrentSelection(const FeaturePtr& theFeature,
     }
     for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) {
       Handle(SelectMgr_EntityOwner) anOwner = aContext->DetectedOwner();
+      if (anOwner.IsNull())
+        continue;
       if (anOwner->Selectable() != anAISIO)
         continue;
       getAttributesOrResults(anOwner, theFeature, theSketch, aResult,
index 5e76cf2017842781fa04d87a9702ae89fcd9c15a..efd6481ec88c340f61e509ad72a8442b47b91792 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <ModuleBase_ResultPrs.h>
 #include <ModuleBase_Tools.h>
+#include <ModuleBase_IModule.h>
 
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_IPresentable.h>
@@ -874,7 +875,9 @@ bool XGUI_Displayer::customizeObject(ObjectPtr theObject)
       return false;
     aCustomPrs = myCustomPrs;
   }
-  return aCustomPrs->customisePresentation(aResult, anAISObj, myCustomPrs);
+  bool isCustomized = aCustomPrs->customisePresentation(aResult, anAISObj, myCustomPrs);
+  isCustomized = myWorkshop->module()->customizeObject(theObject) || isCustomized;
+  return isCustomized;
 }