<p dir="ltr"><br>
Den 20 juni 2016 4:12 em skrev "David Gobbi" <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>>:<br>
><br>
> On Mon, Jun 20, 2016 at 7:02 AM, Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>> wrote:<br>
>><br>
>> Hi all,<br>
>><br>
>> In my custom interaction style (derived from vtkInteractionStyleUser), I have a need to be notified when the interaction style is set on an interactor.<br>
>><br>
>> The reason I need this is that the purpose of my interaction style is to lock the camera position to a cylinder around my subject: The user should be able to zoom in/out, rotate around the subject on a circle, change the azimuth, and pan up/down along the subject (which has the shape of standing cylinder), but not perform other camera movements. The focal point should always be on the axis through the middle of my subject which is parallel to the Y ("vertical") axis. I therefore would like to do some initialization of the camera when the interactor is first set on the interactor style (and, I guess equivalently, when the interaction style is set on the interactor).<br>
>><br>
>> In C++ I think I could override SetInteractor on the interactor style, but in Python that won't work. Is there some event I could listen for which fires when the interaction style gets a new interactor?<br>
><br>
><br>
> Only the ModifiedEvent, but it fires a lot and therefore observing it is inefficient. If you have your own interactor class (and if you use it throughout your application), then you can override its SetInteractorStyle() method since that method is called from the Python side.</p>
<p dir="ltr">Ah, that's true. I have control over the interactor used, so I could subclass it for just this purpose. Thanks!</p>
<p dir="ltr">Elvis<br>
><br>
> - David<br>
><br>
</p>