[vtkusers] vtkAssembly bug?
    David Slack 
    slack at aerosft.com
       
    Fri May 26 09:09:55 EDT 2006
    
    
  
Hi,
I am using nested vtkAssembly's and am curious about the intended 
functionality of the Visibility.  It's my understanding that if you have 
nested vtkAssembly's and you turn off the visibility of one of the 
vtkAssembly's somewhere in the heirarchy, that every vtkAssembly and 
prop that is a child of that vtkAssembly should not be visible.  That, I 
have found, is not the functionality of the current cvs code (or at 
least the one I checked out a couple weeks ago).  The functionality that 
I am seeing is that if you turn off the top vtkAssembly or the bottom 
viewProp, then the bottom viewProp becomes invisible.  Turning off any 
intermediate vtkAssembly has no effect whatsoever on the bottom viewProp.
In order to "fix" this, I changed the vtkAssembly::RenderOpaqueGeometry 
& vtkAssembly::RenderTranslucentGeometry routines to add the following:
 
// render the Paths
  vtkCollectionSimpleIterator sit;
  for ( this->Paths->InitTraversal(sit); (path = 
this->Paths->GetNextPath(sit)); )
    {
//Begin Change   fix visibility so that vtkAssembly turns off children
//
        vtkAssemblyNode *tNode;
        bool tVisibility = true;
        for(path->InitTraversal(); tNode = path->GetNextNode();) {
            vtkProp3D *tProp = (vtkProp3D *) tNode->GetViewProp();
            if(!tProp->GetVisibility()) {
                tVisibility = false;
                break;
            }
        }
//End Change
    prop3D = (vtkProp3D *)path->GetLastNode()->GetViewProp();
//Begin Change
//  if ( prop3D->GetVisibility() )
    if (tVisibility)
//End Change
    {
      prop3D->SetAllocatedRenderTime(fraction, ren);
      prop3D->PokeMatrix(path->GetLastNode()->GetMatrix());
      renderedSomething += prop3D->RenderTranslucentGeometry(ren);
      prop3D->PokeMatrix(NULL);
      }
    }
Basically I have looped through the heirarchy and checked the visibility 
of all the intermediate vtkAssembly's & if any of them is not visible, 
then I skip the rendering.  I don't know if this is the proper fix, but 
the end result is that it works the way I think the code should work.
Thanks,
Dave Slack
    
    
More information about the vtkusers
mailing list