Climb-up color hierarchy

Hello,

In CAD Assistant, it seems that the colors respect some kind of hierarchy. Face color is choosen if available, or shell color if available, or solid color if available etc. At some point in the code, I explore the faces via for(TopExp_Explorer face_ex(some_shell_that_was_attached_to_solid_etc, TopAbs_FACE);, and get the color via the color tool:

color_tool->GetColor(shape, XCAFDoc_ColorCurv, color_label) || 
color_tool->GetColor(shape, XCAFDoc_ColorSurf, color_label) ||
color_tool->GetColor(shape, XCAFDoc_ColorGen, color_label)

If I go too deep inside the hierarchy, colors are not found on the shape. Is there a way to "climb up" in the color hierarchy until the first available is found ?

Best,

gkv311 n's picture

The same shape label in XCAF hierarchy might have multiple parents. For this reason the only way to calculate shape color is going from root to leaves, and not in opposite direction (there is simply no interface returning parent). That is how it is done by XCAFPrs_DocumentExplorer(see XCAFPrs_DocumentNode::Style, but this explorer doesn't go deeper into subshapes level) and XCAFPrs::CollectStyleSettings().