Thanks for your precisions.<br><br>Well you are right! ParaView's proxy mechanism is robust and giving too much freedom to developers could be really dangerous! <br>And effectively, my first try to have access to VolumeMapper BlendMode property was to change the rendering.xml resource in order to expose it.<br>
<br>What I did was: <br><br>- adding a IntVectorProperty in FixedPointVolumeRayCastMapper SourceProxy<br> <IntVectorProperty<br> name="BlendMode"<br> command="SetBlendMode"<br> default_values="0"<br>
number_of_elements="1"<br> animateable="0"><br> <EnumerationDomain name="enum"><br> <Entry value="0" text="Composite"/><br> <Entry value="1" text="MaximumIntensity"/><br>
<Entry value="2" text="MinimumIntensity"/><br> </EnumerationDomain><br> </IntVectorProperty><br><br>- adding BlendMode as exposed property to UniformGridVolumeRepresentationProxy in FixedPoint(...) SubProxy<br>
<Property name="BlendMode"/><br><br>- adding BlendMode as exposed property to UniformGridRepresentation PVRepresentationProxy in UniformGrid(...) SubProxy.<br><br>I changed blend mode by using GetProperty("BlendMode") on the representation proxy, and it works as well. But in both case (bad unprotected way and exposing propoerty way), I have to change something in ParaView's tree and recompile it. It makes my plugin working on my computer only...<br>
<br>Is this BlendMode exposure interesting you and do you want me to send a diff file of my local 'rendering.xml'? <br><br>Thanks again!<br><br>Best regards,<br>Jerome<br><br><br><br><div class="gmail_quote">2009/10/19 Berk Geveci <span dir="ltr"><<a href="mailto:berk.geveci@kitware.com">berk.geveci@kitware.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">> - Is there a reason (software design, maybe?) to protect the functions that<br>
> give access to subproxies, whereas the access to properties are<br>
> -fortunately- public?<br>
> - Is there another way to access SubProxy without modifying ParaView's<br>
> sources?<br>
<br>
</div>Yes, there is a reason for not exposing the sub-proxies. We wanted the<br>
access to the sub-proxies to be only through exposed properties<br>
because we want all proxies (whether they have sub-proxies or not) to<br>
behave exactly the same way. Allowing access to the sub-proxies makes<br>
it almost impossible to make sure that developers don't shoot<br>
themselves in the foot by changing properties of the sub-proxies that<br>
are supposed to be controlled by the super-proxy. For example, a<br>
property in the super-proxy may end up setting multiple properties in<br>
the sub-proxy.<br>
<br>
Isn't there another way of doing this? Maybe expose the property you<br>
are setting? Something like VolumeMapperBlendMode?<br>
<br>
-berk<br>
<div><div></div><div class="h5"><br>
On Mon, Oct 19, 2009 at 2:50 AM, Jérôme <<a href="mailto:jerome.velut@gmail.com">jerome.velut@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I wrote a plugin that enable a toggle between different BlendMode of the<br>
> FixedPointVolumeRayCastMapper that is used by ParaView for volume rendering.<br>
> It catches a key event on a render window ('B' pressed) and toggle<br>
> BlendMode: Composite -> MaximumIntensity -> MinimumIntensity -><br>
> Composite->...<br>
><br>
> Here is my way:<br>
> - When button 'B' pressed:<br>
> - get view manager from core instance<br>
> - get active view from view manager<br>
> - for each representation 'rep' of active view:<br>
> - check if 'rep' has a VolumeRepresentation SubProxy<br>
> - if yes:<br>
> - check if VolumeRepresentation has a VolumeFixedPointRayCastMapper<br>
> SubProxy<br>
> - if yes:<br>
> - get the vtkFixedPointVolumeRayCastMapper ('mapper') from this<br>
> latter SubProxy<br>
> - mapper->SetBlendMode( (++mapper->GetBlendMode( ))%3 );<br>
> - Update and render.<br>
><br>
><br>
> For this to work, I need to call vtkSMProxy::GetSubProxy( char* ) from my<br>
> plugin class. But unfortunately, these functions are protected member. I<br>
> modified the ParaView sources to make it public, and it work just... fine.<br>
> My questions are:<br>
> - Is there a reason (software design, maybe?) to protect the functions that<br>
> give access to subproxies, whereas the access to properties are<br>
> -fortunately- public?<br>
> - Is there another way to access SubProxy without modifying ParaView's<br>
> sources?<br>
><br>
> Thanks!<br>
><br>
> Jerome<br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <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:<br>
> <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>
><br>
</blockquote></div><br>