[vtkusers] Get Actors from picker event

Lachlan Blackhall lachlan at chryatech.com.au
Fri Jan 21 05:59:46 EST 2005


Gday,

I have registered a callback function on the end pick event

iren->AddObserver(vtkCommand::EndPickEvent, callback);

and then implemented the following code in the execute function of the 
callback class

virtual void Execute(vtkObject *caller, unsigned long, void*)
	{
		vtkRenderWindowInteractor *iren =
		reinterpret_cast<vtkRenderWindowInteractor*>(caller);
		vtkPicker *picker = (vtkPicker*)iren->GetPicker();
		vtkActor *a;
		a=picker->GetActors()->GetNextActor();
		a->GetProperty()->SetColor(1,1,1);
		iren->Render();
		
	}

when i run this the end pick event is detected but after this call

		a=picker->GetActors()->GetNextActor();

a contains a pointer to 0x00 (nothing in other words) (i know there 
should be error checking here but this is only a proof of concept)

What error have i made and is there a more correct way to achieve this.

Thanks

Lachlan

P.S. Is it possible to pick actors using a left button mouse click 
event ??
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1383 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050121/dd3db2a2/attachment.bin>


More information about the vtkusers mailing list