segmentation fault from Trackball Actor

I need to know the center location of the actor being manipulated by vtkInteractorStyleTrackballActor.

vtkInteractorStyleTrackballActor->InteractionProp->GetCenter() does this, and because InteractionProp is protected, I wrote a child class for vtkInteractorStyleTrackballActor with a wrapper function. It works fine, except when the vtkInteractorStyleTrackballActor object has never been clicked on. Then I get a segmentation fault.

I know this is a bit esoteric and I shouldn’t be using protected members, but does anyone happen to know why or how to avoid it? Can I somehow do the software equivalent of clicking on the actor when I initialize it?

Thanks

Off of the top of my head: the InteractionProp must be set, and this is done using a pick operation. I see in the code that there are tons of guards involving " this->InteractionProp == nullptr" which typically returns from a method (in your case there may be a missing guard which should be added). Since there is no initial pick, my thought is to either 1) randomly pick one of the actors from the renderer and use this to start, or 2) in your derived class explicitly set the initial InteractionProp.

Hi Will. Thanks for the suggestion. I tested your theory and InteractionProp is indeed the nullptr.

Unfortunately, I’m not sure how or where to assign the Prop. Do I assign it to the vtkInteractorStyleTrackballActor? Might you point me to the specific command? Sorry to be so ignorant.

I found a work-around. I added a guard to catch the (InteractionProp == nullptr) case that issues a warning without crashing, Thanks again.