Andres,<br><br>The active pqView can always change -- as you discovered when state file is loaded or new views are created or client disconnects/reconnects to a server etc. So it makes sense to get the active view fresh each time. Also note that the active view can be NULL as well or some other type that the render view. So a save method would be:<br>
<br><span style="font-family: &#39;courier new&#39;,monospace;">pqView * theView = pqActiveView::instance().current();<br></span><div><span style="font-family: &#39;courier new&#39;,monospace;">vtkSMRenderViewProxy* myProxy = theView?<br>
  vtkSMRenderViewProxy::SafeDownCast(theView-&gt;getViewProxy()) : NULL;<br>if (!myProxy)<br>  {<br>  // no active view, or active view is not a render view.<br>  return;<br>  }<br><br>Hopefully that helps.<br><br>Utkarsh<br>
</span></div><br><br><div class="gmail_quote">2009/5/20 Andrés Felipe Padilla <span dir="ltr">&lt;<a href="mailto:anfeken@gmail.com">anfeken@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello all,<div><br></div><div>I&#39;m developing a ParaView plugin that modifies the camera position with data coming from a interaction device. I&#39;m using C++ and Linux 64 bit. I have tested it with the build in server and it works without a hitch. However, when I connect the client to a server used for visualizing data in a tiled display, I run on some issues, namely a Segmentation Fault :(. </div>

<div><br></div><div>When I connect my client to the remote server, I load my plugin and connect it to the server used for reading the data from the interaction device. It works well if I use a build-in source for test (like a cylinder), and nothing wrong happen. However, If I try to load a ParaView state of a more complex model, the client collapses (Almost every time, sometimes it works just fine and I can use the interaction device with the tile display). When I run gdb, It says that the segmentation fault is triggered by a call to vtkCamera::Roll or some other method of vtkCamera. Since I&#39;m doing this at the constructor of my plugin:</div>

<div><br></div><div><div><span style="font-family: &#39;courier new&#39;,monospace;">  pqView * theView = pqActiveView::instance().current();</span></div><div><span style="font-family: &#39;courier new&#39;,monospace;">  vtkSMRenderViewProxy* myProxy = (vtkSMRenderViewProxy*)theView-&gt;getViewProxy();</span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;"> *theCamera = myProxy-&gt;GetActiveCamera();</span></div><div><br></div><div>and theCamera is a member of my plugin class, I thought that maybe the pqView is changing when I load the state, and the vtkCamera address is no longer valid. Obviously, I would get a Segmentation Fault.</div>

<div><br></div><div>Since It seems like pqView changes when I load a state, then I changed my code in order to obtain the new pqView each time my method that changes the camera position is called (It is a SLOT, by the way). So I changed it like this:</div>

<div><br></div><div><div><span style="font-family: &#39;courier new&#39;,monospace;">void myClass::changeCameraPosition(const float  roll, const float elevation, const float  azimuth)</span></div>
<div><span style="font-family: &#39;courier new&#39;,monospace;">{</span></div><div><span style="font-family: &#39;courier new&#39;,monospace;">  pqView * theView = pqActiveView::instance().current();<br>
</span></div><div><span style="font-family: &#39;courier new&#39;,monospace;">  vtkSMRenderViewProxy* myProxy = (vtkSMRenderViewProxy*)theView-&gt;getViewProxy();</span></div><div><span style="font-family: &#39;courier new&#39;,monospace;">  vtkCamera *newCamera = myProxy-&gt;GetActiveCamera();</span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;">  cout &lt;&lt; &quot;AddNewCam &quot;&lt;&lt;newCamera&lt;&lt;&quot; endNC&quot;&lt;&lt;endl;</span></div><div><span style="font-family: &#39;courier new&#39;,monospace;">  newCamera-&gt;Roll(roll);</span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;">  newCamera-&gt;Elevation(elevation);</span></div><div><span style="font-family: &#39;courier new&#39;,monospace;">  newCamera-&gt;Azimuth(azimuth);</span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;">  newCamera-&gt;OrthogonalizeViewUp();  </span></div><div><span style="font-family: &#39;courier new&#39;,monospace;">}</span></div>
<div><span style="font-family: &#39;courier new&#39;; font-size: 12px;"><br></span></div><div><span style="font-size: 12px;">As you can see, I have added a cout in order to show the new address of theCamera. However, when I tried this solution, the client would die even before printing the new camera address.</span></div>

<div><span style="font-size: 12px;"><br></span></div><div><span style="font-size: 12px;">So, I wanted to ask you, What I&#39;m doing wrong? Is there something different with pqView in a local setting opposed to a remote setting? And, more importantly, why it works sometimes? I would expect a bad behaving code to break every single time, not working in isolated occasions.</span></div>

<div><span style="font-size: 12px;"><br></span></div><div><span style="font-size: 12px;">Thanks a lot in advance for your help.</span></div><div><span style="font-size: 12px;"><br>
</span></div><div><span style="font-size: 12px;">Best Regards,</span></div><div><span style="font-size: 12px;"><br></span></div><div><span style="font-size: 12px;">Andrés Padilla</span></div>
<div><span style="font-size: 12px;">Universidad de los Andes, Graduate Student</span></div></div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br>