Wed, 03/27/2019 - 20:49
Forums:
Hello, I'm trying to make a XCAFPrs_AISObject item half-transparent with :
Handle_AIS_InteractiveContext context = ...;
Handle_XCAFPrs_AISObject obj = ...;
context->SetTransparency(obj, 0.5, false);
context->UpdateCurrentViewer();
but this just doesn't work, the displayed shaded shape stays opaque.
I even tried to call "context->Redisplay(obj, true);" but without any success.
Any idea ?
Wed, 03/27/2019 - 22:32
XCAFPrs_AISObject is not a usual AIS object - it is a presentation for XCAF Label.
XCAF document defines presentation properties of shapes and sub-shapes (colors, including transparency),
and XCAFPrs_AISObject is designed to apply these properties while computing presentation.
Therefore, expected workflow of working with XCAFPrs is modifying the document (XCAFDoc_ColorTool) and then redisplaying presentable object.
It is possible, though, modifying presentation properties without changing the document,
but this requires understanding of XCAFPrs_AISObject / AIS_ColoredShape implementation details - like playing with DispatchStyles()/DefaultStyle() methods.
Or, if document properties are not actually needed - just use AIS_Shape instead.