Hi,<br>thanks for your interest. Attached is a diff file between my rendering.xml and CVS's one.<br>An idea to complete this would be to add a combo-box in the display panel (such as the slider for slice representation,...). However, this is less important, since when the BlendMode property is exposed through the UniformGridRepresentation, the Comp. / MIP / MinIP rendering mode is 'toggleable'. Here is a code snippet that can be use in C++ from inside a plugin to toggle BlendMode (Note, this could be more elegant by using properly QList... ):<br>
<br>///////// Code-snippet: Toggle BlendMode<br> pqViewManager * viewManager = qobject_cast<pqViewManager*><br> (pqApplicationCore::instance()->manager("MULTIVIEW_MANAGER"));<br><br> // Get the representations present in the active view<br>
for( int repId = 0; repId < viewManager->getActiveView( )->getNumberOfRepresentations( ); repId++)<br> {<br><br> pqRepresentation* rep = viewManager->getActiveView( )->getRepresentation( repId );<br>
vtkSMUniformGridVolumeRepresentationProxy* proxy = 0;<br> proxy = static_cast<vtkSMUniformGridVolumeRepresentationProxy*>(rep->getProxy());<br> <br> // Check if the representation proxy is a UniformGridVolumeRepresentationProxy<br>
if( proxy && rep->isVisible( ))<br> {<br> <br> // Get the BlendMode property<br> vtkSMIntVectorProperty* blendModeProp = 0;<br> blendModeProp = vtkSMIntVectorProperty::SafeDownCast( proxy->GetProperty("BlendMode"));<br>
<br> // If the Property is not exposed, it cannot be used!!<br> if( blendModeProp )<br> {<br> // Increment the current BlendMode (Comp -> MIP ->MinIP ->Comp ->...<br>
int blendMode = blendModeProp->GetElement( 0 );<br> blendMode++;<br> blendModeProp->SetElement( 0, blendMode%3 );<br><br> // Render<br> proxy->UpdateSelfAndAllInputs( );<br>
rep->renderView( true );<br> }<br> }<br> }<br><br>/////////////////// End Code-snippet: Toggle BlendMode<br><br>Thanks again,<br>Jerome<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;">I don't have any problems with committing the changes you described.<br>
Would you mind adding a document element to the property XML though?<br>
<font color="#888888"><br>
-berk<br>
</font><div><div></div><div class="h5"><br>
On Mon, Oct 19, 2009 at 10:50 AM, Jérôme <<a href="mailto:jerome.velut@gmail.com">jerome.velut@gmail.com</a>> wrote:<br>
> Thanks for your precisions.<br>
><br>
> Well you are right! ParaView's proxy mechanism is robust and giving too much<br>
> freedom to developers could be really dangerous!<br>
> And effectively, my first try to have access to VolumeMapper BlendMode<br>
> 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<br>
> UniformGridVolumeRepresentationProxy in FixedPoint(...) SubProxy<br>
> <Property name="BlendMode"/><br>
><br>
> - adding BlendMode as exposed property to UniformGridRepresentation<br>
> PVRepresentationProxy in UniformGrid(...) SubProxy.<br>
><br>
> I changed blend mode by using GetProperty("BlendMode") on the representation<br>
> proxy, and it works as well. But in both case (bad unprotected way and<br>
> exposing propoerty way), I have to change something in ParaView's tree and<br>
> 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<br>
> file of my local 'rendering.xml'?<br>
><br>
> Thanks again!<br>
><br>
> Best regards,<br>
> Jerome<br>
><br>
><br>
><br>
> 2009/10/19 Berk Geveci <<a href="mailto:berk.geveci@kitware.com">berk.geveci@kitware.com</a>><br>
>><br>
>> > - Is there a reason (software design, maybe?) to protect the functions<br>
>> > 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>
>> 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>
>><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<br>
>> > 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<br>
>> > VolumeFixedPointRayCastMapper<br>
>> > SubProxy<br>
>> > - if yes:<br>
>> > - get the vtkFixedPointVolumeRayCastMapper ('mapper') from<br>
>> > 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<br>
>> > 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...<br>
>> > fine.<br>
>> > My questions are:<br>
>> > - Is there a reason (software design, maybe?) to protect the functions<br>
>> > 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>
>> > _______________________________________________<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>
><br>
><br>
</div></div></blockquote></div><br>