Salome HOME
A new event Visual Attributes Changed is defined for performance sake.
[modules/shaper.git] / src / PartSet / PartSet_CustomPrs.cpp
index 21465eb1cb133887e2a96caf458beb7fe9b87fd6..e18ca5bb063b58a5716997908d3c8b078328ac4d 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#include <PartSet_CustomPrs.h>
-#include <PartSet_Module.h>
+#include "PartSet_CustomPrs.h"
+#include "PartSet_Module.h"
 #include "PartSet_OperationPrs.h"
 #include "PartSet_OverconstraintListener.h"
+#include "PartSet_SketcherMgr.h"
 
 #include <XGUI_ModuleConnector.h>
 #include <XGUI_Workshop.h>
@@ -30,6 +31,9 @@
 #include <ModuleBase_IViewer.h>
 #include <ModuleBase_Tools.h>
 
+#include <ModelAPI_Tools.h>
+#include <SketchPlugin_Sketch.h>
+
 #include <Config_PropManager.h>
 #include <Events_Loop.h>
 #include <ModelAPI_Events.h>
@@ -68,12 +72,22 @@ bool PartSet_CustomPrs::activate(const FeaturePtr& theFeature,
 #ifdef DO_NOT_VISUALIZE_CUSTOM_PRESENTATION
   return false;
 #endif
+  bool isModified = false;
 
-  myIsActive[theFlag] = true;
-  myFeature = theFeature;
+  // Do not call customisation for sketcher and all its sub-objects
+  if (theFeature->getKind() == SketchPlugin_Sketch::ID())
+    return isModified;
+
+  FeaturePtr aParent = ModelAPI_Tools::compositeOwner(theFeature);
+  if (aParent.get()) {
+    std::string aType = aParent->getKind();
+    if (aType == SketchPlugin_Sketch::ID())
+      return isModified;
+  }
 
-  bool isModified = false;
   if (theFeature.get()) {
+    myIsActive[theFlag] = true;
+    myFeature = theFeature;
     displayPresentation(theFlag, theUpdateViewer);
     isModified = true;
   }