[vtkusers] vtkAssembly bug?
Mathieu Malaterre
mathieu.malaterre at kitware.com
Wed May 31 15:51:54 EDT 2006
David Slack wrote:
> 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.
David,
Can you open a bug report at:
http://vtk.org/Bug
And please add the output of `cvs dif -u` for the specific files you
modified.
Thanks
Mathieu
More information about the vtkusers
mailing list