1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0030464: Visualization - unable to set sub-shape transparency using vaspects command

Added AIS_ColoredShape::SetCustomTransparency() for simple way for assigning sub-shape transparency.
This commit is contained in:
kgv
2019-01-31 14:52:19 +03:00
committed by bugmaster
parent 82d23ad590
commit c1197a1575
5 changed files with 66 additions and 18 deletions

View File

@@ -1709,7 +1709,7 @@ struct ViewerTest_AspectsChangeSet
}
//! @return true if properties are valid
Standard_Boolean Validate (const Standard_Boolean theIsSubPart) const
Standard_Boolean Validate() const
{
Standard_Boolean isOk = Standard_True;
if (Visibility != 0 && Visibility != 1)
@@ -1729,12 +1729,6 @@ struct ViewerTest_AspectsChangeSet
std::cout << "Error: the transparency should be within [0; 1] range (specified " << Transparency << ")\n";
isOk = Standard_False;
}
if (theIsSubPart
&& ToSetTransparency != 0)
{
std::cout << "Error: the transparency can not be defined for sub-part of object!\n";
isOk = Standard_False;
}
if (ToSetAlphaMode == 1
&& (AlphaCutoff <= 0.0f || AlphaCutoff >= 1.0f))
{
@@ -2498,15 +2492,13 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
}
}
Standard_Boolean isFirst = Standard_True;
for (NCollection_Sequence<ViewerTest_AspectsChangeSet>::Iterator aChangesIter (aChanges);
aChangesIter.More(); aChangesIter.Next())
{
if (!aChangesIter.Value().Validate (!isFirst))
if (!aChangesIter.Value().Validate())
{
return 1;
}
isFirst = Standard_False;
}
// special case for -defaults parameter.
@@ -2823,6 +2815,10 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
{
aColoredPrs->SetCustomColor (aSubShape, aChangeSet->Color);
}
if (aChangeSet->ToSetTransparency == 1)
{
aColoredPrs->SetCustomTransparency (aSubShape, aChangeSet->Transparency);
}
if (aChangeSet->ToSetLineWidth == 1)
{
aColoredPrs->SetCustomWidth (aSubShape, aChangeSet->LineWidth);