0026995: Visualization, TKXCAF - do not reset custom material within XCAFPrs_AISObjec...
authorkgv <kgv@opencascade.com>
Tue, 15 Dec 2015 09:14:41 +0000 (12:14 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 17 Dec 2015 13:49:28 +0000 (16:49 +0300)
Assign default material in class constructor instead.

src/XCAFPrs/XCAFPrs_AISObject.cxx

index a1d45f5..eb2f9e6 100644 (file)
@@ -48,6 +48,8 @@ IMPLEMENT_STANDARD_RTTIEXT(XCAFPrs_AISObject,AIS_ColoredShape)
 XCAFPrs_AISObject::XCAFPrs_AISObject (const TDF_Label& theLabel)
 : AIS_ColoredShape(TopoDS_Shape())
 {
+  // define plastic material by default for proper color reproduction
+  SetMaterial (Graphic3d_NOM_PLASTIC);
   myLabel = theLabel;
 }
 
@@ -117,12 +119,6 @@ void XCAFPrs_AISObject::Compute (const Handle(PrsMgr_PresentationManager3d)& the
                                  const Handle(Prs3d_Presentation)&           thePrs,
                                  const Standard_Integer                      theMode)
 {
-  thePrs->Clear();
-
-  // abv: 06 Mar 00: to have good colors
-  Handle(TPrsStd_AISPresentation) aPrs = Handle(TPrsStd_AISPresentation)::DownCast (GetOwner());
-  if (aPrs.IsNull() || !aPrs->HasOwnMaterial()) SetMaterial (Graphic3d_NOM_PLASTIC);
-
   TopoDS_Shape aShape;
   if (!XCAFDoc_ShapeTool::GetShape (myLabel, aShape) || aShape.IsNull()) return;