[vtk-developers] vtkAbstractWidget default/current renderer
Dean Inglis
dean.inglis at camris.ca
Wed Oct 10 16:20:37 EDT 2007
Hi,
I am running into a problem with vtkContourWidget,
trying to Enable it from a GUI checkbox and Initialize
it with a user input vtkPolyData. In the
parent class (vtkAbstractWidget) there is
void vtkAbstractWidget::SetEnabled(int enabling)
{
<snip>
int X=this->Interactor->GetEventPosition()[0];
int Y=this->Interactor->GetEventPosition()[1];
if ( ! this->CurrentRenderer )
{
this->SetCurrentRenderer(this->Interactor->FindPokedRenderer(X,Y));
if (this->CurrentRenderer == NULL)
{
return;
}
}
so, if the interactor is set, and we try to Initialize
the widget before Enabling it, the widget's representation
makes a call to its vtkPointPlacer to validate
point positions, say on top of a vtkImageActor, however,
if the current renderer is not set, we get a crash.
My question is:
should there be some error message
in vtkContourWidget Intitialize to request that the widget
be Enabled first, or, should one allow a check+fix in SetEnabled
for all widgets as follows ?
if ( ! this->CurrentRenderer )
{
this->SetCurrentRenderer(this->Interactor->FindPokedRenderer(X,Y));
if (this->CurrentRenderer == NULL)
{
if (this->DefaultRenderer) // <-------------allow widgets to assign
default to current?
{
this->CurrentRenderer = this->DefaultRenderer;
}
else
{
return;
}
}
Dean
More information about the vtk-developers
mailing list